diff --git a/.gitlab/issue_templates/bugs.md b/.gitlab/issue_templates/bugs.md new file mode 100644 index 0000000000000000000000000000000000000000..378d84f1b9fd63fb4c96cb6ee3319f098b70390d --- /dev/null +++ b/.gitlab/issue_templates/bugs.md @@ -0,0 +1,13 @@ +### Description + +Describe what happens and why you think it is a bug + +### Steps to reproduce + +Describe as precisely as possible how to reproduce the bug. Try to isolate a minimal number of steps. Also describe reproducibility (always, random ...). + +### Configuration information + +OS, OTB version or tag, information related to build (binaries, superbuild, system libs ...) + +/label ~bug diff --git a/.gitlab/issue_templates/documentation_changes.md b/.gitlab/issue_templates/documentation_changes.md new file mode 100644 index 0000000000000000000000000000000000000000..37545799bedd8df7497153892c9ddb1f0e41a960 --- /dev/null +++ b/.gitlab/issue_templates/documentation_changes.md @@ -0,0 +1,7 @@ +### Target documentation ressources + +Can be a combination of Software guide, cookbook, doxygen, blog, applications doc, websites + +### Change requested + +Describe precisely the changes that are required. diff --git a/.gitlab/issue_templates/feature_request.md b/.gitlab/issue_templates/feature_request.md new file mode 100644 index 0000000000000000000000000000000000000000..5b6ee30b89001a72c48d6f9435fd10ebfb5cd5a7 --- /dev/null +++ b/.gitlab/issue_templates/feature_request.md @@ -0,0 +1,3 @@ +Short summary of the requested feature + +/label ~feature diff --git a/.gitlab/issue_templates/request_for_comments.md b/.gitlab/issue_templates/request_for_comments.md new file mode 100644 index 0000000000000000000000000000000000000000..2c74aae515e3d30b890f239d2cb974c95677ab33 --- /dev/null +++ b/.gitlab/issue_templates/request_for_comments.md @@ -0,0 +1,10 @@ +### What changes will be made and why they would make a better Orfeo ToolBox? + +#### High level description + +#### Risks and benefits + +#### Alternatives for implementations + +### Who will be developing the proposed changes? + diff --git a/.gitlab/merge_request_templates/request_for_changes.md b/.gitlab/merge_request_templates/request_for_changes.md new file mode 100644 index 0000000000000000000000000000000000000000..0f49873998b82139ab80fa96fe710300cca68a67 --- /dev/null +++ b/.gitlab/merge_request_templates/request_for_changes.md @@ -0,0 +1,33 @@ +### Summary + +Gives a short summary of the changes. + +### Rationale + +Explain the rationale for the changes (possible link to a Request For Comments or to an issue). + +### Implementation Details + +#### Classes and files + +Give an overview of the implementation: main changes made to classes, files and modules. Do not paste complete diff, as it is available in the merge request already. + +#### Applications + +Describe any changes made to existing applications, or new applications that have been added. + +#### Tests + +Describe the testing strategy for new features. + +### Documentation + +List or link documentation modifications that were made (doxygen, example, Software Guide, application documentation, CookBook). + +### Additional notes + +List remaining open issues if any, and additional notes. + +### Copyright + +The copyright owner is *COPYRIGHT OWNER (OR OWNER'S AGENT)* and has signed the ORFEO ToolBox Contributor License Agreement diff --git a/CMake/FindShark.cmake b/CMake/FindShark.cmake index 59bef138f730718a535ef984deace363cf4f8a47..523f1ee7dcc4498927118bd6427ca906ffac9f11 100644 --- a/CMake/FindShark.cmake +++ b/CMake/FindShark.cmake @@ -97,25 +97,43 @@ if(SHARK_CONFIG_FILE) "${SHARK_VERSION_MAJOR}.${SHARK_VERSION_MINOR}.${SHARK_VERSION_PATCH}") endif() -set(SHARK_USE_OPENMP_matched) -#define SHARK_USE_OPENMP +# Check if Shark was built with OpenMP, CBLAS, DYNLIB, ... file(STRINGS "${SHARK_INCLUDE_DIR}/shark/Core/Shark.h" SHARK_H_CONTENTS) -string(REGEX MATCH - "#define.SHARK_USE_OPENMP" - SHARK_USE_OPENMP_matched "${SHARK_H_CONTENTS}") -if(SHARK_USE_OPENMP_matched) - if(NOT OTB_USE_OPENMP) - message(WARNING "Shark library is built with OpenMP and you have OTB_USE_OPENMP set to OFF.") - endif() +if(SHARK_H_CONTENTS MATCHES "#define.SHARK_USE_OPENMP") + set(SHARK_USE_OPENMP 1) +else() + set(SHARK_USE_OPENMP 0) +endif() + +if(SHARK_H_CONTENTS MATCHES "#define.SHARK_USE_CBLAS") + set(SHARK_USE_CBLAS 1) +else() + set(SHARK_USE_CBLAS 0) +endif() + +if(SHARK_H_CONTENTS MATCHES "#define.SHARK_USE_DYNLIB") + set(SHARK_USE_DYNLIB 1) +else() + set(SHARK_USE_DYNLIB 0) +endif() + +if(SHARK_USE_CBLAS AND SHARK_USE_DYNLIB) + set(REQUIRED_CBLAS_LIB CBLAS_LIBRARY) + find_library(CBLAS_LIBRARY NAMES cblas) +else() + set(REQUIRED_CBLAS_LIB) endif() INCLUDE(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Shark - REQUIRED_VARS SHARK_LIBRARY SHARK_INCLUDE_DIR + REQUIRED_VARS SHARK_LIBRARY SHARK_INCLUDE_DIR ${REQUIRED_CBLAS_LIB} VERSION_VAR SHARK_VERSION_STRING) if(SHARK_FOUND) set(SHARK_INCLUDE_DIRS ${SHARK_INCLUDE_DIR} ${Boost_INCLUDE_DIR} ) set(SHARK_LIBRARIES ${SHARK_LIBRARY} ${Boost_LIBRARIES} ) + if(REQUIRED_CBLAS_LIB) + set(SHARK_LIBRARIES ${SHARK_LIBRARIES} ${CBLAS_LIBRARY}) + endif() endif() diff --git a/CMake/OTBModuleMacros.cmake b/CMake/OTBModuleMacros.cmake index 0938a0f2fb9ed50fe44edf7017d9a4ac325e41b7..afb9a29f5c45b2509d0cd0bfe350df5a59ea846f 100644 --- a/CMake/OTBModuleMacros.cmake +++ b/CMake/OTBModuleMacros.cmake @@ -277,6 +277,12 @@ macro(otb_module_test) foreach(dep IN LISTS OTB_MODULE_${otb-module-test}_DEPENDS) list(APPEND ${otb-module-test}_LIBRARIES "${${dep}_LIBRARIES}") endforeach() + # make sure the test can link with optional libs + foreach(dep IN LISTS OTB_MODULE_${otb-module}_OPTIONAL_DEPENDS) + if (${dep}_ENABLED) + list(APPEND ${otb-module-test}_LIBRARIES "${${dep}_LIBRARIES}") + endif() + endforeach() endmacro() macro(otb_module_warnings_disable) diff --git a/CMake/i18n_qt4.cmake b/CMake/i18n_qt.cmake similarity index 87% rename from CMake/i18n_qt4.cmake rename to CMake/i18n_qt.cmake index 6d51ab2003dd5cde0180991da12bef39c7b493d0..6ef1672cf82bc0465e967ce4282a133e5cf0cf4f 100644 --- a/CMake/i18n_qt4.cmake +++ b/CMake/i18n_qt.cmake @@ -20,7 +20,7 @@ # # Reset Qt I18N source files cache variable. -macro( reset_qt4_i18n_sources ) +macro( reset_qt_i18n_sources ) set( OTB_QT_I18N_INCLUDE_PATH "" CACHE INTERNAL "" FORCE ) set( OTB_QT_I18N_HEADER_FILES "" CACHE INTERNAL "" FORCE ) set( OTB_QT_I18N_SOURCE_FILES "" CACHE INTERNAL "" FORCE ) @@ -33,7 +33,7 @@ endmacro() # # Func -function( add_to_qt4_i18n_files RESULT ) +function( add_to_qt_i18n_files RESULT ) foreach( F ${ARGN} ) #message( "${F}" ) @@ -45,13 +45,13 @@ endfunction() # # -macro( add_to_qt4_i18n_include_path DIRECTORY ) +macro( add_to_qt_i18n_include_path DIRECTORY ) set(OTB_I18N_INCLUDE_PATH ${OTB_I18N_INCLUDE_PATH} ${DIRECTORY} CACHE INTERNAL "") endmacro() # # -macro( add_to_qt4_i18n_headers INCLUDE_DIR ) +macro( add_to_qt_i18n_headers INCLUDE_DIR ) get_filename_component( ABS_INCLUDE_DIR ${INCLUDE_DIR} ABSOLUTE ) @@ -68,20 +68,20 @@ endmacro() # # Add source files to Qt I18n translation build. -macro( add_to_qt4_i18n_sources ) - add_to_qt4_i18n_files( OTB_QT_I18N_SOURCE_FILES ${ARGN} ) +macro( add_to_qt_i18n_sources ) + add_to_qt_i18n_files( OTB_QT_I18N_SOURCE_FILES ${ARGN} ) endmacro() # # Add source files to Qt I18n translation build. -macro( add_to_qt4_i18n_forms ) - add_to_qt4_i18n_files( OTB_QT_I18N_FORM_FILES ${ARGN} ) +macro( add_to_qt_i18n_forms ) + add_to_qt_i18n_files( OTB_QT_I18N_FORM_FILES ${ARGN} ) endmacro() # # -macro( generate_qt4_project FILENAME ) - message( STATUS "Generating Qt4 '${FILENAME}' project file for I18N." ) +macro( generate_qt_project FILENAME ) + message( STATUS "Generating Qt5 '${FILENAME}' project file for I18N." ) unset(_OTB_QT_I18N_INCLUDE_PATH_PRO) unset(_OTB_QT_I18N_HEADER_PRO) diff --git a/CMakeLists.txt b/CMakeLists.txt index c99b0c7948dfb10bc32e4f8b6473122acfeb7f63..44dbd2b25f3172111f988bf3fe0142a8e53e4c03 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -100,9 +100,9 @@ include(PreventInBuildInstalls) include(OTBModuleMacros) include(OTBModuleRemote) include(OTBModuleTest) -include( i18n_qt4 ) +include( i18n_qt ) -reset_qt4_i18n_sources() +reset_qt_i18n_sources() repository_status(${PROJECT_SOURCE_DIR} OTB_GIT_STATUS_MESSAGE) @@ -123,7 +123,7 @@ set(main_project_name ${_OTBModuleMacros_DEFAULT_LABEL}) #----------------------------------------------------------------------------- # OTB version number. set(OTB_VERSION_MAJOR "6") -set(OTB_VERSION_MINOR "4") +set(OTB_VERSION_MINOR "6") set(OTB_VERSION_PATCH "0") set(OTB_VERSION_STRING "${OTB_VERSION_MAJOR}.${OTB_VERSION_MINOR}.${OTB_VERSION_PATCH}") @@ -231,10 +231,6 @@ mark_as_advanced(OTB_USE_DEPRECATED) option(OTB_USE_OPENMP "Add openmp compiler and linker flags" OFF) option(OTB_USE_SSE_FLAGS "Enable SIMD optimizations (hardware dependent)." ON) -#----------------------------------------------------------------------------- -# SHOW_ALL_MSG_DEBUG option -option(OTB_SHOW_ALL_MSG_DEBUG "Show all debug messages (very verbose)" OFF) -#mark_as_advanced(OTB_SHOW_ALL_MSG_DEBUG) include(OTBSetStandardCompilerFlags) #--------------------------------------------------------------- @@ -535,7 +531,7 @@ endforeach() # message("OTB_MODULES_ENABLED = ${modules_list_for_summary}") # unset(modules_list_for_summary) -list(REMOVE_ITEM option_list "OTB_USE_6S" "OTB_USE_SIFTFAST" "OTB_USE_QT4") +list(REMOVE_ITEM option_list "OTB_USE_6S" "OTB_USE_SIFTFAST" "OTB_USE_QT") foreach(item ${option_list}) if(NOT ${item}) list(REMOVE_ITEM option_list "${item}" ) @@ -554,7 +550,7 @@ list(APPEND option_list TINYXML) #Q: Why these two guys here? we already have option_list #A: Because cmake case sensitivity with variables. -if(OTB_USE_QT4) +if(OTB_USE_QT) list(APPEND option_list QT) endif() #sort again! diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000000000000000000000000000000000000..d5d8c34413d24cc601be42b630cd08f63021a0a8 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,179 @@ +# How to contribute to Orfeo ToolBox ? + +Thank you for taking the time to contribute to OTB! This document will guide you +through the workflow and best practices you need to know to send your +contribution. + +There are many ways to contribute to OTB: + +* [Reporting a bug](#reporting-bugs) +* [Making a feature request](#feature-requests-and-discussions) +* [Improving documentation](#documentation-improvements) +* [Contributing code (C++, Python, CMake, etc.)](#code-contribution) +* [Publishing a remote module](#remote-modules) + +Our main workflow uses GitLab for source control, issues and task tracking. We +use a self-hosted GitLab instance: + +[`https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb`](https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb) + +Remember to check out also our [developers mailing list](https://groups.google.com/forum/?hl=fr#!forum/otb-developers/join), +where we discuss some features, improvements and high level project planning. +You are welcome to ask questions there as a beginner or future OTB contributor! + +## Reporting bugs + +If you have found a bug, you can first [search the existing issues](https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/issues?label_name%5B%5D=bug) +to see if it has already been reported. + +If it's a new bug, please [open a new issue on GitLab](https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/issues/new). +The 'Bug' issue template will help you provide all important information and +help fixing the bug quicker. Remember to add as much information as possible! + +## Feature requests and discussions + +Feature requests are welcome! Generally you are welcome to simply [open an issue](https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/issues) +and discuss your idea there. For more complex requests there is an issue +template for in depth description called 'Request for Comments'. + + +## Documentation improvements + +The two main OTB documentations are the [Software Guide](https://www.orfeo-toolbox.org/SoftwareGuide/index.html) +and the [CookBook](https://www.orfeo-toolbox.org/CookBook/). Their sources are +hosted in the main OTB repository in the `Documentation/` directory. Then, to +contribute documentation use the same workflow as for code contributions (see +below). + +See also the [Compiling documentation](https://wiki.orfeo-toolbox.org/index.php/Compiling_documentation) +wiki page for help on building the Sphinx and Latex source. + +## Code contribution + +The OTB workflow is based on GitLab [Merge Requests](https://docs.gitlab.com/ee/gitlab-basics/add-merge-request.html). +Clone the repository, create a feature branch, commit your changes, push the +feature branch to a fork (or the main repository if you are a core developer), +then send a merge request. + +Note that we also accept PRs on our [GitHub mirror](https://github.com/orfeotoolbox/OTB) +which we will manually merge. + +Feature branches are tested on multiple platforms on the OTB test infrastructure (a.k.a the [Dashboard](https://dash.orfeo-toolbox.org/)). They appear in the FeatureBranches section. + +Caveat: even if the Dashboard build on develop branch is broken, it is not +allowed to push fixes directly on develop. The developer trying to fix the +build should create a merge request and submit it for review. Direct push to +develop without review must be avoided. + +### Commit message + +On your feature branch, write a good [commit message](https://xkcd.com/1296/): +short and descriptive. If fixing an issue or bug, put the issue number in the +commit message so that GitLab can [cross-link it](https://docs.gitlab.com/ce/user/project/issues/crosslinking_issues.html). +You can prefix your commit message with an indicating flag (DOC, BUG, PKG, +TEST, SuperBuild, etc.). + +Standard prefixes for OTB commit messages: + + BUG: Fix for runtime crash or incorrect result + COMP: Compiler error or warning fix + DOC: Documentation change + ENH: New functionality + PERF: Performance improvement + STYLE: No logic impact (indentation, comments) + WIP: Work In Progress not ready for merge + +For example, here are some good commit messages: + + BUG: #1701 Warn users if parameter string is unset + DOC: Fix typo in Monteverdi French translation + COMP: Allow GeoTIFF and TIFF to be disabled when no 3rd party drags them + +### Merge request + +Your contribution is ready to be added to the main OTB repository? Send a Merge +Request against the `develop` branch on GitLab using the merge request +template. The merge request will then be discussed by the community and the core +OTB team. + +* Merge requests can not be merged until all discussions have been resolved (this is enforced by GitLab) +* Merge requests **must receive at least 2 positives votes from core developers** (members of Main Repositories group in Gitlab with at least "Developer" level; this includes PSC members) before being merged +* The merger is responsible for checking that the branch is up-to-date with develop +* Merge requests can be merged by anyone (not just PSC or RM) with push access to develop +* Merge requests can be merged once the dashboard is proven green for this branch. + This condition is mandatory unless reviewers and authors explicitely agree that + it can be skipped (for instance in case of documentation merges or compilation + fixes on develop). Branches of that sort can be identified with the ~patch label, + which tells the reviewer that the author would like to merge without dashboard testing. + +Branches can be registered for dashboard testing by adding one line in `Config/feature_branches.txt` in [otb-devutils repository](https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb-devutils.git). + +For branches in the main repository, the syntax is the following: + +``` +branch_name [otb-data_branch_name] + +``` +The second branch name is optional. It can be set if you need to modify [otb-data](https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb-data.git) according to your changes. + +For branches in forks, the syntax is the following: +``` +user/branch_name [user/otb-data_branch_name] +``` +Again, the second branch name is optional. + +For users without push access to [otb-devutils repository](https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb-devutils.git), the modification can be asked through a merge requests to this repository. + +Once the feature branch is registered for testing, it should appear in the *FeatureBranches* section of the [OTB dashboard](https://dash.orfeo-toolbox.org/index.php?project=OTB) next day (remember tests are run on a nightly basis). + +Do not forget to remove the feature branch for testing once it has been merged. + +### Contribution license agreement + +OTB requires that contributors sign out a [Contributor License +Agreement](https://en.wikipedia.org/wiki/Contributor_License_Agreement). The +purpose of this CLA is to ensure that the project has the necessary ownership or +grants of rights over all contributions to allow them to distribute under the +chosen license (Apache License Version 2.0) + +To accept your contribution, we need you to complete, sign and email to *cla [at] +orfeo-toolbox [dot] org* an [Individual Contributor Licensing +Agreement](https://www.orfeo-toolbox.org/cla/icla-en.doc) (ICLA) form and a +[Corporate Contributor Licensing +Agreement](https://www.orfeo-toolbox.org/cla/ccla-en.doc) (CCLA) form if you are +contributing on behalf of your company or another entity which retains copyright +for your contribution. + +The copyright owner (or owner's agent) must be mentioned in headers of all +modified source files and also added to the [NOTICE +file](https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/raw/develop/NOTICE). + +## Remote modules + +[Remote Modules](https://wiki.orfeo-toolbox.org/index.php/Remote_Modules) are +the preferred way if you wish to make your apps and filters available to the +community while keeping control and maintenance of their sources. Remote +modules are just like regular modules, except they are not distributed inside +OTB source code. Under some conditions (dependencies, official acceptance +process, etc.), we are also able to distribute your remote module in the +official standalone binaries. See [the wiki](https://wiki.orfeo-toolbox.org/index.php/Remote_Modules) +for more information. + +## GitLab guidelines + +In order to organize the issues in our GitLab instance, we use both labels and +milestones. + +The [milestones](https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/milestones) should be used to track in which release a feature is merged. +GitLab can then provide a summary of all features and bugs added to a given release +version. + +Regarding labels, we use the following set: +* ~story: significant feature to be implemented with a detailed work plan, it can + correspond to a Request for Comments that has turned into a development action +* ~bug: Bug, crash or unexpected behavior, reported by a user or a developer +* ~feature: Feature request expressed by an OTB user/developer +* ~patch: A small patch fixing build warnings, compilation errors, typos in logs or documentation +* ~"To Do": action is planned +* ~Doing: work in progress +* ~api ~app ~documentation ~monteverdi ~packaging ~qgis: optional context information diff --git a/Documentation/Cookbook/Scripts/otbGenerateWrappersRstDoc.py b/Documentation/Cookbook/Scripts/otbGenerateWrappersRstDoc.py index 70d55ce7c9490d4998b7db595130d0f917bf5576..7f0606992f8e5c461a1b53d6f1e4460f88141125 100755 --- a/Documentation/Cookbook/Scripts/otbGenerateWrappersRstDoc.py +++ b/Documentation/Cookbook/Scripts/otbGenerateWrappersRstDoc.py @@ -95,7 +95,8 @@ def GenerateChoice(app,param,paramlist, count = 0): return output def GenerateParameterType(app,param): - if app.GetParameterType(param) == otbApplication.ParameterType_Empty: + if app.GetParameterType(param) == otbApplication.ParameterType_Empty \ + or app.GetParameterType(param) == otbApplication.ParameterType_Bool: return "Boolean" if app.GetParameterType(param) == otbApplication.ParameterType_Int \ or app.GetParameterType(param) == otbApplication.ParameterType_Radius \ @@ -346,6 +347,8 @@ def GetApplicationExamplePythonSnippet(app,idx,expand = False, inputpath="",outp if paramtype == otbApplication.ParameterType_Empty: app.EnableParameter(param) output+= "\t" + appname + ".EnableParameter("+EncloseString(param)+")" + linesep + if paramtype == otbApplication.ParameterType_Bool: + output+= "\t" + appname + ".SetParameterString("+EncloseString(param)+","+EncloseString(value)+")" + linesep if paramtype == otbApplication.ParameterType_Int \ or paramtype == otbApplication.ParameterType_Radius \ or paramtype == otbApplication.ParameterType_RAM: diff --git a/Documentation/Cookbook/rst/AdvancedUse.rst b/Documentation/Cookbook/rst/AdvancedUse.rst new file mode 100644 index 0000000000000000000000000000000000000000..5ce7228d2f45f4db63d51ed917a8283c3a9e4d0e --- /dev/null +++ b/Documentation/Cookbook/rst/AdvancedUse.rst @@ -0,0 +1,363 @@ +Advanced Use +============ + +This section describes advanced configuration options and tricks. + +Environment variables that affects 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 +those values. + +* ``OTB_DEM_DIRECTORY``: Default directory were DEM tiles are stored. It should only contain ```.hgt`` or or georeferenced ``.tif`` files. Empty if not set (no directory set) +* ``OTB_GEOID_FILE``: Default path to the geoid file that will be used to retrieve height of DEM above ellipsoid. Empty if not set (no geoid set) +* ``OTB_MAX_RAM_HINT``: Default maximum memory that OTB should use for processing, in MB. If not set, default value is 128 MB. +* ``OTB_LOGGER_LEVEL``: Default level of logging for OTB. Should be one of ``DEBUG``, ``INFO``, ``WARNING``, ``CRITICAL`` or ``FATAL``, by increasing order of priority. Only messages with a higher priority than the level of logging will be displayed. If not set, default level is ``INFO``. + +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. + +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 +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 +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 +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 +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: + +:: + + Path/Image.ext?&key1=<value1>&key2=<value2> + +**Note that you’ll probably need to “quote†the filename, especially if calling +applications from the bash command line.** + +Reader options +^^^^^^^^^^^^^^ +:: + + &geom=<path/filename.geom> + +- Contains the file name of a valid geom file + +- Use the content of the specified geom file instead of + image-embedded geometric information + +- empty by default, use the image-embedded information if available + +----------------------------------------------- + +:: + + &sdataidx=<(int)idx> + +- Select the sub-dataset to read + +- 0 by default + +----------------------------------------------- + +:: + + &resol=<(int)resolution factor> + +- Select the JPEG2000 sub-resolution image to read + +- 0 by default + +----------------------------------------------- + +:: + + &bands=r1,r2,...,rn + +- 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 : + + - a single index (1-based) : + + - :code:`2` means 2nd band + + - :code:`-1` means last band + + - or a range of bands : + + - :code:`3:` means 3rd band until the last one + + - :code:`:-2` means the first bands until the second to last + + - :code:`2:4` means bands 2,3 and 4 + +- empty by default (all bands are read from the input image) + +----------------------------------------------- + +:: + + &skipcarto=<(bool)true> + +- Skip the cartographic information + +- Clears the projectionref, set the origin to :math:`[0,0]` and the + spacing to :math:`[1/max(1,r),1/max(1,r)]` where :math:`r` is the resolution + factor. + +- Keeps the keyword list + +- false by default + +----------------------------------------------- + +:: + + &skipgeom=<(bool)true> + +- Skip geometric information + +- Clears the keyword list + +- Keeps the projectionref and the origin/spacing information + +- false by default. + +----------------------------------------------- + +:: + + &skiprpctag=<(bool)true> + +- Skip the reading of internal RPC tags (see + [sec:TypesofSensorModels] for details) + +- false by default. + +Writer options +^^^^^^^^^^^^^^ + +:: + + &writegeom=<(bool)false> + +- To activate writing of external geom file + +- true by default + +----------------------------------------------- + +:: + + &writerpctags=<(bool)true> + +- To activate writing of RPC tags in TIFF files + +- false by default + +----------------------------------------------- + +:: + + &gdal:co:<GDALKEY>=<VALUE> + +- 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 + +- None by default + +----------------------------------------------- + +:: + + &streaming:type=<VALUE> + +- Activates configuration of streaming through extended filenames + +- Override any previous configuration of streaming + +- Allows to configure the kind of streaming to perform + +- Available values are: + + - auto: tiled or stripped streaming mode chosen automatically + depending on TileHint read from input files + + - tiled: tiled streaming mode + + - stripped: stripped streaming mode + + - none: explicitly deactivate streaming + +- Not set by default + +----------------------------------------------- + +:: + + &streaming:sizemode=<VALUE> + +- Allows to choose how the size of the streaming pieces is computed + +- Available values are: + + - auto: size is estimated from the available memory setting by + evaluating pipeline memory print + + - height: size is set by setting height of strips or tiles + + - nbsplits: size is computed from a given number of splits + +- Default is auto + +----------------------------------------------- + +:: + + &streaming:sizevalue=<VALUE> + +- Parameter for size of streaming pieces computation + +- Value is : + + - if sizemode=auto: available memory in Mb + + - if sizemode=height: height of the strip or tile in pixels + + - 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 + nbsplits, streaming is deactivated, if set to auto, value is + fetched from configuration or cmake configuration file) + +----------------------------------------------- + +:: + + &box=<startx>:<starty>:<sizex>:<sizey> + +- User defined parameters of output image region + +- The region must be set with 4 unsigned integers (the separator + used is the colon ’:’). Values are: + + - startx: first index on X (starting with 0) + + - starty: first index on Y (starting with 0) + + - sizex: size along X + + - sizey: size along Y + +- The definition of the region follows the same convention as + itk::Region definition in C++. A region is defined by two classes: + the itk::Index and itk::Size classes. The origin of the region + within the image with which it is associated is defined by Index + +----------------------------------------------- + +:: + + &bands=r1,r2,...,rn + +- Select a subset of bands from the output 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 : + + - a single index (1-based) : + + - :code:`2` means 2nd band + + - :code:`-1` means last band + + - or a range of bands : + + - :code:`3:` means 3rd band until the last one + + - :code:`:-2` means the first bands until the second to last + + - :code:`2:4` means bands 2,3 and 4 + +- Empty by default (all bands are write from the output image) + +The available syntax for boolean options are: + +- ON, On, on, true, True, 1 are available for setting a ’true’ boolean + value + +- OFF, Off, off, false, False, 0 are available for setting a ’false’ + boolean value + +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. + +For open option : + +:: + + &gdal:oo:<GDALKEY>=<VALUE> + + +For creation option : + +:: + + &gdal:co:<GDALKEY>=<VALUE> + + +For layer creation option : + +:: + + &gdal:lco:<GDALKEY>=<VALUE> + + + +Examples +^^^^^^^^^^^^^^ + +You can find below some examples: + +- Write a file with blockSize equal to 256 and with DEFLATE compression + +:: + + $ otbcli_Convert -in OTB-Data/Examples/QB_1_ortho.tif -out "/tmp/example1.tif?&gdal:co:TILED=YES&gdal:co:COMPRESS=DEFLATE" + +- Process only first band from a file + +:: + + $ otbcli_Convert -in "OTB-Data/Examples/QB_1_ortho.tif?&bands=1" -out /tmp/example2.tif diff --git a/Documentation/Cookbook/rst/FAQ.rst b/Documentation/Cookbook/rst/FAQ.rst index 490e77a34c1619fb5025e823fcf680d9c3d27c83..83faac13abd949abb9c97b6ad0e07137e19c0ae2 100644 --- a/Documentation/Cookbook/rst/FAQ.rst +++ b/Documentation/Cookbook/rst/FAQ.rst @@ -189,7 +189,7 @@ The first time, you can get the source code using: :: - git clone https://git@git.orfeo-toolbox.org/git/otb.git + git clone https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb.git Then you can build OTB as usual using this directory as the source (refer to build instructions). Later if you want to update your source, @@ -428,7 +428,7 @@ You can get the base doing: :: - git clone https://git@git.orfeo-toolbox.org/git/otb-data.git + git clone https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb-data.git This is about 1 GB of data, so it will take a while, but you have to do it only once, as after, a simple diff --git a/Documentation/Cookbook/rst/Installation.rst b/Documentation/Cookbook/rst/Installation.rst index 6058b155e95676de923b69e2649dbd86d0a0ef90..4a18859fc78af28af4d2eedf2be2fc2cc93fc54f 100644 --- a/Documentation/Cookbook/rst/Installation.rst +++ b/Documentation/Cookbook/rst/Installation.rst @@ -3,9 +3,9 @@ Installation We provide different standalone binary packages for OTB-Applications: -- for Windows platform (7 or higher) +- for Windows platform (Seven or higher) -- for 64bit Linux distribution +- for 64 bits Linux distribution - for MacOS X @@ -21,17 +21,17 @@ You can get latest binary packages from our `Download page <https://www.orfeo-to Windows ------- -.. include:: Installation_Windows.txt +.. include:: Installation_Windows.rst -Linux x86_64 +Linux ------------ -.. include:: Installation_Linux.txt +.. include:: Installation_Linux.rst MacOS X ------- -.. include:: Installation_Macx.txt +.. include:: Installation_Macos.rst Other packages -------------- diff --git a/Documentation/Cookbook/rst/Installation_Linux.txt b/Documentation/Cookbook/rst/Installation_Linux.rst similarity index 77% rename from Documentation/Cookbook/rst/Installation_Linux.txt rename to Documentation/Cookbook/rst/Installation_Linux.rst index a236e906a5417653c12333a5967c9b6026d120f0..8f90e6cd8183744e0e6f6e98b81f5041b13a3493 100644 --- a/Documentation/Cookbook/rst/Installation_Linux.txt +++ b/Documentation/Cookbook/rst/Installation_Linux.rst @@ -91,9 +91,9 @@ OTB wrappings. If no compatible Python 2.x version is found a notification is generated during the installation process. If the installation completes without issue, information relating to your Python bindings will be provided. -You must have Python numpy bindings installed in your system. They can be installed locally +You must have Python NumPy bindings installed in your system. They can be installed locally without admin rights as follows: "pip install --user numpy". This is to give users the option -to select their own existing Python installation rather than the one dibstributed by the OTB package. +to select their own existing Python installation rather than the one distributed by the OTB package. By default, bindings for Python 2.7 will be enabled with the ``otbenv`` script. If you want to use bindings for Python 3.5, you can copy this script and modify: @@ -115,38 +115,21 @@ Notes: FAQ ~~~ -Q: I am getting an error message... +Q: Unable to import otbApplication library with Python3 +++++++++++++++++++++++++++++++++++ :: - Cannot mix incompatible Qt library (version 0x40806) with this library (version 0x40807) - Aborted + ImportError: libpython3.5m.so.rh-python35-1.0: cannot open shared object file: No such file or directory -A: This is due to a conflict with system Qt4 (usually seen on KDE) and Qt4 + gtk libs in OTB package. The fix you need is to remove those libs from package. +A: You need to add a symlink to libpython3.5m.so.rh-python35-1.0 to make it works. -.. parsed-literal:: - - cd /path/to/OTB-|release|-Linux64 - rm -f lib/libQt* && rm -fr lib/gtk - -Q: Monteverdi and Mapla applications look different from my other applications. -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -A: In versions 6.0, Monteverdi, Mapla and otbapplication (otbgui\_\*) -use the system gtk theme. If you can't install GTK on your system you can use the -one distributed with the OTB package. Note that using system GTK is the preferred -way with the OTB standalone package as the distributed version of GTK do not -work on recent Linux distributions. - -To use the distributed GTK libraries you need to set the OTB_USE_LOCAL_GTK: - -:: - - export OTB_USE_LOCAL_GTK=1 +Here is the solution: -And now start ``monteverdi.sh`` or ``mapla.sh`` from OTB-6.0.0-Linux64 -To get back default behaviour, unset OTB_USE_LOCAL_GTK=1 or set OTB_USE_LOCAL_GTK=0 +- find the libpython3.5XX on your system : find /usr/lib -iname *libpython3.5* +(on Ubuntu 14.04, it is /usr/lib/x86_64-linux-gnu/libpython3.5m.so) +- create a symlink : ln -s path/to/lib/python3.5XX +path/to/lib/libpython3.5m.so.rh-python35-1.0 +- Try to import otbApplication again -In version 6.2 and older, the Linux binaries are built without GTK support to cut some -dependencies. +See this discussion on `OTB issue tracker <https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/issues/1540#note_67864>`_ diff --git a/Documentation/Cookbook/rst/Installation_Linux_xdk.txt b/Documentation/Cookbook/rst/Installation_Linux_xdk.rst similarity index 94% rename from Documentation/Cookbook/rst/Installation_Linux_xdk.txt rename to Documentation/Cookbook/rst/Installation_Linux_xdk.rst index a81d7f1f6f09f6740bee5b41fc1c4aff4515b6d0..38c890f066429e6af90b2c6cb8ec1f20af269a90 100644 --- a/Documentation/Cookbook/rst/Installation_Linux_xdk.txt +++ b/Documentation/Cookbook/rst/Installation_Linux_xdk.rst @@ -54,7 +54,7 @@ Download, Configure and build OTB :: mkdir -p /opt/OTB/build && cd /opt/OTB - git clone --depth=1 --branch=develop https://git@git.orfeo-toolbox.org/git/otb.git source + git clone --depth=1 --branch=develop https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb.git source cd build && cmake ../source make -j2 diff --git a/Documentation/Cookbook/rst/Installation_Macx.txt b/Documentation/Cookbook/rst/Installation_Macos.rst similarity index 100% rename from Documentation/Cookbook/rst/Installation_Macx.txt rename to Documentation/Cookbook/rst/Installation_Macos.rst diff --git a/Documentation/Cookbook/rst/Installation_Macx_xdk.txt b/Documentation/Cookbook/rst/Installation_Macos_xsk.rst similarity index 100% rename from Documentation/Cookbook/rst/Installation_Macx_xdk.txt rename to Documentation/Cookbook/rst/Installation_Macos_xsk.rst diff --git a/Documentation/Cookbook/rst/Installation_Windows.txt b/Documentation/Cookbook/rst/Installation_Windows.rst similarity index 100% rename from Documentation/Cookbook/rst/Installation_Windows.txt rename to Documentation/Cookbook/rst/Installation_Windows.rst diff --git a/Documentation/Cookbook/rst/Installation_Windows_xdk.txt b/Documentation/Cookbook/rst/Installation_Windows_xdk.rst similarity index 100% rename from Documentation/Cookbook/rst/Installation_Windows_xdk.txt rename to Documentation/Cookbook/rst/Installation_Windows_xdk.rst diff --git a/Documentation/Cookbook/rst/Monteverdi.rst b/Documentation/Cookbook/rst/Monteverdi.rst index 257ae1a017a0bac15cadf68443a6a5cdf6d236a4..ac362cc2822f7925b3a21159cd8c43958cc194f7 100644 --- a/Documentation/Cookbook/rst/Monteverdi.rst +++ b/Documentation/Cookbook/rst/Monteverdi.rst @@ -321,7 +321,7 @@ Conclusion ~~~~~~~~~~ The images used in this documentation can be found in the OTB-Data -repository (https://git.orfeo-toolbox.org/otb-data.git): +repository (https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb-data.git): - in OTB-Data/Input: diff --git a/Documentation/Cookbook/rst/OTB-Applications.rst b/Documentation/Cookbook/rst/OTB-Applications.rst index 4da50bd9f419a096e11957e7c35e2621d9cfbd50..1905a737e7e72d869670d226e69bfa6e02b5b9d7 100644 --- a/Documentation/Cookbook/rst/OTB-Applications.rst +++ b/Documentation/Cookbook/rst/OTB-Applications.rst @@ -360,296 +360,3 @@ among 560 cpus and took only 56 seconds. Note that this MPI parallel invocation of applications is only available for command-line calls to OTB applications, and only for images output parameters. - -.. _extended-filenames: - -Extended filenames ------------------- - -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 -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 -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 -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. - -The reader and writer extended file name 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: - -:: - - Path/Image.ext?&key1=<value1>&key2=<value2> - -Note that you’ll probably need to “quote†the filename, especially if calling -applications from the bash command line. - -Reader options -^^^^^^^^^^^^^^ - -:: - - &geom=<path/filename.geom> - -- Contains the file name of a valid geom file - -- Use the content of the specified geom file instead of - image-embedded geometric information - -- empty by default, use the image-embedded information if available - ------------------------------------------------ - -:: - - &sdataidx=<(int)idx> - -- Select the sub-dataset to read - -- 0 by default - ------------------------------------------------ - -:: - - &resol=<(int)resolution factor> - -- Select the JPEG2000 sub-resolution image to read - -- 0 by default - ------------------------------------------------ - -:: - - &bands=r1,r2,...,rn - -- 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 : - - - a single index (1-based) : - - - :code:`2` means 2nd band - - - :code:`-1` means last band - - - or a range of bands : - - - :code:`3:` means 3rd band until the last one - - - :code:`:-2` means the first bands until the second to last - - - :code:`2:4` means bands 2,3 and 4 - -- empty by default (all bands are read from the input image) - ------------------------------------------------ - -:: - - &skipcarto=<(bool)true> - -- Skip the cartographic information - -- Clears the projectionref, set the origin to :math:`[0,0]` and the - spacing to :math:`[1/max(1,r),1/max(1,r)]` where :math:`r` is the resolution - factor. - -- Keeps the keyword list - -- false by default - ------------------------------------------------ - -:: - - &skipgeom=<(bool)true> - -- Skip geometric information - -- Clears the keyword list - -- Keeps the projectionref and the origin/spacing information - -- false by default. - ------------------------------------------------ - -:: - - &skiprpctag=<(bool)true> - -- Skip the reading of internal RPC tags (see - [sec:TypesofSensorModels] for details) - -- false by default. - -Writer options -^^^^^^^^^^^^^^ - -:: - - &writegeom=<(bool)false> - -- To activate writing of external geom file - -- true by default - ------------------------------------------------ - -:: - - &writerpctags=<(bool)true> - -- To activate writing of RPC tags in TIFF files - -- false by default - ------------------------------------------------ - -:: - - &gdal:co:<GDALKEY>=<VALUE> - -- To specify a gdal creation option - -- For gdal creation option information, see dedicated gdal documentation - -- None by default - ------------------------------------------------ - -:: - - &streaming:type=<VALUE> - -- Activates configuration of streaming through extended filenames - -- Override any previous configuration of streaming - -- Allows to configure the kind of streaming to perform - -- Available values are: - - - auto: tiled or stripped streaming mode chosen automatically - depending on TileHint read from input files - - - tiled: tiled streaming mode - - - stripped: stripped streaming mode - - - none: explicitly deactivate streaming - -- Not set by default - ------------------------------------------------ - -:: - - &streaming:sizemode=<VALUE> - -- Allows to choose how the size of the streaming pieces is computed - -- Available values are: - - - auto: size is estimated from the available memory setting by - evaluating pipeline memory print - - - height: size is set by setting height of strips or tiles - - - nbsplits: size is computed from a given number of splits - -- Default is auto - ------------------------------------------------ - -:: - - &streaming:sizevalue=<VALUE> - -- Parameter for size of streaming pieces computation - -- Value is : - - - if sizemode=auto: available memory in Mb - - - if sizemode=height: height of the strip or tile in pixels - - - 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 - nbsplits, streaming is deactivated, if set to auto, value is - fetched from configuration or cmake configuration file) - ------------------------------------------------ - -:: - - &box=<startx>:<starty>:<sizex>:<sizey> - -- User defined parameters of output image region - -- The region must be set with 4 unsigned integers (the separator - used is the colon ’:’). Values are: - - - startx: first index on X (starting with 0) - - - starty: first index on Y (starting with 0) - - - sizex: size along X - - - sizey: size along Y - -- The definition of the region follows the same convention as - itk::Region definition in C++. A region is defined by two classes: - the itk::Index and itk::Size classes. The origin of the region - within the image with which it is associated is defined by Index - ------------------------------------------------ - -:: - - &bands=r1,r2,...,rn - -- Select a subset of bands from the output 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 : - - - a single index (1-based) : - - - :code:`2` means 2nd band - - - :code:`-1` means last band - - - or a range of bands : - - - :code:`3:` means 3rd band until the last one - - - :code:`:-2` means the first bands until the second to last - - - :code:`2:4` means bands 2,3 and 4 - -- Empty by default (all bands are write from the output image) - -The available syntax for boolean options are: - -- ON, On, on, true, True, 1 are available for setting a ’true’ boolean - value - -- OFF, Off, off, false, False, 0 are available for setting a ’false’ - boolean value diff --git a/Documentation/Cookbook/rst/conf.py.in b/Documentation/Cookbook/rst/conf.py.in index 30ce0dc728056846e6a2bdf192840a2beb1b0df6..1e4442b07f398766735fa3898e75692c5b9d52d4 100644 --- a/Documentation/Cookbook/rst/conf.py.in +++ b/Documentation/Cookbook/rst/conf.py.in @@ -211,7 +211,7 @@ latex_elements = { # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - ('index_TOC', 'CookBook-@OTB_VERSION_MAJOR@.@OTB_VERSION_MINOR@.tex', u'OTB CookBook Documentation', + ('index_TOC', 'CookBook-@OTB_VERSION_MAJOR@.@OTB_VERSION_MINOR@.@OTB_VERSION_PATCH@.tex', u'OTB CookBook Documentation', u'OTB Team', 'manual'), ] diff --git a/Documentation/Cookbook/rst/index_TOC.rst b/Documentation/Cookbook/rst/index_TOC.rst index d09049ccec83ef3be5d654decf11e25998f9e7bc..126fc8debfbd713cdd752205ee33f49ba9b60dfd 100644 --- a/Documentation/Cookbook/rst/index_TOC.rst +++ b/Documentation/Cookbook/rst/index_TOC.rst @@ -8,6 +8,7 @@ Table of Contents Installation OTB-Applications Monteverdi + AdvancedUse Recipes Applications FAQ diff --git a/Documentation/Cookbook/rst/recipes/optpreproc.rst b/Documentation/Cookbook/rst/recipes/optpreproc.rst index 41b1169fa8bf5fa3736bc259f7f0797f72415fe3..e3f00ca3a47bb36f7b98e0128a280d52593f233a 100644 --- a/Documentation/Cookbook/rst/recipes/optpreproc.rst +++ b/Documentation/Cookbook/rst/recipes/optpreproc.rst @@ -242,7 +242,7 @@ path to a file which contains the geoid. `Geoid <http://en.wikipedia.org/wiki/Ge corresponds to the equipotential surface that would coincide with the mean ocean surface of the Earth. -We provide one geoid in the `OTB-Data <https://git.orfeo-toolbox.org/otb-data.git/tree/HEAD:/Input/DEM>`_ repository. +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 to the geoid. Finally, it is also possible to use an average elevation diff --git a/Documentation/Cookbook/rst/recipes/pbclassif.rst b/Documentation/Cookbook/rst/recipes/pbclassif.rst index 1e26e4c7f53a0aafdf701cf3b8bd7ef9bc1fb51a..4202066085f000e6ec8f4b1f1eac313f277de09a 100644 --- a/Documentation/Cookbook/rst/recipes/pbclassif.rst +++ b/Documentation/Cookbook/rst/recipes/pbclassif.rst @@ -525,7 +525,7 @@ Example We consider 4 classes: water, roads, vegetation and buildings with red roofs. Data is available in the OTB-Data -`repository <https://git.orfeo-toolbox.org/otb-data.git/tree/HEAD:/Input/Classification>`_ . +`repository <https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb-data/tree/master/Input/Classification>`_ . .. |image_21| image:: ../Art/MonteverdiImages/classification_chain_inputimage.jpg .. |image_22| image:: ../Art/MonteverdiImages/classification_chain_fancyclassif_fusion.jpg diff --git a/Documentation/Cookbook/rst/recipes/python.rst b/Documentation/Cookbook/rst/recipes/python.rst index cbb119372dab87e687c015f08f467ad9ac62f69a..f4d5ff597e3a8cc81b46dc70fa1e760c4eeeccec 100644 --- a/Documentation/Cookbook/rst/recipes/python.rst +++ b/Documentation/Cookbook/rst/recipes/python.rst @@ -29,14 +29,14 @@ application, changing the algorithm at each iteration. import otbApplication # otbApplication.Registry can tell you what application are available - print "Available applications: " - print str( otbApplication.Registry.GetAvailableApplications() ) + print('Available applications: ') + print (str( otbApplication.Registry.GetAvailableApplications())) - # Let's create the application with codename "Smoothing" + # Let's create the application "Smoothing" app = otbApplication.Registry.CreateApplication("Smoothing") - # We print the keys of all its parameter - print app.GetParametersKeys() + # We print the keys of all its parameters + print (app.GetParametersKeys()) # First, we set the input image filename app.SetParameterString("in", argv[1]) @@ -45,37 +45,47 @@ application, changing the algorithm at each iteration. # and can take 3 values: 'mean', 'gaussian', 'anidif' for type in ['mean', 'gaussian', 'anidif']: - print 'Running with ' + type + ' smoothing type' + print('Running with ' + type + ' smoothing type') - # Here we configure the smoothing algorithm + # Now we configure the smoothing algorithm app.SetParameterString("type", type) - # Set the output filename, using the algorithm to differentiate the outputs + # Set the output filename, using the algorithm type to differentiate the outputs app.SetParameterString("out", argv[2] + type + ".tif") - # This will execute the application and save the output file + # This will execute the application and save the output to argv[2] app.ExecuteAndWriteOutput() +If you want to handle the parameters from a Python dictionary, you can use the +functions *SetParameters()* and *GetParameters()*. + +.. code-block:: python + + params = {"in":"myInput.tif", "type.mean.radius":4} + app.SetParameters(params) + params2 = app.GetParameters() + Numpy array processing ---------------------- -Input and output images to any OTB application in the form of numpy array is now possible in OTB python wrapping. -The python wrapping only exposes OTB ApplicationEngine module which allow to access existing C++ applications. +Input and output images to any OTB application in the form of NumPy array is now possible in OTB Python wrapping. +The Python wrapping only exposes OTB Application engine module (called *ApplicationEngine*) which allows to access existing C++ applications. Due to blissful nature of ApplicationEngine's loading mechanism no specific wrapping is required for each application. -Numpy extension to Python wrapping allows data exchange to application as an array rather than a disk file. -Ofcourse, it is possible to load an image from file and then convert to numpy array or just provide a file as earlier via +NumPy extension to Python wrapping allows data exchange to application as an array rather than a disk file. +Of course, it is possible to load an image from file and then convert it to NumPy +array or just provide a file as explained in the previous section via Application.SetParameterString(...). -This bridge that completes numpy and OTB makes it easy to plug OTB into any image processing chain via python code that uses -GIS/Image processing tools such as GDAL, GRASS GIS, OSSIM that can deal with numpy. - +The bridge between NumPy and OTB makes it easy to plug OTB into any image processing chain via Python code that uses +GIS/Image processing tools such as GDAL, GRASS GIS, OSSIM that can deal with NumPy. -Below code reads an input image using python pillow (PIL) and convert it to numpy array. This numpy array is -used an input to the application via *SetImageFromNumpyArray(...)* method. -The application used in this example is ExtractROI. After extracting -a small area the output image is taken as numpy array with *GetImageFromNumpyArray(...)* method thus avoid wiriting -output to a temporary file. +Below code reads an input image using Python Pillow library (fork of PIL) and convert it to +NumPy array. The NumPy array is used as an input to the application via +*SetImageFromNumpyArray(...)* method. The application used in this example is +ExtractROI. After extracting a small area the output image is taken as NumPy +array with *GetImageFromNumpyArray(...)* method thus avoid writing output to a +temporary file. :: @@ -105,7 +115,7 @@ In-memory connection -------------------- Applications are often use as parts of larger processing -chains. Chaining applications currently requires to write/read back +workflow. Chaining applications currently requires to write/read back images between applications, resulting in heavy I/O operations and a significant amount of time dedicated to writing temporary files. @@ -118,9 +128,9 @@ images. The last application of the processing chain is responsible for writing the final result images. In-memory connection between applications is available both at the C++ -API level and using the python bindings. +API level and using the Python bindings. -Here is a Python code sample connecting several applications together: +Here is a Python code sample which connects several applications together: .. code-block:: python @@ -163,11 +173,147 @@ implementation does not break it, for instance by using an internal writer to write intermediate data. In this case, execution should still be correct, but some intermediate data will be read or written. +Interactions with OTB pipeline +------------------------------ + +[Since OTB 6.6] + +The application framework has been extended in order to provide ways to +interact with the pipelines inside each application. It applies only to +applications that use input or output images. Let's check what are the +functions added to the ``Application`` class. There are a lot of getter +functions: + ++---------------------------------+---------------------------------------+ +| Function name | return value | ++=================================+=======================================+ +| ``GetImageOrigin(...)`` | origin of the image (physical position| +| | of the first pixel center) | ++---------------------------------+---------------------------------------+ +| ``GetImageSpacing(...)`` | signed spacing of the image | ++---------------------------------+---------------------------------------+ +| ``GetImageSize(...)`` | size of the LargestPossibleRegion | ++---------------------------------+---------------------------------------+ +| ``GetImageNbBands(...)`` | number of components per pixel | ++---------------------------------+---------------------------------------+ +| ``GetImageProjection(...)`` | Projection WKT string | ++---------------------------------+---------------------------------------+ +| ``GetImageKeywordlist(...)`` | Ossim keywordlist (sensor model) | ++---------------------------------+---------------------------------------+ +| ``GetImageMetaData(...)`` | the entire MetaDataDictionary | ++---------------------------------+---------------------------------------+ +| ``GetImageRequestedRegion(...)``| requested region | ++---------------------------------+---------------------------------------+ +| ``GetImageBasePixelType(...)`` | pixel type of the underlying | +| | Image/VectorImage. | ++---------------------------------+---------------------------------------+ + +All these getters functions use the following arguments: + +* ``key``: a string containing the key of the image parameter +* ``idx``: an optional index (default is 0) that can be used to access ImageList + parameters transparently + +There is also a function to send orders to the pipeline: + + ``PropagateRequestedRegion(key, region, idx=0)``: sets a given RequestedRegion + on the image and propagate it, returns the memory print estimation. This function + can be used to measure the requested portion of input images necessary to produce + an extract of the full output. + +Note: a requested region (like other regions in the C++ API of otb::Image) is +just a pair of an image index and a size, that define a rectangular extract of +the full image. + +This set of function has been used to enhance the bridge between OTB images +and Numpy arrays. There are now import and export functions available in +Python that preserve the metadata of the image during conversions to Numpy +arrays: + +* ``ExportImage(self, key)``: exports an output image parameter into a Python + dictionary. +* ``ImportImage(self, key, dict, index=0)``: imports the image from a Python + dictionary into an image parameter (as a monoband image). +* ``ImportVectorImage(self, key, dict, index=0)``: imports the image from a + Python dictionary into an image parameter (as a multiband image). + +The Python dictionary used has the following entries: + + * ``'array'``: the Numpy array containing the pixel buffer + * ``'origin'``: origin of the image + * ``'spacing'``: signed spacing of the image + * ``'size'``: full size of the image + * ``'region'``: region of the image present in the buffer + * ``'metadata'``: metadata dictionary (contains projection, sensor model,...) + +Now some basic Q&A about this interface: + + Q: What portion of the image is exported to Numpy array? + A: By default, the whole image is exported. If you had a non-empty requested + region (the result of calling PropagateRequestedRegion()), then this region + is exported. + + Q: What is the difference between ImportImage and ImportVectorImage? + A: The first one is here for Applications that expect a monoband otb::Image. + In most cases, you will use the second one: ImportVectorImage. + + Q: What kind of object are there in this dictionary export? + A: The array is a numpy.ndarray. The other fields are wrapped + objects from the OTB library but you can interact with them in a + Python way: they support ``len()`` and ``str()`` operator, as well as + bracket operator ``[]``. Some of them also have a ``keys()`` function just like + dictionaries. + +This interface allows you to export OTB images (or extracts) to Numpy array, +process them by other means, and re-import them with preserved metadatas. Please +note that this is different from an in-memory connection. + +Here is a small example of what can be done: + +.. code-block:: python + + import otbApplication as otb + + # Create a smoothing application + app = otb.Registry.CreateApplication("Smoothing") + app.SetParameterString("in",argv[1]) + + # only call Execute() to setup the pipeline, not ExecuteAndWriteOutput() which would + # run it and write the output image + app.Execute() + + # Setup a special requested region + myRegion = otb.itkRegion() + myRegion['size'][0] = 20 + myRegion['size'][1] = 25 + myRegion['index'].Fill(10) + ram = app.PropagateRequestedRegion("out",myRegion) + + # Check the requested region on the input image + print(app.GetImageRequestedRegion("in")) + + # Create a ReadImageInfo application + app2 = otb.Registry.CreateApplication("ReadImageInfo") + + # export "out" from Smoothing and import it as "in" in ReadImageInfo + ex = app.ExportImage("out") + app2.ImportVectorImage("in", ex) + app2.Execute() + + # Check the result of ReadImageInfo + someKeys = ['sizex', 'sizey', 'spacingx', 'spacingy', 'sensor', 'projectionref'] + for key in someKeys: + print(key + ' : ' + str(app2.GetParameterValue(key))) + + # Only a portion of "out" was exported but ReadImageInfo is still able to detect the + # correct full size of the image + + Corner cases ------------ There are a few corner cases to be aware of when using Python wrappers. They are -often limitations, that one day may be solved by future developments. If it +often limitations, that one day may be solved in future versions. If it happens, this documentation will report the OTB version that fixes the issue. Calling UpdateParameters() @@ -211,30 +357,34 @@ setting the ``field`` parameter: app.UpdateParameters() app.SetParameterString("field", "label") -No metadata in Numpy arrays +No metadata in NumPy arrays ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -With the Numpy module, it is possible to convert images between OTB and Numpy -arrays. For instance, when converting from OTB to Numpy array: +With the NumPy module, it is possible to convert images between OTB and NumPy +arrays. For instance, when converting from OTB to NumPy array: * An ``Update()`` of the underlying ``otb::VectorImage`` is requested. Be aware that the full image is generated. * The pixel buffer is copied into a ``numpy.array`` As you can see, there is no export of the metadata, such as origin, spacing, -projection WKT. It means that if you want to import back a Numpy array into OTB, +geographic projection. It means that if you want to import back a NumPy array into OTB, the image won't have any of these metadata. It can be a problem for applications doing geometry, projections, and also calibration. Future developments will probably offer a more adapted structure to import and -export images between OTB and Python world. +export images between OTB and the Python world. + +Setting of EmptyParameter +^^^^^^^^^^^^^^^^^^^^^^^^^ -Setting of boolean parameters -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Most of the parameters are set using functions ``SetParameterXXX()``, except for +one type of parameter: the ``EmptyParameter``. This class was the first +implementation of a boolean. It is now **deprecated**, you should use ``BoolParameter`` +instead. -Most of the parameters are set using functions ``SetParameterXXX()``. The boolean -parameters are handled differently (also called Empty parameter). Let's take an example with the application -``ReadImageInfo``: +Let's take an example with the application ``ReadImageInfo`` when it was still +using an ``EmptyParameter`` for parameter ``keywordlist``: .. code-block:: python @@ -247,7 +397,7 @@ If you want the get the state of parameter ``keywordlist``, a boolean, use: app.IsParameterEnabled("keywordlist") -To set this parameter ON / OFF, use the functions: +To set this parameter ON/OFF, use the functions: .. code-block:: python diff --git a/Documentation/SoftwareGuide/Latex/CompilingMonteverdi.tex b/Documentation/SoftwareGuide/Latex/CompilingMonteverdi.tex deleted file mode 100644 index 7c38627bd2838e95a5936225d7b4dbb664cc2b08..0000000000000000000000000000000000000000 --- a/Documentation/SoftwareGuide/Latex/CompilingMonteverdi.tex +++ /dev/null @@ -1,59 +0,0 @@ -\setcounter{secnumdepth}{3} - -\chapter{Compiling Monteverdi from source} -\label{chapter:CompilingMonteverdi} - -\section{Linux and Mac OS X} - -Compiling Monteverdi from source follows the same procedure as a regular CMake project: setup a directory for an -out-of-source build, configure and compile. - -\subsection{Monteverdi} - -Make sure OTB is compiled with at least \texttt{OTB\_USE\_QT4}, \texttt{OTB\_USE\_GLUT}, \texttt{OTB\_USE\_GLFW} and \texttt{OTB\_USE\_GLEW} set to ON. -Setup another out-of-source build environment for Monteverdi: -\begin{verbatim} -$ mkdir ~/monteverdi -$ cd ~/monteverdi -$ git clone https://git@git.orfeo-toolbox.org/git/monteverdi2.git -$ mkdir build -$ mkdir install -\end{verbatim} - -Remember to checkout the develop branch if you want the current development version: -\begin{verbatim} -$ cd ~/monteverdi/monteverdi2 -$ git checkout develop -\end{verbatim} - -CMake needs to find both OTB and QWT installation locations. -For example, set an CMake cache pre-population script with the following content: -\begin{verbatim} -# monteverdi-configuration.cmake -set(CMAKE_INSTALL_PREFIX "~/monteverdi/install" CACHE STRING "" FORCE) -set(OTB_DIR "~/OTB/install/lib/cmake/OTB-5.0" CACHE STRING "" FORCE) -set(QWT_INCLUDE_DIR "/usr/include/qwt5-qt4" CACHE STRING "" FORCE) -set(QWT_LIBRARY "/usr/lib64/libqwt.so.5" CACHE STRING "" FORCE) -\end{verbatim} - -Configure and compile monteverdi: -\begin{verbatim} -$ cd ~/monteverdi/build -$ cmake -C monteverdi-configuration.cmake ../monteverdi2 -$ make -$ make install -\end{verbatim} - -Remember to set the \texttt{OTB\_APPLICATION\_PATH} environment variable to -allow monteverdi to find the OTB applications: -\begin{verbatim} -export OTB_APPLICATION_PATH=~/OTB/build/lib/otb/applications -./bin/monteverdi -\end{verbatim} - -\section{Windows} - -Everything that is needed for Monteverdi development on Windows, including compiling from source, is covered in details on the OTB wiki at: -\begin{center} -\url{http://wiki.orfeo-toolbox.org/index.php/OTB_development_on_Windows} -\end{center} diff --git a/Documentation/SoftwareGuide/Latex/Installation.tex b/Documentation/SoftwareGuide/Latex/Installation.tex index ea869b753148edff4d213bf066a1de0b26a24271..e6ab1534d296b6158b0a4627fc4edecfd363992f 100644 --- a/Documentation/SoftwareGuide/Latex/Installation.tex +++ b/Documentation/SoftwareGuide/Latex/Installation.tex @@ -163,7 +163,7 @@ To setup this structure, the following commands can be used: \begin{verbatim} $ mkdir ~/OTB $ cd ~/OTB -$ git clone https://git@git.orfeo-toolbox.org/git/otb.git +$ git clone https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb.git $ mkdir build $ mkdir install \end{verbatim} diff --git a/Documentation/SoftwareGuide/Latex/Introduction.tex b/Documentation/SoftwareGuide/Latex/Introduction.tex index bca731112bbd207b7b598532ed8eb2816cf2ab52..f3ae6653bade821339a938887b6313916cd4125c 100644 --- a/Documentation/SoftwareGuide/Latex/Introduction.tex +++ b/Documentation/SoftwareGuide/Latex/Introduction.tex @@ -100,14 +100,14 @@ process described in Section \ref{chapter:Installation}. There are two other ways of getting the OTB source code: \begin{itemize} \item Clone the current release with \href{https://git-scm.com/}{Git} from the - \href{https://git.orfeo-toolbox.org/otb.git}{OTB git server}, (master branch) + \href{https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb.git}{OTB git server}, (master branch) \item Clone the latest revision with \href{https://git-scm.com/}{Git} from the - \href{https://git.orfeo-toolbox.org/otb.git}{OTB git server} (develop branch). + \href{https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb.git}{OTB git server} (develop branch). \end{itemize} These last two options need a proper \href{https://git-scm.com/}{Git} installation. To get source code from Git, do: \begin{verbatim} -git clone https://git@git.orfeo-toolbox.org/git/otb.git +git clone https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb.git \end{verbatim} Using Git, you can easily navigate through the different versions. The master diff --git a/Documentation/SoftwareGuide/Latex/SoftwareGuide.tex b/Documentation/SoftwareGuide/Latex/SoftwareGuide.tex index c5bd1dff8218ca02c31995c44a83913874e97c27..8cf39aa7a0f2cfff48375656602a0a2404cf053c 100644 --- a/Documentation/SoftwareGuide/Latex/SoftwareGuide.tex +++ b/Documentation/SoftwareGuide/Latex/SoftwareGuide.tex @@ -217,12 +217,8 @@ colorlinks,linkcolor={blue},citecolor={blue},urlcolor={blue}, \input{Introduction.tex} \input{Installation.tex} -%Monteverdi is integrated in OTB as a module since release 5.8 so there is no -%need to maintain a specific section regarding monteverdi compilation. -%\input{CompilingMonteverdi.tex} \input{SystemOverview.tex} - \part{Tutorials}\label{part:tutorials} \input{Tutorial.tex} diff --git a/Documentation/SoftwareGuide/Latex/Tutorial.tex b/Documentation/SoftwareGuide/Latex/Tutorial.tex index be8cd232fc53ecfb8dfe51e5fbae91cb0424fca6..4a09dc660223796abaa0b3f92bb28d4e81660960 100644 --- a/Documentation/SoftwareGuide/Latex/Tutorial.tex +++ b/Documentation/SoftwareGuide/Latex/Tutorial.tex @@ -224,7 +224,7 @@ Once this file is written you just have to run \code{make}. The Get one image from the \code{OTB-Data/Examples} directory from the OTB-Data repository. You can get it either by cloning the OTB data repository -(\code{git clone https://git.orfeo-toolbox.org/otb-data.git}), but that might be quite +(\code{git clone https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb-data.git}), but that might be quite long as this also gets the data to run the tests. Alternatively, you can get it from \url{http://www.orfeo-toolbox.org/packages/OTB-Data-Examples.tgz}. Take for example get \code{QB\_Suburb.png}. diff --git a/Modules/Adapters/CurlAdapters/include/otbCurlHelper.h b/Modules/Adapters/CurlAdapters/include/otbCurlHelper.h index 1ee320daeb0e3d5c4b6cf95bfbedd7255bd89a02..fa00e3615bfaf4d6c6fe824813e5c483d905a7fc 100644 --- a/Modules/Adapters/CurlAdapters/include/otbCurlHelper.h +++ b/Modules/Adapters/CurlAdapters/include/otbCurlHelper.h @@ -48,19 +48,19 @@ public: itkTypeMacro(CurlHelper, CurlHelperInterface); itkNewMacro(Self); - bool TestUrlAvailability(const std::string& url) const ITK_OVERRIDE; + bool TestUrlAvailability(const std::string& url) const override; bool IsCurlReturnHttpError(const std::string& url) const; - int RetrieveFile(const std::ostringstream& urlStream, std::string filename) const ITK_OVERRIDE; + int RetrieveFile(const std::ostringstream& urlStream, std::string filename) const override; - int RetrieveFile(const std::string& urlString, std::string filename) const ITK_OVERRIDE; + int RetrieveFile(const std::string& urlString, std::string filename) const override; - int RetrieveUrlInMemory(const std::string& urlString, std::string& output) const ITK_OVERRIDE; + int RetrieveUrlInMemory(const std::string& urlString, std::string& output) const override; int RetrieveFileMulti(const std::vector<std::string>& listURLs, const std::vector<std::string>& listFiles, - int maxConnect) const ITK_OVERRIDE; + int maxConnect) const override; itkGetMacro(Timeout,long int); @@ -71,7 +71,7 @@ protected: m_Browser("Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.8.1.11) " "Gecko/20071127 Firefox/2.0.0.11"), m_Timeout(10) {} - ~CurlHelper() ITK_OVERRIDE {} + ~CurlHelper() override {} private: CurlHelper(const Self &); //purposely not implemented diff --git a/Modules/Adapters/CurlAdapters/include/otbCurlHelperInterface.h b/Modules/Adapters/CurlAdapters/include/otbCurlHelperInterface.h index 8fed05b3d2c27c82dea4ec3e0c33da89676d6c14..a5cb6a56a02f7f18af6d2811b652b64c7d6dc470 100644 --- a/Modules/Adapters/CurlAdapters/include/otbCurlHelperInterface.h +++ b/Modules/Adapters/CurlAdapters/include/otbCurlHelperInterface.h @@ -66,7 +66,7 @@ public: protected: CurlHelperInterface() {} - ~CurlHelperInterface() ITK_OVERRIDE {} + ~CurlHelperInterface() override {} private: CurlHelperInterface(const Self &); //purposely not implemented diff --git a/Modules/Adapters/CurlAdapters/include/otbCurlHelperStub.h b/Modules/Adapters/CurlAdapters/include/otbCurlHelperStub.h index 58d56edaad576ea44ca7fa7ef8a13c243ac14ece..5393b36ff511a9220441495c3bab318b50408c09 100644 --- a/Modules/Adapters/CurlAdapters/include/otbCurlHelperStub.h +++ b/Modules/Adapters/CurlAdapters/include/otbCurlHelperStub.h @@ -47,20 +47,20 @@ public: itkNewMacro(Self); - bool TestUrlAvailability(const std::string& url) const ITK_OVERRIDE; + bool TestUrlAvailability(const std::string& url) const override; - int RetrieveUrlInMemory(const std::string& urlString, std::string& output) const ITK_OVERRIDE; + int RetrieveUrlInMemory(const std::string& urlString, std::string& output) const override; - int RetrieveFile(const std::ostringstream& urlStream, std::string filename) const ITK_OVERRIDE; + int RetrieveFile(const std::ostringstream& urlStream, std::string filename) const override; - int RetrieveFile(const std::string& urlString, std::string filename) const ITK_OVERRIDE; + int RetrieveFile(const std::string& urlString, std::string filename) const override; int RetrieveFileMulti(const std::vector<std::string>& listURLs, const std::vector<std::string>& listFiles, - int maxConnect) const ITK_OVERRIDE; + int maxConnect) const override; protected: CurlHelperStub() {} - ~CurlHelperStub() ITK_OVERRIDE {} + ~CurlHelperStub() override {} private: CurlHelperStub(const Self &); //purposely not implemented diff --git a/Modules/Adapters/CurlAdapters/src/otbCurlHelper.cxx b/Modules/Adapters/CurlAdapters/src/otbCurlHelper.cxx index a9021f5efd7e37c886862e73eeca0ed1275f9649..39bd3f07067a6ab118d90f9e51258a8de0d644f5 100644 --- a/Modules/Adapters/CurlAdapters/src/otbCurlHelper.cxx +++ b/Modules/Adapters/CurlAdapters/src/otbCurlHelper.cxx @@ -94,7 +94,7 @@ protected: } } - ~CurlResource() ITK_OVERRIDE + ~CurlResource() override { curl_easy_cleanup(m_Curl); } @@ -140,7 +140,7 @@ protected: } } - ~CurlMultiResource() ITK_OVERRIDE + ~CurlMultiResource() override { curl_multi_cleanup(m_Curl); } @@ -187,7 +187,7 @@ public: protected: CurlFileDescriptorResource(){} - ~CurlFileDescriptorResource() ITK_OVERRIDE + ~CurlFileDescriptorResource() override { fclose(m_File); } diff --git a/Modules/Adapters/GdalAdapters/include/otbGeometriesSet.h b/Modules/Adapters/GdalAdapters/include/otbGeometriesSet.h index 14e9f815ca1d4afe0d43bf4c2a4c9596a9cff47e..9306c6575b8389d3adcd540950a378f7600a5a93 100644 --- a/Modules/Adapters/GdalAdapters/include/otbGeometriesSet.h +++ b/Modules/Adapters/GdalAdapters/include/otbGeometriesSet.h @@ -159,10 +159,10 @@ protected: GeometriesSet(ogr::Layer layer); /** Destructor. */ - ~GeometriesSet() ITK_OVERRIDE; + ~GeometriesSet() override; /** Prints self to stream. */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: typedef boost::variant<ogr::DataSource::Pointer, ogr::Layer> AnyGeometriesSetType; AnyGeometriesSetType m_GeometriesSet; diff --git a/Modules/Adapters/GdalAdapters/include/otbGeometriesSource.h b/Modules/Adapters/GdalAdapters/include/otbGeometriesSource.h index 7361aa0c23d8d1a121baf54420246d6b24c92ef1..5b8c8626710c003927905880a1d272a47668db6c 100644 --- a/Modules/Adapters/GdalAdapters/include/otbGeometriesSource.h +++ b/Modules/Adapters/GdalAdapters/include/otbGeometriesSource.h @@ -119,7 +119,7 @@ public: * initializing them. * \post <tt>GetOutput() != NULL</tt> */ - void PrepareOutputs() ITK_OVERRIDE; + void PrepareOutputs() override; protected: /** Default constructor. @@ -129,7 +129,7 @@ protected: /** Destructor. * Does nothing. */ - ~GeometriesSource() ITK_OVERRIDE; + ~GeometriesSource() override; /** Ensures that the output geometries are allocated before processing. * If the output hasn't been set, at this point, the default output geometries diff --git a/Modules/Adapters/GdalAdapters/include/otbGeometriesToGeometriesFilter.h b/Modules/Adapters/GdalAdapters/include/otbGeometriesToGeometriesFilter.h index 5f3ce2267578b13a85a1750cab18046cf680f9c7..26089652fb5ea7920c3db3dd751b14d81d9b5114 100644 --- a/Modules/Adapters/GdalAdapters/include/otbGeometriesToGeometriesFilter.h +++ b/Modules/Adapters/GdalAdapters/include/otbGeometriesToGeometriesFilter.h @@ -91,13 +91,13 @@ protected: /** Destructor. * Does nothing. */ - ~GeometriesToGeometriesFilter() ITK_OVERRIDE; + ~GeometriesToGeometriesFilter() override; /** Processes the input to fill the output. * This is the main processing function. It either works \em in-place or by * \em copying the transformed input \c Feature s into the output. */ - void GenerateData(void) ITK_OVERRIDE; + void GenerateData(void) override; private: /** \e In-place processing function. @@ -364,7 +364,7 @@ protected: /** Default constructor. */ DefaultGeometriesToGeometriesFilter(); /** Destructor. */ - ~DefaultGeometriesToGeometriesFilter() ITK_OVERRIDE; + ~DefaultGeometriesToGeometriesFilter() override; /** * Hook that actually filters an OGR \c Layer. @@ -376,7 +376,7 @@ protected: * \note When <tt>source == destination</tt>, it means this is an \em in-place * filter. */ - void DoProcessLayer(ogr::Layer const& source, ogr::Layer & destination) const ITK_OVERRIDE; + void DoProcessLayer(ogr::Layer const& source, ogr::Layer & destination) const override; /** * Hook used to define the fields of the new layer. * \param[in] source source \c Layer -- for reference @@ -385,7 +385,7 @@ protected: * Just forwards the fields definition to the \c FieldTransformationPolicy * inherited from the \c TransformationFunctorDispatcherType. */ - void DoDefineNewLayerFields(ogr::Layer const& source, ogr::Layer & dest) const ITK_OVERRIDE + void DoDefineNewLayerFields(ogr::Layer const& source, ogr::Layer & dest) const override { this->DefineFields(source, dest); } diff --git a/Modules/Adapters/GdalAdapters/include/otbOGRDataSourceWrapper.h b/Modules/Adapters/GdalAdapters/include/otbOGRDataSourceWrapper.h index bf6d799fd52d88e66a4164d1c50d02aae58e84a7..b06a173fd978e0d7237157fed617e3c90d9ad6f8 100644 --- a/Modules/Adapters/GdalAdapters/include/otbOGRDataSourceWrapper.h +++ b/Modules/Adapters/GdalAdapters/include/otbOGRDataSourceWrapper.h @@ -46,6 +46,7 @@ #include "otbOGRLayerWrapper.h" #include "otbOGRVersionProxy.h" +#include "otbOGRExtendedFilenameToOptions.h" class OGRLayer; class OGRSpatialReference; @@ -88,6 +89,7 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; //@} + typedef OGRExtendedFilenameToOptions FileNameHelperType; /**\name Standard macros */ //@{ /** Default builder. @@ -162,7 +164,7 @@ public: * \note No condition is assumed on the non-nullity of \c source. * \see \c DataSource(GDALDataset *) */ - static Pointer New(ogr::version_proxy::GDALDatasetType * sourcemode, Modes::type mode = Modes::Read); + static Pointer New(ogr::version_proxy::GDALDatasetType * sourcemode, Modes::type mode = Modes::Read , const std::vector< std::string > & layerOptions = std::vector< std::string >() ); //@} /**\name Projection Reference property */ @@ -291,7 +293,7 @@ public: * meta information of another data source and use the same underlying \c * GDALDataset. */ - void Graft(const itk::DataObject *data) ITK_OVERRIDE; + void Graft(const itk::DataObject *data) override; /** * Resets current data source with the one in parameter. @@ -368,7 +370,7 @@ public: Layer CopyLayer( Layer & srcLayer, std::string const& newName, - char ** papszOptions = ITK_NULLPTR); + std::vector<std::string> const& papszOptions = std::vector<std::string>() ); //@} /**\name Layers access @@ -497,6 +499,10 @@ public: */ ogr::version_proxy::GDALDatasetType & ogr(); + void SetLayerCreationOptions( const std::vector< std::string > & options ); + void AddLayerCreationOptions( std::vector< std::string > options ); + const std::vector< std::string > & GetLayerCreationOptions() const ; + protected: /** Default constructor. * The actual \c GDALDataset is using the <em>in-memory</em> \c @@ -511,16 +517,16 @@ protected: /** Init constructor. * \post The newly constructed object owns the \c source parameter. */ - DataSource(ogr::version_proxy::GDALDatasetType * source, Modes::type mode); + DataSource(ogr::version_proxy::GDALDatasetType * source, Modes::type mode , const std::vector< std::string > & layerOption = std::vector< std::string >() ); /** Destructor. * \post The \c GDALDataset owned is released (if not null). */ - ~DataSource() ITK_OVERRIDE; + ~DataSource() override; static Pointer OpenDataSource(std::string const& datasourceName, Modes::type mode); /** Prints self into stream. */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: /** @@ -549,6 +555,7 @@ private: private: ogr::version_proxy::GDALDatasetType *m_DataSource; + std::vector< std::string > m_LayerOptions; Modes::type m_OpenMode; int m_FirstModifiableLayerID; }; // end class DataSource diff --git a/Modules/Adapters/GdalAdapters/include/otbOGRExtendedFilenameToOptions.h b/Modules/Adapters/GdalAdapters/include/otbOGRExtendedFilenameToOptions.h new file mode 100644 index 0000000000000000000000000000000000000000..6ae631531fd5d2de3f6198851deace861b11b1ec --- /dev/null +++ b/Modules/Adapters/GdalAdapters/include/otbOGRExtendedFilenameToOptions.h @@ -0,0 +1,116 @@ +/* + * 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 otbOGRExtendedFilenameToOptions_h +#define otbOGRExtendedFilenameToOptions_h + +#include <unordered_map> +#include "otbExtendedFilenameHelper.h" + +namespace otb +{ + +/** \class OGRExtendedFilenameToOptions + * \brief This class aim at processing GDAL option that can be pass through + * extended filename. + * \ingroup OTBExtendedFilename + * \ingroup OTBGdalAdapters + * + */ +#include "OTBGdalAdaptersExport.h" + +class OTBGdalAdapters_EXPORT OGRExtendedFilenameToOptions : public ExtendedFilenameHelper +{ +public: + /** Standard class typedefs. */ + typedef OGRExtendedFilenameToOptions Self; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + typedef ExtendedFilenameHelper Superclass; + + typedef Superclass::OptionMapType OptionMapType; + typedef OptionMapType::const_iterator ConstMapIteratorType; + typedef std::vector<std::string> GDALOptionType; + + itkTypeMacro(OGRExtendedFilenameToOptions, otb::ExtendedFilenameHelper); + itkNewMacro(Self); + + + /** The creation option structure. */ + struct OpenOptionType + { + GDALOptionType gdalOptions; + // std::unordered_map< std::string , bool > availableOptions; + }; + + struct CreationOptionType + { + GDALOptionType gdalOptions; + // std::unordered_map< std::string , bool > availableOptions; + }; + + struct LayerOptionType + { + std::unordered_map< std::string , std::string > gdalOptions; + }; + + /** Set extended filename */ + void SetExtendedFileName(const char * extFname) override; + + /** Get the GDAL option for type operation */ + GDALOptionType GetGDALOptions( const std::string & type ) const ; + + /** Get the deffierent GDAL options*/ + GDALOptionType GetGDALOpenOptions() const ; + GDALOptionType GetGDALCreationOptions() const ; + GDALOptionType GetGDALLayerOptions() const ; + + bool SimpleFileNameIsSet() const; + bool HasGDALLayerOption() const; + + /** Set GDAL layer option through a vector of string */ + void SetGDALLayerOptions( const GDALOptionType & options ); + + /** Add GDAL layer option to existing one */ + void AddGDALLayerOptions( const GDALOptionType & options ); + + /** Constructor that return a pointer to an OGRExtendedFilename with + * GDAL layer option as options + */ + static Pointer GetGDALLayerOptionsHelper( const GDALOptionType & options ); + +protected: + OGRExtendedFilenameToOptions(); + OGRExtendedFilenameToOptions( const GDALOptionType & options ); + ~OGRExtendedFilenameToOptions() override {}; + +private: + OGRExtendedFilenameToOptions(const Self &) = delete ; + void operator =(const Self&) = delete ; + + OpenOptionType m_OpenOptions; + CreationOptionType m_CreationOptions; + LayerOptionType m_LayerOptions; + bool m_HasFileName; +}; + +} //end namespace otb + +#endif // otbOGRExtendedFilenameToOptions_h diff --git a/Modules/Adapters/GdalAdapters/include/otbOGRFieldWrapper.txx b/Modules/Adapters/GdalAdapters/include/otbOGRFieldWrapper.txx index d83540cac509ce7c6550e641487b4a4612f05e60..d3468a20ecf8961f74821b90f0e7f889763db891 100644 --- a/Modules/Adapters/GdalAdapters/include/otbOGRFieldWrapper.txx +++ b/Modules/Adapters/GdalAdapters/include/otbOGRFieldWrapper.txx @@ -132,7 +132,7 @@ template * <tt> = T</tt>) * * \internal - * This ITK_OVERRIDE is required because of the particular nature of the + * This override is required because of the particular nature of the * <tt>char**</tt> type chosen by OGR API, plus the fact this is the only * const-correct getter... * \since OTB v 3.14.0 @@ -262,7 +262,7 @@ template * <tt> = T</tt>) * * \internal - * This ITK_OVERRIDE is required because of the particular nature of the + * This override is required because of the particular nature of the * <tt>char**</tt> type chosen by OGR API. * \since OTB v 3.14.0 */ diff --git a/Modules/Adapters/GdalAdapters/include/otbOGRVersionProxy.h b/Modules/Adapters/GdalAdapters/include/otbOGRVersionProxy.h index 7fdc308413d2a912eba471b90fe74576e1ef5310..7cae3f6dba4cf94203bfcb7e3cd52f431a5309c9 100644 --- a/Modules/Adapters/GdalAdapters/include/otbOGRVersionProxy.h +++ b/Modules/Adapters/GdalAdapters/include/otbOGRVersionProxy.h @@ -97,7 +97,7 @@ OTBGdalAdapters_EXPORT bool IsOFTInteger64(OGRFieldType type); * \return NULL if file could not be open. */ OTBGdalAdapters_EXPORT - GDALDatasetType * Open(const char * filename, bool readOnly = true); + GDALDatasetType * Open(const char * filename, bool readOnly = true , std::vector< std::string > const & options = std::vector< std::string >() ); /** * This function closes a dataset. @@ -126,7 +126,7 @@ OTBGdalAdapters_EXPORT bool IsOFTInteger64(OGRFieldType type); * \return NULL if dataset could not be created. */ OTBGdalAdapters_EXPORT - GDALDatasetType * Create(GDALDriverType * driver, const char * name); + GDALDatasetType * Create(GDALDriverType * driver, const char * name , std::vector< std::string > const & options = std::vector< std::string >() ); /** diff --git a/Modules/Adapters/GdalAdapters/otb-module.cmake b/Modules/Adapters/GdalAdapters/otb-module.cmake index 637a63ed4226e96af21f3fb7b3a1136c6db100b0..c985c5fb0e477a9f35de9a629e506d865239ee5e 100644 --- a/Modules/Adapters/GdalAdapters/otb-module.cmake +++ b/Modules/Adapters/GdalAdapters/otb-module.cmake @@ -29,6 +29,9 @@ ENABLE_SHARED OTBGDAL OTBITK + TEST_DEPENDS + OTBTestKernel + DESCRIPTION "${DOCUMENTATION}" ) diff --git a/Modules/Adapters/GdalAdapters/src/CMakeLists.txt b/Modules/Adapters/GdalAdapters/src/CMakeLists.txt index 4ba50ff1e286f05842703510931bffec1d5f0f21..0f73c07a03e044b6c89d6a19b5df6fc6b9ae4851 100644 --- a/Modules/Adapters/GdalAdapters/src/CMakeLists.txt +++ b/Modules/Adapters/GdalAdapters/src/CMakeLists.txt @@ -29,6 +29,7 @@ set(OTBGdalAdapters_SRC otbGeometriesToGeometriesFilter.cxx otbOGRDataSourceWrapper.cxx otbOGRVersionProxy.cxx + otbOGRExtendedFilenameToOptions.cxx ) add_library(OTBGdalAdapters ${OTBGdalAdapters_SRC}) diff --git a/Modules/Adapters/GdalAdapters/src/otbOGRDataSourceWrapper.cxx b/Modules/Adapters/GdalAdapters/src/otbOGRDataSourceWrapper.cxx index ac43afbb4d837ce66ed40327bb4b8d1664626cc4..49ce77ba13f10f7e6060c785ccce2ced7b7fed17 100644 --- a/Modules/Adapters/GdalAdapters/src/otbOGRDataSourceWrapper.cxx +++ b/Modules/Adapters/GdalAdapters/src/otbOGRDataSourceWrapper.cxx @@ -41,6 +41,7 @@ /*===========================================================================*/ /*=======================[ construction/destruction ]========================*/ /*===========================================================================*/ + bool otb::ogr::DataSource::Clear() { Reset(ITK_NULLPTR); @@ -85,6 +86,8 @@ const ExtensionDriverAssociation k_ExtensionDriverMap[] = {".GPX", "GPX"}, {".SQLITE", "SQLite"}, {".KML", "KML"}, + {".CSV", "CSV"}, + {".GPKG", "GPKG"} }; /**\ingroup GeometryInternals * \brief Returns the OGR driver name associated to a filename. @@ -117,22 +120,29 @@ char const* DeduceDriverName(std::string filename) otb::ogr::DataSource::DataSource() : m_DataSource(ITK_NULLPTR), + m_LayerOptions() , m_OpenMode(Modes::Update_LayerUpdate), m_FirstModifiableLayerID(0) { Drivers::Init(); - ogr::version_proxy::GDALDriverType * d = ogr::version_proxy::GetDriverByName("Memory"); + ogr::version_proxy::GDALDriverType * d = + ogr::version_proxy::GetDriverByName("Memory"); assert(d && "OGR Memory driver not found"); m_DataSource = ogr::version_proxy::Create(d,"in-memory"); if (!m_DataSource) { - itkExceptionMacro(<< "Failed to create OGRMemDataSource: " << CPLGetLastErrorMsg()); + itkExceptionMacro(<< "Failed to create OGRMemDataSource: " + << CPLGetLastErrorMsg()); } } -otb::ogr::DataSource::DataSource(otb::ogr::version_proxy::GDALDatasetType * source, Modes::type mode) -: m_DataSource(source), - m_OpenMode(mode), +otb::ogr::DataSource::DataSource( + otb::ogr::version_proxy::GDALDatasetType * source , + Modes::type mode , + const std::vector< std::string > & options /*NULL*/ ) +: m_DataSource(source) , + m_LayerOptions(options) , + m_OpenMode(mode) , m_FirstModifiableLayerID(0) { m_FirstModifiableLayerID = GetLayersCount(); @@ -140,9 +150,15 @@ otb::ogr::DataSource::DataSource(otb::ogr::version_proxy::GDALDatasetType * sour otb::ogr::DataSource::Pointer otb::ogr::DataSource::OpenDataSource(std::string const& datasourceName, Modes::type mode) { - bool update = (mode != Modes::Read); + FileNameHelperType::Pointer fileNameHelper = FileNameHelperType::New(); + fileNameHelper->SetExtendedFileName( datasourceName.c_str() ); + std::string simpleFileName = fileNameHelper->GetSimpleFileName(); - ogr::version_proxy::GDALDatasetType * source = ogr::version_proxy::Open(datasourceName.c_str(),!update); + bool update = (mode != Modes::Read); + ogr::version_proxy::GDALDatasetType * source = + ogr::version_proxy::Open( simpleFileName.c_str() , + !update , + fileNameHelper->GetGDALOpenOptions() ); if (!source) { // In read mode, this is a failure @@ -150,39 +166,51 @@ otb::ogr::DataSource::Pointer otb::ogr::DataSource::OpenDataSource(std::string c if (mode == Modes::Read) { itkGenericExceptionMacro(<< "Failed to open GDALDataset file " - << datasourceName<<" : " << CPLGetLastErrorMsg()); + << simpleFileName<<" : " << CPLGetLastErrorMsg()); } // Hand made factory based on file extension. - char const* driverName = DeduceDriverName(datasourceName); + char const* driverName = DeduceDriverName(simpleFileName); if (!driverName) { - itkGenericExceptionMacro(<< "No OGR driver known to OTB to create and handle a DataSource named <" - <<datasourceName<<">."); + itkGenericExceptionMacro(<< "No OGR driver known to OTB to create and " + "handle a DataSource named <" + <<simpleFileName<<">."); } - ogr::version_proxy::GDALDriverType * d = ogr::version_proxy::GetDriverByName(driverName); + ogr::version_proxy::GDALDriverType * d = + ogr::version_proxy::GetDriverByName( driverName ); if(!d) { - itkGenericExceptionMacro(<<"Could not create OGR driver "<<driverName<<", check your OGR configuration for available drivers."); + itkGenericExceptionMacro(<< "Could not create OGR driver " << driverName + << ", check your OGR configuration for available drivers." ); } - source = ogr::version_proxy::Create(d,datasourceName.c_str()); + source = ogr::version_proxy::Create( + d , + simpleFileName.c_str() , + fileNameHelper->GetGDALCreationOptions() ); if (!source) { - itkGenericExceptionMacro(<< "Failed to create GDALDataset <"<<datasourceName - <<"> (driver name: <" << driverName<<">: " << CPLGetLastErrorMsg()); + itkGenericExceptionMacro(<< "Failed to create GDALDataset <" + << simpleFileName << "> (driver name: <" << driverName + <<">: " << CPLGetLastErrorMsg()); } } - return otb::ogr::DataSource::New(source, mode); + return otb::ogr::DataSource::New( source , mode , fileNameHelper->GetGDALLayerOptions() ); } void DeleteDataSource(std::string const& datasourceName) { - bool ret = otb::ogr::version_proxy::Delete(datasourceName.c_str()); + otb::OGRExtendedFilenameToOptions::Pointer fileNameHelper = + otb::OGRExtendedFilenameToOptions::New(); + fileNameHelper->SetExtendedFileName( datasourceName.c_str() ); + std::string simpleFileName = fileNameHelper->GetSimpleFileName(); + + bool ret = otb::ogr::version_proxy::Delete(simpleFileName.c_str()); if (!ret) { - itkGenericExceptionMacro(<< "Deletion of data source " << datasourceName + itkGenericExceptionMacro(<< "Deletion of data source " << simpleFileName << " failed: " << CPLGetLastErrorMsg()); } } @@ -190,14 +218,18 @@ void DeleteDataSource(std::string const& datasourceName) otb::ogr::DataSource::Pointer otb::ogr::DataSource::New(std::string const& datasourceName, Modes::type mode) { + FileNameHelperType::Pointer fileNameHelper = FileNameHelperType::New(); + fileNameHelper->SetExtendedFileName( datasourceName.c_str() ); + std::string simpleFileName = fileNameHelper->GetSimpleFileName(); + if (mode < Modes::Read || mode >= Modes::MAX__) { - itkGenericExceptionMacro(<< "Wrong mode when opening " << datasourceName); + itkGenericExceptionMacro(<< "Wrong mode when opening " << simpleFileName ); } Drivers::Init(); - - ogr::version_proxy::GDALDatasetType * ds = ogr::version_proxy::Open(datasourceName.c_str(),true); + ogr::version_proxy::GDALDatasetType * ds = + ogr::version_proxy::Open( simpleFileName.c_str() , true ); bool ds_exists = (ds!=ITK_NULLPTR); @@ -214,9 +246,9 @@ otb::ogr::DataSource::New(std::string const& datasourceName, Modes::type mode) /*static*/ otb::ogr::DataSource::Pointer -otb::ogr::DataSource::New(otb::ogr::version_proxy::GDALDatasetType * source, Modes::type mode) +otb::ogr::DataSource::New(otb::ogr::version_proxy::GDALDatasetType * source , Modes::type mode , const std::vector< std::string > & layerOptions ) { - Pointer res = new DataSource(source, mode); + Pointer res = new DataSource( source , mode , layerOptions ); res->UnRegister(); return res; } @@ -262,13 +294,20 @@ otb::ogr::Layer otb::ogr::DataSource::CreateLayer( if (m_OpenMode == Modes::Read) { otb::ogr::Layer l = GetLayerChecked(name); // will throw if not existing - itkGenericOutputMacro(<< "Requesting layer creation in read-only GDALDataset. Returning the existing layer"); + itkGenericOutputMacro(<< "Requesting layer creation in read-only " + "GDALDataset. Returning the existing layer"); return l; } // Other mode : Check if the layer already exists. otb::ogr::Layer layer = GetLayer(name); // won't throw on failure + FileNameHelperType::Pointer layerOptionHelper = + FileNameHelperType::GetGDALLayerOptionsHelper( m_LayerOptions ); + layerOptionHelper->AddGDALLayerOptions( papszOptions ); + std::vector<std::string> layerOptions = + layerOptionHelper->GetGDALLayerOptions(); + switch (m_OpenMode) { case Modes::Update_LayerOverwrite: @@ -281,11 +320,15 @@ otb::ogr::Layer otb::ogr::DataSource::CreateLayer( // Then create it OGRLayer * ol = m_DataSource->CreateLayer( - name.c_str(), poSpatialRef, eGType, otb::ogr::StringListConverter(papszOptions).to_ogr()); + name.c_str() , + poSpatialRef , + eGType , + otb::ogr::StringListConverter( layerOptions ).to_ogr() ); + if (!ol) { itkGenericExceptionMacro(<< "Failed to create the layer <"<<name - << "> in the GDALDataset file <" << GetDatasetDescription() + << "> in the GDALDataset file <" << GetDatasetDescription() <<">: " << CPLGetLastErrorMsg()); } @@ -304,11 +347,15 @@ otb::ogr::Layer otb::ogr::DataSource::CreateLayer( { // Then create it OGRLayer * ol = m_DataSource->CreateLayer( - name.c_str(), poSpatialRef, eGType, otb::ogr::StringListConverter(papszOptions).to_ogr()); + name.c_str() , + poSpatialRef , + eGType , + otb::ogr::StringListConverter( layerOptions ).to_ogr() ); + if (!ol) { itkGenericExceptionMacro(<< "Failed to create the layer <"<<name - << "> in the GDALDataset file <" << GetDatasetDescription() + << "> in the GDALDataset file <" << GetDatasetDescription() <<">: " << CPLGetLastErrorMsg()); } @@ -328,11 +375,15 @@ otb::ogr::Layer otb::ogr::DataSource::CreateLayer( // Case where the layer does not exists OGRLayer * ol = m_DataSource->CreateLayer( - name.c_str(), poSpatialRef, eGType, otb::ogr::StringListConverter(papszOptions).to_ogr()); + name.c_str() , + poSpatialRef , + eGType , + otb::ogr::StringListConverter( layerOptions ).to_ogr() ); + if (!ol) { itkGenericExceptionMacro(<< "Failed to create the layer <"<<name - << "> in the GDALDataset file <" << GetDatasetDescription() + << "> in the GDALDataset file <" << GetDatasetDescription() <<">: " << CPLGetLastErrorMsg()); } @@ -353,7 +404,7 @@ otb::ogr::Layer otb::ogr::DataSource::CreateLayer( otb::ogr::Layer otb::ogr::DataSource::CopyLayer( Layer & srcLayer, std::string const& newName, - char ** papszOptions/* = NULL */) + std::vector<std::string> const& papszOptions/* = NULL */) { assert(m_DataSource && "Datasource not initialized"); @@ -364,23 +415,33 @@ otb::ogr::Layer otb::ogr::DataSource::CopyLayer( itkGenericExceptionMacro(<< "Invalid GDALDataset opening mode"); break; case Modes::Read: - itkGenericExceptionMacro(<< "GDALDataset is opened in Read mode : cannot create a layer"); + itkGenericExceptionMacro(<< "GDALDataset is opened in Read mode : " + "cannot create a layer"); break; default: break; } + + FileNameHelperType::Pointer layerOptionHelper = + FileNameHelperType::GetGDALLayerOptionsHelper( m_LayerOptions ); + layerOptionHelper->AddGDALLayerOptions( papszOptions ); + std::vector<std::string> layerOptions = + layerOptionHelper->GetGDALLayerOptions(); OGRLayer * l0 = &srcLayer.ogr(); - OGRLayer * ol = m_DataSource->CopyLayer(l0, newName.c_str(), papszOptions); + OGRLayer * ol = m_DataSource->CopyLayer( + l0 , + newName.c_str() , + otb::ogr::StringListConverter( layerOptions ).to_ogr() ); if (!ol) { itkGenericExceptionMacro(<< "Failed to copy the layer <" - << srcLayer.GetName() << "> into the new layer <" <<newName - << "> in the GDALDataset file <" << GetDatasetDescription() + << srcLayer.GetName() << "> into the new layer <" << newName + << "> in the GDALDataset file <" << GetDatasetDescription() <<">: " << CPLGetLastErrorMsg()); } const bool modifiable = true; - Layer l(ol, modifiable); + Layer l( ol , modifiable ); return l; } @@ -395,10 +456,12 @@ void otb::ogr::DataSource::DeleteLayer(size_t i) itkGenericExceptionMacro(<< "Invalid GDALDataset opening mode"); break; case Modes::Read: - itkGenericExceptionMacro(<< "GDALDataset is opened in Read mode : cannot delete a layer"); + itkGenericExceptionMacro(<< "GDALDataset is opened in Read mode : " + "cannot delete a layer"); break; case Modes::Update_LayerCreateOnly: - itkGenericExceptionMacro(<< "GDALDataset is opened in Update_LayerCreateOnly mode : cannot delete a layer"); + itkGenericExceptionMacro(<< "GDALDataset is opened in " + "Update_LayerCreateOnly mode : cannot delete a layer"); break; default: break; @@ -407,14 +470,16 @@ void otb::ogr::DataSource::DeleteLayer(size_t i) const int nb_layers = GetLayersCount(); if (int(i) >= nb_layers) { - itkExceptionMacro(<< "Cannot delete " << i << "th layer in the GDALDataset <" - << GetDatasetDescription() << "> as it contains only " << nb_layers << "layers."); + itkExceptionMacro(<< "Cannot delete " << i + << "th layer in the GDALDataset <" << GetDatasetDescription() + << "> as it contains only " << nb_layers << "layers."); } const OGRErr err = m_DataSource->DeleteLayer(int(i)); if (err != OGRERR_NONE) { - itkExceptionMacro(<< "Cannot delete " << i << "th layer in the GDALDataset <" - << GetDatasetDescription() << ">: " << CPLGetLastErrorMsg()); + itkExceptionMacro(<< "Cannot delete " << i + << "th layer in the GDALDataset <" << GetDatasetDescription() + << ">: " << CPLGetLastErrorMsg()); } } @@ -471,7 +536,7 @@ size_t otb::ogr::DataSource::GetLayerID(std::string const& name) const if (id < 0) { itkExceptionMacro( << "Cannot fetch any layer named <" << name - << "> in the GDALDataset <" << GetDatasetDescription() << ">: " + << "> in the GDALDataset <" << GetDatasetDescription() << ">: " << CPLGetLastErrorMsg()); } return 0; // keep compiler happy @@ -484,13 +549,15 @@ otb::ogr::Layer otb::ogr::DataSource::GetLayerChecked(size_t i) if (int(i) >= nb_layers) { itkExceptionMacro(<< "Cannot fetch " << i << "th layer in the GDALDataset <" - << GetDatasetDescription() << "> as it contains only " << nb_layers << "layers."); + << GetDatasetDescription() << "> as it contains only " << nb_layers + << "layers."); } OGRLayer * layer_ptr = m_DataSource->GetLayer(int(i)); if (!layer_ptr) { - itkExceptionMacro( << "Unexpected error: cannot fetch " << i << "th layer in the GDALDataset <" - << GetDatasetDescription() << ">: " << CPLGetLastErrorMsg()); + itkExceptionMacro( << "Unexpected error: cannot fetch " << i + << "th layer in the GDALDataset <" << GetDatasetDescription() + << ">: " << CPLGetLastErrorMsg()); } return otb::ogr::Layer(layer_ptr, IsLayerModifiable(i)); } @@ -540,8 +607,9 @@ otb::ogr::Layer otb::ogr::DataSource::ExecuteSQL( if (!layer_ptr) { #if defined(PREFER_EXCEPTION) - itkExceptionMacro( << "Unexpected error: cannot execute the SQL request <" << statement - << "> in the GDALDataset <" << GetDatasetDescription() << ">: " << CPLGetLastErrorMsg()); + itkExceptionMacro( << "Unexpected error: cannot execute the SQL request <" + << statement << "> in the GDALDataset <" << GetDatasetDescription() + << ">: " << CPLGetLastErrorMsg()); #else // Cannot use the deleter made for result sets obtained from // GDALDataset::ExecuteSQL because it checks for non-nullity.... @@ -552,7 +620,33 @@ otb::ogr::Layer otb::ogr::DataSource::ExecuteSQL( return otb::ogr::Layer(layer_ptr, *m_DataSource, modifiable); } +void +otb::ogr::DataSource:: +SetLayerCreationOptions( const std::vector< std::string > & options ) +{ + FileNameHelperType::Pointer helper = FileNameHelperType::New(); + helper->SetGDALLayerOptions( options ); + m_LayerOptions = helper->GetGDALLayerOptions(); + // perf : do we move code from helper->SetGDALLayerOptions in here? +} +void +otb::ogr::DataSource:: +AddLayerCreationOptions( std::vector< std::string > options ) +{ + FileNameHelperType::Pointer helper = FileNameHelperType::New(); + helper->SetGDALLayerOptions( m_LayerOptions ); + helper->AddGDALLayerOptions( options ); + m_LayerOptions = helper->GetGDALLayerOptions(); + // perf : do we move code from helper->AddGDALLayerOptions in here? +} + +const std::vector< std::string > & +otb::ogr::DataSource:: +GetLayerCreationOptions() const +{ + return m_LayerOptions; +} /*===========================================================================*/ /*===============================[ features ]================================*/ /*===========================================================================*/ @@ -591,7 +685,8 @@ OGREnvelope otb::ogr::DataSource::GetGlobalExtent(bool force/* = false */, std:: if(lit==this->end()) { - itkGenericExceptionMacro(<< "Cannot compute global extent because there are no layers in the DataSource"); + itkGenericExceptionMacro(<< "Cannot compute global extent because there " + "are no layers in the DataSource"); } const OGRSpatialReference * ref_srs = lit->GetSpatialRef(); @@ -695,16 +790,18 @@ void otb::ogr::DataSource::SyncToDisk() if(!ret) { itkExceptionMacro( << "Cannot flush the pending of the OGRDataSource <" - << GetDatasetDescription() << ">: " << CPLGetLastErrorMsg()); + << GetDatasetDescription() << ">: " << CPLGetLastErrorMsg()); } } std::string otb::ogr::DataSource::GetDatasetDescription() const { - std::vector<std::string> files = otb::ogr::version_proxy::GetFileListAsStringVector(m_DataSource); + std::vector<std::string> files = + otb::ogr::version_proxy::GetFileListAsStringVector( m_DataSource ); std::string description = ""; - for(std::vector<std::string>::const_iterator it = files.begin();it!=files.end();++it) + for( std::vector<std::string>::const_iterator it = files.begin() ; + it!=files.end() ; ++it ) description+=(*it)+", "; return description; diff --git a/Modules/Adapters/GdalAdapters/src/otbOGRExtendedFilenameToOptions.cxx b/Modules/Adapters/GdalAdapters/src/otbOGRExtendedFilenameToOptions.cxx new file mode 100644 index 0000000000000000000000000000000000000000..a34e70947138645f0d660570c6abdefedb7aa141 --- /dev/null +++ b/Modules/Adapters/GdalAdapters/src/otbOGRExtendedFilenameToOptions.cxx @@ -0,0 +1,178 @@ +/* + * 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 "otbOGRExtendedFilenameToOptions.h" +#include "otb_boost_string_header.h" +#include "otb_boost_tokenizer_header.h" + +namespace otb +{ + +OGRExtendedFilenameToOptions:: +OGRExtendedFilenameToOptions(): +m_HasFileName(false) +{ +} + +OGRExtendedFilenameToOptions:: +OGRExtendedFilenameToOptions( const GDALOptionType & options ): +m_LayerOptions(), +m_HasFileName(false) +{ + this->SetGDALLayerOptions( options ); +} + +OGRExtendedFilenameToOptions::Pointer +OGRExtendedFilenameToOptions:: +GetGDALLayerOptionsHelper( const GDALOptionType & options ) +{ + Pointer res = new OGRExtendedFilenameToOptions( options ); + res->UnRegister(); + return res; +} + + +void +OGRExtendedFilenameToOptions:: +SetExtendedFileName(const char *extFname) +{ + Superclass::SetExtendedFileName(extFname); + m_HasFileName = true; + + const OptionMapType & map = GetOptionMap(); + + ConstMapIteratorType it; + for ( it=map.begin(); it != map.end(); it++ ) + { + std::vector<std::string> tmp; + boost::split(tmp, it->first, boost::is_any_of(":"), boost::token_compress_on); + + if (tmp.size()>2 && (tmp[0]=="gdal") ) + { + if ( tmp[1]=="oo" ) + { + m_OpenOptions.gdalOptions.push_back(tmp[2] + "=" +it->second); + } + else if ( tmp[1]=="co" ) + { + m_CreationOptions.gdalOptions.push_back(tmp[2] + "=" +it->second); + } + else if ( tmp[1]=="lco" ) + { + m_LayerOptions.gdalOptions[tmp[2]] = it->second; + } + else + { + // log a warning + } + } + + } +} + +OGRExtendedFilenameToOptions:: +GDALOptionType +OGRExtendedFilenameToOptions:: +GetGDALOptions( const std::string & type ) const +{ + if ( type == "layer" ) + return GetGDALLayerOptions(); + else if ( type == "creation" ) + return m_CreationOptions.gdalOptions; + else if ( type == "open" ) + return m_OpenOptions.gdalOptions; + else + { + // warn user : wrong option + return GDALOptionType(); + } +} + +void +OGRExtendedFilenameToOptions:: +SetGDALLayerOptions( const OGRExtendedFilenameToOptions::GDALOptionType & options ) +{ + std::vector<std::string> tmp; + for ( const auto & option : options ) + { + boost::split(tmp, option , boost::is_any_of(":"), boost::token_compress_on); + if ( tmp.size()<2 ) + boost::split(tmp, option , boost::is_any_of("="), boost::token_compress_on); + m_LayerOptions.gdalOptions[ tmp[0] ] = tmp[1] ; + } +} + +void +OGRExtendedFilenameToOptions:: +AddGDALLayerOptions( const OGRExtendedFilenameToOptions::GDALOptionType & options ) +{ + for ( const auto & option : options ) + { + std::vector<std::string> tmp; + boost::split(tmp, option , boost::is_any_of(":"), boost::token_compress_on); + if ( tmp.size()<2 ) + boost::split(tmp, option , boost::is_any_of("="), boost::token_compress_on); + m_LayerOptions.gdalOptions[ tmp[0] ] = tmp[1] ; + } +} + +bool +OGRExtendedFilenameToOptions:: +SimpleFileNameIsSet() const +{ + return m_HasFileName; +} + +bool +OGRExtendedFilenameToOptions:: +HasGDALLayerOption() const +{ + return ! m_LayerOptions.gdalOptions.empty() ; +} + +OGRExtendedFilenameToOptions:: +GDALOptionType +OGRExtendedFilenameToOptions:: +GetGDALLayerOptions() const +{ + GDALOptionType options; + for (const auto & option : m_LayerOptions.gdalOptions ) + { + options.push_back( option.first + "=" + option.second ); + } + return options; +} + +#define GetGDALOptionMacro( Type ) \ +OGRExtendedFilenameToOptions:: \ +GDALOptionType \ +OGRExtendedFilenameToOptions:: \ +GetGDAL##Type##Options() const \ +{ \ + return m_##Type##Options.gdalOptions; \ +} \ + +GetGDALOptionMacro( Open ) +GetGDALOptionMacro( Creation ) +// GetGDALOptionMacro( Layer ) + + + +} //end namespace otb diff --git a/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy.cxx b/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy.cxx index 22b7a612ca3f7f557eeed7abe2da3c2e1d047fe9..b616fe752698e68c3731b5ef6bf822802468a33c 100644 --- a/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy.cxx +++ b/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy.cxx @@ -19,6 +19,7 @@ */ #include "otbOGRVersionProxy.h" +#include "otbOGRHelpers.h" #include "itkMacro.h" @@ -60,12 +61,18 @@ OTBGdalAdapters_EXPORT bool IsOFTInteger64(OGRFieldType type) } -GDALDatasetType * Open(const char * filename, bool readOnly) +GDALDatasetType * Open(const char * filename, bool readOnly , std::vector< std::string > const & options ) { #if GDAL_VERSION_NUM<2000000 + (void)options; return OGRSFDriverRegistrar::Open(filename,!readOnly); #else - return (GDALDatasetType *)GDALOpenEx(filename, (readOnly? GDAL_OF_READONLY : GDAL_OF_UPDATE) | GDAL_OF_VECTOR,NULL,NULL,NULL); + return (GDALDatasetType *)GDALOpenEx( + filename, + (readOnly? GDAL_OF_READONLY : GDAL_OF_UPDATE) | GDAL_OF_VECTOR, + NULL, + otb::ogr::StringListConverter( options ).to_ogr(), + NULL); #endif } @@ -78,9 +85,10 @@ void Close(GDALDatasetType * dataset) #endif } -GDALDatasetType * Create(GDALDriverType * driver, const char * name) +GDALDatasetType * Create(GDALDriverType * driver, const char * name , std::vector< std::string > const & options ) { #if GDAL_VERSION_NUM<2000000 + (void)options; GDALDatasetType * ds = driver->CreateDataSource(name); if(ds) @@ -88,7 +96,12 @@ GDALDatasetType * Create(GDALDriverType * driver, const char * name) return ds; #else - return driver->Create(name,0,0,0,GDT_Unknown,NULL); + return driver->Create( name , + 0 , + 0 , + 0 , + GDT_Unknown , + otb::ogr::StringListConverter( options ).to_ogr() ); #endif } diff --git a/Modules/Adapters/GdalAdapters/test/CMakeLists.txt b/Modules/Adapters/GdalAdapters/test/CMakeLists.txt index 5a0de851487aa4484815aa06e6b244c57d23f480..bc03ae797ebe581884ef8b30c42e3f317c9db315 100644 --- a/Modules/Adapters/GdalAdapters/test/CMakeLists.txt +++ b/Modules/Adapters/GdalAdapters/test/CMakeLists.txt @@ -35,5 +35,49 @@ endif() add_executable(otbOGRTestsIO otbOGRDataSourceWrapperIO.cxx) target_link_libraries(otbOGRTestsIO ${OTBGdalAdapters-Test_LIBRARIES}) -add_test(NAME coTuOGRDataSourceWrapperIO +otb_add_test(NAME coTuOGRDataSourceWrapperIO COMMAND otbOGRTestsIO ${INPUTDATA}/ToulousePoints-examples.shp ) + +set(OTBOGRTests +otbOGRTestDriver.cxx +otbOGRExtendedFilenameToOptionsTest.cxx +otbOGRExtendedFilenameToOptionsGDALTest.cxx +) + +add_executable(otbOGRTestDriver ${OTBOGRTests}) +target_link_libraries(otbOGRTestDriver ${OTBGdalAdapters-Test_LIBRARIES}) +otb_module_target_label(otbOGRTestDriver) + +otb_add_test(NAME TvOGRExtendedFilename + COMMAND otbOGRTestDriver + --compare-ascii ${NOTOL} + ${BASELINE}/TvOGRExtendedFilename.txt + ${TEMP}/TvOGRExtendedFilenameTest.txt + otbOGRExtendedFileName + test.shp?&writegeom=ON&gdal:co:QUALITY=75&gdal:co:TILED=YES&gdal:co:BLOCKYSIZE=1024&gdal:lco:layeroption=OPTION&gdal:oo:openoption=OPTION + ${TEMP}/TvOGRExtendedFilenameTest.txt ) + +#Problem with error thrown by GDAL : unable to catch it with "CPLGetLastErrorMsg" +# otb_add_test(NAME TvOGRExtendedFilenameGDALOpen +# COMMAND otbOGRTestDriver +# otbOGRExtendedFileNameGDALOpen +# ${INPUTDATA}/ToulousePoints-examples.shp?&gdal:oo:openOption=OPTION +# ) + +otb_add_test(NAME TvOGRExtendedFilenameGDALCreate + COMMAND otbOGRTestDriver + otbOGRExtendedFileNameGDALCreate + test.shp?gdal:co:creationOption=OPTION + ) + +otb_add_test(NAME TvOGRExtendedFilenameGDALLayer + COMMAND otbOGRTestDriver + otbOGRExtendedFileNameGDALLayer + test.shp?&gdal:lco:layeroption=OPTION + ) + +otb_add_test(NAME TvOGRExtendedFilenameGDALLayerOption + COMMAND otbOGRTestDriver + otbOGRExtendedFileNameGDALLayerOption + test.shp + ) \ No newline at end of file diff --git a/Modules/Adapters/GdalAdapters/test/otbOGRExtendedFilenameToOptionsGDALTest.cxx b/Modules/Adapters/GdalAdapters/test/otbOGRExtendedFilenameToOptionsGDALTest.cxx new file mode 100644 index 0000000000000000000000000000000000000000..37368ea11836c6de38f616d14f368e51a611f702 --- /dev/null +++ b/Modules/Adapters/GdalAdapters/test/otbOGRExtendedFilenameToOptionsGDALTest.cxx @@ -0,0 +1,69 @@ +/* + * 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 "cpl_error.h" +#include "otbOGRExtendedFilenameToOptions.h" +#include "otbOGRDataSourceWrapper.h" +#include <iostream> +#include <fstream> + + +int otbOGRExtendedFileNameGDALOpen(int , char* argv[]) +{ + auto test = otb::ogr::DataSource::New( argv[1] ); + std::string error = CPLGetLastErrorMsg(); + return 0; +} + +int otbOGRExtendedFileNameGDALCreate(int , char* argv[]) +{ + auto test = otb::ogr::DataSource::New( argv[1] , otb::ogr::DataSource::Modes::Overwrite); + std::string error = CPLGetLastErrorMsg(); + if ( error.find( "does not support creation option creationOption" ) ) + return EXIT_SUCCESS; + return EXIT_FAILURE; +} + +int otbOGRExtendedFileNameGDALLayer(int , char* argv[]) +{ + auto test = otb::ogr::DataSource::New( argv[1] , otb::ogr::DataSource::Modes::Update_LayerOverwrite); + test->CreateLayer( "2layertest" , + ITK_NULLPTR , + wkbUnknown ); + std::string error = CPLGetLastErrorMsg(); + if ( error.find( "does not support layer creation option layeroption" ) ) + return EXIT_SUCCESS; + return EXIT_FAILURE; +} + +int otbOGRExtendedFileNameGDALLayerOption(int , char* argv[]) +{ + auto test = otb::ogr::DataSource::New( argv[1] , otb::ogr::DataSource::Modes::Update_LayerOverwrite); + std::vector<std::string> option { "vectorlayeroption=OPTION" }; + test->CreateLayer( "2layertest" , + ITK_NULLPTR , + wkbUnknown , + option ); + std::string error = CPLGetLastErrorMsg(); + if ( error.find( "does not support layer creation option vectorlayeroption" ) ) + return EXIT_SUCCESS; + return EXIT_FAILURE; +} + diff --git a/Modules/Adapters/GdalAdapters/test/otbOGRExtendedFilenameToOptionsTest.cxx b/Modules/Adapters/GdalAdapters/test/otbOGRExtendedFilenameToOptionsTest.cxx new file mode 100644 index 0000000000000000000000000000000000000000..63df6eeed09ed3c5b63ff8369dd95467bdaadb3c --- /dev/null +++ b/Modules/Adapters/GdalAdapters/test/otbOGRExtendedFilenameToOptionsTest.cxx @@ -0,0 +1,96 @@ +/* + * 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 "otbOGRExtendedFilenameToOptions.h" +#include <algorithm> +#include <iostream> +#include <fstream> + + +using namespace otb; + + +typedef OGRExtendedFilenameToOptions FilenameHelperType; + +int otbOGRExtendedFileName(int , char* argv[]) +{ + // Verify the number of parameters in the command line + const char * inputExtendedFilename = argv[1]; + const char * outputFilename = argv[2]; + + std::cout<< argv[1] <<" "<<argv[2]<<std::endl; + FilenameHelperType::Pointer helper = FilenameHelperType::New(); + + helper->SetExtendedFileName(inputExtendedFilename); + + std::ofstream file; + file.open(outputFilename); + + file << helper->SimpleFileNameIsSet() << std::endl; + file << helper->GetSimpleFileName() << std::endl; + + file << "Open option :"<<std::endl; + FilenameHelperType::GDALOptionType open = helper->GetGDALOpenOptions(); + for ( auto option : open ) + { + file<< option << std::endl; + } + + file << "Create option :"<<std::endl; + FilenameHelperType::GDALOptionType create = helper->GetGDALOptions("creation"); + for ( auto option : create ) + { + file<< option << std::endl; + } + + file << "Layer option :"<<std::endl; + FilenameHelperType::GDALOptionType layer = helper->GetGDALOptions("layer"); + for ( auto option : layer ) + { + file<< option << std::endl; + } + + file<< "End of classic helper."<<std::endl; + + layer.push_back("TOTO=first"); + FilenameHelperType::Pointer layerHelper = + FilenameHelperType::GetGDALLayerOptionsHelper ( layer ); + std::cout<< layerHelper->GetGDALLayerOptions()[0] <<std::endl; + FilenameHelperType::GDALOptionType newOptions; + // std::vector< std::string> newOptions; + newOptions.push_back("TOTO=second"); + newOptions.push_back("TiTi=option"); + layerHelper->AddGDALLayerOptions( newOptions ); + + file << layerHelper->SimpleFileNameIsSet() << std::endl; + file << layerHelper->HasGDALLayerOption() << std::endl; + file << "Layer option from layer helper:"<<std::endl; + FilenameHelperType::GDALOptionType latestOptions = layerHelper->GetGDALOptions("layer"); + // need to sort for dummy windows + std::sort( latestOptions.begin() , latestOptions.end() ); + for ( auto option : latestOptions ) + { + file<< option << std::endl; + } + + file.close(); + return EXIT_SUCCESS; +} + diff --git a/Modules/Adapters/GdalAdapters/test/otbOGRTestDriver.cxx b/Modules/Adapters/GdalAdapters/test/otbOGRTestDriver.cxx new file mode 100644 index 0000000000000000000000000000000000000000..dba04ea4d743cc89be61e25aa01978fd87882a5b --- /dev/null +++ b/Modules/Adapters/GdalAdapters/test/otbOGRTestDriver.cxx @@ -0,0 +1,30 @@ +/* + * 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(otbOGRExtendedFileName); + REGISTER_TEST(otbOGRExtendedFileNameGDALOpen); + REGISTER_TEST(otbOGRExtendedFileNameGDALCreate); + REGISTER_TEST(otbOGRExtendedFileNameGDALLayer); + REGISTER_TEST(otbOGRExtendedFileNameGDALLayerOption); +} diff --git a/Modules/Adapters/OSSIMAdapters/include/otbDEMConvertAdapter.h b/Modules/Adapters/OSSIMAdapters/include/otbDEMConvertAdapter.h index 3e12cbe3b50416a2e38df83d49dfc6d45ecf2e64..109f67dba72f39d3c56b35ebe552c585d83c4299 100644 --- a/Modules/Adapters/OSSIMAdapters/include/otbDEMConvertAdapter.h +++ b/Modules/Adapters/OSSIMAdapters/include/otbDEMConvertAdapter.h @@ -49,7 +49,7 @@ public: protected: DEMConvertAdapter(); - ~DEMConvertAdapter() ITK_OVERRIDE; + ~DEMConvertAdapter() override; private: DEMConvertAdapter(const Self &); //purposely not implemented diff --git a/Modules/Adapters/OSSIMAdapters/include/otbDEMHandler.h b/Modules/Adapters/OSSIMAdapters/include/otbDEMHandler.h index dc7a552e2a1efd3174474e5048f4522913a75a5b..498b0374d2775c910a01b6e76351a157990176d2 100644 --- a/Modules/Adapters/OSSIMAdapters/include/otbDEMHandler.h +++ b/Modules/Adapters/OSSIMAdapters/include/otbDEMHandler.h @@ -169,9 +169,9 @@ public: protected: DEMHandler(); - ~DEMHandler() ITK_OVERRIDE {} + ~DEMHandler() override {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; // Ossim does not allow retrieving the geoid file path // We therefore must keep it on our side diff --git a/Modules/Adapters/OSSIMAdapters/include/otbDateTimeAdapter.h b/Modules/Adapters/OSSIMAdapters/include/otbDateTimeAdapter.h index 0d4101c1f9dfd26f8421f61936d39ecba3fe02c5..5a0a3d4855efc5bd8e731e61f068a50aa43b5213 100644 --- a/Modules/Adapters/OSSIMAdapters/include/otbDateTimeAdapter.h +++ b/Modules/Adapters/OSSIMAdapters/include/otbDateTimeAdapter.h @@ -85,7 +85,7 @@ public: protected: DateTimeAdapter(); - ~DateTimeAdapter() ITK_OVERRIDE; + ~DateTimeAdapter() override; private: DateTimeAdapter(const Self &); //purposely not implemented diff --git a/Modules/Adapters/OSSIMAdapters/include/otbEllipsoidAdapter.h b/Modules/Adapters/OSSIMAdapters/include/otbEllipsoidAdapter.h index 539d8b0e8bad5759a2e182308b2443222ca6705e..d6a6de8e302ad8ea491f75bfc1a6f06f47e006b3 100644 --- a/Modules/Adapters/OSSIMAdapters/include/otbEllipsoidAdapter.h +++ b/Modules/Adapters/OSSIMAdapters/include/otbEllipsoidAdapter.h @@ -67,7 +67,7 @@ public: protected: EllipsoidAdapter(); - ~EllipsoidAdapter() ITK_OVERRIDE; + ~EllipsoidAdapter() override; private: EllipsoidAdapter(const Self &); //purposely not implemented diff --git a/Modules/Adapters/OSSIMAdapters/include/otbFilterFunctionValues.h b/Modules/Adapters/OSSIMAdapters/include/otbFilterFunctionValues.h index 065197b830079d8f175e5d32e98f41aceeaa8254..2e835d0cdee2d7e54177a2ec5ac69db8fb27ec4d 100644 --- a/Modules/Adapters/OSSIMAdapters/include/otbFilterFunctionValues.h +++ b/Modules/Adapters/OSSIMAdapters/include/otbFilterFunctionValues.h @@ -103,10 +103,10 @@ protected: /** Constructor */ FilterFunctionValues(); /** Destructor */ - ~FilterFunctionValues() ITK_OVERRIDE {} + ~FilterFunctionValues() override {} /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: FilterFunctionValues(const Self &); //purposely not implemented diff --git a/Modules/Adapters/OSSIMAdapters/include/otbGeometricSarSensorModelAdapter.h b/Modules/Adapters/OSSIMAdapters/include/otbGeometricSarSensorModelAdapter.h index 690deb7b910c8b93c157608846cd1c430d10b3a4..02173165dc376ecd0fe92ac7cf6548968c255845 100644 --- a/Modules/Adapters/OSSIMAdapters/include/otbGeometricSarSensorModelAdapter.h +++ b/Modules/Adapters/OSSIMAdapters/include/otbGeometricSarSensorModelAdapter.h @@ -78,7 +78,7 @@ public: protected: GeometricSarSensorModelAdapter(); - ~GeometricSarSensorModelAdapter() ITK_OVERRIDE; + ~GeometricSarSensorModelAdapter() override; private: GeometricSarSensorModelAdapter(const Self &); //purposely not implemented diff --git a/Modules/Adapters/OSSIMAdapters/include/otbMapProjectionAdapter.h b/Modules/Adapters/OSSIMAdapters/include/otbMapProjectionAdapter.h index 7ba5ffe592361e2203ba0fa015c67834b4a2e337..ed71e227f00bc8e1e9610b2503f2b24ee0f66142 100644 --- a/Modules/Adapters/OSSIMAdapters/include/otbMapProjectionAdapter.h +++ b/Modules/Adapters/OSSIMAdapters/include/otbMapProjectionAdapter.h @@ -89,7 +89,7 @@ public: protected: MapProjectionAdapter(); - ~MapProjectionAdapter() ITK_OVERRIDE; + ~MapProjectionAdapter() override; private: MapProjectionAdapter(const Self &); //purposely not implemented diff --git a/Modules/Adapters/OSSIMAdapters/include/otbPlatformPositionAdapter.h b/Modules/Adapters/OSSIMAdapters/include/otbPlatformPositionAdapter.h index 2f74ac90a866ec946b24f9b50b3c4013fd18a3a3..ea770482aa1729fe1c81c73b62a057ab91ff24e0 100644 --- a/Modules/Adapters/OSSIMAdapters/include/otbPlatformPositionAdapter.h +++ b/Modules/Adapters/OSSIMAdapters/include/otbPlatformPositionAdapter.h @@ -78,7 +78,7 @@ public: protected: PlatformPositionAdapter(); - ~PlatformPositionAdapter() ITK_OVERRIDE; + ~PlatformPositionAdapter() override; private: PlatformPositionAdapter(const Self &); //purposely not implemented diff --git a/Modules/Adapters/OSSIMAdapters/include/otbSarSensorModelAdapter.h b/Modules/Adapters/OSSIMAdapters/include/otbSarSensorModelAdapter.h index 692c1574fc7e12b390832546a43154411d6f5e7b..48e05c89417e9ebf7dda34db83ecd6ea16e72425 100644 --- a/Modules/Adapters/OSSIMAdapters/include/otbSarSensorModelAdapter.h +++ b/Modules/Adapters/OSSIMAdapters/include/otbSarSensorModelAdapter.h @@ -24,6 +24,7 @@ #include <memory> #include "otbDEMHandler.h" +#include "itkPoint.h" namespace ossimplugins { @@ -62,6 +63,9 @@ public: typedef std::auto_ptr<ossimplugins::ossimSarSensorModel> InternalModelPointer; + using Point2DType = itk::Point<double,2>; + using Point3DType = itk::Point<double,3>; + /** Method for creation through the object factory. */ itkNewMacro(Self); @@ -80,6 +84,21 @@ public: /** Deburst metadata if possible and return lines to keep in image file */ bool Deburst(std::vector<std::pair<unsigned long, unsigned long> > & lines); + /** Transform world point (lat,lon,hgt) to input image point + (col,row) and YZ frame */ + bool WorldToLineSampleYZ(const Point3DType & inGeoPoint, Point2DType & cr, Point2DType & yz) const; + + /** Transform world point (lat,lon,hgt) to input image point + (col,row) */ + bool WorldToLineSample(const Point3DType & inGEoPOint, Point2DType & cr) const; + +/** Transform world point (lat,lon,hgt) to satellite position (x,y,z) and satellite velocity */ + bool WorldToSatPositionAndVelocity(const Point3DType & inGeoPoint, Point3DType & satelitePosition, + Point3DType & sateliteVelocity) const; + + /** Transform world point (lat,lon,hgt) to cartesian point (x,y,z) */ + static bool WorldToCartesian(const Point3DType & inGeoPoint, Point3DType & outCartesianPoint); + static bool ImageLineToDeburstLine(const std::vector<std::pair<unsigned long,unsigned long> >& lines, unsigned long imageLine, unsigned long & deburstLine); static void DeburstLineToImageLine(const std::vector<std::pair<unsigned long,unsigned long> >& lines, unsigned long deburstLine, unsigned long & imageLine); @@ -87,7 +106,7 @@ public: protected: SarSensorModelAdapter(); - virtual ~SarSensorModelAdapter() ITK_OVERRIDE; + virtual ~SarSensorModelAdapter() override; private: SarSensorModelAdapter(const Self &); //purposely not implemented diff --git a/Modules/Adapters/OSSIMAdapters/include/otbSensorModelAdapter.h b/Modules/Adapters/OSSIMAdapters/include/otbSensorModelAdapter.h index d6099e9a73da9c7f0fe24fc6032554fa6d008979..fe55f03488e8875df4efacf8f902fba64f222294 100644 --- a/Modules/Adapters/OSSIMAdapters/include/otbSensorModelAdapter.h +++ b/Modules/Adapters/OSSIMAdapters/include/otbSensorModelAdapter.h @@ -111,7 +111,7 @@ public: protected: SensorModelAdapter(); - ~SensorModelAdapter() ITK_OVERRIDE; + ~SensorModelAdapter() override; private: SensorModelAdapter(const Self &); //purposely not implemented diff --git a/Modules/Adapters/OSSIMAdapters/src/otbImageKeywordlist.cxx b/Modules/Adapters/OSSIMAdapters/src/otbImageKeywordlist.cxx index 36550717ca0ade79935fad796beb91624afdf008..0294d5f74408c9828958a2aab1b679d6c6ca1fe2 100644 --- a/Modules/Adapters/OSSIMAdapters/src/otbImageKeywordlist.cxx +++ b/Modules/Adapters/OSSIMAdapters/src/otbImageKeywordlist.cxx @@ -241,8 +241,6 @@ ReadGeometryFromImage(const std::string& filename, bool checkRpcTag) if (projection) { - otbMsgDevMacro(<< "OSSIM plugin projection instantiated ! "); - hasMetaData = projection->saveState(geom_kwl); otb_kwl.SetKeywordlist(geom_kwl); } @@ -257,7 +255,6 @@ ReadGeometryFromImage(const std::string& filename, bool checkRpcTag) ->open(ossimFilename(filename.c_str()))); if (handler) { - otbMsgDevMacro(<< "OSSIM Open Image SUCCESS ! "); // Add ossimPlugins model ossimProjectionFactoryRegistry::instance()->registerFactory(ossimplugins::ossimPluginProjectionFactory::instance()); @@ -273,7 +270,6 @@ ReadGeometryFromImage(const std::string& filename, bool checkRpcTag) // if the handler has found a sensor model, copy the tags found if (hasMetaData && dynamic_cast<ossimSensorModel const*>(projection)) { - otbMsgDevMacro(<<"OSSIM sensor projection instantiated ! "); otb_kwl.SetKeywordlist(geom_kwl); // geom_kwl.print(std::cout); } @@ -287,60 +283,15 @@ ReadGeometryFromImage(const std::string& filename, bool checkRpcTag) } /**********************************************************/ - /* Third try : look for external geom file and RPC tags */ + /* Third try : look for RPC tags */ /**********************************************************/ - if (!hasMetaData) + if (!hasMetaData && checkRpcTag) { - // If still no metadata, try the ".geom" file - ossimFilename ossimGeomFile = ossimFilename(filename).setExtension(".geom"); - otb_kwl = ReadGeometryFromGEOMFile(ossimGeomFile); - - // also check any RPC tags - ImageKeywordlist rpc_kwl; - if (checkRpcTag) - { - rpc_kwl = ReadGeometryFromRPCTag(filename); - } + // check any RPC tags + otb_kwl = ReadGeometryFromRPCTag(filename); - if (otb_kwl.HasKey("type")) + if (!otb_kwl.Empty()) { - // external geom has a "type" keyword - std::string geomType(otb_kwl.GetMetadataByKey("type")); - ossimProjection *testProj = ossimProjectionFactoryRegistry::instance() - ->createProjection(ossimString(geomType)); - if (dynamic_cast<ossimSensorModel*>(testProj)) - { - // "type" keyword corresponds to a sensor model : don't erase it - if (rpc_kwl.GetSize() > 0) - { - rpc_kwl.ClearMetadataByKey("type"); - } - - ossimKeywordlist ossim_test_kwl; - otb_kwl.convertToOSSIMKeywordlist(ossim_test_kwl); - testProj = ossimProjectionFactoryRegistry::instance() - ->createProjection(ossim_test_kwl); - if (testProj) - { - // external geom contains a valid sensor geometry - hasMetaData = true; - } - } - } - - // copy keywords found in RPC tags if the external geom is not valid - if (!hasMetaData && rpc_kwl.GetSize() > 0) - { - const ImageKeywordlist::KeywordlistMap &kwlMap = rpc_kwl.GetKeywordlist(); - for (ImageKeywordlist::KeywordlistMap::const_iterator it = kwlMap.begin(); - it != kwlMap.end(); - ++it) - { - if (it->second != "") - { - otb_kwl.AddKey(it->first , it->second); - } - } hasMetaData = true; } } @@ -362,16 +313,6 @@ ReadGeometryFromImage(const std::string& filename, bool checkRpcTag) // which uses ossimSensorModelFactory and ossimPluginProjectionFactory internally, // thus by-passing the need for a valid ossimImageHandler. - if (!hasMetaData) - { - otbMsgDevMacro(<< "OSSIM MetaData not present ! "); - } - else - { - otbMsgDevMacro(<< "OSSIM MetaData present ! "); - //otbMsgDevMacro(<< geom_kwl); - } - return otb_kwl; } @@ -524,7 +465,6 @@ WriteGeometry(const ImageKeywordlist& otb_kwl, const std::string& filename) if (geom_kwl.getSize() > 0) { - otbMsgDevMacro(<< "Exporting keywordlist ..."); ossimFilename geomFileName(filename); geomFileName.setExtension(".geom"); geom_kwl.write(geomFileName.chars()); diff --git a/Modules/Adapters/OSSIMAdapters/src/otbSarSensorModelAdapter.cxx b/Modules/Adapters/OSSIMAdapters/src/otbSarSensorModelAdapter.cxx index 62d5203af5c4d7dc04f4b9a3d66706cef1fa084a..56bcfbca01f498b1f8cc020b5c8e839ebf809cbb 100644 --- a/Modules/Adapters/OSSIMAdapters/src/otbSarSensorModelAdapter.cxx +++ b/Modules/Adapters/OSSIMAdapters/src/otbSarSensorModelAdapter.cxx @@ -109,7 +109,112 @@ void SarSensorModelAdapter::DeburstLineToImageLine(const std::vector<std::pair<u ossimplugins::ossimSarSensorModel::deburstLineToImageLine(lines,deburstLine,imageLine); } +bool SarSensorModelAdapter::WorldToLineSampleYZ(const Point3DType & inGeoPoint, Point2DType & cr, Point2DType & yz) const +{ + if(m_SensorModel.get() == ITK_NULLPTR) + { + return false; + } + + ossimGpt inGpt; + inGpt.lon = inGeoPoint[0]; + inGpt.lat = inGeoPoint[1]; + inGpt.hgt = inGeoPoint[2]; + + ossimDpt outDpt; + + double y(0.),z(0.); + m_SensorModel->worldToLineSampleYZ(inGpt,outDpt,y,z); + + if(outDpt.isNan()) + return false; + + cr[0]=outDpt.x; + cr[1]=outDpt.y; + yz[0]=y; + yz[1]=z; + + return true; +} +bool SarSensorModelAdapter::WorldToLineSample(const Point3DType & inGeoPoint, Point2DType & cr) const +{ + if(m_SensorModel.get() == ITK_NULLPTR) + { + return false; + } + + ossimGpt inGpt; + inGpt.lon = inGeoPoint[0]; + inGpt.lat = inGeoPoint[1]; + inGpt.hgt = inGeoPoint[2]; + + ossimDpt outDpt; + + m_SensorModel->worldToLineSample(inGpt,outDpt); + + if(outDpt.isNan()) + return false; + + cr[0]=outDpt.x; + cr[1]=outDpt.y; + + return true; +} + +bool SarSensorModelAdapter::WorldToCartesian(const Point3DType & inGeoPoint, Point3DType & outCartesianPoint) +{ + ossimGpt inGpt; + inGpt.lon = inGeoPoint[0]; + inGpt.lat = inGeoPoint[1]; + inGpt.hgt = inGeoPoint[2]; + + ossimEcefPoint outCartesien(inGpt); + + if(outCartesien.isNan()) + return false; + + outCartesianPoint[0] = outCartesien.x(); + outCartesianPoint[1] = outCartesien.y(); + outCartesianPoint[2] = outCartesien.z(); + + return true; +} + +bool SarSensorModelAdapter::WorldToSatPositionAndVelocity(const Point3DType & inGeoPoint, + Point3DType & satelitePosition, + Point3DType & sateliteVelocity) const +{ + if(m_SensorModel.get() == ITK_NULLPTR) + { + return false; + } + + ossimGpt inGpt; + inGpt.lon = inGeoPoint[0]; + inGpt.lat = inGeoPoint[1]; + inGpt.hgt = inGeoPoint[2]; + + ossimplugins::ossimSarSensorModel::TimeType azimuthTime; + double rangeTime; + ossimEcefPoint sensorPos; + ossimEcefVector sensorVel; + + const bool success = m_SensorModel->worldToAzimuthRangeTime(inGpt, azimuthTime, rangeTime,sensorPos,sensorVel); + + if(sensorPos.isNan() || !success) + return false; + + satelitePosition[0] = sensorPos.x(); + satelitePosition[1] = sensorPos.y(); + satelitePosition[2] = sensorPos.z(); + + sateliteVelocity[0] = sensorVel.x(); + sateliteVelocity[1] = sensorVel.y(); + sateliteVelocity[2] = sensorVel.z(); + + return true; +} } // namespace otb diff --git a/Modules/Adapters/OSSIMAdapters/test/CMakeLists.txt b/Modules/Adapters/OSSIMAdapters/test/CMakeLists.txt index 54a7117fc93c342e11d0e77b2b5226c70c0104cc..8dadc14ff05f911b3fa0af4cca37e05592cecced 100644 --- a/Modules/Adapters/OSSIMAdapters/test/CMakeLists.txt +++ b/Modules/Adapters/OSSIMAdapters/test/CMakeLists.txt @@ -31,6 +31,7 @@ otbGeometricSarSensorModelAdapter.cxx otbPlatformPositionAdapter.cxx otbDEMHandlerTest.cxx otbRPCSolverAdapterTest.cxx +otbSarSensorModelAdapterTest.cxx ) add_executable(otbOSSIMAdaptersTestDriver ${OTBOSSIMAdaptersTests}) @@ -499,3 +500,8 @@ otb_add_test(NAME uaTvRPCSolverAdapterValidationTest COMMAND otbOSSIMAdaptersTes ${INPUTDATA}/DEM/egm96.grd ) + +otb_add_test(NAME uaTvSarSensorModelAdapter COMMAND otbOSSIMAdaptersTestDriver + otbSarSensorModelAdapterTest + ${INPUTDATA}/s1a-iw1-slc-vh-amp_xt.geom + ) diff --git a/Modules/Adapters/OSSIMAdapters/test/otbOSSIMAdaptersTestDriver.cxx b/Modules/Adapters/OSSIMAdapters/test/otbOSSIMAdaptersTestDriver.cxx index 911e57e671884e9bb003e399b605b6dfd3dacf29..5f7295d6dffdb208aafde1ab1326ecdd544bd24f 100644 --- a/Modules/Adapters/OSSIMAdapters/test/otbOSSIMAdaptersTestDriver.cxx +++ b/Modules/Adapters/OSSIMAdapters/test/otbOSSIMAdaptersTestDriver.cxx @@ -33,4 +33,5 @@ void RegisterTests() REGISTER_TEST(otbPlatformPositionComputeBaselineTest); REGISTER_TEST(otbDEMHandlerTest); REGISTER_TEST(otbRPCSolverAdapterTest); + REGISTER_TEST(otbSarSensorModelAdapterTest); } diff --git a/Modules/Adapters/OSSIMAdapters/test/otbSarSensorModelAdapterTest.cxx b/Modules/Adapters/OSSIMAdapters/test/otbSarSensorModelAdapterTest.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d48f10066193796158002b55aba127b464814ccc --- /dev/null +++ b/Modules/Adapters/OSSIMAdapters/test/otbSarSensorModelAdapterTest.cxx @@ -0,0 +1,84 @@ +/* + * 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 <fstream> +#include <iomanip> + +#include "otbSarSensorModelAdapter.h" +#include "otbImageKeywordlist.h" + + +int otbSarSensorModelAdapterTest(int itkNotUsed(argc), char* argv[]) +{ + std::string infname = argv[1]; + + otb::SarSensorModelAdapter::Pointer sensorModel = otb::SarSensorModelAdapter::New(); + + auto kwl = otb::ReadGeometryFromGEOMFile(infname); + + bool success = sensorModel->LoadState(kwl); + + if(!success) + { + std::cerr<<"Could not LoadState() from keyword list read from"<<infname<<std::endl; + return EXIT_FAILURE; + } + + std::vector<std::pair<unsigned long, unsigned long> > lines; + success = sensorModel->Deburst(lines); + + if(!success) + { + std::cerr<<"Deburst() call failed."<<std::endl; + return EXIT_FAILURE; + } + + + otb::ImageKeywordlist outKwl; + success = sensorModel->SaveState(outKwl); + if(!success) + { + std::cerr<<"SaveState() call failed."<<std::endl; + return EXIT_FAILURE; + } + + + otb::SarSensorModelAdapter::Point2DType out1,out2; + otb::SarSensorModelAdapter::Point3DType in, out3, out4, out5; + + // GCP 99 from input geom file + //support_data.geom.gcp[99].world_pt.hgt: 2.238244926818182e+02 + //support_data.geom.gcp[99].world_pt.lat: 4.323458093295080e+01 + //support_data.geom.gcp[99].world_pt.lon: 1.116316013091967e+00 + + in[0] = 4.323458093295080e+01; + in[1] = 1.116316013091967e+00; + in[2] = 2.238244926818182e+02; + + sensorModel->WorldToLineSample(in,out1); + sensorModel->WorldToLineSampleYZ(in,out1,out2); + + sensorModel->WorldToCartesian(in, out5); + sensorModel->WorldToSatPositionAndVelocity(in,out3, out4); + + + return EXIT_SUCCESS; +} diff --git a/Modules/Adapters/QtAdapters/include/otbQtAdapters.h b/Modules/Adapters/QtAdapters/include/otbQtAdapters.h index fd5c3e09bd6b3c59079c1edf62185e11b413d402..99939627cfde31cf2a56521622589101918aa78d 100644 --- a/Modules/Adapters/QtAdapters/include/otbQtAdapters.h +++ b/Modules/Adapters/QtAdapters/include/otbQtAdapters.h @@ -118,7 +118,7 @@ GetExistingDirectory( QWidget * p = 0, */ QString OTBQtAdapters_EXPORT -GetOpenFileName( QWidget * p =0, +GetOpenFilename( QWidget * p =0, const QString & caption = QString(), const QString & dir = QString(), const QString & filter = QString(), @@ -145,7 +145,7 @@ GetOpenFileName( QWidget * p =0, */ QStringList OTBQtAdapters_EXPORT -GetOpenFileNames( QWidget * p =0, +GetOpenFilenames( QWidget * p =0, const QString & caption = QString(), const QString & dir = QString(), const QString & filter = QString(), @@ -172,7 +172,7 @@ GetOpenFileNames( QWidget * p =0, */ QString OTBQtAdapters_EXPORT -GetSaveFileName( QWidget * p =0, +GetSaveFilename( QWidget * p =0, const QString & caption = QString(), const QString & dir = QString(), const QString & filter = QString(), diff --git a/Modules/Adapters/QtAdapters/otb-module.cmake b/Modules/Adapters/QtAdapters/otb-module.cmake index 631fde8b968ce843b28660e35691f9ebd58bb793..028a6703cc4d586729a01a4485a6eda05c8a24c4 100644 --- a/Modules/Adapters/QtAdapters/otb-module.cmake +++ b/Modules/Adapters/QtAdapters/otb-module.cmake @@ -22,6 +22,6 @@ set( DOCUMENTATION "Adapters for the Qt Library.") otb_module( OTBQtAdapters ENABLE_SHARED - DEPENDS OTBQt4 + DEPENDS OTBQt DESCRIPTION "${DOCUMENTATION}" ) diff --git a/Modules/Adapters/QtAdapters/src/CMakeLists.txt b/Modules/Adapters/QtAdapters/src/CMakeLists.txt index e11dce202bf62d2823eb3934486cf1e546db7167..7b172de93e5bf7db63ff9075273ba5071030f4de 100644 --- a/Modules/Adapters/QtAdapters/src/CMakeLists.txt +++ b/Modules/Adapters/QtAdapters/src/CMakeLists.txt @@ -26,15 +26,15 @@ set( OTBQtAdapters_HEADERS_MOC # otbQtAdapters.h ) -add_to_qt4_i18n_sources( ${OTBQtAdapters_SRCS} ) -add_to_qt4_i18n_headers( "../include" ${OTBQtAdapters_SRCS} ) +add_to_qt_i18n_sources( ${OTBQtAdapters_SRCS} ) +add_to_qt_i18n_headers( "../include" ${OTBQtAdapters_SRCS} ) -qt4_wrap_cpp( OTBQtAdapters_SRC_MOC ${OTBQtAdapters_HEADERS_MOC} ) +qt5_wrap_cpp( OTBQtAdapters_SRC_MOC ${OTBQtAdapters_HEADERS_MOC} ) add_library( OTBQtAdapters ${OTBQtAdapters_SRC} ${OTBQtAdapters_SRC_MOC}) target_link_libraries( OTBQtAdapters - ${OTBQt4_LIBRARIES} + ${OTBQt_LIBRARIES} ) otb_module_target( OTBQtAdapters ) diff --git a/Modules/Adapters/QtAdapters/src/otbQtAdapters.cxx b/Modules/Adapters/QtAdapters/src/otbQtAdapters.cxx index 89f457dc9ca5bd5fae76a1798f7e4a8b994d368c..380c3e129dd287d80e43ac0f6d2d49ca1b20c15b 100644 --- a/Modules/Adapters/QtAdapters/src/otbQtAdapters.cxx +++ b/Modules/Adapters/QtAdapters/src/otbQtAdapters.cxx @@ -95,7 +95,7 @@ GetExistingDirectory( QWidget * p, /*****************************************************************************/ QString -GetOpenFileName( QWidget * p, +GetOpenFilename( QWidget * p, const QString& caption, const QString& dir, const QString& filter, @@ -129,7 +129,7 @@ GetOpenFileName( QWidget * p, /*****************************************************************************/ QStringList -GetOpenFileNames( QWidget * p, +GetOpenFilenames( QWidget * p, const QString & caption, const QString & dir, const QString & filter, @@ -163,7 +163,7 @@ GetOpenFileNames( QWidget * p, /*****************************************************************************/ QString -GetSaveFileName( QWidget * p, +GetSaveFilename( QWidget * p, const QString & caption, const QString & dir, const QString & filter, diff --git a/Modules/Applications/AppChangeDetection/app/otbMultivariateAlterationDetector.cxx b/Modules/Applications/AppChangeDetection/app/otbMultivariateAlterationDetector.cxx index 668930e92202047b758e168f77eb37f22c381620..b2ec075b68b420a8971c40246db133739081bfa8 100644 --- a/Modules/Applications/AppChangeDetection/app/otbMultivariateAlterationDetector.cxx +++ b/Modules/Applications/AppChangeDetection/app/otbMultivariateAlterationDetector.cxx @@ -43,7 +43,7 @@ public: itkTypeMacro(MultivariateAlterationDetector, otb::Wrapper::Application); private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("MultivariateAlterationDetector"); SetDescription("Change detection by Multivariate Alteration Detector (MAD) algorithm"); @@ -110,11 +110,11 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { typedef otb::MultivariateAlterationDetectorImageFilter< FloatVectorImageType, diff --git a/Modules/Applications/AppClassification/app/CMakeLists.txt b/Modules/Applications/AppClassification/app/CMakeLists.txt index 3e1dbd85f5cd2ca409ddb9ef51389edf5e544976..d34c3842d0a6d9e39011b98df48af97bfb2ceb87 100644 --- a/Modules/Applications/AppClassification/app/CMakeLists.txt +++ b/Modules/Applications/AppClassification/app/CMakeLists.txt @@ -125,5 +125,10 @@ otb_create_application( SOURCES otbVectorClassifier.cxx LINK_LIBRARIES ${${otb-module}_LIBRARIES}) +otb_create_application( + NAME SampleAugmentation + SOURCES otbSampleAugmentation.cxx + LINK_LIBRARIES ${${otb-module}_LIBRARIES}) + # Mantis-1427 : temporary fix add_dependencies(${otb-module}-all otbapp_ImageEnvelope) diff --git a/Modules/Applications/AppClassification/app/otbClassificationMapRegularization.cxx b/Modules/Applications/AppClassification/app/otbClassificationMapRegularization.cxx index c5b0262be43c83ff560ec97ea3a418411ef5d17f..7f8b71c8d7e488e5fc8ab3624c6e7de374f8aefa 100644 --- a/Modules/Applications/AppClassification/app/otbClassificationMapRegularization.cxx +++ b/Modules/Applications/AppClassification/app/otbClassificationMapRegularization.cxx @@ -57,7 +57,7 @@ public: private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("ClassificationMapRegularization"); SetDescription("Filters the input labeled image using Majority Voting in a ball shaped neighbordhood."); @@ -92,7 +92,7 @@ private: SetParameterDescription("ip.radius", "The radius of the ball shaped structuring element (expressed in pixels). By default, 'ip.radius = 1 pixel'."); SetDefaultParameterInt("ip.radius", 1.0); - AddParameter(ParameterType_Empty, "ip.suvbool", "Multiple majority: Undecided(X)/Original"); + AddParameter(ParameterType_Bool, "ip.suvbool", "Multiple majority: Undecided(X)/Original"); SetParameterDescription("ip.suvbool", "Pixels with more than 1 majority class are marked as Undecided if this parameter is checked (true), or keep their Original labels otherwise (false). Please note that the Undecided value must be different from existing labels in the input labeled image. By default, 'ip.suvbool = false'."); AddParameter(ParameterType_Int, "ip.nodatalabel", "Label for the NoData class"); @@ -103,7 +103,7 @@ private: SetParameterDescription("ip.undecidedlabel", "Label for the Undecided class. By default, 'ip.undecidedlabel = 0'."); SetDefaultParameterInt("ip.undecidedlabel", 0.0); - AddParameter(ParameterType_Empty, "ip.onlyisolatedpixels", "Process isolated pixels only"); + AddParameter(ParameterType_Bool, "ip.onlyisolatedpixels", "Process isolated pixels only"); SetParameterDescription("ip.onlyisolatedpixels", "Only pixels whose label is unique in the neighbordhood will be processed. By default, 'ip.onlyisolatedpixels = false'."); AddParameter(ParameterType_Int, "ip.isolatedthreshold", "Threshold for isolated pixels"); @@ -125,12 +125,12 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do here : all parameters are independent } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { // Majority Voting m_NeighMajVotingFilter = NeighborhoodMajorityVotingFilterType::New(); @@ -153,7 +153,7 @@ private: m_NeighMajVotingFilter->SetLabelForUndecidedPixels(GetParameterInt("ip.undecidedlabel")); // Set to Undecided label if NOT unique Majority Voting - if (IsParameterEnabled("ip.suvbool")) + if (GetParameterInt("ip.suvbool")) { m_NeighMajVotingFilter->SetKeepOriginalLabelBool(false); } @@ -164,7 +164,7 @@ private: } // Process isolated pixels only - if (IsParameterEnabled("ip.onlyisolatedpixels")) + if (GetParameterInt("ip.onlyisolatedpixels")) { m_NeighMajVotingFilter->SetOnlyIsolatedPixels(true); m_NeighMajVotingFilter->SetIsolatedThreshold(GetParameterInt("ip.isolatedthreshold")); diff --git a/Modules/Applications/AppClassification/app/otbComputeConfusionMatrix.cxx b/Modules/Applications/AppClassification/app/otbComputeConfusionMatrix.cxx index 4bee3df4fe9bd1ca3220428adc28f4ed91c7e9e2..d009f21f0a619ae1a6efc0433f5ae67bc9ec0979 100644 --- a/Modules/Applications/AppClassification/app/otbComputeConfusionMatrix.cxx +++ b/Modules/Applications/AppClassification/app/otbComputeConfusionMatrix.cxx @@ -103,7 +103,7 @@ private: }; - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("ComputeConfusionMatrix"); SetDescription("Computes the confusion matrix of a classification"); @@ -183,7 +183,7 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { if ( HasValue("ref.vector.in") ) { @@ -363,7 +363,7 @@ private: return sid; } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { StreamingInitializationData sid = InitStreamingData(); diff --git a/Modules/Applications/AppClassification/app/otbComputeImagesStatistics.cxx b/Modules/Applications/AppClassification/app/otbComputeImagesStatistics.cxx index 0956eb7a0068264402c218687efd3c89feacfc76..055bc703e8364b49ad88a4de736008466d210833 100644 --- a/Modules/Applications/AppClassification/app/otbComputeImagesStatistics.cxx +++ b/Modules/Applications/AppClassification/app/otbComputeImagesStatistics.cxx @@ -45,7 +45,7 @@ public: itkTypeMacro(ComputeImagesStatistics, otb::Application); private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("ComputeImagesStatistics"); SetDocName("Compute Images second order statistics"); @@ -85,12 +85,12 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do here : all parameters are independent } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { //Statistics estimator typedef otb::StreamingStatisticsVectorImageFilter<FloatVectorImageType> StreamingStatisticsVImageFilterType; diff --git a/Modules/Applications/AppClassification/app/otbComputeOGRLayersFeaturesStatistics.cxx b/Modules/Applications/AppClassification/app/otbComputeOGRLayersFeaturesStatistics.cxx index 5f108a9a13e1ee408449082bb89f980b00761c94..0774475d1d9d6dd3c2bf3d29eb4a0278e1371def 100644 --- a/Modules/Applications/AppClassification/app/otbComputeOGRLayersFeaturesStatistics.cxx +++ b/Modules/Applications/AppClassification/app/otbComputeOGRLayersFeaturesStatistics.cxx @@ -46,7 +46,7 @@ public: ; private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("ComputeOGRLayersFeaturesStatistics"); SetDescription("Compute statistics of the features in a set of OGR Layers"); @@ -75,7 +75,7 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { if ( HasValue("inshp") ) { @@ -117,7 +117,7 @@ private: } } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { clock_t tic = clock(); diff --git a/Modules/Applications/AppClassification/app/otbComputePolylineFeatureFromImage.cxx b/Modules/Applications/AppClassification/app/otbComputePolylineFeatureFromImage.cxx index 1e098e7846e0bd13aa19f2cb61fd07d05ca0cdde..1c9c715bed02a7fa1d849feb36a765bfa3c47a7b 100644 --- a/Modules/Applications/AppClassification/app/otbComputePolylineFeatureFromImage.cxx +++ b/Modules/Applications/AppClassification/app/otbComputePolylineFeatureFromImage.cxx @@ -76,7 +76,7 @@ public: ; private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("ComputePolylineFeatureFromImage"); SetDescription("This application compute for each studied polyline, contained in the input VectorData, the chosen descriptors."); @@ -116,12 +116,12 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do here : all parameters are independent } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { // Vector Data into Image projection FloatVectorImageType::Pointer inImage = GetParameterImage("in"); diff --git a/Modules/Applications/AppClassification/app/otbDSFuzzyModelEstimation.cxx b/Modules/Applications/AppClassification/app/otbDSFuzzyModelEstimation.cxx index e6343bf4b9654a41b82317f7c8d6412b87e2e940..60a49e14782f8bfb40d6a20bcf2f9adfbaa0b139 100644 --- a/Modules/Applications/AppClassification/app/otbDSFuzzyModelEstimation.cxx +++ b/Modules/Applications/AppClassification/app/otbDSFuzzyModelEstimation.cxx @@ -51,12 +51,12 @@ typedef itk::AmoebaOptimizer OptimizerType; typedef const OptimizerType * OptimizerPointer; -void Execute(itk::Object *caller, const itk::EventObject & event) ITK_OVERRIDE +void Execute(itk::Object *caller, const itk::EventObject & event) override { Execute( (const itk::Object *)caller, event); } -void Execute(const itk::Object * object, const itk::EventObject & event) ITK_OVERRIDE +void Execute(const itk::Object * object, const itk::EventObject & event) override { OptimizerPointer optimizer = dynamic_cast< OptimizerPointer >( object ); @@ -115,7 +115,7 @@ public: itkTypeMacro(DSFuzzyModelEstimation, otb::Application); private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("DSFuzzyModelEstimation"); SetDescription("Estimate feature fuzzy model parameters using 2 vector data (ground truth samples and wrong samples)."); @@ -143,12 +143,12 @@ private: AddParameter(ParameterType_String, "cri", "Criterion"); SetParameterDescription("cri", "Dempster Shafer criterion (by default (belief+plausibility)/2)"); MandatoryOff("cri"); - SetParameterString("cri","((Belief + Plausibility)/2.)", false); + SetParameterString("cri","((Belief + Plausibility)/2.)"); AddParameter(ParameterType_Float,"wgt","Weighting"); SetParameterDescription("wgt","Coefficient between 0 and 1 to promote undetection or false detections (default 0.5)"); MandatoryOff("wgt"); - SetParameterFloat("wgt",0.5, false); + SetParameterFloat("wgt",0.5); AddParameter(ParameterType_InputFilename,"initmod","initialization model"); SetParameterDescription("initmod","Initialization model (xml file) to be used. If the xml initialization model is set, the descriptor list is not used (specified using the option -desclist)"); @@ -157,16 +157,15 @@ private: AddParameter(ParameterType_StringList, "desclist","Descriptor list"); SetParameterDescription("desclist","List of the descriptors to be used in the model (must be specified to perform an automatic initialization)"); MandatoryOff("desclist"); - SetParameterString("desclist","", false); + SetParameterString("desclist",""); AddParameter(ParameterType_Int,"maxnbit","Maximum number of iterations"); MandatoryOff("maxnbit"); SetParameterDescription("maxnbit","Maximum number of optimizer iteration (default 200)"); - SetParameterInt("maxnbit",200, false); + SetParameterInt("maxnbit",200); - AddParameter(ParameterType_Empty,"optobs","Optimizer Observer"); + AddParameter(ParameterType_Bool,"optobs","Optimizer Observer"); SetParameterDescription("optobs","Activate the optimizer observer"); - MandatoryOff("optobs"); AddParameter(ParameterType_OutputFilename,"out","Output filename"); SetParameterDescription("out","Output model file name (xml file) contains the optimal model to perform information fusion."); @@ -184,7 +183,7 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do here : all parameters are independent @@ -194,7 +193,7 @@ private: } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { //Instantiate @@ -405,7 +404,7 @@ private: // Create the Command observer and register it with the optimizer. CommandIterationUpdate::Pointer observer = CommandIterationUpdate::New(); - if (IsParameterEnabled("optobs")) + if (GetParameterInt("optobs")) { m_Optimizer->AddObserver(itk::IterationEvent(), observer); } diff --git a/Modules/Applications/AppClassification/app/otbFusionOfClassifications.cxx b/Modules/Applications/AppClassification/app/otbFusionOfClassifications.cxx index b31ae21c16d927de64135bdd47b1f07ebb9d595e..4fa71c70e5cf371db67b8e70c57088f29d4c5a43 100644 --- a/Modules/Applications/AppClassification/app/otbFusionOfClassifications.cxx +++ b/Modules/Applications/AppClassification/app/otbFusionOfClassifications.cxx @@ -93,7 +93,7 @@ public: itkTypeMacro(FusionOfClassifications, otb::Application); private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("FusionOfClassifications"); SetDescription("Fuses several classifications maps of the same image on the basis of class labels."); @@ -173,7 +173,7 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do here : all parameters are independent } @@ -285,7 +285,7 @@ private: } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { // Clear any previous filter m_Filters.clear(); diff --git a/Modules/Applications/AppClassification/app/otbImageClassifier.cxx b/Modules/Applications/AppClassification/app/otbImageClassifier.cxx index 1f94d2714355e37db5137cfd85d3de72b3927e57..59f3cd2936e063053862000c47e6d1d59d7aefa9 100644 --- a/Modules/Applications/AppClassification/app/otbImageClassifier.cxx +++ b/Modules/Applications/AppClassification/app/otbImageClassifier.cxx @@ -67,13 +67,13 @@ public: protected: - ~ImageClassifier() ITK_OVERRIDE + ~ImageClassifier() override { MachineLearningModelFactoryType::CleanFactories(); } private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("ImageClassifier"); SetDescription("Performs a classification of the input image according to a model file."); @@ -141,12 +141,12 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do here : all parameters are independent } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { // Load input image FloatVectorImageType::Pointer inImage = GetParameterImage("in"); diff --git a/Modules/Applications/AppClassification/app/otbKMeansClassification.cxx b/Modules/Applications/AppClassification/app/otbKMeansClassification.cxx index a5067bf9cdb782b5dd2d70e25a43c23f7d41baa8..ee04d9cd0fb2ff3035ca2208a8cd64c735cd93d8 100644 --- a/Modules/Applications/AppClassification/app/otbKMeansClassification.cxx +++ b/Modules/Applications/AppClassification/app/otbKMeansClassification.cxx @@ -59,11 +59,10 @@ protected: InitKMClassification(); // init at the end cleanup - AddParameter( ParameterType_Empty, "cleanup", "Temporary files cleaning" ); - EnableParameter( "cleanup" ); + AddParameter( ParameterType_Bool, "cleanup", "Temporary files cleaning" ); SetParameterDescription( "cleanup", "If activated, the application will try to clean all temporary files it created" ); - MandatoryOff( "cleanup" ); + SetParameterInt("cleanup", 1); } void InitKMSampling() @@ -148,7 +147,7 @@ protected: void ComputeImageEnvelope(const std::string &vectorFileName) { - GetInternalApplication("imgenvelop")->SetParameterString("out", vectorFileName, false); + GetInternalApplication("imgenvelop")->SetParameterString("out", vectorFileName); GetInternalApplication("imgenvelop")->ExecuteAndWriteOutput(); } @@ -187,8 +186,8 @@ protected: { std::vector<std::string> fieldList = {fieldName}; - GetInternalApplication("polystats")->SetParameterStringList("field", fieldList, false); - GetInternalApplication("polystats")->SetParameterString("out", statisticsFileName, false); + GetInternalApplication("polystats")->SetParameterStringList("field", fieldList); + GetInternalApplication("polystats")->SetParameterString("out", statisticsFileName); ExecuteInternal("polystats"); } @@ -199,17 +198,17 @@ protected: int NBSamples) { /* SampleSelection */ - GetInternalApplication("select")->SetParameterString("out", sampleFileName, false); + GetInternalApplication("select")->SetParameterString("out", sampleFileName); UpdateInternalParameters("select"); - GetInternalApplication("select")->SetParameterString("instats", statisticsFileName, false); - GetInternalApplication("select")->SetParameterString("field", fieldName, false); + GetInternalApplication("select")->SetParameterString("instats", statisticsFileName); + GetInternalApplication("select")->SetParameterString("field", fieldName); - GetInternalApplication("select")->SetParameterString("strategy", "constant", false); - GetInternalApplication("select")->SetParameterInt("strategy.constant.nb", NBSamples, false); + GetInternalApplication("select")->SetParameterString("strategy", "constant"); + GetInternalApplication("select")->SetParameterInt("strategy.constant.nb", NBSamples); if( IsParameterEnabled("rand")) - GetInternalApplication("select")->SetParameterInt("rand", GetParameterInt("rand"), false); + GetInternalApplication("select")->SetParameterInt("rand", GetParameterInt("rand")); // select sample positions ExecuteInternal("select"); @@ -217,8 +216,8 @@ protected: /* SampleExtraction */ UpdateInternalParameters("extraction"); - GetInternalApplication("extraction")->SetParameterString("outfield", "prefix", false); - GetInternalApplication("extraction")->SetParameterString("outfield.prefix.name", "value_", false); + GetInternalApplication("extraction")->SetParameterString("outfield", "prefix"); + GetInternalApplication("extraction")->SetParameterString("outfield.prefix.name", "value_"); // extract sample descriptors GetInternalApplication("extraction")->ExecuteAndWriteOutput(); @@ -229,7 +228,7 @@ protected: const std::string &modelFileName) { std::vector<std::string> extractOutputList = {sampleTrainFileName}; - GetInternalApplication("training")->SetParameterStringList("io.vd", extractOutputList, false); + GetInternalApplication("training")->SetParameterStringList("io.vd", extractOutputList); UpdateInternalParameters("training"); // set field names @@ -242,19 +241,19 @@ protected: oss << i; selectedNames.push_back( selectPrefix + oss.str() ); } - GetInternalApplication("training")->SetParameterStringList("feat", selectedNames, false); + GetInternalApplication("training")->SetParameterStringList("feat", selectedNames); - GetInternalApplication("training")->SetParameterString("classifier", "sharkkm", false); + GetInternalApplication("training")->SetParameterString("classifier", "sharkkm"); GetInternalApplication("training")->SetParameterInt("classifier.sharkkm.maxiter", - GetParameterInt("maxit"), false); + GetParameterInt("maxit")); GetInternalApplication("training")->SetParameterInt("classifier.sharkkm.k", - GetParameterInt("nc"), false); + GetParameterInt("nc")); if( IsParameterEnabled("rand")) - GetInternalApplication("training")->SetParameterInt("rand", GetParameterInt("rand"), false); + GetInternalApplication("training")->SetParameterInt("rand", GetParameterInt("rand")); GetInternalApplication("training")->GetParameterByKey("v")->SetActive(false); - GetInternalApplication("training")->SetParameterString("io.out", modelFileName, false); + GetInternalApplication("training")->SetParameterString("io.out", modelFileName); ExecuteInternal( "training" ); otbAppLogINFO("output model : " << GetInternalApplication("training")->GetParameterString("io.out")); @@ -264,8 +263,8 @@ protected: const std::string &imagesStatsFileName) { std::vector<std::string> imageFileNameList = {imageFileName}; - GetInternalApplication("imgstats")->SetParameterStringList("il", imageFileNameList, false); - GetInternalApplication("imgstats")->SetParameterString("out", imagesStatsFileName, false); + GetInternalApplication("imgstats")->SetParameterStringList("il", imageFileNameList); + GetInternalApplication("imgstats")->SetParameterString("out", imagesStatsFileName); ExecuteInternal( "imgstats" ); otbAppLogINFO("image statistics file : " << GetInternalApplication("imgstats")->GetParameterString("out")); @@ -292,12 +291,15 @@ protected: itkExceptionMacro(<< "File : " << modelFileName << " couldn't be opened"); } - // get the end line with the centroids + // get the line with the centroids (starts with "2 ") std::string line, centroidLine; while(std::getline(infile,line)) { - if (!line.empty()) + if (line.size() > 2 && line[0] == '2' && line[1] == ' ') + { centroidLine = line; + break; + } } std::vector<std::string> centroidElm; @@ -395,7 +397,7 @@ public: itkTypeMacro(Self, Superclass); private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("KMeansClassification"); SetDescription("Unsupervised KMeans image classification"); @@ -449,11 +451,11 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { if (IsParameterEnabled("vm") && HasValue("vm")) Superclass::ConnectKMClassificationMask(); @@ -497,7 +499,7 @@ private: Superclass::CreateOutMeansFile(GetParameterImage("in"), fileNames.modelFile, GetParameterInt("nc")); // Remove all tempory files - if( IsParameterEnabled( "cleanup" ) ) + if( GetParameterInt( "cleanup" ) ) { otbAppLogINFO( <<"Final clean-up ..." ); fileNames.clear(); @@ -506,7 +508,7 @@ private: void UpdateKMPolygonClassStatisticsParameters(const std::string &vectorFileName) { - GetInternalApplication( "polystats" )->SetParameterString( "vec", vectorFileName, false ); + GetInternalApplication( "polystats" )->SetParameterString( "vec", vectorFileName); UpdateInternalParameters( "polystats" ); } diff --git a/Modules/Applications/AppClassification/app/otbMultiImageSamplingRate.cxx b/Modules/Applications/AppClassification/app/otbMultiImageSamplingRate.cxx index 889e909cc54301fb53eeb952783e9d1f4325fa20..0b60504fed8ea033038900f466b86054bc6402b3 100644 --- a/Modules/Applications/AppClassification/app/otbMultiImageSamplingRate.cxx +++ b/Modules/Applications/AppClassification/app/otbMultiImageSamplingRate.cxx @@ -57,7 +57,7 @@ private: m_CalculatorList = RateCalculatorListType::New(); } - void DoInit() + void DoInit() override { SetName("MultiImageSamplingRate"); SetDescription("Compute sampling rate for an input set of images."); @@ -164,7 +164,7 @@ private: SetParameterDescription("strategy.all","Take all samples"); // Default strategy : smallest - SetParameterString("strategy","smallest", false); + SetParameterString("strategy","smallest"); AddParameter(ParameterType_Choice, "mim", "Multi-Image Mode"); @@ -186,11 +186,11 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() + void DoUpdateParameters() override { } - void DoExecute() + void DoExecute() override { // Clear state m_CalculatorList->Clear(); diff --git a/Modules/Applications/AppClassification/app/otbOGRLayerClassifier.cxx b/Modules/Applications/AppClassification/app/otbOGRLayerClassifier.cxx index eb58a7e0ac4371d6c0fa4830f457bf36c11d426f..86a2d7066d8f4242c6cbcd2815ae0b327e5e5b63 100644 --- a/Modules/Applications/AppClassification/app/otbOGRLayerClassifier.cxx +++ b/Modules/Applications/AppClassification/app/otbOGRLayerClassifier.cxx @@ -55,7 +55,7 @@ public: ; private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("OGRLayerClassifier"); SetDescription("Classify an OGR layer based on a machine learning model and a list of features to consider."); @@ -82,7 +82,7 @@ private: AddParameter(ParameterType_String,"cfield","Field containing the predicted class."); SetParameterDescription("cfield","Field containing the predicted class"); - SetParameterString("cfield","predicted", false); + SetParameterString("cfield","predicted"); // Doc example parameter settings SetDocExampleParameterValue("inshp", "vectorData.shp"); @@ -94,7 +94,7 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { if ( HasValue("inshp") ) { @@ -135,7 +135,7 @@ private: } } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { #ifdef OTB_USE_LIBSVM diff --git a/Modules/Applications/AppClassification/app/otbPolygonClassStatistics.cxx b/Modules/Applications/AppClassification/app/otbPolygonClassStatistics.cxx index ff4f4b01e4be8c30476b4aef78dadaf9819e606f..3fa23e056d2da13e362692fb1bb06d43e866bc14 100644 --- a/Modules/Applications/AppClassification/app/otbPolygonClassStatistics.cxx +++ b/Modules/Applications/AppClassification/app/otbPolygonClassStatistics.cxx @@ -67,7 +67,7 @@ private: } - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("PolygonClassStatistics"); SetDescription("Computes statistics on a training polygon set."); @@ -76,7 +76,7 @@ private: SetDocName("Polygon Class Statistics"); SetDocLongDescription("The application processes a set of geometries " "intended for training (they should have a field giving the associated " - "class). The geometries are analysed against a support image to compute " + "class). The geometries are analyzed against a support image to compute " "statistics : \n" " - number of samples per class\n" " - number of samples per geometry\n" @@ -92,17 +92,17 @@ private: AddDocTag(Tags::Learning); - AddParameter(ParameterType_InputImage, "in", "InputImage"); + AddParameter(ParameterType_InputImage, "in", "Input image"); SetParameterDescription("in", "Support image that will be classified"); - AddParameter(ParameterType_InputImage, "mask", "InputMask"); + AddParameter(ParameterType_InputImage, "mask", "Input validity mask"); SetParameterDescription("mask", "Validity mask (only pixels corresponding to a mask value greater than 0 will be used for statistics)"); MandatoryOff("mask"); AddParameter(ParameterType_InputFilename, "vec", "Input vectors"); - SetParameterDescription("vec","Input geometries to analyse"); + SetParameterDescription("vec","Input geometries to analyze"); - AddParameter(ParameterType_OutputFilename, "out", "Output Statistics"); + AddParameter(ParameterType_OutputFilename, "out", "Output XML statistics file"); SetParameterDescription("out","Output file to store statistics (XML format)"); AddParameter(ParameterType_ListView, "field", "Field Name"); @@ -127,7 +127,7 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { if ( HasValue("vec") ) { @@ -155,9 +155,25 @@ private: } } } + + // Check that the extension of the output parameter is XML (mandatory for + // StatisticsXMLFileWriter) + // Check it here to trigger the error before polygons analysis + + if ( HasValue("out") ) + { + // Store filename extension + // Check that the right extension is given : expected .xml + const std::string extension = itksys::SystemTools::GetFilenameLastExtension(this->GetParameterString("out")); + + if (itksys::SystemTools::LowerCase(extension) != ".xml") + { + otbAppLogFATAL( << extension << " is a wrong extension for parameter \"out\": Expected .xml" ); + } + } } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { otb::ogr::DataSource::Pointer vectors = otb::ogr::DataSource::New(this->GetParameterString("vec")); @@ -223,7 +239,7 @@ private: filter->SetLayerIndex(this->GetParameterInt("layer")); filter->GetStreamer()->SetAutomaticAdaptativeStreaming(GetParameterInt("ram")); - AddProcess(filter->GetStreamer(),"Analyse polygons..."); + AddProcess(filter->GetStreamer(),"Analyze polygons..."); filter->Update(); FilterType::ClassCountMapType &classCount = filter->GetClassCountOutput()->Get(); diff --git a/Modules/Applications/AppClassification/app/otbPredictRegression.cxx b/Modules/Applications/AppClassification/app/otbPredictRegression.cxx index 8a4401679f240d9edfb086e520e21d519acea157..0c8dce2d8618d2b6c1e7f44d6cd57d93f00ece40 100644 --- a/Modules/Applications/AppClassification/app/otbPredictRegression.cxx +++ b/Modules/Applications/AppClassification/app/otbPredictRegression.cxx @@ -107,13 +107,13 @@ public: protected: - ~PredictRegression() ITK_OVERRIDE + ~PredictRegression() override { MachineLearningModelFactoryType::CleanFactories(); } private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("PredictRegression"); SetDescription("Performs a prediction of the input image according to a regression model file."); @@ -182,12 +182,12 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do here : all parameters are independent } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { // Load input image FloatVectorImageType::Pointer inImage = GetParameterImage("in"); diff --git a/Modules/Applications/AppClassification/app/otbSOMClassification.cxx b/Modules/Applications/AppClassification/app/otbSOMClassification.cxx index 86572e90ad0eebd83dbc8ec8ee3e338677984af6..1b0b7ffcc7da5682e3c02550ef4f026cf0371eb9 100644 --- a/Modules/Applications/AppClassification/app/otbSOMClassification.cxx +++ b/Modules/Applications/AppClassification/app/otbSOMClassification.cxx @@ -76,7 +76,7 @@ private: m_Classifier = ClassificationFilterType::New(); } - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("SOMClassification"); SetDescription("SOM image classification."); @@ -178,12 +178,12 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { // initiating random number generation itk::Statistics::MersenneTwisterRandomVariateGenerator::Pointer diff --git a/Modules/Applications/AppClassification/app/otbSampleAugmentation.cxx b/Modules/Applications/AppClassification/app/otbSampleAugmentation.cxx new file mode 100644 index 0000000000000000000000000000000000000000..093e690739de5eba191f11ac0dba3c48e93ae64d --- /dev/null +++ b/Modules/Applications/AppClassification/app/otbSampleAugmentation.cxx @@ -0,0 +1,270 @@ +/* + * 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 "otbOGRDataSourceWrapper.h" +#include "otbSampleAugmentationFilter.h" + +namespace otb +{ +namespace Wrapper +{ + + +class SampleAugmentation : public Application +{ +public: + /** Standard class typedefs. */ + typedef SampleAugmentation Self; + typedef Application Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + /** Standard macro */ + itkNewMacro(Self); + + itkTypeMacro(SampleAugmentation, otb::Application); + + /** Filters typedef */ + using FilterType = otb::SampleAugmentationFilter; + using SampleType = FilterType::SampleType; + using SampleVectorType = FilterType::SampleVectorType; + +private: + SampleAugmentation() {} + + void DoInit() override + { + SetName("SampleAugmentation"); + SetDescription("Generates synthetic samples from a sample data file."); + + // Documentation + SetDocName("Sample Augmentation"); + SetDocLongDescription("The application takes a sample data file as " + "generated by the SampleExtraction application and " + "generates synthetic samples to increase the number of " + "available samples."); + SetDocLimitations("None"); + SetDocAuthors("OTB-Team"); + SetDocSeeAlso(" "); + + AddDocTag(Tags::Learning); + + AddParameter(ParameterType_InputFilename, "in", "Input samples"); + SetParameterDescription("in","Vector data file containing samples (OGR format)"); + + AddParameter(ParameterType_OutputFilename, "out", "Output samples"); + SetParameterDescription("out","Output vector data file storing new samples" + "(OGR format)."); + + AddParameter(ParameterType_ListView, "field", "Field Name"); + SetParameterDescription("field","Name of the field carrying the class name in the input vectors."); + SetListViewSingleSelectionMode("field",true); + + AddParameter(ParameterType_Int, "layer", "Layer Index"); + SetParameterDescription("layer", "Layer index to read in the input vector file."); + MandatoryOff("layer"); + SetDefaultParameterInt("layer",0); + + AddParameter(ParameterType_Int, "label", "Label of the class to be augmented"); + SetParameterDescription("label", "Label of the class of the input file for which " + "new samples will be generated."); + SetDefaultParameterInt("label",1); + + AddParameter(ParameterType_Int, "samples", "Number of generated samples"); + SetParameterDescription("samples", "Number of synthetic samples that will " + "be generated."); + SetDefaultParameterInt("samples",100); + + AddParameter(ParameterType_ListView, "exclude", "Field names for excluded features."); + SetParameterDescription("exclude", + "List of field names in the input vector data that will not be generated in the output file."); + + AddParameter(ParameterType_Choice, "strategy", "Augmentation strategy"); + + AddChoice("strategy.replicate","Replicate input samples"); + SetParameterDescription("strategy.replicate","The new samples are generated " + "by replicating input samples which are randomly " + "selected with replacement."); + + AddChoice("strategy.jitter","Jitter input samples"); + SetParameterDescription("strategy.jitter","The new samples are generated " + "by adding gaussian noise to input samples which are " + "randomly selected with replacement."); + AddParameter(ParameterType_Float, "strategy.jitter.stdfactor", + "Factor for dividing the standard deviation of each feature"); + SetParameterDescription("strategy.jitter.stdfactor", + "The noise added to the input samples will have the " + "standard deviation of the input features divided " + "by the value of this parameter. "); + SetDefaultParameterFloat("strategy.jitter.stdfactor",10); + + AddChoice("strategy.smote","Smote input samples"); + SetParameterDescription("strategy.smote","The new samples are generated " + "by using the SMOTE algorithm (http://dx.doi.org/10.1613/jair.953) " + "on input samples which are " + "randomly selected with replacement."); + AddParameter(ParameterType_Int, "strategy.smote.neighbors", + "Number of nearest neighbors."); + SetParameterDescription("strategy.smote.neighbors", + "Number of nearest neighbors to be used in the " + "SMOTE algorithm"); + SetDefaultParameterFloat("strategy.smote.neighbors", 5); + + AddRANDParameter("seed"); + MandatoryOff("seed"); + + // Doc example parameter settings + SetDocExampleParameterValue("in", "samples.sqlite"); + SetDocExampleParameterValue("field", "class"); + SetDocExampleParameterValue("label", "3"); + SetDocExampleParameterValue("samples", "100"); + SetDocExampleParameterValue("out","augmented_samples.sqlite"); + SetDocExampleParameterValue( "exclude", "OGC_FID name class originfid" ); + SetDocExampleParameterValue("strategy", "smote"); + SetDocExampleParameterValue("strategy.smote.neighbors", "5"); + + SetOfficialDocLink(); + } + + void DoUpdateParameters() override + { + if ( HasValue("in") ) + { + std::string vectorFile = GetParameterString("in"); + ogr::DataSource::Pointer ogrDS = + ogr::DataSource::New(vectorFile, ogr::DataSource::Modes::Read); + ogr::Layer layer = ogrDS->GetLayer(this->GetParameterInt("layer")); + ogr::Feature feature = layer.ogr().GetNextFeature(); + + ClearChoices("exclude"); + ClearChoices("field"); + + for(int iField=0; iField<feature.ogr().GetFieldCount(); iField++) + { + std::string key, item = feature.ogr().GetFieldDefnRef(iField)->GetNameRef(); + key = item; + std::string::iterator end = std::remove_if(key.begin(),key.end(), + [](auto c){return !std::isalnum(c);}); + std::transform(key.begin(), end, key.begin(), tolower); + + OGRFieldType fieldType = feature.ogr().GetFieldDefnRef(iField)->GetType(); + + if(fieldType == OFTString || fieldType == OFTInteger || ogr::version_proxy::IsOFTInteger64(fieldType)) + { + std::string tmpKey="field."+key.substr(0, end - key.begin()); + AddChoice(tmpKey,item); + } + if( fieldType == OFTInteger || ogr::version_proxy::IsOFTInteger64( fieldType ) || fieldType == OFTReal ) + { + std::string tmpKey = "exclude." + key.substr( 0, static_cast<unsigned long>( end - key.begin() ) ); + AddChoice( tmpKey, item ); + } + } + } + } + + void DoExecute() override + { + ogr::DataSource::Pointer vectors; + ogr::DataSource::Pointer output; + vectors = ogr::DataSource::New(this->GetParameterString("in")); + output = ogr::DataSource::New(this->GetParameterString("out"), + ogr::DataSource::Modes::Overwrite); + + // Retrieve the field name + std::vector<int> selectedCFieldIdx = GetSelectedItems("field"); + + if(selectedCFieldIdx.empty()) + { + otbAppLogFATAL(<<"No field has been selected for data labelling!"); + } + + std::vector<std::string> cFieldNames = GetChoiceNames("field"); + std::string fieldName = cFieldNames[selectedCFieldIdx.front()]; + + std::vector<std::string> excludedFields = + GetExcludedFields( GetChoiceNames( "exclude" ), + GetSelectedItems( "exclude" )); + for(const auto& ef : excludedFields) + otbAppLogINFO("Excluding feature " << ef << '\n'); + + int seed = std::time(nullptr); + if(IsParameterEnabled("seed")) seed = this->GetParameterInt("seed"); + + + FilterType::Pointer filter = FilterType::New(); + filter->SetInput(vectors); + filter->SetLayer(this->GetParameterInt("layer")); + filter->SetNumberOfSamples(this->GetParameterInt("samples")); + filter->SetOutputSamples(output); + filter->SetClassFieldName(fieldName); + filter->SetLabel(this->GetParameterInt("label")); + filter->SetExcludedFields(excludedFields); + filter->SetSeed(seed); + switch (this->GetParameterInt("strategy")) + { + // replicate + case 0: + { + otbAppLogINFO("Augmentation strategy : replicate"); + filter->SetStrategy(FilterType::Strategy::Replicate); + } + break; + // jitter + case 1: + { + otbAppLogINFO("Augmentation strategy : jitter"); + filter->SetStrategy(FilterType::Strategy::Jitter); + filter->SetStdFactor(this->GetParameterFloat("strategy.jitter.stdfactor")); + } + break; + case 2: + { + otbAppLogINFO("Augmentation strategy : smote"); + filter->SetStrategy(FilterType::Strategy::Smote); + filter->SetSmoteNeighbors(this->GetParameterInt("strategy.smote.neighbors")); + } + break; + } + filter->Update(); + output->SyncToDisk(); + } + + + std::vector<std::string> GetExcludedFields(const std::vector<std::string>& fieldNames, + const std::vector<int>& selectedIdx) + { + auto nbFeatures = static_cast<unsigned int>(selectedIdx.size()); + std::vector<std::string> result( nbFeatures ); + for( unsigned int i = 0; i < nbFeatures; ++i ) + { + result[i] = fieldNames[selectedIdx[i]]; + } + return result; + } + +}; + +} // end of namespace Wrapper +} // end of namespace otb + +OTB_APPLICATION_EXPORT(otb::Wrapper::SampleAugmentation) diff --git a/Modules/Applications/AppClassification/app/otbSampleExtraction.cxx b/Modules/Applications/AppClassification/app/otbSampleExtraction.cxx index a9c2b07fbde06f288706a67fb9b7b999cb7de076..2c48308344b02b27744c3c362a07603ceb348c47 100644 --- a/Modules/Applications/AppClassification/app/otbSampleExtraction.cxx +++ b/Modules/Applications/AppClassification/app/otbSampleExtraction.cxx @@ -53,7 +53,7 @@ public: private: SampleExtraction() {} - void DoInit() + void DoInit() override { SetName("SampleExtraction"); SetDescription("Extracts samples values from an image."); @@ -89,7 +89,7 @@ private: AddParameter(ParameterType_String, "outfield.prefix.name", "Output field prefix"); SetParameterDescription("outfield.prefix.name","Prefix used to form the field names that" "will contain the extracted values."); - SetParameterString("outfield.prefix.name", "value_", false); + SetParameterString("outfield.prefix.name", "value_"); AddChoice("outfield.list","Use the given name list"); SetParameterDescription("outfield.list","Use the given name list"); @@ -119,7 +119,7 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() + void DoUpdateParameters() override { if ( HasValue("vec") ) { @@ -149,7 +149,7 @@ private: } } - void DoExecute() + void DoExecute() override { ogr::DataSource::Pointer vectors; ogr::DataSource::Pointer output; diff --git a/Modules/Applications/AppClassification/app/otbSampleSelection.cxx b/Modules/Applications/AppClassification/app/otbSampleSelection.cxx index b41f20470f2ac4fe5d2321011cc6c806a66ebb03..681e0630774f278c714121d51bd433f3b627dc9a 100644 --- a/Modules/Applications/AppClassification/app/otbSampleSelection.cxx +++ b/Modules/Applications/AppClassification/app/otbSampleSelection.cxx @@ -80,7 +80,7 @@ private: m_RateCalculator = RateCalculatorType::New(); } - void DoInit() + void DoInit() override { SetName("SampleSelection"); SetDescription("Selects samples from a training vector data set."); @@ -200,7 +200,7 @@ private: SetParameterDescription("strategy.all","Take all samples"); // Default strategy : smallest - SetParameterString("strategy","smallest", false); + SetParameterString("strategy","smallest"); AddParameter(ParameterType_ListView, "field", "Field Name"); SetParameterDescription("field","Name of the field carrying the class name in the input vectors."); @@ -227,7 +227,7 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() + void DoUpdateParameters() override { if ( HasValue("vec") ) { @@ -257,7 +257,7 @@ private: } } - void DoExecute() + void DoExecute() override { // Clear state m_RateCalculator->ClearRates(); diff --git a/Modules/Applications/AppClassification/app/otbTrainImagesClassifier.cxx b/Modules/Applications/AppClassification/app/otbTrainImagesClassifier.cxx index a76f81dce73870d4d6820f4931999d5253e9fed5..26b11023f6e5e1a441b5b592d991d2a601b210e8 100644 --- a/Modules/Applications/AppClassification/app/otbTrainImagesClassifier.cxx +++ b/Modules/Applications/AppClassification/app/otbTrainImagesClassifier.cxx @@ -35,7 +35,7 @@ public: itkNewMacro( Self ) itkTypeMacro( Self, Superclass ) - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName( "TrainImagesClassifier" ); SetDescription( "Train a classifier from multiple pairs of images and training vector data." ); @@ -86,7 +86,7 @@ public: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { if( HasValue( "io.vd" ) && IsParameterEnabled( "io.vd" )) { @@ -157,7 +157,7 @@ public: } - void DoExecute() + void DoExecute() override { TrainFileNamesHandler fileNames; std::vector<std::string> vectorFileList; @@ -205,7 +205,7 @@ public: TrainModel( imageList, fileNames.sampleTrainOutputs, fileNames.sampleValidOutputs ); // cleanup - if( IsParameterEnabled( "cleanup" ) ) + if( GetParameterInt( "cleanup" ) ) { otbAppLogINFO( <<"Final clean-up ..." ); fileNames.clear(); @@ -217,7 +217,7 @@ private : void UpdatePolygonClassStatisticsParameters() { std::vector<std::string> vectorFileList = GetParameterStringList( "io.vd" ); - GetInternalApplication( "polystat" )->SetParameterString( "vec", vectorFileList[0], false ); + GetInternalApplication( "polystat" )->SetParameterString( "vec", vectorFileList[0]); UpdateInternalParameters( "polystat" ); } diff --git a/Modules/Applications/AppClassification/app/otbTrainRegression.cxx b/Modules/Applications/AppClassification/app/otbTrainRegression.cxx index 690d03da1de8ad2a9388f36f11e1775d5ce9ce8f..90009e31523c4283eea4b819c9fced52e52d82d7 100644 --- a/Modules/Applications/AppClassification/app/otbTrainRegression.cxx +++ b/Modules/Applications/AppClassification/app/otbTrainRegression.cxx @@ -98,7 +98,7 @@ protected: private: -void DoInit() ITK_OVERRIDE +void DoInit() override { SetName("TrainRegression"); SetDescription( @@ -183,7 +183,7 @@ void DoInit() ITK_OVERRIDE SetParameterDescription( "sample.vtr" , "Ratio between training and validation samples (0.0 = all training, " "1.0 = all validation) (default = 0.5)."); - SetParameterFloat( "sample.vtr" , 0.5 , false ); + SetParameterFloat( "sample.vtr" , 0.5); Superclass::DoInit(); @@ -198,7 +198,7 @@ void DoInit() ITK_OVERRIDE SetOfficialDocLink(); } -void DoUpdateParameters() ITK_OVERRIDE +void DoUpdateParameters() override { if (HasValue("io.csv") && IsParameterEnabled("io.csv")) { @@ -279,7 +279,7 @@ void ParseCSVPredictors(std::string path, ListSampleType* outputList) ifs.close(); } -void DoExecute() ITK_OVERRIDE +void DoExecute() override { GetLogger()->Debug("Entering DoExecute\n"); //Create training and validation for list samples and label list samples diff --git a/Modules/Applications/AppClassification/app/otbTrainVectorClassifier.cxx b/Modules/Applications/AppClassification/app/otbTrainVectorClassifier.cxx index f37eb3020f4934146d3ad4cfa9d402c19d058026..4243c21766ac88d1ca1f915bf1def5018ec5af8b 100644 --- a/Modules/Applications/AppClassification/app/otbTrainVectorClassifier.cxx +++ b/Modules/Applications/AppClassification/app/otbTrainVectorClassifier.cxx @@ -54,7 +54,7 @@ public: typedef ContingencyTableType::Pointer ContingencyTablePointerType; protected: - void DoInit() + void DoInit() override { SetName( "TrainVectorClassifier" ); SetDescription( "Train a classifier based on labeled geometries and a " @@ -73,12 +73,12 @@ protected: Superclass::DoInit(); } - void DoUpdateParameters() + void DoUpdateParameters() override { Superclass::DoUpdateParameters(); } - void DoExecute() + void DoExecute() override { m_FeaturesInfo.SetClassFieldNames( GetChoiceNames( "cfield" ), GetSelectedItems( "cfield" ) ); @@ -112,7 +112,7 @@ protected: contingencyTableCalculator->Compute(performanceLabeledListSample->Begin(), performanceLabeledListSample->End(),predictedListSample->Begin(), predictedListSample->End()); - if(IsParameterEnabled("v")) + if(GetParameterInt("v")) { otbAppLogINFO( "Training performances:" ); otbAppLogINFO(<<"Contingency table: reference labels (rows) vs. produced labels (cols)\n" diff --git a/Modules/Applications/AppClassification/app/otbVectorClassifier.cxx b/Modules/Applications/AppClassification/app/otbVectorClassifier.cxx index b8ecd88713eb985b25f935741268a17f8f955edf..abc87f0098e65f42903a1bbb57a7a0bdc527df64 100644 --- a/Modules/Applications/AppClassification/app/otbVectorClassifier.cxx +++ b/Modules/Applications/AppClassification/app/otbVectorClassifier.cxx @@ -80,13 +80,13 @@ public: typedef itk::Statistics::ListSample<InputSampleType> ListSampleType; typedef otb::Statistics::ShiftScaleSampleListFilter<ListSampleType, ListSampleType> ShiftScaleFilterType; - ~VectorClassifier() ITK_OVERRIDE + ~VectorClassifier() override { MachineLearningModelFactoryType::CleanFactories(); } private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("VectorClassifier"); SetDescription("Performs a classification of the input vector data according to a model file."); @@ -124,13 +124,13 @@ private: "Only geometries with this field available will be taken into account.\n" "The field is added either in the input file (if 'out' off) or in the output file.\n" "Caution, the 'cfield' must not exist in the input file if you are updating the file."); - SetParameterString("cfield","predicted", false); + SetParameterString("cfield","predicted"); AddParameter(ParameterType_ListView, "feat", "Field names to be calculated."); SetParameterDescription("feat","List of field names in the input vector data used as features for training. " "Put the same field names as the TrainVectorClassifier application."); - AddParameter(ParameterType_Empty, "confmap", "Confidence map"); + AddParameter(ParameterType_Bool, "confmap", "Confidence map"); SetParameterDescription( "confmap", "Confidence map of the produced classification. " "The confidence index depends on the model : \n" " - LibSVM : difference between the two highest probabilities " @@ -145,7 +145,6 @@ private: " * RandomForest : Confidence (proportion of votes for the majority class). " "Margin (normalized difference of the votes of the 2 majority classes) is not available for now.\n" " * SVM : distance to margin (only works for 2-class models).\n"); - MandatoryOff("confmap"); AddParameter(ParameterType_OutputFilename, "out", "Output vector data file containing class labels"); SetParameterDescription("out","Output vector data file storing sample values (OGR format)." @@ -163,7 +162,7 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { if ( HasValue("in") ) { @@ -197,7 +196,7 @@ private: } } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { clock_t tic = clock(); @@ -271,10 +270,10 @@ private: ConfidenceListSampleType::Pointer quality; - bool computeConfidenceMap(IsParameterEnabled("confmap") && m_Model->HasConfidenceIndex() + bool computeConfidenceMap(GetParameterInt("confmap") && m_Model->HasConfidenceIndex() && !m_Model->GetRegressionMode()); - if (!m_Model->HasConfidenceIndex() && IsParameterEnabled("confmap")) + if (!m_Model->HasConfidenceIndex() && GetParameterInt("confmap")) { otbAppLogWARNING("Confidence map requested but the classifier doesn't support it!"); } diff --git a/Modules/Applications/AppClassification/app/otbVectorDataDSValidation.cxx b/Modules/Applications/AppClassification/app/otbVectorDataDSValidation.cxx index 11e75421ae78dee6bd5e17de99aefa91fe660ee4..61a8908f9cab792791aa2c7a5ca54837ff57a1c8 100644 --- a/Modules/Applications/AppClassification/app/otbVectorDataDSValidation.cxx +++ b/Modules/Applications/AppClassification/app/otbVectorDataDSValidation.cxx @@ -58,7 +58,7 @@ public: itkTypeMacro(VectorDataDSValidation, otb::Application); private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("VectorDataDSValidation"); SetDescription("Vector data validation based on the fusion of features using Dempster-Shafer evidence theory framework."); @@ -87,12 +87,12 @@ private: AddParameter(ParameterType_String, "cri", "Criterion"); SetParameterDescription("cri", "Dempster Shafer criterion (by default (belief+plausibility)/2)"); MandatoryOff("cri"); - SetParameterString("cri", "((Belief + Plausibility)/2.)", false); + SetParameterString("cri", "((Belief + Plausibility)/2.)"); AddParameter(ParameterType_Float, "thd", "Criterion threshold"); SetParameterDescription("thd", "Criterion threshold (default 0.5)"); MandatoryOff("thd"); - SetParameterFloat("thd",0.5, false); + SetParameterFloat("thd",0.5); AddParameter(ParameterType_OutputVectorData, "out", "Output Vector Data"); SetParameterDescription("out", "Output VectorData containing only the validated samples"); @@ -106,7 +106,7 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do here : all parameters are independent @@ -116,7 +116,7 @@ private: } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { //Read the vector data diff --git a/Modules/Applications/AppClassification/include/otbLearningApplicationBase.h b/Modules/Applications/AppClassification/include/otbLearningApplicationBase.h index e71be6402140e11227b8c4373dc14cfdb896c7b6..72e87a389ce73951061e25bd0c0760d26ef5afa0 100644 --- a/Modules/Applications/AppClassification/include/otbLearningApplicationBase.h +++ b/Modules/Applications/AppClassification/include/otbLearningApplicationBase.h @@ -121,7 +121,7 @@ public: protected: LearningApplicationBase(); - ~LearningApplicationBase() ITK_OVERRIDE; + ~LearningApplicationBase() override; /** Generic method to train and save the machine learning model. This method * uses specific train methods depending on the chosen model.*/ @@ -135,7 +135,7 @@ protected: std::string modelPath); /** Init method that creates all the parameters for machine learning models */ - void DoInit() ITK_OVERRIDE; + void DoInit() override; /** Flag to switch between classification and regression mode. * False by default, child classes may change it in their constructor */ diff --git a/Modules/Applications/AppClassification/include/otbTrainBoost.txx b/Modules/Applications/AppClassification/include/otbTrainBoost.txx index 46cbbbd12560b459c95a3264116ac189b75398fc..f971a2a6294bf42561db2bd799c895877482f254 100644 --- a/Modules/Applications/AppClassification/include/otbTrainBoost.txx +++ b/Modules/Applications/AppClassification/include/otbTrainBoost.txx @@ -61,16 +61,16 @@ namespace Wrapper SetParameterDescription("classifier.boost.t.gentle", "A modified version of the Real Adaboost algorithm, using Newton stepping " "rather than exact optimization at each step."); - SetParameterString("classifier.boost.t", "real", false); + SetParameterString("classifier.boost.t", "real"); SetParameterDescription("classifier.boost.t", "Type of Boosting algorithm."); //Do not expose SplitCriteria //WeakCount AddParameter(ParameterType_Int, "classifier.boost.w", "Weak count"); - SetParameterInt("classifier.boost.w",100, false); + SetParameterInt("classifier.boost.w",100); SetParameterDescription("classifier.boost.w","The number of weak classifiers."); //WeightTrimRate AddParameter(ParameterType_Float, "classifier.boost.r", "Weight Trim Rate"); - SetParameterFloat("classifier.boost.r",0.95, false); + SetParameterFloat("classifier.boost.r",0.95); SetParameterDescription("classifier.boost.r", "A threshold between 0 and 1 used to save computational time. " "Samples with summary weight <= (1 - weight_trim_rate) do not participate in" @@ -78,7 +78,7 @@ namespace Wrapper "functionality."); //MaxDepth : Not sure that this parameter has to be exposed. AddParameter(ParameterType_Int, "classifier.boost.m", "Maximum depth of the tree"); - SetParameterInt("classifier.boost.m",1, false); + SetParameterInt("classifier.boost.m",1); SetParameterDescription("classifier.boost.m","Maximum depth of the tree."); } diff --git a/Modules/Applications/AppClassification/include/otbTrainDecisionTree.txx b/Modules/Applications/AppClassification/include/otbTrainDecisionTree.txx index 9803a91a7a8a03f46f9b5bd8443d3d12a112926a..01284b5826247a8f07aaabe429d3bd06034e95ed 100644 --- a/Modules/Applications/AppClassification/include/otbTrainDecisionTree.txx +++ b/Modules/Applications/AppClassification/include/otbTrainDecisionTree.txx @@ -40,9 +40,9 @@ LearningApplicationBase<TInputValue,TOutputValue> //MaxDepth AddParameter(ParameterType_Int, "classifier.dt.max", "Maximum depth of the tree"); #ifdef OTB_OPENCV_3 - SetParameterInt("classifier.dt.max",10, false); + SetParameterInt("classifier.dt.max",10); #else - SetParameterInt("classifier.dt.max",65535, false); + SetParameterInt("classifier.dt.max",65535); #endif SetParameterDescription("classifier.dt.max", "The training algorithm attempts to split each node while its depth is smaller " @@ -51,14 +51,14 @@ LearningApplicationBase<TInputValue,TOutputValue> //MinSampleCount AddParameter(ParameterType_Int, "classifier.dt.min", "Minimum number of samples in each node"); - SetParameterInt("classifier.dt.min",10, false); + SetParameterInt("classifier.dt.min",10); SetParameterDescription("classifier.dt.min", "If the number of samples in a node is smaller " "than this parameter, then this node will not be split."); //RegressionAccuracy AddParameter(ParameterType_Float, "classifier.dt.ra", "Termination criteria for regression tree"); - SetParameterFloat("classifier.dt.ra",0.01, false); + SetParameterFloat("classifier.dt.ra",0.01); SetParameterDescription("classifier.dt.ra", "If all absolute differences between an estimated value in a node " "and the values of the train samples in this node are smaller than this " @@ -72,7 +72,7 @@ LearningApplicationBase<TInputValue,TOutputValue> AddParameter(ParameterType_Int, "classifier.dt.cat", "Cluster possible values of a categorical variable into K <= cat clusters to find a " "suboptimal split"); - SetParameterInt("classifier.dt.cat",10, false); + SetParameterInt("classifier.dt.cat",10); SetParameterDescription("classifier.dt.cat", "Cluster possible values of a categorical variable into K <= cat clusters to find a " "suboptimal split."); @@ -81,22 +81,22 @@ LearningApplicationBase<TInputValue,TOutputValue> AddParameter(ParameterType_Int, "classifier.dt.f", "K-fold cross-validations"); #ifdef OTB_OPENCV_3 // disable cross validation by default (crash in opencv 3.2) - SetParameterInt("classifier.dt.f",0, false); + SetParameterInt("classifier.dt.f",0); #else - SetParameterInt("classifier.dt.f",10, false); + SetParameterInt("classifier.dt.f",10); #endif SetParameterDescription("classifier.dt.f", "If cv_folds > 1, then it prunes a tree with K-fold cross-validation where K " "is equal to cv_folds."); //Use1seRule - AddParameter(ParameterType_Empty, "classifier.dt.r", "Set Use1seRule flag to false"); + AddParameter(ParameterType_Bool, "classifier.dt.r", "Set Use1seRule flag to false"); SetParameterDescription("classifier.dt.r", "If true, then a pruning will be harsher. This will make a tree more compact and more " "resistant to the training data noise but a bit less accurate."); //TruncatePrunedTree - AddParameter(ParameterType_Empty, "classifier.dt.t", "Set TruncatePrunedTree flag to false"); + AddParameter(ParameterType_Bool, "classifier.dt.t", "Set TruncatePrunedTree flag to false"); SetParameterDescription("classifier.dt.t", "If true, then pruned branches are physically removed from the tree."); @@ -121,11 +121,11 @@ LearningApplicationBase<TInputValue,TOutputValue> classifier->SetRegressionAccuracy(GetParameterFloat("classifier.dt.ra")); classifier->SetMaxCategories(GetParameterInt("classifier.dt.cat")); classifier->SetCVFolds(GetParameterInt("classifier.dt.f")); - if (IsParameterEnabled("classifier.dt.r")) + if (GetParameterInt("classifier.dt.r")) { classifier->SetUse1seRule(false); } - if (IsParameterEnabled("classifier.dt.t")) + if (GetParameterInt("classifier.dt.t")) { classifier->SetTruncatePrunedTree(false); } diff --git a/Modules/Applications/AppClassification/include/otbTrainGradientBoostedTree.txx b/Modules/Applications/AppClassification/include/otbTrainGradientBoostedTree.txx index 7f69ac9338011c00f3c11164f3a4a1a362a65c65..30a3fde157d6bc04ca60524373333d088254b549 100644 --- a/Modules/Applications/AppClassification/include/otbTrainGradientBoostedTree.txx +++ b/Modules/Applications/AppClassification/include/otbTrainGradientBoostedTree.txx @@ -52,7 +52,7 @@ LearningApplicationBase<TInputValue,TOutputValue> //WeakCount AddParameter(ParameterType_Int, "classifier.gbt.w", "Number of boosting algorithm iterations"); - SetParameterInt("classifier.gbt.w",200, false); + SetParameterInt("classifier.gbt.w",200); SetParameterDescription( "classifier.gbt.w", "Number \"w\" of boosting algorithm iterations, with w*K being the total number of trees in " @@ -60,20 +60,20 @@ LearningApplicationBase<TInputValue,TOutputValue> //Shrinkage AddParameter(ParameterType_Float, "classifier.gbt.s", "Regularization parameter"); - SetParameterFloat("classifier.gbt.s",0.01, false); + SetParameterFloat("classifier.gbt.s",0.01); SetParameterDescription("classifier.gbt.s", "Regularization parameter."); //SubSamplePortion AddParameter(ParameterType_Float, "classifier.gbt.p", "Portion of the whole training set used for each algorithm iteration"); - SetParameterFloat("classifier.gbt.p",0.8, false); + SetParameterFloat("classifier.gbt.p",0.8); SetParameterDescription( "classifier.gbt.p", "Portion of the whole training set used for each algorithm iteration. The subset is generated randomly."); //MaxDepth AddParameter(ParameterType_Int, "classifier.gbt.max", "Maximum depth of the tree"); - SetParameterInt("classifier.gbt.max",3, false); + SetParameterInt("classifier.gbt.max",3); SetParameterDescription( "classifier.gbt.max", "The training algorithm attempts to split each node while its depth is smaller than the maximum " "possible depth of the tree. The actual depth may be smaller if the other termination criteria are met, and/or " diff --git a/Modules/Applications/AppClassification/include/otbTrainImagesBase.txx b/Modules/Applications/AppClassification/include/otbTrainImagesBase.txx index a646cea9539fc3c8b6dcc5f013a6996ed7bf2a9d..15d599176a00bace3665bf780ec4ea55ad197b4d 100644 --- a/Modules/Applications/AppClassification/include/otbTrainImagesBase.txx +++ b/Modules/Applications/AppClassification/include/otbTrainImagesBase.txx @@ -39,11 +39,10 @@ void TrainImagesBase::InitIO() SetParameterDescription( "io.vd", "A list of vector data to select the training samples." ); MandatoryOn( "io.vd" ); - AddParameter( ParameterType_Empty, "cleanup", "Temporary files cleaning" ); - EnableParameter( "cleanup" ); + AddParameter( ParameterType_Bool, "cleanup", "Temporary files cleaning" ); SetParameterDescription( "cleanup", "If activated, the application will try to clean all temporary files it created" ); - MandatoryOff( "cleanup" ); + SetParameterInt( "cleanup", 1); } void TrainImagesBase::InitSampling() @@ -79,7 +78,7 @@ void TrainImagesBase::InitSampling() AddParameter( ParameterType_Float, "sample.vtr", "Training and validation sample ratio" ); SetParameterDescription( "sample.vtr", "Ratio between training and validation samples (0.0 = all training, 1.0 = " "all validation) (default = 0.5)." ); - SetParameterFloat( "sample.vtr", 0.5, false ); + SetParameterFloat( "sample.vtr", 0.5); SetMaximumParameterFloatValue( "sample.vtr", 1.0 ); SetMinimumParameterFloatValue( "sample.vtr", 0.0 ); @@ -160,8 +159,8 @@ void TrainImagesBase::ComputePolygonStatistics(FloatVectorImageListType *imageLi for( unsigned int i = 0; i < nbImages; i++ ) { GetInternalApplication( "polystat" )->SetParameterInputImage( "in", imageList->GetNthElement( i ) ); - GetInternalApplication( "polystat" )->SetParameterString( "vec", vectorFileNames[i], false ); - GetInternalApplication( "polystat" )->SetParameterString( "out", statisticsFileNames[i], false ); + GetInternalApplication( "polystat" )->SetParameterString( "vec", vectorFileNames[i]); + GetInternalApplication( "polystat" )->SetParameterString( "out", statisticsFileNames[i]); ExecuteInternal( "polystat" ); } } @@ -170,7 +169,7 @@ void TrainImagesBase::ComputePolygonStatistics(FloatVectorImageListType *imageLi TrainImagesBase::SamplingRates TrainImagesBase::ComputeFinalMaximumSamplingRates(bool dedicatedValidation) { SamplingRates rates; - GetInternalApplication( "rates" )->SetParameterString( "mim", "proportional", false ); + GetInternalApplication( "rates" )->SetParameterString( "mim", "proportional"); double vtr = GetParameterFloat( "sample.vtr" ); long mt = GetParameterInt( "sample.mt" ); long mv = GetParameterInt( "sample.mv" ); @@ -224,11 +223,11 @@ void TrainImagesBase::ComputeSamplingRate(const std::vector<std::string> &statis const std::string &ratesFileName, long maximum) { // Sampling rates - GetInternalApplication( "rates" )->SetParameterStringList( "il", statisticsFileNames, false ); - GetInternalApplication( "rates" )->SetParameterString( "out", ratesFileName, false ); + GetInternalApplication( "rates" )->SetParameterStringList( "il", statisticsFileNames); + GetInternalApplication( "rates" )->SetParameterString( "out", ratesFileName); if( GetParameterInt( "sample.bm" ) != 0 ) { - GetInternalApplication( "rates" )->SetParameterString( "strategy", "smallest", false ); + GetInternalApplication( "rates" )->SetParameterString( "strategy", "smallest"); } else { @@ -236,12 +235,12 @@ void TrainImagesBase::ComputeSamplingRate(const std::vector<std::string> &statis { std::ostringstream oss; oss << maximum; - GetInternalApplication( "rates" )->SetParameterString( "strategy", "constant", false ); - GetInternalApplication( "rates" )->SetParameterString( "strategy.constant.nb", oss.str(), false ); + GetInternalApplication( "rates" )->SetParameterString( "strategy", "constant"); + GetInternalApplication( "rates" )->SetParameterString( "strategy.constant.nb", oss.str()); } else { - GetInternalApplication( "rates" )->SetParameterString( "strategy", "all", false ); + GetInternalApplication( "rates" )->SetParameterString( "strategy", "all"); } } ExecuteInternal( "rates" ); @@ -251,9 +250,9 @@ void TrainImagesBase::TrainModel(FloatVectorImageListType *imageList, const std::vector<std::string> &sampleTrainFileNames, const std::vector<std::string> &sampleValidationFileNames) { - GetInternalApplication( "training" )->SetParameterStringList( "io.vd", sampleTrainFileNames, false ); + GetInternalApplication( "training" )->SetParameterStringList( "io.vd", sampleTrainFileNames); if( !sampleValidationFileNames.empty() ) - GetInternalApplication( "training" )->SetParameterStringList( "valid.vd", sampleValidationFileNames, false ); + GetInternalApplication( "training" )->SetParameterStringList( "valid.vd", sampleValidationFileNames); UpdateInternalParameters( "training" ); // set field names @@ -266,7 +265,7 @@ TrainImagesBase::TrainModel(FloatVectorImageListType *imageList, const std::vect oss << i; selectedNames.push_back( "value_" + oss.str() ); } - GetInternalApplication( "training" )->SetParameterStringList( "feat", selectedNames, false ); + GetInternalApplication( "training" )->SetParameterStringList( "feat", selectedNames); ExecuteInternal( "training" ); } @@ -276,38 +275,38 @@ void TrainImagesBase::SelectAndExtractSamples(FloatVectorImageType *image, std:: std::string selectedField) { GetInternalApplication( "select" )->SetParameterInputImage( "in", image ); - GetInternalApplication( "select" )->SetParameterString( "out", sampleFileName, false ); + GetInternalApplication( "select" )->SetParameterString( "out", sampleFileName); // Change the selection strategy based on selected sampling strategy switch( strategy ) { // case GEOMETRIC: -// GetInternalApplication( "select" )->SetParameterString( "sampler", "random", false ); -// GetInternalApplication( "select" )->SetParameterString( "strategy", "percent", false ); +// GetInternalApplication( "select" )->SetParameterString( "sampler", "random"); +// GetInternalApplication( "select" )->SetParameterString( "strategy", "percent"); // GetInternalApplication( "select" )->SetParameterFloat( "strategy.percent.p", -// GetParameterFloat( "sample.percent" ), false ); +// GetParameterFloat( "sample.percent" )); // break; case CLASS: default: - GetInternalApplication( "select" )->SetParameterString( "vec", vectorFileName, false ); - GetInternalApplication( "select" )->SetParameterString( "instats", statisticsFileName, false ); - GetInternalApplication( "select" )->SetParameterString( "sampler", "periodic", false ); + GetInternalApplication( "select" )->SetParameterString( "vec", vectorFileName); + GetInternalApplication( "select" )->SetParameterString( "instats", statisticsFileName); + GetInternalApplication( "select" )->SetParameterString( "sampler", "periodic"); GetInternalApplication( "select" )->SetParameterInt( "sampler.periodic.jitter", 50 ); - GetInternalApplication( "select" )->SetParameterString( "strategy", "byclass", false ); - GetInternalApplication( "select" )->SetParameterString( "strategy.byclass.in", ratesFileName, false ); + GetInternalApplication( "select" )->SetParameterString( "strategy", "byclass"); + GetInternalApplication( "select" )->SetParameterString( "strategy.byclass.in", ratesFileName); break; } // select sample positions ExecuteInternal( "select" ); - GetInternalApplication( "extraction" )->SetParameterString( "vec", sampleFileName, false ); + GetInternalApplication( "extraction" )->SetParameterString( "vec", sampleFileName); UpdateInternalParameters( "extraction" ); if( !selectedField.empty() ) - GetInternalApplication( "extraction" )->SetParameterString( "field", selectedField, false ); + GetInternalApplication( "extraction" )->SetParameterString( "field", selectedField); - GetInternalApplication( "extraction" )->SetParameterString( "outfield", "prefix", false ); - GetInternalApplication( "extraction" )->SetParameterString( "outfield.prefix.name", "value_", false ); + GetInternalApplication( "extraction" )->SetParameterString( "outfield", "prefix"); + GetInternalApplication( "extraction" )->SetParameterString( "outfield.prefix.name", "value_"); // extract sample descriptors ExecuteInternal( "extraction" ); diff --git a/Modules/Applications/AppClassification/include/otbTrainKNN.txx b/Modules/Applications/AppClassification/include/otbTrainKNN.txx index 2ff93632bcd9b399e6d399f16cfe1fa33ed2cc6d..71e02215dbbf94e4b6d014ae89e92f11ac1389fb 100644 --- a/Modules/Applications/AppClassification/include/otbTrainKNN.txx +++ b/Modules/Applications/AppClassification/include/otbTrainKNN.txx @@ -39,7 +39,7 @@ namespace Wrapper //K parameter AddParameter(ParameterType_Int, "classifier.knn.k", "Number of Neighbors"); - SetParameterInt("classifier.knn.k",32, false); + SetParameterInt("classifier.knn.k",32); SetParameterDescription("classifier.knn.k","The number of neighbors to use."); if (this->m_RegressionFlag) diff --git a/Modules/Applications/AppClassification/include/otbTrainLibSVM.txx b/Modules/Applications/AppClassification/include/otbTrainLibSVM.txx index 18b9f4d39a8926abf645647bec30273d2b98e3b5..0e34ad78c40f9e7465f1de7a88e5bef08bfa1fa0 100644 --- a/Modules/Applications/AppClassification/include/otbTrainLibSVM.txx +++ b/Modules/Applications/AppClassification/include/otbTrainLibSVM.txx @@ -54,7 +54,7 @@ namespace Wrapper SetParameterDescription("classifier.libsvm.k.sigmoid", "The kernel is a hyperbolic tangente function of the vectors."); - SetParameterString("classifier.libsvm.k", "linear", false); + SetParameterString("classifier.libsvm.k", "linear"); SetParameterDescription("classifier.libsvm.k", "SVM Kernel Type."); AddParameter(ParameterType_Choice, "classifier.libsvm.m", "SVM Model Type"); SetParameterDescription("classifier.libsvm.m", "Type of SVM formulation."); @@ -67,7 +67,7 @@ namespace Wrapper "multiplier C is used "); AddChoice("classifier.libsvm.m.nusvr", "Nu Support Vector Regression"); - SetParameterString("classifier.libsvm.m", "epssvr", false); + SetParameterString("classifier.libsvm.m", "epssvr"); SetParameterDescription("classifier.libsvm.m.nusvr", "Same as the epsilon regression except that this time the bounded " "parameter nu is used instead of epsilon"); @@ -89,33 +89,32 @@ namespace Wrapper SetParameterDescription("classifier.libsvm.m.oneclass", "All the training data are from the same class, SVM builds a boundary " "that separates the class from the rest of the feature space."); - SetParameterString("classifier.libsvm.m", "csvc", false); + SetParameterString("classifier.libsvm.m", "csvc"); } AddParameter(ParameterType_Float, "classifier.libsvm.c", "Cost parameter C"); - SetParameterFloat("classifier.libsvm.c",1.0, false); + SetParameterFloat("classifier.libsvm.c",1.0); SetParameterDescription("classifier.libsvm.c", "SVM models have a cost parameter C (1 by default) to control the " "trade-off between training errors and forcing rigid margins."); AddParameter(ParameterType_Float, "classifier.libsvm.nu", "Cost parameter Nu"); - SetParameterFloat("classifier.libsvm.nu",0.5, false); + SetParameterFloat("classifier.libsvm.nu",0.5); SetParameterDescription("classifier.libsvm.nu", "Cost parameter Nu, in the range 0..1, the larger the value, " "the smoother the decision."); // It seems that it miss a nu parameter for the nu-SVM use. - AddParameter(ParameterType_Empty, "classifier.libsvm.opt", "Parameters optimization"); - MandatoryOff("classifier.libsvm.opt"); + AddParameter(ParameterType_Bool, "classifier.libsvm.opt", "Parameters optimization"); SetParameterDescription("classifier.libsvm.opt", "SVM parameters optimization flag."); - AddParameter(ParameterType_Empty, "classifier.libsvm.prob", "Probability estimation"); - MandatoryOff("classifier.libsvm.prob"); + + AddParameter(ParameterType_Bool, "classifier.libsvm.prob", "Probability estimation"); SetParameterDescription("classifier.libsvm.prob", "Probability estimation flag."); if (this->m_RegressionFlag) { AddParameter(ParameterType_Float, "classifier.libsvm.eps", "Epsilon"); - SetParameterFloat("classifier.libsvm.eps",1e-3, false); + SetParameterFloat("classifier.libsvm.eps",1e-3); SetParameterDescription("classifier.libsvm.eps", "The distance between feature vectors from the training set and " "the fitting hyper-plane must be less than Epsilon. For outliers" @@ -137,14 +136,8 @@ namespace Wrapper libSVMClassifier->SetTargetListSample(trainingLabeledListSample); //SVM Option //TODO : Add other options ? - if (IsParameterEnabled("classifier.libsvm.opt")) - { - libSVMClassifier->SetParameterOptimization(true); - } - if (IsParameterEnabled("classifier.libsvm.prob")) - { - libSVMClassifier->SetDoProbabilityEstimates(true); - } + libSVMClassifier->SetParameterOptimization(GetParameterInt("classifier.libsvm.opt")); + libSVMClassifier->SetDoProbabilityEstimates(GetParameterInt("classifier.libsvm.prob")); libSVMClassifier->SetNu(GetParameterFloat("classifier.libsvm.nu")); libSVMClassifier->SetC(GetParameterFloat("classifier.libsvm.c")); diff --git a/Modules/Applications/AppClassification/include/otbTrainNeuralNetwork.txx b/Modules/Applications/AppClassification/include/otbTrainNeuralNetwork.txx index 4081034a5f0fead34f03f3f0325f0ad6294b5582..33a4930ac4f2458b0aa0153d7f762529b7fa280a 100644 --- a/Modules/Applications/AppClassification/include/otbTrainNeuralNetwork.txx +++ b/Modules/Applications/AppClassification/include/otbTrainNeuralNetwork.txx @@ -52,7 +52,7 @@ LearningApplicationBase<TInputValue,TOutputValue> "take into account the magnitude of the partial derivative (coordinate " "of the gradient) but only its sign."); - SetParameterString("classifier.ann.t", "reg", false); + SetParameterString("classifier.ann.t", "reg"); SetParameterDescription("classifier.ann.t", "Type of training method for the multilayer perceptron (MLP) neural network."); @@ -73,7 +73,7 @@ LearningApplicationBase<TInputValue,TOutputValue> AddChoice("classifier.ann.f.ident", "Identity function"); AddChoice("classifier.ann.f.sig", "Symmetrical Sigmoid function"); AddChoice("classifier.ann.f.gau", "Gaussian function (Not completely supported)"); - SetParameterString("classifier.ann.f", "sig", false); + SetParameterString("classifier.ann.f", "sig"); SetParameterDescription("classifier.ann.f", "This function determine whether the output of the node is positive or not " "depending on the output of the transfert function."); @@ -81,21 +81,21 @@ LearningApplicationBase<TInputValue,TOutputValue> //Alpha AddParameter(ParameterType_Float, "classifier.ann.a", "Alpha parameter of the activation function"); - SetParameterFloat("classifier.ann.a",1., false); + SetParameterFloat("classifier.ann.a",1.); SetParameterDescription("classifier.ann.a", "Alpha parameter of the activation function (used only with sigmoid and gaussian functions)."); //Beta AddParameter(ParameterType_Float, "classifier.ann.b", "Beta parameter of the activation function"); - SetParameterFloat("classifier.ann.b",1., false); + SetParameterFloat("classifier.ann.b",1.); SetParameterDescription("classifier.ann.b", "Beta parameter of the activation function (used only with sigmoid and gaussian functions)."); //BackPropDWScale AddParameter(ParameterType_Float, "classifier.ann.bpdw", "Strength of the weight gradient term in the BACKPROP method"); - SetParameterFloat("classifier.ann.bpdw",0.1, false); + SetParameterFloat("classifier.ann.bpdw",0.1); SetParameterDescription("classifier.ann.bpdw", "Strength of the weight gradient term in the BACKPROP method. The " "recommended value is about 0.1."); @@ -103,7 +103,7 @@ LearningApplicationBase<TInputValue,TOutputValue> //BackPropMomentScale AddParameter(ParameterType_Float, "classifier.ann.bpms", "Strength of the momentum term (the difference between weights on the 2 previous iterations)"); - SetParameterFloat("classifier.ann.bpms",0.1, false); + SetParameterFloat("classifier.ann.bpms",0.1); SetParameterDescription("classifier.ann.bpms", "Strength of the momentum term (the difference between weights on the 2 previous " "iterations). This parameter provides some inertia to smooth the random " @@ -113,14 +113,14 @@ LearningApplicationBase<TInputValue,TOutputValue> //RegPropDW0 AddParameter(ParameterType_Float, "classifier.ann.rdw", "Initial value Delta_0 of update-values Delta_{ij} in RPROP method"); - SetParameterFloat("classifier.ann.rdw",0.1, false); + SetParameterFloat("classifier.ann.rdw",0.1); SetParameterDescription("classifier.ann.rdw", "Initial value Delta_0 of update-values Delta_{ij} in RPROP method (default = 0.1)."); //RegPropDWMin AddParameter(ParameterType_Float, "classifier.ann.rdwm", "Update-values lower limit Delta_{min} in RPROP method"); - SetParameterFloat("classifier.ann.rdwm",1e-7, false); + SetParameterFloat("classifier.ann.rdwm",1e-7); SetParameterDescription("classifier.ann.rdwm", "Update-values lower limit Delta_{min} in RPROP method. It must be positive " "(default = 1e-7)."); @@ -139,20 +139,20 @@ LearningApplicationBase<TInputValue,TOutputValue> AddChoice("classifier.ann.term.all", "Max. iterations + Epsilon"); SetParameterDescription("classifier.ann.term.all", "Both termination criteria are used. Training stop at the first reached"); - SetParameterString("classifier.ann.term", "all", false); + SetParameterString("classifier.ann.term", "all"); SetParameterDescription("classifier.ann.term", "Termination criteria."); //Epsilon AddParameter(ParameterType_Float, "classifier.ann.eps", "Epsilon value used in the Termination criteria"); - SetParameterFloat("classifier.ann.eps",0.01, false); + SetParameterFloat("classifier.ann.eps",0.01); SetParameterDescription("classifier.ann.eps", "Epsilon value used in the Termination criteria."); //MaxIter AddParameter(ParameterType_Int, "classifier.ann.iter", "Maximum number of iterations used in the Termination criteria"); - SetParameterInt("classifier.ann.iter",1000, false); + SetParameterInt("classifier.ann.iter",1000); SetParameterDescription("classifier.ann.iter", "Maximum number of iterations used in the Termination criteria."); diff --git a/Modules/Applications/AppClassification/include/otbTrainRandomForests.txx b/Modules/Applications/AppClassification/include/otbTrainRandomForests.txx index f557731207aa92509c7f156fcfbdf794ebaf9d03..e19777a6861c793150c652cdb9d695cde874a618 100644 --- a/Modules/Applications/AppClassification/include/otbTrainRandomForests.txx +++ b/Modules/Applications/AppClassification/include/otbTrainRandomForests.txx @@ -39,7 +39,7 @@ LearningApplicationBase<TInputValue,TOutputValue> "See complete documentation here \\url{http://docs.opencv.org/modules/ml/doc/random_trees.html}."); //MaxDepth AddParameter(ParameterType_Int, "classifier.rf.max", "Maximum depth of the tree"); - SetParameterInt("classifier.rf.max",5, false); + SetParameterInt("classifier.rf.max",5); SetParameterDescription( "classifier.rf.max", "The depth of the tree. A low value will likely underfit and conversely a high value will likely overfit. " @@ -47,14 +47,14 @@ LearningApplicationBase<TInputValue,TOutputValue> //MinSampleCount AddParameter(ParameterType_Int, "classifier.rf.min", "Minimum number of samples in each node"); - SetParameterInt("classifier.rf.min",10, false); + SetParameterInt("classifier.rf.min",10); SetParameterDescription( "classifier.rf.min", "If the number of samples in a node is smaller than this parameter, " "then the node will not be split. A reasonable value is a small percentage of the total data e.g. 1 percent."); //RegressionAccuracy AddParameter(ParameterType_Float, "classifier.rf.ra", "Termination Criteria for regression tree"); - SetParameterFloat("classifier.rf.ra",0., false); + SetParameterFloat("classifier.rf.ra",0.); SetParameterDescription("classifier.rf.ra", "If all absolute differences between an estimated value in a node " "and the values of the train samples in this node are smaller than this regression accuracy parameter, " "then the node will not be split."); @@ -66,7 +66,7 @@ LearningApplicationBase<TInputValue,TOutputValue> //MaxNumberOfCategories AddParameter(ParameterType_Int, "classifier.rf.cat", "Cluster possible values of a categorical variable into K <= cat clusters to find a suboptimal split"); - SetParameterInt("classifier.rf.cat",10, false); + SetParameterInt("classifier.rf.cat",10); SetParameterDescription( "classifier.rf.cat", "Cluster possible values of a categorical variable into K <= cat clusters to find a suboptimal split."); @@ -78,7 +78,7 @@ LearningApplicationBase<TInputValue,TOutputValue> //MaxNumberOfVariables AddParameter(ParameterType_Int, "classifier.rf.var", "Size of the randomly selected subset of features at each tree node"); - SetParameterInt("classifier.rf.var",0, false); + SetParameterInt("classifier.rf.var",0); SetParameterDescription( "classifier.rf.var", "The size of the subset of features, randomly selected at each tree node, that are used to find the best split(s). " @@ -87,7 +87,7 @@ LearningApplicationBase<TInputValue,TOutputValue> //MaxNumberOfTrees AddParameter(ParameterType_Int, "classifier.rf.nbtrees", "Maximum number of trees in the forest"); - SetParameterInt("classifier.rf.nbtrees",100, false); + SetParameterInt("classifier.rf.nbtrees",100); SetParameterDescription( "classifier.rf.nbtrees", "The maximum number of trees in the forest. Typically, the more trees you have, the better the accuracy. " @@ -97,7 +97,7 @@ LearningApplicationBase<TInputValue,TOutputValue> //ForestAccuracy AddParameter(ParameterType_Float, "classifier.rf.acc", "Sufficient accuracy (OOB error)"); - SetParameterFloat("classifier.rf.acc",0.01, false); + SetParameterFloat("classifier.rf.acc",0.01); SetParameterDescription("classifier.rf.acc","Sufficient accuracy (OOB error)."); diff --git a/Modules/Applications/AppClassification/include/otbTrainSVM.txx b/Modules/Applications/AppClassification/include/otbTrainSVM.txx index ac9524faa26de64a04e4a98b008b101f225cc8ca..ab5138ba33027df907b4d908622250404e2dd1a0 100644 --- a/Modules/Applications/AppClassification/include/otbTrainSVM.txx +++ b/Modules/Applications/AppClassification/include/otbTrainSVM.txx @@ -42,14 +42,14 @@ namespace Wrapper { AddChoice("classifier.svm.m.epssvr", "Epsilon Support Vector Regression"); AddChoice("classifier.svm.m.nusvr", "Nu Support Vector Regression"); - SetParameterString("classifier.svm.m", "epssvr", false); + SetParameterString("classifier.svm.m", "epssvr"); } else { AddChoice("classifier.svm.m.csvc", "C support vector classification"); AddChoice("classifier.svm.m.nusvc", "Nu support vector classification"); AddChoice("classifier.svm.m.oneclass", "Distribution estimation (One Class SVM)"); - SetParameterString("classifier.svm.m", "csvc", false); + SetParameterString("classifier.svm.m", "csvc"); } AddParameter(ParameterType_Choice, "classifier.svm.k", "SVM Kernel Type"); AddChoice("classifier.svm.k.linear", "Linear"); @@ -57,22 +57,22 @@ namespace Wrapper AddChoice("classifier.svm.k.rbf", "Gaussian radial basis function"); AddChoice("classifier.svm.k.poly", "Polynomial"); AddChoice("classifier.svm.k.sigmoid", "Sigmoid"); - SetParameterString("classifier.svm.k", "linear", false); + SetParameterString("classifier.svm.k", "linear"); SetParameterDescription("classifier.svm.k", "SVM Kernel Type."); AddParameter(ParameterType_Float, "classifier.svm.c", "Cost parameter C"); - SetParameterFloat("classifier.svm.c",1.0, false); + SetParameterFloat("classifier.svm.c",1.0); SetParameterDescription("classifier.svm.c", "SVM models have a cost parameter C (1 by default) to control the trade-off" " between training errors and forcing rigid margins."); AddParameter(ParameterType_Float, "classifier.svm.nu", "Parameter nu of a SVM optimization problem (NU_SVC / ONE_CLASS)"); - SetParameterFloat("classifier.svm.nu",0.0, false); + SetParameterFloat("classifier.svm.nu",0.0); SetParameterDescription("classifier.svm.nu", "Parameter nu of a SVM optimization problem."); if (this->m_RegressionFlag) { AddParameter(ParameterType_Float, "classifier.svm.p", "Parameter epsilon of a SVM optimization problem (EPS_SVR)"); - SetParameterFloat("classifier.svm.p",1.0, false); + SetParameterFloat("classifier.svm.p",1.0); SetParameterDescription("classifier.svm.p", "Parameter epsilon of a SVM optimization problem (EPS_SVR)."); AddParameter(ParameterType_Choice, @@ -87,34 +87,33 @@ namespace Wrapper "Stops when either iteration or epsilon criteria is true"); AddParameter(ParameterType_Float, "classifier.svm.iter", "Maximum iteration"); - SetParameterFloat("classifier.svm.iter",1000, false); + SetParameterFloat("classifier.svm.iter",1000); SetParameterDescription("classifier.svm.iter", "Maximum number of iterations (corresponds to the termination criteria 'iter')."); AddParameter(ParameterType_Float, "classifier.svm.eps", "Epsilon accuracy threshold"); - SetParameterFloat("classifier.svm.eps",FLT_EPSILON, false); + SetParameterFloat("classifier.svm.eps",FLT_EPSILON); SetParameterDescription("classifier.svm.eps", "Epsilon accuracy (corresponds to the termination criteria 'eps')."); } AddParameter(ParameterType_Float, "classifier.svm.coef0", "Parameter coef0 of a kernel function (POLY / SIGMOID)"); - SetParameterFloat("classifier.svm.coef0",0.0, false); + SetParameterFloat("classifier.svm.coef0",0.0); SetParameterDescription("classifier.svm.coef0", "Parameter coef0 of a kernel function (POLY / SIGMOID)."); AddParameter(ParameterType_Float, "classifier.svm.gamma", "Parameter gamma of a kernel function (POLY / RBF / SIGMOID)"); - SetParameterFloat("classifier.svm.gamma",1.0, false); + SetParameterFloat("classifier.svm.gamma",1.0); SetParameterDescription("classifier.svm.gamma", "Parameter gamma of a kernel function (POLY / RBF / SIGMOID)."); AddParameter(ParameterType_Float, "classifier.svm.degree", "Parameter degree of a kernel function (POLY)"); - SetParameterFloat("classifier.svm.degree",1.0, false); + SetParameterFloat("classifier.svm.degree",1.0); SetParameterDescription("classifier.svm.degree", "Parameter degree of a kernel function (POLY)."); - AddParameter(ParameterType_Empty, "classifier.svm.opt", + AddParameter(ParameterType_Bool, "classifier.svm.opt", "Parameters optimization"); - MandatoryOff("classifier.svm.opt"); SetParameterDescription("classifier.svm.opt", "SVM parameters optimization flag.\n" "-If set to True, then the optimal SVM parameters will be estimated. " "Parameters are considered optimal by OpenCV when the cross-validation estimate of " @@ -229,23 +228,20 @@ namespace Wrapper SVMClassifier->SetCoef0(GetParameterFloat("classifier.svm.coef0")); SVMClassifier->SetGamma(GetParameterFloat("classifier.svm.gamma")); SVMClassifier->SetDegree(GetParameterFloat("classifier.svm.degree")); - if (IsParameterEnabled("classifier.svm.opt")) - { - SVMClassifier->SetParameterOptimization(true); - } + SVMClassifier->SetParameterOptimization(GetParameterInt("classifier.svm.opt")); SVMClassifier->Train(); SVMClassifier->Save(modelPath); // Update the displayed parameters in the GUI after the training process, for further use of them - SetParameterFloat("classifier.svm.c",static_cast<float> (SVMClassifier->GetOutputC()), false); - SetParameterFloat("classifier.svm.nu",static_cast<float> (SVMClassifier->GetOutputNu()), false); + SetParameterFloat("classifier.svm.c",static_cast<float> (SVMClassifier->GetOutputC())); + SetParameterFloat("classifier.svm.nu",static_cast<float> (SVMClassifier->GetOutputNu())); if (this->m_RegressionFlag) { - SetParameterFloat("classifier.svm.p",static_cast<float> (SVMClassifier->GetOutputP()), false); + SetParameterFloat("classifier.svm.p",static_cast<float> (SVMClassifier->GetOutputP())); } - SetParameterFloat("classifier.svm.coef0",static_cast<float> (SVMClassifier->GetOutputCoef0()), false); - SetParameterFloat("classifier.svm.gamma",static_cast<float> (SVMClassifier->GetOutputGamma()), false); - SetParameterFloat("classifier.svm.degree",static_cast<float> (SVMClassifier->GetOutputDegree()), false); + SetParameterFloat("classifier.svm.coef0",static_cast<float> (SVMClassifier->GetOutputCoef0())); + SetParameterFloat("classifier.svm.gamma",static_cast<float> (SVMClassifier->GetOutputGamma())); + SetParameterFloat("classifier.svm.degree",static_cast<float> (SVMClassifier->GetOutputDegree())); } } //end namespace wrapper diff --git a/Modules/Applications/AppClassification/include/otbTrainSharkRandomForests.txx b/Modules/Applications/AppClassification/include/otbTrainSharkRandomForests.txx index f2c2f97dc24bc77d798e533eadb09ef9354298d0..fa7ef6646ac634a1dca47dbc5741743ad201ccee 100644 --- a/Modules/Applications/AppClassification/include/otbTrainSharkRandomForests.txx +++ b/Modules/Applications/AppClassification/include/otbTrainSharkRandomForests.txx @@ -43,7 +43,7 @@ LearningApplicationBase<TInputValue,TOutputValue> //MaxNumberOfTrees AddParameter(ParameterType_Int, "classifier.sharkrf.nbtrees", "Maximum number of trees in the forest"); - SetParameterInt("classifier.sharkrf.nbtrees",100, false); + SetParameterInt("classifier.sharkrf.nbtrees",100); SetParameterDescription( "classifier.sharkrf.nbtrees", "The maximum number of trees in the forest. Typically, the more trees you have, the better the accuracy. " @@ -53,7 +53,7 @@ LearningApplicationBase<TInputValue,TOutputValue> //NodeSize AddParameter(ParameterType_Int, "classifier.sharkrf.nodesize", "Min size of the node for a split"); - SetParameterInt("classifier.sharkrf.nodesize",25, false); + SetParameterInt("classifier.sharkrf.nodesize",25); SetParameterDescription( "classifier.sharkrf.nodesize", "If the number of samples in a node is smaller than this parameter, " @@ -61,7 +61,7 @@ LearningApplicationBase<TInputValue,TOutputValue> //MTry AddParameter(ParameterType_Int, "classifier.sharkrf.mtry", "Number of features tested at each node"); - SetParameterInt("classifier.sharkrf.mtry",0, false); + SetParameterInt("classifier.sharkrf.mtry",0); SetParameterDescription( "classifier.sharkrf.mtry", "The number of features (variables) which will be tested at each node in " @@ -71,7 +71,7 @@ LearningApplicationBase<TInputValue,TOutputValue> //OOB Ratio AddParameter(ParameterType_Float, "classifier.sharkrf.oobr", "Out of bound ratio"); - SetParameterFloat("classifier.sharkrf.oobr",0.66, false); + SetParameterFloat("classifier.sharkrf.oobr",0.66); SetParameterDescription("classifier.sharkrf.oobr", "Set the fraction of the original training dataset to use as the out of bag sample." "A good default value is 0.66. "); diff --git a/Modules/Applications/AppClassification/include/otbTrainVectorBase.h b/Modules/Applications/AppClassification/include/otbTrainVectorBase.h index 9bcf6df3862b1d85e0f026de44fc98dee34885e5..300b1b5879d05d7682fb944649e3f12bc482a882 100644 --- a/Modules/Applications/AppClassification/include/otbTrainVectorBase.h +++ b/Modules/Applications/AppClassification/include/otbTrainVectorBase.h @@ -180,9 +180,9 @@ protected: TargetListSampleType::Pointer m_PredictedList; FeaturesInfo m_FeaturesInfo; - void DoInit() ITK_OVERRIDE; - void DoUpdateParameters() ITK_OVERRIDE; - void DoExecute() ITK_OVERRIDE; + void DoInit() override; + void DoUpdateParameters() override; + void DoExecute() override; }; diff --git a/Modules/Applications/AppClassification/include/otbTrainVectorBase.txx b/Modules/Applications/AppClassification/include/otbTrainVectorBase.txx index 2c3575c2ead20381438f9f66d5cd9c65c1723132..453db3f3f02c29a23533ef26db67fb71d8cb6411 100644 --- a/Modules/Applications/AppClassification/include/otbTrainVectorBase.txx +++ b/Modules/Applications/AppClassification/include/otbTrainVectorBase.txx @@ -91,10 +91,9 @@ void TrainVectorBase::DoInit() "The contingency table is output when we unsupervised algorithms is used otherwise the confusion matrix is output." ); MandatoryOff( "io.confmatout" ); - AddParameter(ParameterType_Empty, "v", "Verbose mode"); - EnableParameter("v"); + AddParameter(ParameterType_Bool, "v", "Verbose mode"); SetParameterDescription("v", "Verbose mode, display the contingency table result."); - MandatoryOff("v"); + SetParameterInt("v", 1); // Doc example parameter settings SetDocExampleParameterValue( "io.vd", "vectorData.shp" ); diff --git a/Modules/Applications/AppClassification/test/CMakeLists.txt b/Modules/Applications/AppClassification/test/CMakeLists.txt index fae1474266db959a03a6accd01b14b43f00f4ec0..e848e08ed8fca6c2f1bd840c6adc16816b716bc6 100644 --- a/Modules/Applications/AppClassification/test/CMakeLists.txt +++ b/Modules/Applications/AppClassification/test/CMakeLists.txt @@ -972,3 +972,39 @@ otb_test_application( ${OTBAPP_BASELINE_FILES}/apTvClMultiImageSamplingRate_out_3.csv ${TEMP}/apTvClMultiImageSamplingRate_out_3.csv ) + +#------------ SampleAgmentation TESTS ---------------- +otb_test_application(NAME apTvClSampleAugmentationReplicate + APP SampleAugmentation + OPTIONS -in ${INPUTDATA}/Classification/apTvClSampleExtractionOut.sqlite + -field class + -label 3 + -samples 100 + -out ${TEMP}/apTvClSampleAugmentationReplicate.sqlite + -exclude originfid + -strategy replicate + ) + +otb_test_application(NAME apTvClSampleAugmentationJitter + APP SampleAugmentation + OPTIONS -in ${INPUTDATA}/Classification/apTvClSampleExtractionOut.sqlite + -field class + -label 3 + -samples 100 + -out ${TEMP}/apTvClSampleAugmentationJitter.sqlite + -exclude originfid + -strategy jitter + -strategy.jitter.stdfactor 10 + ) + +otb_test_application(NAME apTvClSampleAugmentationSmote + APP SampleAugmentation + OPTIONS -in ${INPUTDATA}/Classification/apTvClSampleExtractionOut.sqlite + -field class + -label 3 + -samples 100 + -out ${TEMP}/apTvClSampleAugmentationSmote.sqlite + -exclude originfid + -strategy smote + -strategy.smote.neighbors 5 + ) diff --git a/Modules/Applications/AppDescriptors/app/otbHomologousPointsExtraction.cxx b/Modules/Applications/AppDescriptors/app/otbHomologousPointsExtraction.cxx index 073e53727f6b194b27e49887c4cf8c70469c537f..4c9e3bbc45375ce478142d263477395a70fdaae7 100644 --- a/Modules/Applications/AppDescriptors/app/otbHomologousPointsExtraction.cxx +++ b/Modules/Applications/AppDescriptors/app/otbHomologousPointsExtraction.cxx @@ -80,7 +80,7 @@ public: itkTypeMacro(HomologousPointsExtraction, otb::Wrapper::Application); private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("HomologousPointsExtraction"); SetDocName("Homologous points extraction"); @@ -135,10 +135,8 @@ private: SetMinimumParameterFloatValue("threshold",0.0); SetDefaultParameterFloat("threshold",0.6); - AddParameter(ParameterType_Empty,"backmatching","Use back-matching to filter matches."); + AddParameter(ParameterType_Bool,"backmatching","Use back-matching to filter matches."); SetParameterDescription("backmatching","If set to true, matches should be consistent in both ways."); - MandatoryOff("backmatching"); - DisableParameter("backmatching"); AddParameter(ParameterType_Choice,"mode","Keypoints search mode"); @@ -177,10 +175,10 @@ private: SetParameterDescription("precision","Estimated precision of the colocalisation function in pixels"); SetDefaultParameterFloat("precision",0.); - AddParameter(ParameterType_Empty,"mfilter","Filter points according to geographical or sensor based colocalisation"); + AddParameter(ParameterType_Bool,"mfilter","Filter points according to geographical or sensor based colocalisation"); SetParameterDescription("mfilter","If enabled, this option allows one to filter matches according to colocalisation from sensor or geographical information, using the given tolerancy expressed in pixels"); - AddParameter(ParameterType_Empty,"2wgs84","If enabled, points from second image will be exported in WGS84"); + AddParameter(ParameterType_Bool,"2wgs84","If enabled, points from second image will be exported in WGS84"); // Elevation ElevationParametersHandler::AddElevationParameters(this, "elev"); @@ -202,7 +200,7 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { } @@ -251,7 +249,7 @@ private: matchingFilter->SetInput1(surf1->GetOutput()); matchingFilter->SetInput2(surf2->GetOutput()); matchingFilter->SetDistanceThreshold(GetParameterFloat("threshold")); - matchingFilter->SetUseBackMatching(IsParameterEnabled("backmatching")); + matchingFilter->SetUseBackMatching(GetParameterInt("backmatching")); } try @@ -276,7 +274,7 @@ private: bool filtered = false; - if(IsParameterEnabled("mfilter")) + if(GetParameterInt("mfilter")) { pprime1 = rsTransform->TransformPoint(point1); error = vcl_sqrt((point2[0]-pprime1[0])*(point2[0]-pprime1[0])+(point2[1]-pprime1[1])*(point2[1]-pprime1[1])); @@ -289,7 +287,7 @@ private: if(!filtered) { - if(IsParameterEnabled("2wgs84")) + if(GetParameterInt("2wgs84")) { pprime2 = rsTransform2ToWGS84->TransformPoint(point2); @@ -326,7 +324,7 @@ private: } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { OGRMultiLineString mls; diff --git a/Modules/Applications/AppDimensionalityReduction/app/CMakeLists.txt b/Modules/Applications/AppDimensionalityReduction/app/CMakeLists.txt index 63c4a2105666056a75d4f7b02a8a1dbac75a2e50..6e57a26cb83cf691166b6f1e8e98dff98a21c578 100644 --- a/Modules/Applications/AppDimensionalityReduction/app/CMakeLists.txt +++ b/Modules/Applications/AppDimensionalityReduction/app/CMakeLists.txt @@ -22,3 +22,22 @@ otb_create_application( NAME DimensionalityReduction SOURCES otbDimensionalityReduction.cxx LINK_LIBRARIES ${${otb-module}_LIBRARIES}) + +OTB_CREATE_APPLICATION( + NAME TrainDimensionalityReduction + SOURCES otbTrainDimensionalityReduction.cxx + LINK_LIBRARIES ${${otb-module}_LIBRARIES} ${OTBCommon_LIBRARIES} ${OTBITK_LIBRARIES} ${OTBBoost_LIBRARIES} ${OTBShark_LIBRARIES} + ) + +OTB_CREATE_APPLICATION( + NAME ImageDimensionalityReduction + SOURCES otbImageDimensionalityReduction.cxx + LINK_LIBRARIES ${${otb-module}_LIBRARIES} ${OTBCommon_LIBRARIES} ${OTBITK_LIBRARIES} ${OTBBoost_LIBRARIES} ${OTBShark_LIBRARIES} + ) + +OTB_CREATE_APPLICATION( + NAME VectorDimensionalityReduction + SOURCES otbVectorDimensionalityReduction.cxx + LINK_LIBRARIES ${${otb-module}_LIBRARIES} ${OTBCommon_LIBRARIES} ${OTBITK_LIBRARIES} ${OTBBoost_LIBRARIES} ${OTBShark_LIBRARIES} + ) + diff --git a/Modules/Applications/AppDimensionalityReduction/app/otbDimensionalityReduction.cxx b/Modules/Applications/AppDimensionalityReduction/app/otbDimensionalityReduction.cxx index 686b78bb4cad81a332c249358998b59523fabdc6..2721c1232c42ab7cf208430bb8548dbde859ca74 100644 --- a/Modules/Applications/AppDimensionalityReduction/app/otbDimensionalityReduction.cxx +++ b/Modules/Applications/AppDimensionalityReduction/app/otbDimensionalityReduction.cxx @@ -89,7 +89,7 @@ public: ; private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("DimensionalityReduction"); SetDescription("Perform Dimension reduction of the input image."); @@ -164,9 +164,8 @@ private: MandatoryOff("nbcomp"); SetMinimumParameterIntValue("nbcomp", 0); - AddParameter(ParameterType_Empty, "normalize", "Normalize."); + AddParameter(ParameterType_Bool, "normalize", "Normalize."); SetParameterDescription("normalize", "center AND reduce data before Dimensionality reduction."); - MandatoryOff("normalize"); AddParameter(ParameterType_OutputFilename, "outmatrix", "Transformation matrix output (text format)"); SetParameterDescription("outmatrix", "Filename to store the transformation matrix (csv format)"); @@ -184,7 +183,7 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { if (HasValue("in")) { @@ -196,7 +195,7 @@ private: unsigned int nbComp = static_cast<unsigned int> (GetParameterInt("nbcomp")); if (nbComp > nbComponents) { - SetParameterInt("nbcomp",nbComponents, false); + SetParameterInt("nbcomp",nbComponents); otbAppLogINFO( << "number of selected components can't exceed image dimension : "<<nbComponents ); } @@ -206,14 +205,14 @@ private: if (this->GetParameterString("outinv").size()!= 0) { otbAppLogWARNING(<<"This application only provides the forward transform for the MAF method."); - this->SetParameterString("outinv", "", false); + this->SetParameterString("outinv", ""); } this->DisableParameter("outinv"); if (this->GetParameterString("outmatrix").size()!= 0) { otbAppLogWARNING(<<"No transformation matrix available for MAF method."); - this->SetParameterString("outmatrix", "", false); + this->SetParameterString("outmatrix", ""); } this->DisableParameter("outmatrix"); @@ -225,19 +224,19 @@ private: unsigned int nbComp = static_cast<unsigned int> (GetParameterInt("nbcomp")); if ((nbComp != 0) && (nbComp != nbComponents)) { - SetParameterInt("nbcomp",nbComponents, false); + SetParameterInt("nbcomp",nbComponents); otbAppLogINFO( << "all components are kept when using MAF filter method."); } } } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { // Get Parameters int nbComp = GetParameterInt("nbcomp"); - bool normalize = IsParameterEnabled("normalize"); + bool normalize = GetParameterInt("normalize"); bool rescale = IsParameterEnabled("rescale"); bool invTransform = HasValue("outinv") && IsParameterEnabled("outinv"); diff --git a/Modules/Applications/AppDimensionalityReduction/app/otbImageDimensionalityReduction.cxx b/Modules/Applications/AppDimensionalityReduction/app/otbImageDimensionalityReduction.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d9dd8e8816fec2cce2502a81b624a59ce33817ab --- /dev/null +++ b/Modules/Applications/AppDimensionalityReduction/app/otbImageDimensionalityReduction.cxx @@ -0,0 +1,273 @@ +/* + * 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 "itkUnaryFunctorImageFilter.h" +#include "otbChangeLabelImageFilter.h" +#include "otbStandardWriterWatcher.h" +#include "otbStatisticsXMLFileReader.h" +#include "otbShiftScaleVectorImageFilter.h" +#include "otbImageDimensionalityReductionFilter.h" +#include "otbMultiToMonoChannelExtractROI.h" +#include "otbImageToVectorImageCastFilter.h" +#include "otbDimensionalityReductionModelFactory.h" + +namespace otb +{ +namespace Functor +{ +/** + * simple affine function : y = ax+b + */ +template<class TInput, class TOutput> +class AffineFunctor +{ +public: + typedef double InternalType; + + // constructor + AffineFunctor() : m_A(1.0),m_B(0.0) {} + + // destructor + virtual ~AffineFunctor() {} + + void SetA(InternalType a) + { + m_A = a; + } + + void SetB(InternalType b) + { + m_B = b; + } + + inline TOutput operator()(const TInput & x) const + { + return static_cast<TOutput>( static_cast<InternalType>(x)*m_A + m_B); + } +private: + InternalType m_A; + InternalType m_B; +}; + +} // end of namespace Functor + +namespace Wrapper +{ +/** + * \class ImageDimensionalityReduction + * + * Apply a dimensionality reduction model to an image + */ +class ImageDimensionalityReduction : public Application +{ +public: + /** Standard class typedefs. */ + typedef ImageDimensionalityReduction Self; + typedef Application Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + /** Standard macro */ + itkNewMacro(Self); + + itkTypeMacro(ImageDimensionalityReduction, otb::Application); + + /** Filters typedef */ + typedef UInt8ImageType MaskImageType; + typedef itk::VariableLengthVector< + FloatVectorImageType::InternalPixelType> MeasurementType; + typedef otb::StatisticsXMLFileReader<MeasurementType> StatisticsReader; + typedef otb::ShiftScaleVectorImageFilter< + FloatVectorImageType, FloatVectorImageType> RescalerType; + typedef itk::UnaryFunctorImageFilter< + FloatImageType, + FloatImageType, + otb::Functor::AffineFunctor<float,float> > OutputRescalerType; + typedef otb::ImageDimensionalityReductionFilter< + FloatVectorImageType, + FloatVectorImageType, + MaskImageType> DimensionalityReductionFilterType; + typedef DimensionalityReductionFilterType::Pointer DimensionalityReductionFilterPointerType; + typedef DimensionalityReductionFilterType::ModelType ModelType; + typedef ModelType::Pointer ModelPointerType; + typedef DimensionalityReductionFilterType::ValueType ValueType; + typedef DimensionalityReductionFilterType::LabelType LabelType; + typedef otb::DimensionalityReductionModelFactory< + ValueType, LabelType> DimensionalityReductionModelFactoryType; + +protected: + + ~ImageDimensionalityReduction() override + { + DimensionalityReductionModelFactoryType::CleanFactories(); + } + +private: + void DoInit() override + { + SetName("ImageDimensionalityReduction"); + SetDescription("Performs dimensionality reduction of the input image " + "according to a dimensionality reduction model file."); + + // Documentation + SetDocName("Image Dimensionality Reduction"); + SetDocLongDescription("This application reduces the dimension of an input" + " image, based on a machine learning model file produced by" + " the TrainDimensionalityReduction application. Pixels of the " + "output image will contain the reduced values from" + "the model. The input pixels" + " can be optionally centered and reduced according " + "to the statistics file produced by the " + "ComputeImagesStatistics application. "); + + SetDocLimitations("The input image must contain the feature bands used for" + " the model training. " + "If a statistics file was used during training by the " + "Training application, it is mandatory to use the same " + "statistics file for reduction."); + SetDocAuthors("OTB-Team"); + SetDocSeeAlso("TrainDimensionalityReduction, ComputeImagesStatistics"); + + AddDocTag(Tags::Learning); + + AddParameter(ParameterType_InputImage, "in", "Input Image"); + SetParameterDescription( "in", "The input image to predict."); + + AddParameter(ParameterType_InputImage, "mask", "Input Mask"); + SetParameterDescription( "mask", "The mask allow restricting " + "classification of the input image to the area where mask pixel values " + "are greater than 0."); + MandatoryOff("mask"); + + AddParameter(ParameterType_InputFilename, "model", "Model file"); + SetParameterDescription("model", "A dimensionality reduction model file (produced by " + "TrainRegression application)."); + + AddParameter(ParameterType_InputFilename, "imstat", "Statistics file"); + SetParameterDescription("imstat", "A XML file containing mean and standard" + " deviation to center and reduce samples before prediction " + "(produced by ComputeImagesStatistics application). If this file contains" + "one more bands than the sample size, the last stat of last band will be" + "applied to expand the output predicted value"); + MandatoryOff("imstat"); + + AddParameter(ParameterType_OutputImage, "out", "Output Image"); + SetParameterDescription( "out", "Output image containing reduced values"); + + AddRAMParameter(); + + // Doc example parameter settings + SetDocExampleParameterValue("in", "QB_1_ortho.tif"); + SetDocExampleParameterValue("imstat", "EstimateImageStatisticsQB1.xml"); + SetDocExampleParameterValue("model", "clsvmModelQB1.model"); + SetDocExampleParameterValue("out", "ReducedImageQB1.tif"); + } + + void DoUpdateParameters() override + { + // Nothing to do here : all parameters are independent + } + + void DoExecute() override + { + // Load input image + FloatVectorImageType::Pointer inImage = GetParameterImage("in"); + inImage->UpdateOutputInformation(); + unsigned int nbFeatures = inImage->GetNumberOfComponentsPerPixel(); + + // Load DR model using a factory + otbAppLogINFO("Loading model"); + m_Model = DimensionalityReductionModelFactoryType::CreateDimensionalityReductionModel( + GetParameterString("model"), + DimensionalityReductionModelFactoryType::ReadMode); + + if (m_Model.IsNull()) + { + otbAppLogFATAL(<< "Error when loading model " << GetParameterString("model") + << " : unsupported model type"); + } + + m_Model->Load(GetParameterString("model")); + otbAppLogINFO("Model loaded, dimension = "<< m_Model->GetDimension()); + + // Classify + m_ClassificationFilter = DimensionalityReductionFilterType::New(); + m_ClassificationFilter->SetModel(m_Model); + + FloatVectorImageType::Pointer outputImage = m_ClassificationFilter->GetOutput(); + + // Normalize input image if asked + if( IsParameterEnabled("imstat") && HasValue("imstat") ) + { + otbAppLogINFO("Input image normalization activated."); + // Normalize input image (optional) + StatisticsReader::Pointer statisticsReader = StatisticsReader::New(); + MeasurementType meanMeasurementVector; + MeasurementType stddevMeasurementVector; + m_Rescaler = RescalerType::New(); + + // Load input image statistics + statisticsReader->SetFileName(GetParameterString("imstat")); + meanMeasurementVector = statisticsReader->GetStatisticVectorByName("mean"); + stddevMeasurementVector = statisticsReader->GetStatisticVectorByName("stddev"); + otbAppLogINFO( "mean used: " << meanMeasurementVector ); + otbAppLogINFO( "standard deviation used: " << stddevMeasurementVector ); + if (meanMeasurementVector.Size() != nbFeatures) + { + otbAppLogFATAL("Wrong number of components in statistics file : "<<meanMeasurementVector.Size()); + } + + // Rescale vector image + m_Rescaler->SetScale(stddevMeasurementVector); + m_Rescaler->SetShift(meanMeasurementVector); + m_Rescaler->SetInput(inImage); + + m_ClassificationFilter->SetInput(m_Rescaler->GetOutput()); + } + else + { + otbAppLogINFO("Input image normalization deactivated."); + m_ClassificationFilter->SetInput(inImage); + } + + if(IsParameterEnabled("mask")) + { + otbAppLogINFO("Using input mask"); + // Load mask image and cast into LabeledImageType + MaskImageType::Pointer inMask = GetParameterUInt8Image("mask"); + + m_ClassificationFilter->SetInputMask(inMask); + } + + SetParameterOutputImage<FloatVectorImageType>("out", outputImage); + } + + DimensionalityReductionFilterType::Pointer m_ClassificationFilter; + ModelPointerType m_Model; + RescalerType::Pointer m_Rescaler; + OutputRescalerType::Pointer m_OutRescaler; +}; + +} // end of namespace Wrapper +} // end of namespace otb + +OTB_APPLICATION_EXPORT(otb::Wrapper::ImageDimensionalityReduction) diff --git a/Modules/Applications/AppDimensionalityReduction/app/otbTrainDimensionalityReduction.cxx b/Modules/Applications/AppDimensionalityReduction/app/otbTrainDimensionalityReduction.cxx new file mode 100644 index 0000000000000000000000000000000000000000..34390791ab52ba160523ae8fbbe4e5e0fbbdc241 --- /dev/null +++ b/Modules/Applications/AppDimensionalityReduction/app/otbTrainDimensionalityReduction.cxx @@ -0,0 +1,181 @@ +/* + * 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 "otbOGRDataSourceWrapper.h" +#include "otbOGRFeatureWrapper.h" + +#include "itkVariableLengthVector.h" + +#include "otbShiftScaleSampleListFilter.h" +#include "otbStatisticsXMLFileReader.h" + +#include <fstream> // write the model file + +#include "otbDimensionalityReductionModelFactory.h" +#include "otbTrainDimensionalityReductionApplicationBase.h" + +namespace otb +{ +namespace Wrapper +{ + +/** + * \class TrainDimensionalityReduction + * + * Training of a dimensionality reduction model + */ +class TrainDimensionalityReduction : public TrainDimensionalityReductionApplicationBase<float,float> +{ +public: + typedef TrainDimensionalityReduction Self; + typedef TrainDimensionalityReductionApplicationBase<float, float> Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + itkNewMacro(Self); + itkTypeMacro(TrainDimensionalityReduction, otb::Application); + + typedef Superclass::SampleType SampleType; + typedef Superclass::ListSampleType ListSampleType; + typedef Superclass::SampleImageType SampleImageType; + + typedef float ValueType; + typedef itk::VariableLengthVector<ValueType> MeasurementType; + + typedef otb::StatisticsXMLFileReader<SampleType> StatisticsReader; + + typedef otb::Statistics::ShiftScaleSampleListFilter<ListSampleType, ListSampleType> ShiftScaleFilterType; + + typedef otb::DimensionalityReductionModelFactory<ValueType, ValueType> ModelFactoryType; + +private: + void DoInit() override + { + SetName("TrainDimensionalityReduction"); + SetDescription("Train a dimensionality reduction model"); + + SetDocName("Train Dimensionality Reduction"); + SetDocLongDescription("Trainer for dimensionality reduction algorithms " + "(autoencoders, PCA, SOM). All input samples are used to compute the " + "model, like other machine learning models.\n" + "The model can be used in the ImageDimensionalityReduction and " + "VectorDimensionalityReduction applications."); + + SetDocLimitations("None"); + SetDocAuthors("OTB-Team"); + SetDocSeeAlso("ImageDimensionalityReduction, VectorDimensionalityReduction"); + + AddParameter(ParameterType_Group, "io", "Input and output data"); + SetParameterDescription("io", "This group of parameters allows setting input and output data."); + + AddParameter(ParameterType_InputVectorData, "io.vd", "Input Vector Data"); + SetParameterDescription("io.vd", "Input geometries used for training (note " + ": all geometries from the layer will be used)"); + + AddParameter(ParameterType_OutputFilename, "io.out", "Output model"); + SetParameterDescription("io.out", "Output file containing the estimated model (.txt format)."); + + AddParameter(ParameterType_InputFilename, "io.stats", "Input XML image statistics file"); + MandatoryOff("io.stats"); + SetParameterDescription("io.stats", "XML file containing mean and variance of each feature."); + + AddParameter(ParameterType_StringList, "feat", "Field names to be used for training."); // + SetParameterDescription("feat","List of field names in the input vector data" + " used as features for training."); // + + Superclass::DoInit(); + + AddRAMParameter(); + + // Doc example parameter settings + SetDocExampleParameterValue("io.vd", "cuprite_samples.sqlite"); + SetDocExampleParameterValue("io.out", "mode.ae"); + SetDocExampleParameterValue("algorithm", "pca"); + SetDocExampleParameterValue("algorithm.pca.dim", "8"); + SetDocExampleParameterValue("feat","value_0 value_1 value_2 value_3 value_4" + " value_5 value_6 value_7 value_8 value_9"); + } + + void DoUpdateParameters() override + { + } + + void DoExecute() override + { + std::string shapefile = GetParameterString("io.vd"); + + otb::ogr::DataSource::Pointer source = + otb::ogr::DataSource::New(shapefile, otb::ogr::DataSource::Modes::Read); + otb::ogr::Layer layer = source->GetLayer(0); + ListSampleType::Pointer input = ListSampleType::New(); + const int nbFeatures = GetParameterStringList("feat").size(); + + input->SetMeasurementVectorSize(nbFeatures); + otb::ogr::Layer::const_iterator it = layer.cbegin(); + otb::ogr::Layer::const_iterator itEnd = layer.cend(); + for( ; it!=itEnd ; ++it) + { + MeasurementType mv; + mv.SetSize(nbFeatures); + for(int idx=0; idx < nbFeatures; ++idx) + { + mv[idx] = (*it)[GetParameterStringList("feat")[idx]].GetValue<double>(); + } + input->PushBack(mv); + } + + MeasurementType meanMeasurementVector; + MeasurementType stddevMeasurementVector; + + if (HasValue("io.stats") && IsParameterEnabled("io.stats")) + { + StatisticsReader::Pointer statisticsReader = StatisticsReader::New(); + std::string XMLfile = GetParameterString("io.stats"); + statisticsReader->SetFileName(XMLfile); + meanMeasurementVector = statisticsReader->GetStatisticVectorByName("mean"); + stddevMeasurementVector = statisticsReader->GetStatisticVectorByName("stddev"); + } + else + { + meanMeasurementVector.SetSize(nbFeatures); + meanMeasurementVector.Fill(0.); + stddevMeasurementVector.SetSize(nbFeatures); + stddevMeasurementVector.Fill(1.); + } + + ShiftScaleFilterType::Pointer trainingShiftScaleFilter = ShiftScaleFilterType::New(); + trainingShiftScaleFilter->SetInput(input); + trainingShiftScaleFilter->SetShifts(meanMeasurementVector); + trainingShiftScaleFilter->SetScales(stddevMeasurementVector); + trainingShiftScaleFilter->Update(); + + ListSampleType::Pointer trainingListSample= trainingShiftScaleFilter->GetOutput(); + + this->Train(trainingListSample,GetParameterString("io.out")); + } + +}; + +} // end of namespace Wrapper +} // end of namespace otb + +OTB_APPLICATION_EXPORT(otb::Wrapper::TrainDimensionalityReduction) diff --git a/Modules/Applications/AppDimensionalityReduction/app/otbVectorDimensionalityReduction.cxx b/Modules/Applications/AppDimensionalityReduction/app/otbVectorDimensionalityReduction.cxx new file mode 100644 index 0000000000000000000000000000000000000000..24e7ba98ffeb4268e6adea854a0c44971477b1e3 --- /dev/null +++ b/Modules/Applications/AppDimensionalityReduction/app/otbVectorDimensionalityReduction.cxx @@ -0,0 +1,434 @@ +/* + * 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 "otbOGRDataSourceWrapper.h" +#include "otbOGRFeatureWrapper.h" +#include "itkVariableLengthVector.h" +#include "otbStatisticsXMLFileReader.h" +#include "itkListSample.h" +#include "otbShiftScaleSampleListFilter.h" +#include "otbDimensionalityReductionModelFactory.h" +#include <time.h> + +namespace otb +{ +namespace Wrapper +{ + +/** Utility function to negate std::isalnum */ +bool IsNotAlphaNum(char c) +{ +return !std::isalnum(c); +} + +/** + * \class VectorDimensionalityReduction + * + * Apply a dimensionality reduction model on a vector file + */ +class VectorDimensionalityReduction : public Application +{ +public: + /** Standard class typedefs. */ + typedef VectorDimensionalityReduction Self; + typedef Application Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + /** Standard macro */ + itkNewMacro(Self); + itkTypeMacro(Self, Application) + + /** Filters typedef */ + typedef float ValueType; + typedef itk::VariableLengthVector<ValueType> InputSampleType; + typedef itk::Statistics::ListSample<InputSampleType> ListSampleType; + typedef MachineLearningModel< + itk::VariableLengthVector<ValueType>, + itk::VariableLengthVector<ValueType> > DimensionalityReductionModelType; + typedef DimensionalityReductionModelFactory< + ValueType,ValueType> DimensionalityReductionModelFactoryType; + typedef DimensionalityReductionModelType::Pointer ModelPointerType; + + /** Statistics Filters typedef */ + typedef itk::VariableLengthVector<ValueType> MeasurementType; + typedef otb::StatisticsXMLFileReader<MeasurementType> StatisticsReader; + typedef otb::Statistics::ShiftScaleSampleListFilter< + ListSampleType, ListSampleType> ShiftScaleFilterType; + +protected: + ~VectorDimensionalityReduction() override + { + DimensionalityReductionModelFactoryType::CleanFactories(); + } + +private: + void DoInit() override + { + SetName("VectorDimensionalityReduction"); + SetDescription("Performs dimensionality reduction of the input vector data " + "according to a model file."); + SetDocName("Vector Dimensionality Reduction"); + SetDocAuthors("OTB-Team"); + SetDocLongDescription("This application performs a vector data " + "dimensionality reduction based on a model file produced by the " + "TrainDimensionalityReduction application."); + SetDocSeeAlso("TrainDimensionalityReduction"); + SetDocLimitations("None"); + AddDocTag(Tags::Learning); + + AddParameter(ParameterType_InputVectorData, "in", "Name of the input vector data"); + SetParameterDescription("in","The input vector data to reduce."); + + AddParameter(ParameterType_InputFilename, "instat", "Statistics file"); + SetParameterDescription("instat", "A XML file containing mean and standard " + "deviation to center and reduce samples before dimensionality reduction " + "(produced by ComputeImagesStatistics application)."); + MandatoryOff("instat"); + + AddParameter(ParameterType_InputFilename, "model", "Model file"); + SetParameterDescription("model", "A model file (produced by the " + "TrainDimensionalityReduction application,"); + + AddParameter(ParameterType_OutputFilename, "out", "Output vector data file " + "containing the reduced vector"); + SetParameterDescription("out","Output vector data file storing sample " + "values (OGR format). If not given, the input vector data file is used. " + "In overwrite mode, the original features will be lost."); + MandatoryOff("out"); + + AddParameter(ParameterType_ListView, "feat", "Input features to use for reduction."); // + SetParameterDescription("feat","List of field names in the input vector " + "data used as features for reduction."); // + + AddParameter(ParameterType_Choice, "featout", "Output feature"); // + SetParameterDescription("featout", "Naming of output features"); + + AddChoice("featout.prefix", "Prefix"); + SetParameterDescription("featout.prefix", "Use a name prefix"); + + AddParameter(ParameterType_String, "featout.prefix.name", "Feature name prefix"); + SetParameterDescription("featout.prefix.name","Name prefix for output " + "features. This prefix is followed by the numeric index of each output feature."); + SetParameterString("featout.prefix.name","reduced_", false); + + AddChoice("featout.list","List"); + SetParameterDescription("featout.list", "Use a list with all names"); + + AddParameter(ParameterType_StringList, "featout.list.names", "Feature name list"); + SetParameterDescription("featout.list.names","List of field names for the output " + "features which result from the reduction."); // + + AddParameter(ParameterType_Int, "pcadim", "Principal component dimension"); // + SetParameterDescription("pcadim","This optional parameter can be set to " + "reduce the number of eignevectors used in the PCA model file. This " + "parameter can't be used for other models"); // + MandatoryOff("pcadim"); + + AddParameter(ParameterType_Choice, "mode", "Writting mode"); // + SetParameterDescription("mode", "This parameter determines if the output " + "file is overwritten or updated [overwrite/update]. If an output file " + "name is given, the original file is copied before creating the new features."); + + AddChoice("mode.overwrite", "Overwrite"); + SetParameterDescription("mode.overwrite","Overwrite mode"); // + + AddChoice("mode.update", "Update"); + SetParameterDescription("mode.update", "Update mode"); + + // Doc example parameter settings + SetDocExampleParameterValue("in", "vectorData.shp"); + SetDocExampleParameterValue("instat", "meanVar.xml"); + SetDocExampleParameterValue("model", "model.txt"); + SetDocExampleParameterValue("out", "vectorDataOut.shp"); + SetDocExampleParameterValue("feat", "perimeter area width"); + //SetOfficialDocLink(); + } + + void DoUpdateParameters() override + { + if ( HasValue("in") ) + { + std::string shapefile = GetParameterString("in"); + otb::ogr::DataSource::Pointer ogrDS; + OGRSpatialReference oSRS(""); + std::vector<std::string> options; + ogrDS = otb::ogr::DataSource::New(shapefile, otb::ogr::DataSource::Modes::Read); + otb::ogr::Layer layer = ogrDS->GetLayer(0); + OGRFeatureDefn &layerDefn = layer.GetLayerDefn(); + ClearChoices("feat"); + + for(int iField=0; iField< layerDefn.GetFieldCount(); iField++) + { + std::string item = layerDefn.GetFieldDefn(iField)->GetNameRef(); + std::string key(item); + std::string::iterator end = std::remove_if( key.begin(), key.end(), IsNotAlphaNum ); + std::transform( key.begin(), end, key.begin(), tolower ); + std::string tmpKey = "feat." + key.substr( 0, static_cast<unsigned long>( end - key.begin() ) ); + AddChoice(tmpKey,item); + } + } + } + + void DoExecute() override + { + clock_t tic = clock(); + + std::string shapefile = GetParameterString("in"); + otb::ogr::DataSource::Pointer source = otb::ogr::DataSource::New( + shapefile, otb::ogr::DataSource::Modes::Read); + otb::ogr::Layer layer = source->GetLayer(0); + ListSampleType::Pointer input = ListSampleType::New(); + std::vector<int> inputIndexes = GetSelectedItems("feat"); + int nbFeatures = inputIndexes.size(); + + input->SetMeasurementVectorSize(nbFeatures); + otb::ogr::Layer::const_iterator it = layer.cbegin(); + otb::ogr::Layer::const_iterator itEnd = layer.cend(); + + // Get the list of non-selected field indexes + // /!\ The 'feat' is assumed to expose all available fields, hence the + // mapping between GetSelectedItems() and OGR field indexes + OGRFeatureDefn &inLayerDefn = layer.GetLayerDefn(); + std::set<int> otherInputFields; + for (int i=0 ; i < inLayerDefn.GetFieldCount() ; i++) + otherInputFields.insert(i); + for (int k=0 ; k < nbFeatures ; k++) + otherInputFields.erase(inputIndexes[k]); + + for( ; it!=itEnd ; ++it) + { + MeasurementType mv; + mv.SetSize(nbFeatures); + + for(int idx=0; idx < nbFeatures; ++idx) + { + mv[idx] = static_cast<float>( (*it)[inputIndexes[idx]].GetValue<double>() ); + } + input->PushBack(mv); + } + + /** Statistics for shift/scale */ + MeasurementType meanMeasurementVector; + MeasurementType stddevMeasurementVector; + + if (HasValue("instat") && IsParameterEnabled("instat")) + { + StatisticsReader::Pointer statisticsReader = StatisticsReader::New(); + std::string XMLfile = GetParameterString("instat"); + statisticsReader->SetFileName(XMLfile); + meanMeasurementVector = statisticsReader->GetStatisticVectorByName("mean"); + stddevMeasurementVector = statisticsReader->GetStatisticVectorByName("stddev"); + otbAppLogINFO("Mean used: " << meanMeasurementVector); + otbAppLogINFO("Standard deviation used: " << stddevMeasurementVector); + } + else + { + meanMeasurementVector.SetSize(nbFeatures); + meanMeasurementVector.Fill(0.); + stddevMeasurementVector.SetSize(nbFeatures); + stddevMeasurementVector.Fill(1.); + } + + ShiftScaleFilterType::Pointer trainingShiftScaleFilter = ShiftScaleFilterType::New(); + trainingShiftScaleFilter->SetInput(input); + trainingShiftScaleFilter->SetShifts(meanMeasurementVector); + trainingShiftScaleFilter->SetScales(stddevMeasurementVector); + trainingShiftScaleFilter->Update(); + + otbAppLogINFO("Loading model"); + /** Read the model */ + m_Model = DimensionalityReductionModelFactoryType::CreateDimensionalityReductionModel( + GetParameterString("model"), + DimensionalityReductionModelFactoryType::ReadMode); + if (m_Model.IsNull()) + { + otbAppLogFATAL(<< "Error when loading model " << GetParameterString("model") + << " : unsupported model type"); + } + m_Model->Load(GetParameterString("model")); + if (HasValue("pcadim") && IsParameterEnabled("pcadim")) + { + std::string modelName(m_Model->GetNameOfClass()); + if (modelName != "PCAModel") + { + otbAppLogFATAL(<< "Can't set 'pcadim' on a model : "<< modelName); + } + m_Model->SetDimension( GetParameterInt("pcadim") ); + } + otbAppLogINFO("Model loaded, dimension : "<< m_Model->GetDimension()); + + /** Perform Dimensionality Reduction */ + ListSampleType::Pointer listSample = trainingShiftScaleFilter->GetOutput(); + ListSampleType::Pointer target = m_Model->PredictBatch(listSample); + + /** Create/Update Output Shape file */ + ogr::DataSource::Pointer output; + ogr::DataSource::Pointer buffer = ogr::DataSource::New(); + bool updateMode = false; + + if (IsParameterEnabled("out") && HasValue("out")) + { + // Create new OGRDataSource + if (GetParameterString("mode")=="overwrite") + { + output = ogr::DataSource::New(GetParameterString("out"), ogr::DataSource::Modes::Overwrite); + otb::ogr::Layer newLayer = output->CreateLayer( + GetParameterString("out"), + const_cast<OGRSpatialReference*>(layer.GetSpatialRef()), + layer.GetGeomType()); + // Copy existing fields except the ones selected for reduction + for (const int& k : otherInputFields) + { + OGRFieldDefn fieldDefn(inLayerDefn.GetFieldDefn(k)); + newLayer.CreateField(fieldDefn); + } + } + else if (GetParameterString("mode")=="update") + { + //output = ogr::DataSource::New(GetParameterString("out"), ogr::DataSource::Modes::Update_LayerCreateOnly); + // Update mode + otb::ogr::DataSource::Pointer source_output = + otb::ogr::DataSource::New(GetParameterString("out"), otb::ogr::DataSource::Modes::Read); + layer = source_output->GetLayer(0); + updateMode = true; + otbAppLogINFO("Update input vector data."); + + // fill temporary buffer for the transfer + otb::ogr::Layer inputLayer = layer; + layer = buffer->CopyLayer(inputLayer, std::string("Buffer")); + // close input data source + source_output->Clear(); + // Re-open input data source in update mode + output = otb::ogr::DataSource::New( + GetParameterString("out"), + otb::ogr::DataSource::Modes::Update_LayerUpdate); + } + else + { + otbAppLogFATAL(<< "Error when creating the output file" << + GetParameterString("mode") << " : unsupported writting mode type"); + } + } + + otb::ogr::Layer outLayer = output->GetLayer(0); + OGRErr errStart = outLayer.ogr().StartTransaction(); + + if (errStart != OGRERR_NONE) + { + otbAppLogFATAL(<< "Unable to start transaction for OGR layer " << outLayer.ogr().GetName() << "."); + } + + // Build the list of output fields + std::vector<std::string> outFields; + if(GetParameterString("featout") == "prefix") + { + std::string prefix = GetParameterString("featout.prefix.name"); + std::ostringstream oss; + for (unsigned int i=0 ; i < m_Model->GetDimension() ; i++) + { + oss.str(prefix); + oss.seekp(0,std::ios_base::end); + oss << i; + outFields.push_back(oss.str()); + } + } + else if(GetParameterString("featout") == "list") + { + outFields = GetParameterStringList("featout.list.names"); + if (outFields.size() != m_Model->GetDimension()) + { + otbAppLogFATAL( << "Wrong number of output field names, expected " + << m_Model->GetDimension() << " , got "<< outFields.size()); + } + } + else + { + otbAppLogFATAL( << "Unsupported output feature mode : " + << GetParameterString("featout")); + } + + // Add the field of prediction in the output layer if field not exist + for (unsigned int i=0; i<outFields.size() ;i++) + { + OGRFeatureDefn &layerDefn = outLayer.GetLayerDefn(); + int idx = layerDefn.GetFieldIndex(outFields[i].c_str()); + + if (idx >= 0) + { + if (layerDefn.GetFieldDefn(idx)->GetType() != OFTReal) + otbAppLogFATAL("Field name "<< outFields[i] + << " already exists with a different type!"); + } + else + { + OGRFieldDefn predictedField(outFields[i].c_str(), OFTReal); + ogr::FieldDefn predictedFieldDef(predictedField); + outLayer.CreateField(predictedFieldDef); + } + } + + // Fill output layer + unsigned int count=0; + it = layer.cbegin(); + itEnd = layer.cend(); + for( ; it!=itEnd ; ++it, ++count) + { + ogr::Feature dstFeature(outLayer.GetLayerDefn()); + + dstFeature.SetFrom( *it , TRUE); + dstFeature.SetFID(it->GetFID()); + + for (std::size_t i=0; i<outFields.size(); ++i) + { + dstFeature[outFields[i]].SetValue<double>(target->GetMeasurementVector(count)[i]); + } + if (updateMode) + { + outLayer.SetFeature(dstFeature); + } + else + { + outLayer.CreateFeature(dstFeature); + } + } + + if(outLayer.ogr().TestCapability("Transactions")) + { + const OGRErr errCommitX = outLayer.ogr().CommitTransaction(); + if (errCommitX != OGRERR_NONE) + { + otbAppLogFATAL(<< "Unable to commit transaction for OGR layer " << + outLayer.ogr().GetName() << "."); + } + } + output->SyncToDisk(); + clock_t toc = clock(); + otbAppLogINFO( "Elapsed: "<< ((double)(toc - tic) / CLOCKS_PER_SEC)<<" seconds."); + } + + ModelPointerType m_Model; +}; + +} // end of namespace Wrapper +} // end of namespace otb + +OTB_APPLICATION_EXPORT(otb::Wrapper::VectorDimensionalityReduction) diff --git a/Modules/Applications/AppDimensionalityReduction/include/otbDimensionalityReductionTrainAutoencoder.txx b/Modules/Applications/AppDimensionalityReduction/include/otbDimensionalityReductionTrainAutoencoder.txx new file mode 100644 index 0000000000000000000000000000000000000000..f474167e38be7fe6f2a8e56fc8838811afec789b --- /dev/null +++ b/Modules/Applications/AppDimensionalityReduction/include/otbDimensionalityReductionTrainAutoencoder.txx @@ -0,0 +1,164 @@ +/* + * 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 otbDimensionalityReductionTrainAutoencoder_txx +#define otbDimensionalityReductionTrainAutoencoder_txx + +#include "otbTrainDimensionalityReductionApplicationBase.h" +#include "otbAutoencoderModel.h" + +namespace otb +{ +namespace Wrapper +{ + +template <class TInputValue, class TOutputValue> +void +TrainDimensionalityReductionApplicationBase<TInputValue,TOutputValue> +::InitAutoencoderParams() +{ + AddChoice("algorithm.autoencoder", "Shark Autoencoder"); + SetParameterDescription("algorithm.autoencoder", + "This group of parameters allows setting Shark autoencoder parameters. " + ); + + //Number Of Iterations + AddParameter(ParameterType_Int, "algorithm.autoencoder.nbiter", + "Maximum number of iterations during training"); + SetParameterInt("algorithm.autoencoder.nbiter",100, false); + SetParameterDescription( + "algorithm.autoencoder.nbiter", + "The maximum number of iterations used during training."); + + AddParameter(ParameterType_Int, "algorithm.autoencoder.nbiterfinetuning", + "Maximum number of iterations during training"); + SetParameterInt("algorithm.autoencoder.nbiterfinetuning",0, false); + SetParameterDescription( + "algorithm.autoencoder.nbiterfinetuning", + "The maximum number of iterations used during fine tuning of the whole network."); + + AddParameter(ParameterType_Float, "algorithm.autoencoder.epsilon", + "Epsilon"); + SetParameterFloat("algorithm.autoencoder.epsilon",0, false); + SetParameterDescription( + "algorithm.autoencoder.epsilon", + "Epsilon"); + + AddParameter(ParameterType_Float, "algorithm.autoencoder.initfactor", + "Weight initialization factor"); + SetParameterFloat("algorithm.autoencoder.initfactor",1, false); + SetParameterDescription( + "algorithm.autoencoder.initfactor", "Parameter that control the weight initialization of the autoencoder"); + + //Number Of Hidden Neurons + AddParameter(ParameterType_StringList, "algorithm.autoencoder.nbneuron", "Size"); + SetParameterDescription( + "algorithm.autoencoder.nbneuron", + "The number of neurons in each hidden layer."); + + //Regularization + AddParameter(ParameterType_StringList, "algorithm.autoencoder.regularization", "Strength of the regularization"); + SetParameterDescription("algorithm.autoencoder.regularization", + "Strength of the L2 regularization used during training"); + + //Noise strength + AddParameter(ParameterType_StringList, "algorithm.autoencoder.noise", "Strength of the noise"); + SetParameterDescription("algorithm.autoencoder.noise", + "Strength of the noise"); + + // Sparsity parameter + AddParameter(ParameterType_StringList, "algorithm.autoencoder.rho", "Sparsity parameter"); + SetParameterDescription("algorithm.autoencoder.rho", + "Sparsity parameter"); + + // Sparsity regularization strength + AddParameter(ParameterType_StringList, "algorithm.autoencoder.beta", "Sparsity regularization strength"); + SetParameterDescription("algorithm.autoencoder.beta", + "Sparsity regularization strength"); + + AddParameter(ParameterType_OutputFilename, "algorithm.autoencoder.learningcurve", "Learning curve"); + SetParameterDescription("algorithm.autoencoder.learningcurve", "Learning error values"); + MandatoryOff("algorithm.autoencoder.learningcurve"); +} + +template <class TInputValue, class TOutputValue> +void +TrainDimensionalityReductionApplicationBase<TInputValue,TOutputValue> +::BeforeTrainAutoencoder(typename ListSampleType::Pointer trainingListSample, + std::string modelPath) +{ + typedef shark::LogisticNeuron NeuronType; + typedef otb::AutoencoderModel<InputValueType, NeuronType> AutoencoderModelType; + TrainAutoencoder<AutoencoderModelType>(trainingListSample,modelPath); +} + +template <class TInputValue, class TOutputValue> +template <typename autoencoderchoice> +void TrainDimensionalityReductionApplicationBase<TInputValue,TOutputValue>::TrainAutoencoder(typename ListSampleType::Pointer trainingListSample,std::string modelPath) +{ + typename autoencoderchoice::Pointer dimredTrainer = autoencoderchoice::New(); + itk::Array<unsigned int> nb_neuron; + itk::Array<float> noise; + itk::Array<float> regularization; + itk::Array<float> rho; + itk::Array<float> beta; + std::vector<std::basic_string<char>> s_nbneuron= GetParameterStringList("algorithm.autoencoder.nbneuron"); + std::vector<std::basic_string<char>> s_noise= GetParameterStringList("algorithm.autoencoder.noise"); + std::vector<std::basic_string<char>> s_regularization= GetParameterStringList("algorithm.autoencoder.regularization"); + std::vector<std::basic_string<char>> s_rho= GetParameterStringList("algorithm.autoencoder.rho"); + std::vector<std::basic_string<char>> s_beta= GetParameterStringList("algorithm.autoencoder.beta"); + nb_neuron.SetSize(s_nbneuron.size()); + noise.SetSize(s_nbneuron.size()); + regularization.SetSize(s_nbneuron.size()); + rho.SetSize(s_nbneuron.size()); + beta.SetSize(s_nbneuron.size()); + for (unsigned int i=0; i<s_nbneuron.size(); i++) + { + nb_neuron[i]=std::stoi(s_nbneuron[i]); + noise[i]=std::stof(s_noise[i]); + regularization[i]=std::stof(s_regularization[i]); + rho[i]=std::stof(s_rho[i]); + beta[i]=std::stof(s_beta[i]); + } + dimredTrainer->SetNumberOfHiddenNeurons(nb_neuron); + dimredTrainer->SetNumberOfIterations(GetParameterInt("algorithm.autoencoder.nbiter")); + dimredTrainer->SetNumberOfIterationsFineTuning(GetParameterInt("algorithm.autoencoder.nbiterfinetuning")); + dimredTrainer->SetEpsilon(GetParameterFloat("algorithm.autoencoder.epsilon")); + dimredTrainer->SetInitFactor(GetParameterFloat("algorithm.autoencoder.initfactor")); + dimredTrainer->SetRegularization(regularization); + dimredTrainer->SetNoise(noise); + dimredTrainer->SetRho(rho); + dimredTrainer->SetBeta(beta); + dimredTrainer->SetWriteWeights(true); + if (HasValue("algorithm.autoencoder.learningcurve") && + IsParameterEnabled("algorithm.autoencoder.learningcurve")) + { + dimredTrainer->SetWriteLearningCurve(true); + dimredTrainer->SetLearningCurveFileName(GetParameterString("algorithm.autoencoder.learningcurve")); + } + + dimredTrainer->SetInputListSample(trainingListSample); + dimredTrainer->Train(); + dimredTrainer->Save(modelPath); +} + +} //end namespace wrapper +} //end namespace otb + +#endif diff --git a/Modules/Applications/AppDimensionalityReduction/include/otbDimensionalityReductionTrainPCA.txx b/Modules/Applications/AppDimensionalityReduction/include/otbDimensionalityReductionTrainPCA.txx new file mode 100644 index 0000000000000000000000000000000000000000..03016916cb0186d118f57a95ee726b80f69486d5 --- /dev/null +++ b/Modules/Applications/AppDimensionalityReduction/include/otbDimensionalityReductionTrainPCA.txx @@ -0,0 +1,66 @@ +/* + * 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 otbDimensionalityReductionTrainPCA_txx +#define otbDimensionalityReductionTrainPCA_txx + +#include "otbTrainDimensionalityReductionApplicationBase.h" +#include "otbPCAModel.h" + +namespace otb +{ +namespace Wrapper +{ + +template <class TInputValue, class TOutputValue> +void +TrainDimensionalityReductionApplicationBase<TInputValue,TOutputValue> +::InitPCAParams() +{ + AddChoice("algorithm.pca", "Shark PCA"); + SetParameterDescription("algorithm.pca", + "This group of parameters allows setting Shark PCA parameters. " + ); + + //Output Dimension + AddParameter(ParameterType_Int, "algorithm.pca.dim", + "Dimension of the output of the pca transformation"); + SetParameterInt("algorithm.pca.dim",10, false); + SetParameterDescription( + "algorithm.pca.dim", + "Dimension of the output of the pca transformation."); +} + +template <class TInputValue, class TOutputValue> +void TrainDimensionalityReductionApplicationBase<TInputValue,TOutputValue> +::TrainPCA(typename ListSampleType::Pointer trainingListSample,std::string modelPath) +{ + typedef otb::PCAModel<InputValueType> PCAModelType; + typename PCAModelType::Pointer dimredTrainer = PCAModelType::New(); + dimredTrainer->SetDimension(GetParameterInt("algorithm.pca.dim")); + dimredTrainer->SetInputListSample(trainingListSample); + dimredTrainer->SetWriteEigenvectors(true); + dimredTrainer->Train(); + dimredTrainer->Save(modelPath); +} + +} //end namespace wrapper +} //end namespace otb + +#endif diff --git a/Modules/Applications/AppDimensionalityReduction/include/otbDimensionalityReductionTrainSOM.txx b/Modules/Applications/AppDimensionalityReduction/include/otbDimensionalityReductionTrainSOM.txx new file mode 100644 index 0000000000000000000000000000000000000000..51cdd9e1acf1ededba9b54f93260e10c16962572 --- /dev/null +++ b/Modules/Applications/AppDimensionalityReduction/include/otbDimensionalityReductionTrainSOM.txx @@ -0,0 +1,157 @@ +/* + * 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 otbDimensionalityReductionTrainSOM_txx +#define otbDimensionalityReductionTrainSOM_txx +#include "otbTrainDimensionalityReductionApplicationBase.h" +#include "otbSOMModel.h" + +namespace otb +{ +namespace Wrapper +{ + +template <class TInputValue, class TOutputValue> +void +TrainDimensionalityReductionApplicationBase<TInputValue,TOutputValue> +::InitSOMParams() +{ + AddChoice("algorithm.som", "OTB SOM"); + SetParameterDescription("algorithm.som", + "This group of parameters allows setting SOM parameters. "); + + AddParameter(ParameterType_StringList , "algorithm.som.s", "Map size"); + SetParameterDescription("algorithm.som.s", "Sizes of the SOM map (one per " + "dimension). For instance, [12;15] means a 2D map of size 12x15. Support" + "2D to 5D maps."); + MandatoryOff("algorithm.som.s"); + + AddParameter(ParameterType_StringList , "algorithm.som.n", "Neighborhood sizes"); + SetParameterDescription("algorithm.som.n", "Sizes of the initial neighborhood " + "in the SOM map (one per dimension). The number of sizes should be the same" + " as the map sizes"); + MandatoryOff("algorithm.som.n"); + + AddParameter(ParameterType_Int, "algorithm.som.ni", "NumberIteration"); + SetParameterDescription("algorithm.som.ni", "Number of iterations for SOM learning"); + MandatoryOff("algorithm.som.ni"); + + AddParameter(ParameterType_Float, "algorithm.som.bi", "BetaInit"); + SetParameterDescription("algorithm.som.bi", "Initial learning coefficient"); + MandatoryOff("algorithm.som.bi"); + + AddParameter(ParameterType_Float, "algorithm.som.bf", "BetaFinal"); + SetParameterDescription("algorithm.som.bf", "Final learning coefficient"); + MandatoryOff("algorithm.som.bf"); + + AddParameter(ParameterType_Float, "algorithm.som.iv", "InitialValue"); + SetParameterDescription("algorithm.som.iv", "Maximum initial neuron weight"); + MandatoryOff("algorithm.som.iv"); + + std::vector<std::string> size(2, std::string("10")); + std::vector<std::string> radius(2, std::string("3")); + SetParameterStringList("algorithm.som.s", size, false); + SetParameterStringList("algorithm.som.n", radius, false); + DisableParameter("algorithm.som.s"); + DisableParameter("algorithm.som.n"); + + SetDefaultParameterInt("algorithm.som.ni", 5); + SetDefaultParameterFloat("algorithm.som.bi", 1.0); + SetDefaultParameterFloat("algorithm.som.bf", 0.1); + SetDefaultParameterFloat("algorithm.som.iv", 10.0); +} + +template <class TInputValue, class TOutputValue> +void +TrainDimensionalityReductionApplicationBase<TInputValue,TOutputValue> +::BeforeTrainSOM(typename ListSampleType::Pointer trainingListSample, + std::string modelPath) +{ + std::vector<std::string> s = GetParameterStringList("algorithm.som.s"); + int SomDim = s.size(); + + if(SomDim == 2) + { + typedef otb::SOMModel<InputValueType, 2> SOM2DModelType; + TrainSOM<SOM2DModelType >(trainingListSample,modelPath); + } + + if(SomDim == 3) + { + typedef otb::SOMModel<InputValueType, 3> SOM3DModelType; + TrainSOM<SOM3DModelType >(trainingListSample,modelPath); + } + + if(SomDim == 4) + { + typedef otb::SOMModel<InputValueType, 4> SOM4DModelType; + TrainSOM<SOM4DModelType >(trainingListSample,modelPath); + } + + if(SomDim == 5) + { + typedef otb::SOMModel<InputValueType, 5> SOM5DModelType; + TrainSOM<SOM5DModelType >(trainingListSample,modelPath); + } + if(SomDim > 5 || SomDim < 2) + { + otbAppLogFATAL(<< "Invalid number of dimensions : " << SomDim << + ". Only support 2, 3, 4 or 5 dimensions"); + } +} + +template <class TInputValue, class TOutputValue> +template <typename TSOM> +void TrainDimensionalityReductionApplicationBase<TInputValue,TOutputValue> +::TrainSOM(typename ListSampleType::Pointer trainingListSample,std::string modelPath) +{ + typename TSOM::Pointer dimredTrainer = TSOM::New(); + dimredTrainer->SetNumberOfIterations(GetParameterInt("algorithm.som.ni")); + dimredTrainer->SetBetaInit(GetParameterFloat("algorithm.som.bi")); + dimredTrainer->SetWriteMap(true); + dimredTrainer->SetBetaEnd(GetParameterFloat("algorithm.som.bf")); + dimredTrainer->SetMaxWeight(GetParameterFloat("algorithm.som.iv")); + typename TSOM::SizeType size; + std::vector<std::string> s = GetParameterStringList("algorithm.som.s"); + for (unsigned int i=0; i<s.size(); i++) + { + size[i]=boost::lexical_cast<unsigned int>(s[i]); + } + + dimredTrainer->SetMapSize(size); + typename TSOM::SizeType radius; + std::vector<std::string> n = GetParameterStringList("algorithm.som.n"); + if (n.size() != s.size()) + { + otbAppLogFATAL(<< "Wrong number of neighborhood radii : expected "<< s.size() << " ; got "<< n.size()); + } + for (unsigned int i=0; i < n.size(); i++) + { + radius[i]=boost::lexical_cast<unsigned int>(n[i]); + } + dimredTrainer->SetNeighborhoodSizeInit(radius); + dimredTrainer->SetInputListSample(trainingListSample); + dimredTrainer->Train(); + dimredTrainer->Save(modelPath); +} + +} //end namespace wrapper +} //end namespace otb + +#endif diff --git a/Modules/Applications/AppDimensionalityReduction/include/otbTrainDimensionalityReductionApplicationBase.h b/Modules/Applications/AppDimensionalityReduction/include/otbTrainDimensionalityReductionApplicationBase.h new file mode 100644 index 0000000000000000000000000000000000000000..b0a2ae847ac0595c1744c73117a9c4d711bc93a9 --- /dev/null +++ b/Modules/Applications/AppDimensionalityReduction/include/otbTrainDimensionalityReductionApplicationBase.h @@ -0,0 +1,147 @@ +/* + * 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 otbTrainDimensionalityReductionApplicationBase_h +#define otbTrainDimensionalityReductionApplicationBase_h + +#include "otbConfigure.h" +#include "otbWrapperApplication.h" +#include "otbDimensionalityReductionModelFactory.h" + +// ListSample +#include "itkListSample.h" +#include "itkVariableLengthVector.h" + +#include <iostream> + +namespace otb +{ +namespace Wrapper +{ + +/** \class LearningApplicationBase + * \brief LearningApplicationBase is the base class for application that + * use machine learning model. + * + * This base class offers a DoInit() method to initialize all the parameters + * related to machine learning models. They will all be in the choice parameter + * named "classifier". The class also offers generic Train() and Classify() + * methods. The classes derived from LearningApplicationBase only need these + * 3 methods to handle the machine learning model. + * + * There are multiple machine learning models in OTB, some imported + * from OpenCV and one imported from LibSVM. They all have + * different parameters. The purpose of this class is to handle the + * creation of all parameters related to machine learning models (in + * DoInit() ), and to dispatch the calls to specific train functions + * in function Train(). + * + * This class is templated over scalar types for input and output values. + * Typically, the input value type will be either float of double. The choice + * of an output value type depends on the learning mode. This base class + * supports both classification and regression modes. For classification + * (enabled by default), the output value type corresponds to a class + * identifier so integer types suit well. For regression, the output value + * should not be an integer type, but rather a floating point type. In addition, + * an application deriving this base class for regression should initialize + * the m_RegressionFlag to true in their constructor. + * + * \sa TrainImagesClassifier + * \sa TrainRegression + * + * \ingroup OTBAppDimensionalityReduction + */ +template <class TInputValue, class TOutputValue> +class TrainDimensionalityReductionApplicationBase: public Application +{ +public: + /** Standard class typedefs. */ + typedef TrainDimensionalityReductionApplicationBase Self; + typedef Application Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + /** Standard macro */ + itkTypeMacro(TrainDimensionalityReductionApplicationBase, otb::Application) + + typedef TInputValue InputValueType; + typedef TOutputValue OutputValueType; + + typedef otb::VectorImage<InputValueType> SampleImageType; + typedef typename SampleImageType::PixelType PixelType; + + typedef otb::DimensionalityReductionModelFactory< + InputValueType, OutputValueType> ModelFactoryType; + typedef typename ModelFactoryType::DimensionalityReductionModelTypePointer ModelPointerType; + typedef typename ModelFactoryType::DimensionalityReductionModelType ModelType; + + typedef typename ModelType::InputSampleType SampleType; + typedef typename ModelType::InputListSampleType ListSampleType; + +protected: + TrainDimensionalityReductionApplicationBase(); + ~TrainDimensionalityReductionApplicationBase() override; + + /** Generic method to train and save the machine learning model. This method + * uses specific train methods depending on the chosen model.*/ + void Train(typename ListSampleType::Pointer trainingListSample, + std::string modelPath); + + /** Generic method to load a model file and use it to classify a sample list*/ + void Reduce(typename ListSampleType::Pointer validationListSample, + std::string modelPath); + + /** Init method that creates all the parameters for machine learning models */ + void DoInit() override; + +private: + + /** Specific Init and Train methods for each machine learning model */ + + void InitSOMParams(); + template <class somchoice> + void TrainSOM(typename ListSampleType::Pointer trainingListSample, std::string modelPath); + void BeforeTrainSOM(typename ListSampleType::Pointer trainingListSample, std::string modelPath); + +#ifdef OTB_USE_SHARK + void InitAutoencoderParams(); + void InitPCAParams(); + + void BeforeTrainAutoencoder(typename ListSampleType::Pointer trainingListSample, std::string modelPath); + template <class autoencoderchoice> + void TrainAutoencoder(typename ListSampleType::Pointer trainingListSample, std::string modelPath); + + void TrainPCA(typename ListSampleType::Pointer trainingListSample, std::string modelPath); +#endif +}; + +} // end of namespace Wrapper +} // end of namespace otb + +#ifndef OTB_MANUAL_INSTANTIATION +#include "otbTrainDimensionalityReductionApplicationBase.txx" +#include "otbDimensionalityReductionTrainSOM.txx" + +#ifdef OTB_USE_SHARK +#include "otbDimensionalityReductionTrainAutoencoder.txx" +#include "otbDimensionalityReductionTrainPCA.txx" +#endif +#endif + +#endif diff --git a/Modules/Applications/AppDimensionalityReduction/include/otbTrainDimensionalityReductionApplicationBase.txx b/Modules/Applications/AppDimensionalityReduction/include/otbTrainDimensionalityReductionApplicationBase.txx new file mode 100644 index 0000000000000000000000000000000000000000..057541017693139268c1039820dc3febde93562b --- /dev/null +++ b/Modules/Applications/AppDimensionalityReduction/include/otbTrainDimensionalityReductionApplicationBase.txx @@ -0,0 +1,109 @@ +/* + * 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 otbTrainDimensionalityReductionApplicationBase_txx +#define otbTrainDimensionalityReductionApplicationBase_txx + +#include "otbTrainDimensionalityReductionApplicationBase.h" + +namespace otb +{ +namespace Wrapper +{ + +template <class TInputValue, class TOutputValue> +TrainDimensionalityReductionApplicationBase<TInputValue,TOutputValue> +::TrainDimensionalityReductionApplicationBase() +{ +} + +template <class TInputValue, class TOutputValue> +TrainDimensionalityReductionApplicationBase<TInputValue,TOutputValue> +::~TrainDimensionalityReductionApplicationBase() +{ + ModelFactoryType::CleanFactories(); +} + +template <class TInputValue, class TOutputValue> +void +TrainDimensionalityReductionApplicationBase<TInputValue,TOutputValue> +::DoInit() +{ + AddDocTag(Tags::Learning); + + // main choice parameter that will contain all dimensionality reduction options + AddParameter(ParameterType_Choice, "algorithm", "algorithm to use for the training"); + SetParameterDescription("algorithm", "Choice of the dimensionality reduction " + "algorithm to use for the training."); + + InitSOMParams(); + +#ifdef OTB_USE_SHARK + InitAutoencoderParams(); + InitPCAParams(); +#endif + +} + +template <class TInputValue, class TOutputValue> +void +TrainDimensionalityReductionApplicationBase<TInputValue,TOutputValue> +::Reduce(typename ListSampleType::Pointer /*validationListSample*/,std::string /*modelPath*/) +{ +} + +template <class TInputValue, class TOutputValue> +void +TrainDimensionalityReductionApplicationBase<TInputValue,TOutputValue> +::Train( + typename ListSampleType::Pointer trainingListSample, + std::string modelPath) +{ + // get the name of the chosen machine learning model + const std::string modelName = GetParameterString("algorithm"); + // call specific train function + + if(modelName == "som") + { + BeforeTrainSOM(trainingListSample,modelPath); + } + + if(modelName == "autoencoder") + { +#ifdef OTB_USE_SHARK + BeforeTrainAutoencoder(trainingListSample,modelPath); +#else + otbAppLogFATAL("Module SharkLearning is not installed. You should consider turning OTB_USE_SHARK on during cmake configuration."); +#endif + } + + if(modelName == "pca") + { +#ifdef OTB_USE_SHARK + TrainPCA(trainingListSample,modelPath); +#else + otbAppLogFATAL("Module SharkLearning is not installed. You should consider turning OTB_USE_SHARK on during cmake configuration."); +#endif + } +} + +} // end of namespace Wrapper +} // end of namespace otb + +#endif diff --git a/Modules/Applications/AppDimensionalityReduction/otb-module.cmake b/Modules/Applications/AppDimensionalityReduction/otb-module.cmake index 2ee3b794a6d9741a7b7cb1a5ed15b6620702a77e..4b1a936de279cec5f16b1e9a7eb4c7839dc17379 100644 --- a/Modules/Applications/AppDimensionalityReduction/otb-module.cmake +++ b/Modules/Applications/AppDimensionalityReduction/otb-module.cmake @@ -25,9 +25,11 @@ otb_module(OTBAppDimensionalityReduction DEPENDS OTBImageManipulation OTBStatistics + OTBIOXML OTBApplicationEngine OTBDimensionalityReduction - TEST_DEPENDS + OTBDimensionalityReductionLearning + TEST_DEPENDS OTBTestKernel OTBCommandLine diff --git a/Modules/Applications/AppDimensionalityReduction/test/CMakeLists.txt b/Modules/Applications/AppDimensionalityReduction/test/CMakeLists.txt index 78737f6b82196796969f11363608af24814f5a62..0ec91c997978405bee777e5c9b230cbc9f977350 100644 --- a/Modules/Applications/AppDimensionalityReduction/test/CMakeLists.txt +++ b/Modules/Applications/AppDimensionalityReduction/test/CMakeLists.txt @@ -38,3 +38,58 @@ otb_test_application(NAME apTvFEDimensionalityReductionPCA ${BASELINE}/bfTvPCAImageFilter3.tif ${TEMP}/apTvChDimensionalityReductionPCA.tif) +#------------------------------------------------------------------------------- +set(algos ae pca som) + +set(ae_params +-algorithm autoencoder +-algorithm.autoencoder.nbneuron 8 +-algorithm.autoencoder.regularization 0.01 +-algorithm.autoencoder.noise 0 +-algorithm.autoencoder.rho 0 +-algorithm.autoencoder.beta 0) + +set(pca_params +-algorithm pca +-algorithm.pca.dim 8) + +set(som_params +-algorithm som +-algorithm.som.s 10 10 +-algorithm.som.n 3 3 +-algorithm.som.ni 10) + +foreach(algo ${algos}) + string(TOUPPER ${algo} ualgo) + #------------------ TrainDimensionalityReduction TESTS------------------------ + otb_test_application(NAME apTvDrTrainDimensionalityReduction${ualgo} + APP TrainDimensionalityReduction + OPTIONS -io.vd ${INPUTDATA}/cuprite_samples.sqlite + -io.out ${TEMP}/cuprite_DRModel.${algo} + -io.stats ${INPUTDATA}/cupriteStats.xml + -feat value_0 value_1 value_2 value_3 value_4 value_5 value_6 value_7 value_8 value_9 + ${${algo}_params}) + + #------------------ ImageDimensionalityReduction TESTS------------------------ + otb_test_application(NAME apTvDrImageDimensionalityReduction${ualgo} + APP ImageDimensionalityReduction + OPTIONS -in ${INPUTDATA}/cupriteSubHsi.tif + -model ${TEMP}/cuprite_DRModel.${algo} + -imstat ${INPUTDATA}/cupriteStats.xml + -out ${TEMP}/cupriteReduced_${algo}.tif) + + set_tests_properties( apTvDrImageDimensionalityReduction${ualgo} + PROPERTIES DEPENDS apTvDrTrainDimensionalityReduction${ualgo}) + + #------------------ VectorDimensionalityReduction TESTS----------------------- + otb_test_application(NAME apTvDrVectorDimensionalityReduction${ualgo} + APP VectorDimensionalityReduction + OPTIONS -in ${INPUTDATA}/cuprite_samples.sqlite + -model ${TEMP}/cuprite_DRModel.${algo} + -instat ${INPUTDATA}/cupriteStats.xml + -out ${TEMP}/cupriteReduced_${algo}.sqlite + -feat value_0 value_1 value_2 value_3 value_4 value_5 value_6 value_7 value_8 value_9) + + set_tests_properties( apTvDrVectorDimensionalityReduction${ualgo} + PROPERTIES DEPENDS apTvDrTrainDimensionalityReduction${ualgo}) +endforeach() diff --git a/Modules/Applications/AppDomainTransform/app/otbDomainTransform.cxx b/Modules/Applications/AppDomainTransform/app/otbDomainTransform.cxx index 54dbe894f6520795efb9066b3d1546f89c991cd8..dbaced29bca148c94a1e056fbd7e2fd4239942bb 100644 --- a/Modules/Applications/AppDomainTransform/app/otbDomainTransform.cxx +++ b/Modules/Applications/AppDomainTransform/app/otbDomainTransform.cxx @@ -81,7 +81,7 @@ public: private: DomainTransform() {} - ~DomainTransform() ITK_OVERRIDE + ~DomainTransform() override { } @@ -99,7 +99,7 @@ private: #endif } - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("DomainTransform"); SetDescription("Domain Transform application for wavelet and fourier"); @@ -134,7 +134,7 @@ private: AddChoice("mode.fft", "FFT transform"); SetParameterDescription("mode.fft", "FFT transform"); - AddParameter(ParameterType_Empty, "mode.fft.shift", "Shift fft transform"); + AddParameter(ParameterType_Bool, "mode.fft.shift", "Shift fft transform"); SetParameterDescription("mode.fft.shift", "Shift transform of fft filter"); AddChoice("mode.wavelet", "Wavelet"); @@ -152,8 +152,8 @@ private: AddChoice("mode.wavelet.form.sym8", "SYMLET8"); // Default values for mode - SetParameterString("mode", "wavelet", false); - SetParameterString("mode.wavelet.form", "haar", false); + SetParameterString("mode", "wavelet"); + SetParameterString("mode.wavelet.form", "haar"); AddParameter(ParameterType_Choice,"direction", "Direction"); AddChoice("direction.forward", "Forward"); @@ -173,12 +173,12 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { int dir = GetParameterInt("direction"); int mode = GetParameterInt("mode"); @@ -263,8 +263,8 @@ private: else { // fft ttransform - bool shift = IsParameterEnabled( "mode.fft.shift"); - typedef otb::Image< std::complex<OutputPixelType> > ComplexOutputImageType; + bool shift = GetParameterInt( "mode.fft.shift"); + typedef otb::Image< std::complex<OutputPixelType> > ComplexOutputImageType; if (dir == 0 ) { diff --git a/Modules/Applications/AppEdge/app/otbEdgeExtraction.cxx b/Modules/Applications/AppEdge/app/otbEdgeExtraction.cxx index a608338ddefab721dc1c8b0a4f0f0b6f035f8c49..cbadc412bb8edd5ff8654c459c5ae03c1e707a02 100644 --- a/Modules/Applications/AppEdge/app/otbEdgeExtraction.cxx +++ b/Modules/Applications/AppEdge/app/otbEdgeExtraction.cxx @@ -61,7 +61,7 @@ itkTypeMacro(EdgeExtraction, otb::Application); private: -void DoInit() ITK_OVERRIDE +void DoInit() override { SetName("EdgeExtraction"); SetDescription( @@ -142,12 +142,12 @@ SetDocExampleParameterValue("out", "Edges.tif"); SetOfficialDocLink(); } -void DoUpdateParameters() ITK_OVERRIDE +void DoUpdateParameters() override { // Nothing to do here : all parameters are independent } -void DoExecute() ITK_OVERRIDE +void DoExecute() override { FloatVectorImageType::Pointer inImage = GetParameterImage("in"); inImage->UpdateOutputInformation(); diff --git a/Modules/Applications/AppEdge/app/otbLineSegmentDetection.cxx b/Modules/Applications/AppEdge/app/otbLineSegmentDetection.cxx index 45bc66c51d3562a5850bf83c269f8102e87828e0..5884e33d17d6fedcc427f8c25ea629e4c4f85e5f 100644 --- a/Modules/Applications/AppEdge/app/otbLineSegmentDetection.cxx +++ b/Modules/Applications/AppEdge/app/otbLineSegmentDetection.cxx @@ -53,7 +53,7 @@ public: itkTypeMacro(LineSegmentDetection, otb::Wrapper::Application); private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("LineSegmentDetection"); SetDescription("Detect line segments in raster"); @@ -85,11 +85,10 @@ private: // Elevation ElevationParametersHandler::AddElevationParameters(this, "elev"); - AddParameter(ParameterType_Empty, "norescale", "No rescaling in [0, 255]"); + AddParameter(ParameterType_Bool, "norescale", "No rescaling in [0, 255]"); SetParameterDescription("norescale", "By default, the input image amplitude is rescaled between [0,255]." " Turn on this parameter to skip rescaling"); - MandatoryOff("norescale"); AddRAMParameter(); @@ -100,11 +99,11 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { typedef otb::VectorImageToAmplitudeImageFilter<FloatVectorImageType, FloatImageType> VectorImageToAmplitudeImageFilterType; @@ -132,7 +131,7 @@ private: = ShiftScaleImageFilterType::New(); // Default behavior is to do the rescaling - if ( !IsParameterEnabled("norescale") ) + if ( !GetParameterInt("norescale") ) { stats->SetInput(amplitudeConverter->GetOutput()); stats->GetStreamer()->SetAutomaticAdaptativeStreaming(GetParameterInt("ram")); diff --git a/Modules/Applications/AppFiltering/app/otbContrastEnhancement.cxx b/Modules/Applications/AppFiltering/app/otbContrastEnhancement.cxx index 3c55bf6efaa3da250f6c0286c1dc1f7cb6e69045..3d7fed0f93aaf23b466b18b3c5d7bed65122dcf6 100644 --- a/Modules/Applications/AppFiltering/app/otbContrastEnhancement.cxx +++ b/Modules/Applications/AppFiltering/app/otbContrastEnhancement.cxx @@ -11,7 +11,7 @@ * * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreened to in writing, software + * 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 @@ -154,7 +154,7 @@ private: "or to reduce the dynamic of the image without losing too much contrast. " "It offers several options as a no data value, " "a contrast limitation factor, a local version of the algorithm and " - "also a mode to equalized the luminance of the image."); + "also a mode to equalize the luminance of the image."); // Documentation SetDocName("Contrast Enhancement"); @@ -164,13 +164,14 @@ private: "over the image and then use the whole dynamic : meaning flattening the " "histogram. That gives us gain for each bin that transform the original " "histogram into the flat one. This gain is then apply on the original " - "image. Upon this coarse algorithm we added several option to allow " - "a finer result. First there is the limitation of the contrast. Many " - "ways can be used to do it, we choose to limit the contrast by modifying " - "the original histogram. To do so we clip the histogram at a given " - "height and redistribute equally among the bins the clipped population. " - "Then we add a local version of the algorithm. It is possible to apply " - "the algorithm on tiles of the image. That gives us gain depending on " + "image." + "\nThe application proposes several option to allow a finer result : " + "\n- There is an option to limit contrast. We choose to limit the contrast " + "by modifying the original histogram. To do so we clip the histogram at a " + "given height and redistribute equally among the bins the clipped population. " + "Then we add a local version of the algorithm. " + "\n- It is possible to apply the algorithm on tiles of the image, instead " + "of on the whole image. That gives us gain depending on " "the value of the pixel and its position in the image. In order to " "smoothen the result we interpolate the gain between tiles."); SetDocLimitations("None"); @@ -185,17 +186,18 @@ private: AddParameter(ParameterType_OutputImage, "out", "Output Image"); SetParameterDescription("out", "Output image."); - AddParameter(ParameterType_Int , "bins" , "Number of bin"); + AddParameter(ParameterType_Int , "bins" , "Number of bins"); SetDefaultParameterInt("bins", 256); SetParameterDescription("bins", - "Number of bin used to create the histogram"); + "Number of bins in the histogram"); AddParameter(ParameterType_Float , "hfact" , "Contrast Limitation"); SetParameterDescription("hfact","This parameter will set the maximum " "height accepted in a bin on the input image histogram. " "The maximum height will be computed as hfact*eqHeight where eqHeight " "is the height of the theoretical flat histogram. The higher hfact, the " - "higher the contrast."); + "higher the contrast." + "\nWhen using 'luminance mode', it is recommended to limit this factor to a small value (ex : 4)"); MandatoryOff("hfact"); AddParameter(ParameterType_Float , "nodata" , "Nodata Value"); @@ -208,12 +210,12 @@ private: "for the histogram computation"); AddChoice( "spatial.local" , "Local" ); SetParameterDescription("spatial.local" , "The histograms will be " - "computed on the each thumbnail. Each of the histogram will be " + "computed on each thumbnail. Each of the histogram will be " "equalized and the corresponding gain will be interpolated."); AddChoice( "spatial.global" , "Global" ); SetParameterDescription("spatial.global" , "The histogram will be " - "computed on the whole image. The equalization will be done on " - "this single histogram."); + "computed on the whole image. The equalization will be computed on " + "this histogram."); AddParameter(ParameterType_Int,"spatial.local.h" , @@ -222,24 +224,24 @@ private: "Thumbnail width in pixel"); AddParameter(ParameterType_Choice , "minmax" , "Minimum and maximum " - "definition"); + "settings"); SetParameterDescription("minmax","Minimum and maximum value that will " "bound the histogram."); AddChoice( "minmax.auto" , "Automatic" ); SetParameterDescription("minmax.auto" , "Minimum and maximum value will " "be computed on the image (nodata value won't be taken " "into account) . Each band will have a minimum and a maximum."); - AddParameter(ParameterType_Empty, "minmax.auto.global", "Global"); + AddParameter(ParameterType_Bool, "minmax.auto.global", "Global"); SetParameterDescription("minmax.auto.global" , "Automatic" "Min/max computation will result in the same minimum and maximum for " "all the bands."); - AddChoice( "minmax.manuel" , "Manuel" ); + AddChoice( "minmax.manual" , "Manual settings of min/max values" ); SetParameterDescription("minmax.auto","Minimum and maximum value will be " "set by the user"); - AddParameter(ParameterType_Float , "minmax.manuel.min" , "Minimum"); - AddParameter(ParameterType_Float , "minmax.manuel.max" , "Maximum"); - MandatoryOff("minmax.manuel.min"); - MandatoryOff("minmax.manuel.max"); + AddParameter(ParameterType_Float , "minmax.manual.min" , "Minimum value"); + AddParameter(ParameterType_Float , "minmax.manual.max" , "Maximum value"); + MandatoryOff("minmax.manual.min"); + MandatoryOff("minmax.manual.max"); AddParameter(ParameterType_Choice , "mode" , "What to equalized"); AddChoice( "mode.each" , "Channels" ); @@ -247,28 +249,33 @@ private: "Each channel is equalized independently" ); AddChoice( "mode.lum" , "Luminance" ); SetParameterDescription( "mode.lum" , - "The luminance is equalized and then a gain is applied " - "on each channels. This gain for each channels will depend on" - "the weight (coef) of the channel in the luminance." ); - AddParameter(ParameterType_Group , "mode.lum.red" , "Red Channel" ); - AddParameter(ParameterType_Int , "mode.lum.red.ch" , "Red Channel" ); + "The relative luminance is calculated thanks to the coefficients." + "Then the histogram is equalized and then a gain is applied on each channels." + "This gain for each channels will depend on" + "the weight (coef) of the channel in the luminance." + "\nNote that default values come from color space theories " + "on how human eyes perceive colors)" + +); + AddParameter(ParameterType_Group , "mode.lum.red" , "Red channel" ); + AddParameter(ParameterType_Int , "mode.lum.red.ch" , "Red channel" ); SetDefaultParameterInt("mode.lum.red.ch", 0 ); AddParameter(ParameterType_Float , "mode.lum.red.coef" , - "Value for luminance computation" ); + "Value for luminance computation for the red channel" ); SetDefaultParameterFloat("mode.lum.red.coef", 0.21 ); - AddParameter(ParameterType_Group , "mode.lum.green" , "Green Channel" ); - AddParameter(ParameterType_Int , "mode.lum.green.ch" , "Greenen Channel" ); + AddParameter(ParameterType_Group , "mode.lum.green" , "Green channel" ); + AddParameter(ParameterType_Int , "mode.lum.green.ch" , "Green channel" ); SetDefaultParameterInt("mode.lum.green.ch", 1 ); AddParameter(ParameterType_Float , "mode.lum.green.coef" , - "Value for luminance computation" ); + "Value for luminance computation of the green channel" ); SetDefaultParameterFloat("mode.lum.green.coef", 0.71 ); - AddParameter(ParameterType_Group , "mode.lum.blue" , "Blue Channel" ); - AddParameter(ParameterType_Int , "mode.lum.blue.ch" , "Blue Channel" ); + AddParameter(ParameterType_Group , "mode.lum.blue" , "Blue channel" ); + AddParameter(ParameterType_Int , "mode.lum.blue.ch" , "Blue channel" ); SetDefaultParameterInt("mode.lum.blue.ch", 2 ); AddParameter(ParameterType_Float , "mode.lum.blue.coef" , - "Value for luminance computation" ); + "Value for luminance computation of the blue channel" ); SetDefaultParameterFloat("mode.lum.blue.coef", 0.08 ); SetDefaultParameterInt( "spatial.local.w" , 256 ); @@ -282,8 +289,8 @@ private: SetMinimumParameterIntValue("spatial.local.w", 1); SetExampleComment( "Local contrast enhancement by luminance" , 0 ); - SetDocExampleParameterValue( "in" , "couleurs.tif" ); - SetDocExampleParameterValue( "out" , "equalizedcouleurs.tif float" ); + SetDocExampleParameterValue( "in" , "colours.tif" ); + SetDocExampleParameterValue( "out" , "equalizedcolors.tif float" ); SetDocExampleParameterValue( "bins" , "256" ); SetDocExampleParameterValue( "spatial.local.w" , "500" ); SetDocExampleParameterValue( "spatial.local.h" , "500"); @@ -300,12 +307,6 @@ private: FloatVectorImageType::RegionType::SizeType size; size = inImage->GetLargestPossibleRegion().GetSize() ; - // if ( !HasUserValue("spatial.local.w") ) - // SetParameterInt( "spatial.local.w" , size[0] ); - - // if ( !HasUserValue("spatial.local.h") ) - // SetParameterInt( "spatial.local.h" , size[1] ); - if ( GetParameterString("spatial") == "local" && HasValue("spatial.local.h") && HasValue("spatial.local.w") && HasValue("bins") ) @@ -320,37 +321,17 @@ private: !HasUserValue("mode.lum.green.ch") && !HasUserValue("mode.lum.blue.ch") ) SetDefaultValue( inImage , "RGB" ); + } - // if ( HasUserValue("minmax.manuel.min") && - // HasUserValue("minmax.manuel.max") ) - // { - // if ( GetParameterFloat( "minmax.manuel.min" ) > - // GetParameterFloat( "minmax.manuel.max" ) ) - // { - // float temp = GetParameterFloat( "minmax.manuel.min" ); - // SetParameterFloat( "minmax.manuel.min" , - // GetParameterFloat( "minmax.manuel.max" )); - // SetParameterFloat( "minmax.manuel.max" , temp ); - // } - // else if ( GetParameterFloat( "minmax.manuel.min" ) == - // GetParameterFloat( "minmax.manuel.max" ) ) - // { - // std::ostringstream oss; - // oss<<"Warning minimum and maximum are equal."<<std::endl; - // otbAppLogINFO( << oss.str() ); - // } - // } - } - - if ( GetParameterString("minmax") == "manuel" ) - { - MandatoryOn("minmax.manuel.min"); - MandatoryOn("minmax.manuel.max"); + if ( GetParameterString("minmax") == "manual" ) + { + MandatoryOn("minmax.manual.min"); + MandatoryOn("minmax.manual.max"); } else if ( GetParameterString("minmax") == "auto" ) { - MandatoryOff("minmax.manuel.min"); - MandatoryOff("minmax.manuel.max"); + MandatoryOff("minmax.manual.min"); + MandatoryOff("minmax.manual.max"); } } @@ -488,15 +469,15 @@ private: if ( m_MinMaxMode == "auto" ) { oss << "automatic"; - if ( IsParameterEnabled( "minmax.auto.global" ) ) + if ( GetParameterInt( "minmax.auto.global" ) ) { oss << " and global"; } } else { - oss << GetParameterFloat("minmax.manuel.min") << "/" << - GetParameterFloat("minmax.manuel.max"); + oss << GetParameterFloat("minmax.manual.min") << "/" << + GetParameterFloat("minmax.manual.max"); } otbAppLogINFO( << oss.str() ); @@ -530,14 +511,14 @@ private: // Check for min max validity void WarningMinMax() { - if ( m_MinMaxMode == "manuel" && - GetParameterFloat( "minmax.manuel.min" ) > - GetParameterFloat( "minmax.manuel.max" ) ) + if ( m_MinMaxMode == "manual" && + GetParameterFloat( "minmax.manual.min" ) > + GetParameterFloat( "minmax.manual.max" ) ) { std::ostringstream oss; - oss<<"The minimum (" << GetParameterFloat( "minmax.manuel.min" ) << + oss<<"The minimum (" << GetParameterFloat( "minmax.manual.min" ) << ") is superior to the maximum (" - << GetParameterFloat( "minmax.manuel.max" ) + << GetParameterFloat( "minmax.manual.max" ) << ") please correct this error or allow the application to compute " "those parameters"; otbAppLogFATAL( << oss.str() ) @@ -564,10 +545,10 @@ private: FloatVectorImageType::PixelType & max , FloatVectorImageType::PixelType & min ) { - if ( m_MinMaxMode == "manuel" ) + if ( m_MinMaxMode == "manual" ) { - min.Fill( GetParameterFloat("minmax.manuel.min") ); - max.Fill( GetParameterFloat("minmax.manuel.max") ); + min.Fill( GetParameterFloat("minmax.manual.min") ); + max.Fill( GetParameterFloat("minmax.manual.max") ); } else { @@ -584,7 +565,7 @@ private: statFilter->Update(); min = statFilter->GetMinimum(); max = statFilter->GetMaximum(); - if ( IsParameterEnabled("minmax.auto.global") ) + if ( GetParameterInt("minmax.auto.global") ) { float temp(min[0]); for ( unsigned int i = 1 ; i < min.GetSize() ; i++ ) @@ -602,8 +583,8 @@ private: } std::ostringstream oss; oss<<"Minimum and maximum are for each channel : "; - if ( IsParameterEnabled("minmax.auto.global") || - m_MinMaxMode == "manuel" ) + if ( GetParameterInt("minmax.auto.global") || + m_MinMaxMode == "manual" ) { oss<<std::endl<<min[0]<<" and "<<max[0]; } diff --git a/Modules/Applications/AppFiltering/app/otbSmoothing.cxx b/Modules/Applications/AppFiltering/app/otbSmoothing.cxx index a31dc933881f65e3e50618d151f880fc87c90e9c..550cc25350e186deaf52f88ca3189d08d1f0da4d 100644 --- a/Modules/Applications/AppFiltering/app/otbSmoothing.cxx +++ b/Modules/Applications/AppFiltering/app/otbSmoothing.cxx @@ -55,7 +55,7 @@ public: itkTypeMacro(Smoothing, otb::Application); private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName( "Smoothing" ); SetDescription( "Apply a smoothing filter to an image" ); @@ -116,7 +116,7 @@ private: SetDefaultParameterInt( "type.anidif.nbiter" , 10 ); SetDefaultParameterInt( "type.anidif.conductance" , 1. ); - SetParameterString( "type" , "anidif" , false ); + SetParameterString( "type" , "anidif"); // Doc example parameter settings SetExampleComment( "Image smoothing using a mean filter." , 0 ); @@ -136,12 +136,12 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do here : all parameters are independent } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { GetLogger()->Debug("Entering DoExecute\n"); diff --git a/Modules/Applications/AppFiltering/test/CMakeLists.txt b/Modules/Applications/AppFiltering/test/CMakeLists.txt index f8195d22ce294a43281177f623e47c534de4927a..1c16ed0193190488d716c011445f68d70aa9f671 100644 --- a/Modules/Applications/AppFiltering/test/CMakeLists.txt +++ b/Modules/Applications/AppFiltering/test/CMakeLists.txt @@ -68,9 +68,9 @@ otb_test_application(NAME apTvUtContrastTest_base_glob -out ${TEMP}/apTvUtContrastTest_base_glob.tif int16 -bins 256 -spatial global - -minmax manuel - -minmax.manuel.min 0 - -minmax.manuel.max 255 + -minmax manual + -minmax.manual.min 0 + -minmax.manual.max 255 VALID --compare-image ${NOTOL} ${BASELINE}/apTvUtContrastTest_base_glob.tif ${TEMP}/apTvUtContrastTest_base_glob.tif) diff --git a/Modules/Applications/AppFusion/app/otbBundleToPerfectSensor.cxx b/Modules/Applications/AppFusion/app/otbBundleToPerfectSensor.cxx index bd52a805c544f79c16b7a02699498cbf92716006..40a439e340ec8f4fc0734eee148cd0ba690bdeaa 100644 --- a/Modules/Applications/AppFusion/app/otbBundleToPerfectSensor.cxx +++ b/Modules/Applications/AppFusion/app/otbBundleToPerfectSensor.cxx @@ -42,7 +42,7 @@ public: private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("BundleToPerfectSensor"); SetDescription("Perform P+XS pansharpening"); @@ -85,12 +85,12 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { UpdateInternalParameters("superimpose"); } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { ExecuteInternal("superimpose"); diff --git a/Modules/Applications/AppFusion/app/otbPansharpening.cxx b/Modules/Applications/AppFusion/app/otbPansharpening.cxx index 15fa33cc7e8cb2e995dc16383b14f78824d1a680..fce89cc116cddd05c4d3271cbc0d05304cff703a 100644 --- a/Modules/Applications/AppFusion/app/otbPansharpening.cxx +++ b/Modules/Applications/AppFusion/app/otbPansharpening.cxx @@ -73,7 +73,7 @@ public: private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("Pansharpening"); SetDescription("Perform P+XS pansharpening"); @@ -138,12 +138,12 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do here : all parameters are independent } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { FloatVectorImageType* panchroV = GetParameterImage("inp"); if ( panchroV->GetNumberOfComponentsPerPixel() != 1 ) diff --git a/Modules/Applications/AppHyperspectral/app/otbHyperspectralUnmixing.cxx b/Modules/Applications/AppHyperspectral/app/otbHyperspectralUnmixing.cxx index 8d510460a6892d3a64124625e3288b8d107a476e..13c2306602d67449e1c280474c643b48a6e40358 100644 --- a/Modules/Applications/AppHyperspectral/app/otbHyperspectralUnmixing.cxx +++ b/Modules/Applications/AppHyperspectral/app/otbHyperspectralUnmixing.cxx @@ -88,7 +88,7 @@ public: itkTypeMacro(HyperspectralUnmixing, otb::Application); private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("HyperspectralUnmixing"); SetDescription("Estimate abundance maps from an hyperspectral image and a set of endmembers."); @@ -144,7 +144,7 @@ private: AddChoice("ua.mdmdnmf", "MDMDNMF"); SetParameterDescription("ua.mdmdnmf", "Minimum Dispersion Constrained Non Negative Matrix Factorization"); - SetParameterString("ua", "ucls", false); + SetParameterString("ua", "ucls"); // Doc example parameter settings SetDocExampleParameterValue("in", "cupriteSubHsi.tif"); SetDocExampleParameterValue("ie", "cupriteEndmembers.tif"); @@ -154,12 +154,12 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do here : all parameters are independent } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { m_ProcessObjects.clear(); diff --git a/Modules/Applications/AppHyperspectral/app/otbVertexComponentAnalysis.cxx b/Modules/Applications/AppHyperspectral/app/otbVertexComponentAnalysis.cxx index c3b04df6a957230444db0dfb6a5c1eb8f3961587..e919d57f5d110ad42a682d2363effa88d1b17e2d 100644 --- a/Modules/Applications/AppHyperspectral/app/otbVertexComponentAnalysis.cxx +++ b/Modules/Applications/AppHyperspectral/app/otbVertexComponentAnalysis.cxx @@ -47,7 +47,7 @@ public: itkTypeMacro(VertexComponentAnalysis, otb::Application); private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("VertexComponentAnalysis"); SetDescription("Given a set of mixed spectral vectors, estimate" @@ -80,7 +80,7 @@ private: AddParameter(ParameterType_Int, "ne", "Number of endmembers"); SetParameterDescription("ne","The number of endmembers to extract from the hyperspectral image."); - SetParameterInt("ne",1, false); + SetParameterInt("ne",1); MandatoryOn("ne"); AddParameter(ParameterType_OutputImage, "outendm", "Output Endmembers"); @@ -99,12 +99,12 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do here : all parameters are independent } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { DoubleVectorImageType::Pointer inputImage = GetParameterDoubleVectorImage("in"); DoubleVectorImageType::Pointer endmembersImage; diff --git a/Modules/Applications/AppImageUtils/app/otbColorMapping.cxx b/Modules/Applications/AppImageUtils/app/otbColorMapping.cxx index ad8c68b614ed9b23f12182729964cabaae40f104..929633021b58cc5e5cd3b4cb5639554ab5e586a6 100644 --- a/Modules/Applications/AppImageUtils/app/otbColorMapping.cxx +++ b/Modules/Applications/AppImageUtils/app/otbColorMapping.cxx @@ -248,7 +248,7 @@ public: <FloatImageType, LabelImageType> CasterToLabelImageType; private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("ColorMapping"); SetDescription("Maps an input label image to 8-bits RGB using look-up tables."); @@ -346,11 +346,11 @@ private: AddParameter(ParameterType_Float,"method.continuous.min","Mapping range lower value"); SetParameterDescription("method.continuous.min","Set the lower input value of the mapping range."); - SetParameterFloat("method.continuous.min",0., false); + SetParameterFloat("method.continuous.min",0.); AddParameter(ParameterType_Float,"method.continuous.max","Mapping range higher value"); SetParameterDescription("method.continuous.max","Set the higher input value of the mapping range."); - SetParameterFloat("method.continuous.max",255., false); + SetParameterFloat("method.continuous.max",255.); // Optimal LUT AddChoice("method.optimal","Compute an optimized look-up table"); @@ -359,7 +359,7 @@ private: "[color to label] Searching all the colors present in the image to compute a continuous label list"); AddParameter(ParameterType_Int,"method.optimal.background", "Background label"); SetParameterDescription("method.optimal.background","Value of the background label"); - SetParameterInt("method.optimal.background",0, false); + SetParameterInt("method.optimal.background",0); SetMinimumParameterIntValue("method.optimal.background", 0); SetMaximumParameterIntValue("method.optimal.background", 255); @@ -371,18 +371,18 @@ private: AddParameter(ParameterType_Float, "method.image.nodatavalue", "NoData value"); SetParameterDescription("method.image.nodatavalue","NoData value for each channel of the support image, which will not be handled in the LUT estimation. If NOT checked, ALL the pixel values of the support image will be handled in the LUT estimation."); MandatoryOff("method.image.nodatavalue"); - SetParameterFloat("method.image.nodatavalue",0, false); + SetParameterFloat("method.image.nodatavalue",0); DisableParameter("method.image.nodatavalue"); AddParameter(ParameterType_Int, "method.image.low", "lower quantile"); SetParameterDescription("method.image.low","lower quantile for image normalization"); MandatoryOff("method.image.low"); - SetParameterInt("method.image.low",2, false); + SetParameterInt("method.image.low",2); SetMinimumParameterIntValue("method.image.low", 0); SetMaximumParameterIntValue("method.image.low", 100); AddParameter(ParameterType_Int, "method.image.up", "upper quantile"); SetParameterDescription("method.image.up","upper quantile for image normalization"); MandatoryOff("method.image.up"); - SetParameterInt("method.image.up",2, false); + SetParameterInt("method.image.up",2); SetMinimumParameterIntValue("method.image.up", 0); SetMaximumParameterIntValue("method.image.up", 100); @@ -397,7 +397,7 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Make sure the operation color->label is not called with methods continuous or image. // These methods are not implemented for this operation yet. @@ -406,12 +406,12 @@ private: if (GetParameterInt("method")==1 || GetParameterInt("method")==3) { otbAppLogWARNING("Override method : use optimal"); - SetParameterInt("method",2, false); + SetParameterInt("method",2); } } } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { if(GetParameterInt("op")==0) { diff --git a/Modules/Applications/AppImageUtils/app/otbCompareImages.cxx b/Modules/Applications/AppImageUtils/app/otbCompareImages.cxx index 2d0d54c83c8e1297ebcbfba5206cf88a231f2bc0..cbdcb90795e11c3400a1bbeb9ab02c4b612f98db 100644 --- a/Modules/Applications/AppImageUtils/app/otbCompareImages.cxx +++ b/Modules/Applications/AppImageUtils/app/otbCompareImages.cxx @@ -49,7 +49,7 @@ public: typedef otb::StreamingCompareImageFilter<FloatImageType> StreamingCompareImageFilterType; private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("CompareImages"); SetDescription("Estimator between 2 images."); @@ -134,7 +134,7 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Set channel interval if( HasValue("ref.in") ) @@ -169,12 +169,15 @@ private: } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { // Init filters - m_ExtractRefFilter = ExtractROIMonoFilterType::New(); - m_ExtractMeasFilter = ExtractROIMonoFilterType::New(); - m_CompareFilter = StreamingCompareImageFilterType::New(); + ExtractROIMonoFilterType::Pointer extractRefFilter = + ExtractROIMonoFilterType::New(); + ExtractROIMonoFilterType::Pointer extractMeasFilter = + ExtractROIMonoFilterType::New(); + StreamingCompareImageFilterType::Pointer compareFilter = + StreamingCompareImageFilterType::New(); // Get input image pointers FloatVectorImageType::Pointer refIm = this->GetParameterImage("ref.in"); @@ -200,41 +203,37 @@ private: otbAppLogFATAL( << "ROI is not contained in the images regions"); } - m_ExtractRefFilter->SetInput( refIm ); - m_ExtractMeasFilter->SetInput( measIm ); + extractRefFilter->SetInput( refIm ); + extractMeasFilter->SetInput( measIm ); - m_ExtractRefFilter->SetExtractionRegion(region); - m_ExtractMeasFilter->SetExtractionRegion(region); + extractRefFilter->SetExtractionRegion(region); + extractMeasFilter->SetExtractionRegion(region); // Set channels to extract otbAppLogINFO( << "reference image channel "<<this->GetParameterInt("ref.channel")<<" is compared with measured image channel "<<this->GetParameterInt("meas.channel")); - m_ExtractRefFilter->SetChannel( this->GetParameterInt("ref.channel") ); - m_ExtractMeasFilter->SetChannel( this->GetParameterInt("meas.channel") ); + extractRefFilter->SetChannel( this->GetParameterInt("ref.channel") ); + extractMeasFilter->SetChannel( this->GetParameterInt("meas.channel") ); // Compute comparison - m_CompareFilter->SetInput1(m_ExtractRefFilter->GetOutput()); - m_CompareFilter->SetInput2(m_ExtractMeasFilter->GetOutput()); - m_CompareFilter->SetPhysicalSpaceCheck(false); - m_CompareFilter->GetStreamer()->SetAutomaticAdaptativeStreaming(GetParameterInt("ram")); - AddProcess(m_CompareFilter->GetStreamer(), "Comparing..."); - m_CompareFilter->Update(); + compareFilter->SetInput1(extractRefFilter->GetOutput()); + compareFilter->SetInput2(extractMeasFilter->GetOutput()); + compareFilter->SetPhysicalSpaceCheck(false); + compareFilter->GetStreamer()->SetAutomaticAdaptativeStreaming(GetParameterInt("ram")); + AddProcess(compareFilter->GetStreamer(), "Comparing..."); + compareFilter->Update(); // Show result - otbAppLogINFO( << "MSE: " << m_CompareFilter->GetMSE() ); - otbAppLogINFO( << "MAE: " << m_CompareFilter->GetMAE() ); - otbAppLogINFO( << "PSNR: " << m_CompareFilter->GetPSNR() ); - otbAppLogINFO( << "Number of Pixel different: " << m_CompareFilter->GetDiffCount() ); - - SetParameterFloat( "mse",m_CompareFilter->GetMSE() , false); - SetParameterFloat( "mae",m_CompareFilter->GetMAE() , false); - SetParameterFloat( "psnr",m_CompareFilter->GetPSNR() , false); - SetParameterFloat( "count",m_CompareFilter->GetDiffCount() , false); + otbAppLogINFO( << "MSE: " << compareFilter->GetMSE() ); + otbAppLogINFO( << "MAE: " << compareFilter->GetMAE() ); + otbAppLogINFO( << "PSNR: " << compareFilter->GetPSNR() ); + otbAppLogINFO( << "Number of Pixel different: " << compareFilter->GetDiffCount() ); + + SetParameterFloat( "mse",compareFilter->GetMSE()); + SetParameterFloat( "mae",compareFilter->GetMAE()); + SetParameterFloat( "psnr",compareFilter->GetPSNR()); + SetParameterFloat( "count",compareFilter->GetDiffCount()); + RegisterPipeline(); } - - - ExtractROIMonoFilterType::Pointer m_ExtractRefFilter; - ExtractROIMonoFilterType::Pointer m_ExtractMeasFilter; - StreamingCompareImageFilterType::Pointer m_CompareFilter; }; } diff --git a/Modules/Applications/AppImageUtils/app/otbConcatenateImages.cxx b/Modules/Applications/AppImageUtils/app/otbConcatenateImages.cxx index 185872b828b9299a1e807ee02d48b5da26f67931..0c9d52659cf8864c387b70388470f51b9114db59 100644 --- a/Modules/Applications/AppImageUtils/app/otbConcatenateImages.cxx +++ b/Modules/Applications/AppImageUtils/app/otbConcatenateImages.cxx @@ -54,7 +54,7 @@ public: typedef ObjectList<ExtractROIFilterType> ExtractROIFilterListType; private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("ConcatenateImages"); SetDescription("Concatenate a list of images of the same size into a single multi-channel one."); @@ -72,10 +72,6 @@ private: AddDocTag("Concatenation"); AddDocTag("Multi-channel"); - m_Concatener = ListConcatenerFilterType::New(); - m_ExtractorList = ExtractROIFilterListType::New(); - m_ImageList = ImageListType::New(); - AddParameter(ParameterType_InputImageList, "il", "Input images list"); SetParameterDescription("il", "The list of images to concatenate, must have the same size."); @@ -91,18 +87,19 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do here for the parameters : all are independent - - // Reinitialize the object - m_Concatener = ListConcatenerFilterType::New(); - m_ImageList = ImageListType::New(); - m_ExtractorList = ExtractROIFilterListType::New(); } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { + ListConcatenerFilterType::Pointer m_Concatener = + ListConcatenerFilterType::New(); + ExtractROIFilterListType::Pointer m_ExtractorList = + ExtractROIFilterListType::New(); + ImageListType::Pointer m_ImageList = + ImageListType::New(); // Get the input image list FloatVectorImageListType::Pointer inList = this->GetParameterImageList("il"); @@ -140,12 +137,8 @@ private: m_Concatener->SetInput( m_ImageList ); SetParameterOutputImage("out", m_Concatener->GetOutput()); + RegisterPipeline(); } - - - ListConcatenerFilterType::Pointer m_Concatener; - ExtractROIFilterListType::Pointer m_ExtractorList; - ImageListType::Pointer m_ImageList; }; } diff --git a/Modules/Applications/AppImageUtils/app/otbConvert.cxx b/Modules/Applications/AppImageUtils/app/otbConvert.cxx index 621d48adb330f544d8b7afb1ec7bd09aee43001b..706406e190ace7d4fb198341e3f585dd30a4c6f1 100644 --- a/Modules/Applications/AppImageUtils/app/otbConvert.cxx +++ b/Modules/Applications/AppImageUtils/app/otbConvert.cxx @@ -85,7 +85,7 @@ public: private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("Convert"); SetDescription("Convert an image to a different format, optionally rescaling the data" @@ -120,7 +120,7 @@ private: AddChoice("type.none", "None"); AddChoice("type.linear", "Linear"); AddChoice("type.log2", "Log2"); - SetParameterString("type", "none", false); + SetParameterString("type", "none"); AddParameter(ParameterType_Float,"type.linear.gamma","Gamma correction factor"); SetParameterDescription("type.linear.gamma","Gamma correction factor"); @@ -192,7 +192,7 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Read information if ( HasValue("in") ) @@ -482,7 +482,7 @@ private: } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { switch ( this->GetParameterOutputImagePixelType("out") ) { diff --git a/Modules/Applications/AppImageUtils/app/otbDEMConvert.cxx b/Modules/Applications/AppImageUtils/app/otbDEMConvert.cxx index 3e79f0ad67be01a4f00562120800bd1df7a90f6e..cee406ad9f6f47ec5fbcbecad72067241582bb52 100644 --- a/Modules/Applications/AppImageUtils/app/otbDEMConvert.cxx +++ b/Modules/Applications/AppImageUtils/app/otbDEMConvert.cxx @@ -45,7 +45,7 @@ public: itkTypeMacro(DEMConvert, otb::Application); private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("DEMConvert"); SetDescription("Converts a geo-referenced DEM image into a general raster file compatible with OTB DEM handling."); @@ -75,7 +75,7 @@ private: SetOfficialDocLink(); } -void DoUpdateParameters() ITK_OVERRIDE +void DoUpdateParameters() override { // nothing to update } @@ -85,7 +85,7 @@ void DoUpdateParameters() ITK_OVERRIDE * (.ras, .geom and . omd) */ -void DoExecute() ITK_OVERRIDE +void DoExecute() override { // Load input image FloatVectorImageType::Pointer inImage = GetParameterImage("in"); diff --git a/Modules/Applications/AppImageUtils/app/otbDynamicConvert.cxx b/Modules/Applications/AppImageUtils/app/otbDynamicConvert.cxx index fa8b76c501ec66ee5672ce6a19efd8128ac8f5c7..beaf1b516ef0dd1e22e12593dd6f39109b896b59 100644 --- a/Modules/Applications/AppImageUtils/app/otbDynamicConvert.cxx +++ b/Modules/Applications/AppImageUtils/app/otbDynamicConvert.cxx @@ -85,7 +85,7 @@ public: private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("DynamicConvert"); SetDescription("Change the pixel type and rescale the image's dynamic"); @@ -124,7 +124,7 @@ private: SetParameterDescription("type", "Transfer function for the rescaling"); AddChoice("type.linear", "Linear"); AddChoice("type.log2", "Log2"); - SetParameterString("type", "linear", false); + SetParameterString("type", "linear"); AddParameter(ParameterType_Float,"type.linear.gamma", "Gamma correction factor"); @@ -212,7 +212,7 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Read information if ( HasValue("in") ) diff --git a/Modules/Applications/AppImageUtils/app/otbExtractROI.cxx b/Modules/Applications/AppImageUtils/app/otbExtractROI.cxx index bd6a8d1583cf4b54dd0ebc441108000735a943ec..adcb2f3f43e3596bd5ce3030bbf94940df8033ed 100644 --- a/Modules/Applications/AppImageUtils/app/otbExtractROI.cxx +++ b/Modules/Applications/AppImageUtils/app/otbExtractROI.cxx @@ -63,7 +63,7 @@ public: private: void - DoInit() ITK_OVERRIDE + DoInit() override { SetName("ExtractROI"); SetDescription("Extract a ROI defined by the user."); @@ -247,7 +247,7 @@ private: } void - DoUpdateParameters() ITK_OVERRIDE + DoUpdateParameters() override { if ( HasValue("in") ) { @@ -255,31 +255,39 @@ private: inImage->UpdateOutputInformation(); ImageType::RegionType largestRegion = inImage->GetLargestPossibleRegion(); - bool userExtent = !HasUserValue( "mode.extent.ulx" ) \ - && !HasUserValue( "mode.extent.uly" ) \ - && !HasUserValue( "mode.extent.lrx" ) \ - && !HasUserValue( "mode.extent.lry" ); - - bool userRadius = !HasUserValue( "mode.radius.r" ) \ - && !HasUserValue( "mode.radius.cx" ) \ - && !HasUserValue( "mode.radius.cy" ); - - // Update the sizes only if the user has not defined a size - if (!HasUserValue("sizex") && !HasUserValue("sizey") ) + ImageType::RegionType currentLargest; + currentLargest.SetSize( 0 , GetDefaultParameterInt("sizex") ); + currentLargest.SetSize( 1 , GetDefaultParameterInt("sizey") ); + currentLargest.SetIndex( 1 , GetDefaultParameterInt("starty") ); + currentLargest.SetIndex( 0 , GetDefaultParameterInt("startx") ); + // Update default only if largest has changed + if ( currentLargest != largestRegion ) { - SetParameterInt("sizex",largestRegion.GetSize()[0], false); - SetParameterInt("sizey",largestRegion.GetSize()[1], false); - - // Compute extent parameter with default sizex and sizey - if ( GetParameterString( "mode" ) == "extent" && userExtent ) - ComputeExtentFromIndex( inImage, largestRegion ); - - // Compute radius parameter with default sizex and sizey - if ( GetParameterString( "mode" ) == "radius" && userRadius ) - ComputeRadiusFromIndex( inImage , largestRegion ); + // Setting maximum value + SetMaximumParameterIntValue( "sizex" , largestRegion.GetSize(0) ); + SetMaximumParameterIntValue( "sizey" , largestRegion.GetSize(1) ); + SetMaximumParameterIntValue( "startx" , + largestRegion.GetIndex(0) + largestRegion.GetSize(0) ); + SetMaximumParameterIntValue( "starty" , + largestRegion.GetIndex(1) + largestRegion.GetSize(1) ); + // Setting default value + SetDefaultParameterInt( "sizex" , largestRegion.GetSize(0) ); + SetDefaultParameterInt( "sizey" , largestRegion.GetSize(1) ); + SetDefaultParameterInt( "startx" , largestRegion.GetIndex(0) ); + SetDefaultParameterInt( "starty" , largestRegion.GetIndex(1) ); + // Setting actual value + if ( !HasUserValue("sizex") ) + SetParameterFloat( "sizex" , + GetDefaultParameterFloat( "sizex" ) ); + if ( !HasUserValue("sizey") ) + SetParameterFloat( "sizey" , + GetDefaultParameterFloat( "sizey" ) ); + // Compute radius parameters default value + ComputeRadiusFromIndex( inImage , largestRegion ); + // Compute extent parameters default value + ComputeExtentFromIndex( inImage, largestRegion ); } - unsigned int nbComponents = inImage->GetNumberOfComponentsPerPixel(); ListViewParameter *clParam = dynamic_cast<ListViewParameter*>(GetParameterByKey("cl")); @@ -296,55 +304,25 @@ private: } } - // Put the limit of the index and the size relative the image - - SetMaximumParameterIntValue("sizex", largestRegion.GetSize(0)); - SetMaximumParameterIntValue("sizey", largestRegion.GetSize(1)); - SetMaximumParameterIntValue("startx", largestRegion.GetSize(0)); - SetMaximumParameterIntValue("starty", largestRegion.GetSize(1)); - - // Update the start and size parameter depending on the mode - if ( GetParameterString("mode") == "extent" && !userExtent) + if ( GetParameterString("mode") == "extent" ) ComputeIndexFromExtent(); - if (GetParameterString("mode") == "radius" && !userRadius) + if (GetParameterString("mode") == "radius" ) ComputeIndexFromRadius(); - - // Crop the roi region to be included in the largest possible - // region - if(!this->CropRegionOfInterest()) - { - // Put the index of the ROI to origin and try to crop again - SetParameterInt("startx",0, false); - SetParameterInt("starty",0, false); - this->CropRegionOfInterest(); - } - if(GetParameterString("mode")=="fit") { - this->SetParameterRole("startx",Role_Output); - this->SetParameterRole("starty",Role_Output); - this->SetParameterRole("sizex",Role_Output); - this->SetParameterRole("sizey",Role_Output); - this->DisableParameter("startx"); - this->DisableParameter("starty"); - this->DisableParameter("sizex"); - this->DisableParameter("sizey"); + SetParameterRole("startx",Role_Output); + SetParameterRole("starty",Role_Output); + SetParameterRole("sizex",Role_Output); + SetParameterRole("sizey",Role_Output); } - - else if(GetParameterString("mode")=="standard" || - GetParameterString("mode")=="extent" || - GetParameterString("mode")== "radius" ) + else { - this->SetParameterRole("startx",Role_Input); - this->SetParameterRole("starty",Role_Input); - this->SetParameterRole("sizex",Role_Input); - this->SetParameterRole("sizey",Role_Input); - this->EnableParameter("startx"); - this->EnableParameter("starty"); - this->EnableParameter("sizex"); - this->EnableParameter("sizey"); + SetParameterRole("startx",Role_Input); + SetParameterRole("starty",Role_Input); + SetParameterRole("sizex",Role_Input); + SetParameterRole("sizey",Role_Input); } } @@ -355,6 +333,10 @@ private: MandatoryOff("starty"); MandatoryOff("sizex"); MandatoryOff("sizey"); + DisableParameter("startx"); + DisableParameter("starty"); + DisableParameter("sizex"); + DisableParameter("sizey"); } else { @@ -362,6 +344,10 @@ private: MandatoryOn("starty"); MandatoryOn("sizex"); MandatoryOn("sizey"); + EnableParameter("startx"); + EnableParameter("starty"); + EnableParameter("sizex"); + EnableParameter("sizey"); } if ( GetParameterString( "mode" ) == "fit" && HasValue( "mode.fit.im" ) ) @@ -384,18 +370,15 @@ private: region.SetSize(1, GetParameterInt("sizey")); region.SetIndex(0, GetParameterInt("startx")); region.SetIndex(1, GetParameterInt("starty")); - if ( HasValue("in") ) + ImageType* inImage = GetParameterImage("in"); + inImage->UpdateOutputInformation(); + if (region.Crop(inImage->GetLargestPossibleRegion())) { - ImageType* inImage = GetParameterImage("in"); - inImage->UpdateOutputInformation(); - if (region.Crop(inImage->GetLargestPossibleRegion())) - { - SetParameterInt("sizex",region.GetSize(0), HasUserValue("sizex")); - SetParameterInt("sizey",region.GetSize(1), HasUserValue("sizey")); - SetParameterInt("startx",region.GetIndex(0), HasUserValue("startx")); - SetParameterInt("starty",region.GetIndex(1), HasUserValue("starty")); - return true; - } + SetParameterInt("sizex",region.GetSize(0)); + SetParameterInt("sizey",region.GetSize(1)); + SetParameterInt("startx",region.GetIndex(0)); + SetParameterInt("starty",region.GetIndex(1)); + return true; } return false; } @@ -404,20 +387,14 @@ private: ComputeIndexFromExtent() { assert( GetParameterString( "mode" ) == "extent" ); - int pixelValue = -1 ; // Compute standard parameter depending on the unit chosen by the user + FloatVectorImageType::IndexType uli , lri; if (GetParameterString( "mode.extent.unit" ) == "pxl" ) { - pixelValue = std::round( GetParameterFloat( "mode.extent.ulx" ) ); - SetParameterInt( "startx", pixelValue , true ); - pixelValue = std::round( GetParameterFloat( "mode.extent.lrx" ) \ - - pixelValue ) + 1 ; - SetParameterInt( "sizex", pixelValue , true ); - pixelValue = std::round( GetParameterFloat( "mode.extent.uly" ) ); - SetParameterInt( "starty", pixelValue , true ); - pixelValue = std::round( GetParameterFloat( "mode.extent.lry" ) \ - - pixelValue ) + 1 ; - SetParameterInt( "sizey", pixelValue , true ); + uli[0] = std::round( GetParameterFloat( "mode.extent.ulx" ) ); + uli[1] = std::round( GetParameterFloat( "mode.extent.uly" ) ); + lri[0] = std::round( GetParameterFloat( "mode.extent.lrx" ) ); + lri[1] = std::round( GetParameterFloat( "mode.extent.lry" ) ); } else if( GetParameterString( "mode.extent.unit" ) == "phy" ) { @@ -426,20 +403,11 @@ private: ulp[ 1 ] = GetParameterFloat( "mode.extent.uly" ); lrp[ 0 ] = GetParameterFloat( "mode.extent.lrx" ); lrp[ 1 ] = GetParameterFloat( "mode.extent.lry" ); - ImageType * inImage = GetParameterImage("in"); - FloatVectorImageType::IndexType uli , lri; inImage->TransformPhysicalPointToIndex(ulp,uli); - inImage->TransformPhysicalPointToIndex(lrp,lri); - - SetParameterInt( "startx", uli[0] , true ); - SetParameterInt( "starty", uli[1] , true ); - - SetParameterInt( "sizex", lri[0] - uli[0] + 1, true ); - SetParameterInt( "sizey", lri[1] - uli[1] + 1, true ); - + inImage->TransformPhysicalPointToIndex(lrp,lri); } - else if( GetParameterString( "mode.extent.unit" ) == "lonlat" ) + else // if( GetParameterString( "mode.extent.unit" ) == "lonlat" ) { RSTransformType::Pointer rsTransform = RSTransformType::New(); ImageType* inImage = GetParameterImage("in"); @@ -453,18 +421,13 @@ private: lrp_in[ 1 ] = GetParameterFloat( "mode.extent.lry" ); ulp_out = rsTransform->TransformPoint(ulp_in); lrp_out = rsTransform->TransformPoint(lrp_in); - - FloatVectorImageType::IndexType uli_out , lri_out; - inImage->TransformPhysicalPointToIndex(ulp_out,uli_out); - inImage->TransformPhysicalPointToIndex(lrp_out,lri_out); - - SetParameterInt( "startx", uli_out[0] , true ); - SetParameterInt( "starty", uli_out[1] , true ); - - SetParameterInt( "sizex", lri_out[0] - uli_out[0] + 1, true ); - SetParameterInt( "sizey", lri_out[1] - uli_out[1] + 1, true ); + inImage->TransformPhysicalPointToIndex(ulp_out,uli); + inImage->TransformPhysicalPointToIndex(lrp_out,lri); } - this->CropRegionOfInterest(); + SetParameterInt( "startx", uli[0]); + SetParameterInt( "starty", uli[1]); + SetParameterInt( "sizex", lri[0] - uli[0] + 1); + SetParameterInt( "sizey", lri[1] - uli[1] + 1); } void @@ -477,24 +440,24 @@ private: lri[ 1 ] = largestRegion.GetSize()[1]; if ( GetParameterString( "mode.extent.unit" ) == "pxl" ) { - SetParameterFloat("mode.extent.ulx", uli[0] , false); - SetParameterFloat("mode.extent.uly", uli[1] , false); - SetParameterFloat("mode.extent.lrx", lri[0] , false); - SetParameterFloat("mode.extent.lry", lri[1] , false); + SetDefaultParameterFloat("mode.extent.ulx", uli[0]); + SetDefaultParameterFloat("mode.extent.uly", uli[1]); + SetDefaultParameterFloat("mode.extent.lrx", lri[0]); + SetDefaultParameterFloat("mode.extent.lry", lri[1]); } else if ( GetParameterString( "mode.extent.unit" ) == "phy" ) { itk::Point<float, 2> ulp, lrp; input->TransformIndexToPhysicalPoint(uli,ulp); - SetParameterFloat("mode.extent.ulx",ulp[0], false); - SetParameterFloat("mode.extent.uly",ulp[1], false); + SetDefaultParameterFloat("mode.extent.ulx",ulp[0]); + SetDefaultParameterFloat("mode.extent.uly",ulp[1]); input->TransformIndexToPhysicalPoint(lri,lrp); - SetParameterFloat("mode.extent.lrx",lrp[0], false); - SetParameterFloat("mode.extent.lry",lrp[1], false); + SetDefaultParameterFloat("mode.extent.lrx",lrp[0]); + SetDefaultParameterFloat("mode.extent.lry",lrp[1]); } - else if ( GetParameterString( "mode.extent.unit" ) == "lonlat" ) + else // if ( GetParameterString( "mode.extent.unit" ) == "lonlat" ) { RSTransformType::Pointer rsTransform = RSTransformType::New(); rsTransform->SetInputKeywordList( input->GetImageKeywordlist() ); @@ -503,31 +466,42 @@ private: itk::Point<float, 2> ulp_in, lrp_in , ulp_out , lrp_out; input->TransformIndexToPhysicalPoint(uli,ulp_in); ulp_out = rsTransform->TransformPoint( ulp_in ); - SetParameterFloat( "mode.extent.ulx" , ulp_out[ 0 ] , false ); - SetParameterFloat( "mode.extent.uly" , ulp_out[ 1 ] , false ); + SetDefaultParameterFloat( "mode.extent.ulx" , ulp_out[ 0 ]); + SetDefaultParameterFloat( "mode.extent.uly" , ulp_out[ 1 ]); input->TransformIndexToPhysicalPoint( lri , lrp_in ); lrp_out = rsTransform->TransformPoint( lrp_in ); - SetParameterFloat( "mode.extent.lrx" , lrp_out[ 0 ] , false ); - SetParameterFloat( "mode.extent.lry" , lrp_out[ 1 ] , false ); + SetDefaultParameterFloat( "mode.extent.lrx" , lrp_out[ 0 ]); + SetDefaultParameterFloat( "mode.extent.lry" , lrp_out[ 1 ]); } + if ( !HasUserValue( "mode.extent.ulx" ) ) + SetParameterFloat( "mode.extent.ulx" , + GetDefaultParameterFloat( "mode.extent.ulx" ) ); + if ( !HasUserValue( "mode.extent.uly" ) ) + SetParameterFloat( "mode.extent.uly" , + GetDefaultParameterFloat( "mode.extent.uly" ) ); + if ( !HasUserValue( "mode.extent.lrx" ) ) + SetParameterFloat( "mode.extent.lrx" , + GetDefaultParameterFloat( "mode.extent.lrx" ) ); + if ( !HasUserValue( "mode.extent.lry" ) ) + SetParameterFloat( "mode.extent.lry" , + GetDefaultParameterFloat( "mode.extent.lry" ) ); } void ComputeIndexFromRadius() { - int pixelValue = -1; + FloatVectorImageType::SizeType radiusi ; + radiusi.Fill(0); assert( GetParameterString( "mode" ) == "radius" ); - // First compute sizex sizey thanks to the radius - if ( HasUserValue( "mode.radius.r" ) ) + if ( HasValue( "mode.radius.r" ) ) { if ( GetParameterString( "mode.radius.unitr" ) == "pxl" ) { - pixelValue = std::floor( 2 * GetParameterFloat( "mode.radius.r" ) ) + 1; - SetParameterInt( "sizey", pixelValue , true ); - SetParameterInt( "sizex", pixelValue , true ); + radiusi[0] = std::floor( GetParameterFloat( "mode.radius.r" ) ); + radiusi[1] = std::floor( GetParameterFloat( "mode.radius.r" ) ); } - if ( GetParameterString( "mode.radius.unitr" ) == "phy" ) + else //if ( GetParameterString( "mode.radius.unitr" ) == "phy" ) { ImageType * inImage = GetParameterImage("in"); itk::Point<float, 2> radxp , radyp , ulp ; @@ -540,64 +514,34 @@ private: radyp[1] += GetParameterFloat( "mode.radius.r" ); bool lgtx = inImage->TransformPhysicalPointToIndex( radxp , radxi ); bool lgty = inImage->TransformPhysicalPointToIndex( radyp , radyi ); - FloatVectorImageType::IndexValueType maxR = - std::min( inImage->GetLargestPossibleRegion().GetSize()[0] , - inImage->GetLargestPossibleRegion().GetSize()[1] ); - maxR = maxR / 2 - ( (maxR + 1) % 2 ); - if ( lgtx && lgty) - { - pixelValue = std::max( radxi[0] , radyi[1] ); - if ( maxR<pixelValue ) - { - pixelValue = std::min( std::min( radxi[0] , radyi[1] ) , maxR ); - } - } - else if ( lgtx ) - { - pixelValue = std::min( radxi[0] , maxR ); - } - else if ( lgty ) - { - pixelValue = std::min( radyi[1] , maxR ); - } + if ( lgtx ) + radiusi[0] = radxp[0]; else - { - pixelValue = maxR; - } - SetParameterInt( "sizey", 2 * pixelValue + 1 , true ); - SetParameterInt( "sizex", 2 * pixelValue + 1 , true ); + radiusi[0] = GetDefaultParameterInt( "sizex"); + if ( lgty ) + radiusi[1] = radyp[1]; + else + radiusi[1] = GetDefaultParameterInt( "sizey"); } } - - // Then compute startx and starty - bool size = ( HasValue("sizex") && HasValue("sizey") ); - if ( size ) + FloatVectorImageType::IndexType centeri ; + bool isIn(true); + if ( HasValue("sizex") && HasValue("sizey") ) { - int radiusxi = GetParameterInt("sizex") / 2 ; - int radiusyi = GetParameterInt("sizey") / 2 ; - - if ( GetParameterString( "mode.radius.unitc" ) == "pxl" && size ) + if ( GetParameterString( "mode.radius.unitc" ) == "pxl" ) { - pixelValue = std::round(GetParameterFloat( "mode.radius.cx" )); - SetParameterInt( "startx", pixelValue - radiusxi , true ); - pixelValue = std::round(GetParameterFloat( "mode.radius.cy" )); - SetParameterInt( "starty", pixelValue - radiusyi , true ); + centeri[0] = std::round(GetParameterFloat( "mode.radius.cx" )); + centeri[1] = std::round(GetParameterFloat( "mode.radius.cy" )); } - if ( GetParameterString( "mode.radius.unitc" ) == "phy" && size ) + else if ( GetParameterString( "mode.radius.unitc" ) == "phy" ) { ImageType * inImage = GetParameterImage("in"); itk::Point<float, 2> centerp; centerp[ 0 ] = GetParameterFloat( "mode.radius.cx" ); centerp[ 1 ] = GetParameterFloat( "mode.radius.cy" ); - FloatVectorImageType::IndexType centeri ; - bool isIn = inImage->TransformPhysicalPointToIndex( centerp , centeri ); - if ( isIn ) - { - SetParameterInt( "startx", centeri[0] - radiusxi , true ); - SetParameterInt( "starty", centeri[1] - radiusyi , true ); - } + isIn = inImage->TransformPhysicalPointToIndex( centerp , centeri ); } - if ( GetParameterString( "mode.radius.unitc" ) == "lonlat" && size ) + else // if ( GetParameterString( "mode.radius.unitc" ) == "lonlat" ) { ImageType* inImage = GetParameterImage("in"); RSTransformType::Pointer rsTransform = RSTransformType::New(); @@ -608,16 +552,21 @@ private: centerp_in[ 0 ] = GetParameterFloat( "mode.radius.cx" ); centerp_in[ 1 ] = GetParameterFloat( "mode.radius.cy" ); centerp_out = rsTransform->TransformPoint(centerp_in); - FloatVectorImageType::IndexType centeri_out; - bool isIn = inImage->TransformPhysicalPointToIndex( centerp_out , - centeri_out ); - if ( isIn ) - { - SetParameterInt( "startx", centeri_out[0] - radiusxi , true ); - SetParameterInt( "starty", centeri_out[1] - radiusyi , true ); - } + isIn = inImage->TransformPhysicalPointToIndex( centerp_out , + centeri ); } } + if ( isIn ) + { + SetParameterInt( "startx", centeri[0] - radiusi[0]); + SetParameterInt( "sizex", centeri[0] + radiusi[0] + 1 ); + SetParameterInt( "starty", centeri[1] - radiusi[1]); + SetParameterInt( "sizey", centeri[1] + radiusi[1] + 1 ); + } + else + { + // log + } } void @@ -636,30 +585,36 @@ private: if ( GetParameterString("mode.radius.unitr") == "pxl" ) { int rad = std::min( centeri[ 0 ], centeri[ 1 ] ); - SetParameterFloat( "mode.radius.r" , rad , false ); + SetDefaultParameterFloat( "mode.radius.r" , rad); } - if ( GetParameterString("mode.radius.unitr") == "phy" ) + else // if ( GetParameterString("mode.radius.unitr") == "phy" ) { itk::Point<float, 2> centerp , helpRxp, helpRyp; input->TransformIndexToPhysicalPoint(centeri,centerp); input->TransformIndexToPhysicalPoint(helpRxi,helpRxp); input->TransformIndexToPhysicalPoint(helpRyi,helpRyp); float rad = std::min( helpRxp[0] - helpRyp[0] , helpRyp[1] - helpRxp[1] ); - SetParameterFloat( "mode.radius.r" , rad , false ); + SetDefaultParameterFloat( "mode.radius.r" , rad); } + + if ( !HasUserValue( "mode.radius.r" ) ) + SetParameterFloat( "mode.radius.r" , + GetDefaultParameterFloat( "mode.radius.r" ) ); + + // Center if ( GetParameterString("mode.radius.unitc") == "pxl" ) { - SetParameterFloat( "mode.radius.cx" , centeri[0] , false ); - SetParameterFloat( "mode.radius.cy" , centeri[1] , false) ; + SetDefaultParameterFloat( "mode.radius.cx" , centeri[0] ); + SetDefaultParameterFloat( "mode.radius.cy" , centeri[1] ); } - if ( GetParameterString("mode.radius.unitc") == "phy" ) + else if ( GetParameterString("mode.radius.unitc") == "phy" ) { - itk::Point<float, 2> centerp , helpRp; + itk::Point<float, 2> centerp ; input->TransformIndexToPhysicalPoint(centeri,centerp); - SetParameterFloat( "mode.radius.cx" , centerp[0] , false ); - SetParameterFloat( "mode.radius.cy" , centerp[1] , false) ; + SetDefaultParameterFloat( "mode.radius.cx" , centerp[0] ); + SetDefaultParameterFloat( "mode.radius.cy" , centerp[1] ); } - if ( GetParameterString("mode.radius.unitc") == "lonlat" ) + else // if ( GetParameterString("mode.radius.unitc") == "lonlat" ) { RSTransformType::Pointer rsTransform = RSTransformType::New(); rsTransform->SetInputKeywordList( input->GetImageKeywordlist() ); @@ -668,13 +623,19 @@ private: itk::Point<float, 2> centerp_in, centerp_out; input->TransformIndexToPhysicalPoint(centeri,centerp_in); centerp_out = rsTransform->TransformPoint( centerp_in ); - SetParameterFloat( "mode.radius.cx" , centerp_out[ 0 ] , false ); - SetParameterFloat( "mode.radius.cy" , centerp_out[ 1 ] , false ); + SetDefaultParameterFloat( "mode.radius.cx" , centerp_out[ 0 ]); + SetDefaultParameterFloat( "mode.radius.cy" , centerp_out[ 1 ]); } + if ( !HasUserValue( "mode.radius.cx") ) + SetParameterFloat( "mode.radius.cx" , + GetDefaultParameterFloat( "mode.radius.cx" ) ); + if ( !HasUserValue( "mode.radius.cy") ) + SetParameterFloat( "mode.radius.cy" , + GetDefaultParameterFloat( "mode.radius.cy" ) ); } void - DoExecute() ITK_OVERRIDE + DoExecute() override { ImageType* inImage = GetParameterImage("in"); inImage->UpdateOutputInformation(); @@ -755,10 +716,10 @@ private: lri[1] = std::max( std::max( uli_out[1] , uri_out[1] ) , std::max( lli_out[1] , lri_out[1] ) ); - SetParameterInt( "startx", uli[0] , false ); - SetParameterInt( "starty", uli[1] , false ); - SetParameterInt( "sizex", lri[0] - uli[0] , false ); - SetParameterInt( "sizey", lri[1] - uli[1] , false ); + SetParameterInt( "startx", uli[0]); + SetParameterInt( "starty", uli[1]); + SetParameterInt( "sizex", lri[0] - uli[0]); + SetParameterInt( "sizey", lri[1] - uli[1]); } } else if( HasValue( "mode.fit.im" ) && GetParameterString( "mode" ) == "fit" ) @@ -766,7 +727,7 @@ private: // Setup the DEM Handler otb::Wrapper::ElevationParametersHandler::SetupDEMHandlerFromElevationParameters(this,"elev"); - FloatVectorImageType::Pointer referencePtr = this->GetParameterImage("mode.fit.im"); + FloatVectorImageType::Pointer referencePtr = GetParameterImage("mode.fit.im"); referencePtr->UpdateOutputInformation(); RSTransformType::Pointer rsTransform = RSTransformType::New(); @@ -826,25 +787,25 @@ private: } - this->CropRegionOfInterest(); + if ( !CropRegionOfInterest() ) + otbAppLogWARNING(<<"Could not extract the ROI as it is out of the " + "input image."); - m_ExtractROIFilter = ExtractROIFilterType::New(); - m_ExtractROIFilter->SetInput(inImage); - m_ExtractROIFilter->SetStartX(GetParameterInt("startx")); - m_ExtractROIFilter->SetStartY(GetParameterInt("starty")); - m_ExtractROIFilter->SetSizeX(GetParameterInt("sizex")); - m_ExtractROIFilter->SetSizeY(GetParameterInt("sizey")); + ExtractROIFilterType::Pointer extractROIFilter = ExtractROIFilterType::New(); + extractROIFilter->SetInput(inImage); + extractROIFilter->SetStartX(GetParameterInt("startx")); + extractROIFilter->SetStartY(GetParameterInt("starty")); + extractROIFilter->SetSizeX(GetParameterInt("sizex")); + extractROIFilter->SetSizeY(GetParameterInt("sizey")); for (unsigned int idx = 0; idx < GetSelectedItems("cl").size(); ++idx) { - m_ExtractROIFilter->SetChannel(GetSelectedItems("cl")[idx] + 1 ); + extractROIFilter->SetChannel(GetSelectedItems("cl")[idx] + 1 ); } - SetParameterOutputImage("out", m_ExtractROIFilter->GetOutput()); + SetParameterOutputImage("out", extractROIFilter->GetOutput()); + RegisterPipeline(); } - - ExtractROIFilterType::Pointer m_ExtractROIFilter; - }; } diff --git a/Modules/Applications/AppImageUtils/app/otbManageNoData.cxx b/Modules/Applications/AppImageUtils/app/otbManageNoData.cxx index 439ba055904d6e1a3c8c5e72e367d2a27cc73771..c38a88f29804fb7462ebb8393958da8ccf9507b9 100644 --- a/Modules/Applications/AppImageUtils/app/otbManageNoData.cxx +++ b/Modules/Applications/AppImageUtils/app/otbManageNoData.cxx @@ -58,7 +58,7 @@ public: typedef otb::ChangeInformationImageFilter<FloatVectorImageType> ChangeInfoFilterType; private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("ManageNoData"); SetDescription("Manage No-Data"); @@ -79,10 +79,8 @@ private: AddParameter(ParameterType_OutputImage, "out", "Output Image"); SetParameterDescription("out", "Output image"); - AddParameter(ParameterType_Empty,"usenan", "Consider NaN as no-data"); + AddParameter(ParameterType_Bool,"usenan", "Consider NaN as no-data"); SetParameterDescription("usenan","If active, the application will consider NaN as no-data values as well"); - MandatoryOff("usenan"); - DisableParameter("usenan"); AddParameter(ParameterType_Choice,"mode","No-data handling mode"); SetParameterDescription("mode","Allows choosing between different no-data handling options"); @@ -112,7 +110,7 @@ private: SetParameterDescription("mode.apply.ndval","No Data value used according to the mask image"); SetDefaultParameterFloat("mode.apply.ndval", 0.0); - SetParameterString("mode","buildmask", false); + SetParameterString("mode","buildmask"); AddRAMParameter(); @@ -125,25 +123,25 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do here for the parameters : all are independent } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { FloatVectorImageType::Pointer inputPtr = this->GetParameterImage("in"); m_Filter = FilterType::New(); m_Filter->SetInsideValue(this->GetParameterFloat("mode.buildmask.inv")); m_Filter->SetOutsideValue(this->GetParameterFloat("mode.buildmask.outv")); - m_Filter->SetNaNIsNoData(IsParameterEnabled("usenan")); + m_Filter->SetNaNIsNoData(GetParameterInt("usenan")); m_Filter->SetInput(inputPtr); m_ChangeNoDataFilter = ChangeNoDataFilterType::New(); m_ChangeNoDataFilter->SetInput(inputPtr); - m_ChangeNoDataFilter->SetNaNIsNoData(IsParameterEnabled("usenan")); + m_ChangeNoDataFilter->SetNaNIsNoData(GetParameterInt("usenan")); std::vector<double> newNoData(inputPtr->GetNumberOfComponentsPerPixel(),GetParameterFloat("mode.changevalue.newv")); diff --git a/Modules/Applications/AppImageUtils/app/otbMultiResolutionPyramid.cxx b/Modules/Applications/AppImageUtils/app/otbMultiResolutionPyramid.cxx index d94f67b260a694de203b6814f20b67ce207b6c03..15c5e1ea5acc615e114f98a50e95a915df777c9f 100644 --- a/Modules/Applications/AppImageUtils/app/otbMultiResolutionPyramid.cxx +++ b/Modules/Applications/AppImageUtils/app/otbMultiResolutionPyramid.cxx @@ -58,7 +58,7 @@ public: FloatVectorImageType> ShrinkFilterType; private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("MultiResolutionPyramid"); SetDescription("Build a multi-resolution pyramid of the image."); @@ -96,12 +96,11 @@ private: SetParameterDescription( "vfactor", "Variance factor use in smoothing. It is multiplied by the subsampling factor of each level in the pyramid (default is 0.6)."); // Boolean Fast scheme - AddParameter(ParameterType_Empty, "fast", "Use Fast Scheme"); + AddParameter(ParameterType_Bool, "fast", "Use Fast Scheme"); std::ostringstream desc; desc<<"If used, this option allows one to speed-up computation by iteratively" <<" subsampling previous level of pyramid instead of processing the full input."; SetParameterDescription("fast", desc.str()); - MandatoryOff("fast"); // Doc example parameter settings SetDocExampleParameterValue("in", "QB_Toulouse_Ortho_XS.tif"); @@ -114,14 +113,14 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do here for the parameters : all are independent // Reinitialize the internal process used } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { // Initializing the process m_SmoothingFilter = SmoothingVectorImageFilterType::New(); @@ -132,7 +131,7 @@ private: unsigned int shrinkFactor = GetParameterInt("sfactor"); double varianceFactor = GetParameterFloat("vfactor"); - bool fastScheme = IsParameterEnabled("fast"); + bool fastScheme = GetParameterInt("fast"); // Get the input image FloatVectorImageType::Pointer inImage = GetParameterImage("in"); diff --git a/Modules/Applications/AppImageUtils/app/otbPixelValue.cxx b/Modules/Applications/AppImageUtils/app/otbPixelValue.cxx index 1bca9241ea384ab9210913f1ca7949e68178142c..80c55244c8de69e0ba860acb9eb91751a06f92c7 100644 --- a/Modules/Applications/AppImageUtils/app/otbPixelValue.cxx +++ b/Modules/Applications/AppImageUtils/app/otbPixelValue.cxx @@ -48,7 +48,7 @@ public: itkTypeMacro(PixelValue, otb::Application); private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("PixelValue"); SetDescription("Get the value of a pixel."); @@ -120,7 +120,7 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { if ( HasValue("in") ) { @@ -206,7 +206,7 @@ private: return box; } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { std::string mode = GetParameterString( "mode" ); FloatVectorImageType::Pointer inImage = GetParameterImage("in"); @@ -292,7 +292,7 @@ private: id.Fill(0); std::ostringstream oss; oss << extractor->GetOutput()->GetPixel(id); - SetParameterString("value", oss.str(), false); + SetParameterString("value", oss.str()); //Display image information in the dedicated logger otbAppLogINFO( << oss.str() ); } diff --git a/Modules/Applications/AppImageUtils/app/otbQuicklook.cxx b/Modules/Applications/AppImageUtils/app/otbQuicklook.cxx index dd7134c62009cdfadc14b11f98f9f39734b09c50..f31b64075bec5a3d90dcb6e8c04d2685a555ecde 100644 --- a/Modules/Applications/AppImageUtils/app/otbQuicklook.cxx +++ b/Modules/Applications/AppImageUtils/app/otbQuicklook.cxx @@ -53,7 +53,7 @@ public: <ExtractROIFilterType::OutputImageType, ExtractROIFilterType::OutputImageType> ShrinkImageFilterType; private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("Quicklook"); SetDescription("Generates a subsampled version of an image extract"); @@ -121,7 +121,7 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Update the sizes only if the user does not defined a size if ( HasValue("in") ) @@ -146,8 +146,8 @@ private: if (!HasUserValue("rsx") && !HasUserValue("rsy") ) { - SetParameterInt("rsx",largestRegion.GetSize()[0], false); - SetParameterInt("rsy",largestRegion.GetSize()[1], false); + SetParameterInt("rsx",largestRegion.GetSize()[0]); + SetParameterInt("rsy",largestRegion.GetSize()[1]); } // Put the limit of the index and the size relative the image @@ -168,8 +168,8 @@ private: if(!this->CropRegionOfInterest()) { // Put the index of the ROI to origin and try to crop again - SetParameterInt("rox",0, false); - SetParameterInt("roy",0, false); + SetParameterInt("rox",0); + SetParameterInt("roy",0); this->CropRegionOfInterest(); } } @@ -183,46 +183,53 @@ bool CropRegionOfInterest() region.SetSize(1, GetParameterInt("rsy")); region.SetIndex(0, GetParameterInt("rox")); region.SetIndex(1, GetParameterInt("roy")); + FloatVectorImageType::RegionType region0 = region; if ( HasValue("in") ) { if (region.Crop(GetParameterImage("in")->GetLargestPossibleRegion())) { - SetParameterInt( "rsx", region.GetSize(0), HasUserValue("rsx") ); - SetParameterInt( "rsy", region.GetSize(1), HasUserValue("rsy") ); - SetParameterInt( "rox", region.GetIndex(0), HasUserValue("rox") ); - SetParameterInt( "roy", region.GetIndex(1), HasUserValue("roy") ); + if (region0.GetSize(0) != region.GetSize(0)) + SetParameterInt( "rsx", region.GetSize(0)); + if (region0.GetSize(1) != region.GetSize(1)) + SetParameterInt( "rsy", region.GetSize(1)); + if (region0.GetIndex(0) != region.GetIndex(0)) + SetParameterInt( "rox", region.GetIndex(0)); + if (region0.GetIndex(1) != region.GetIndex(1)) + SetParameterInt( "roy", region.GetIndex(1)); return true; } } return false; } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { InputImageType::Pointer inImage = GetParameterImage("in"); - m_ExtractROIFilter = ExtractROIFilterType::New(); - m_ResamplingFilter = ShrinkImageFilterType::New(); + ExtractROIFilterType::Pointer extractROIFilter = + ExtractROIFilterType::New(); + ShrinkImageFilterType::Pointer resamplingFilter = + ShrinkImageFilterType::New(); // The image on which the quicklook will be generated - // Will eventually be the m_ExtractROIFilter output + // Will eventually be the extractROIFilter output if (HasUserValue("rox") || HasUserValue("roy") || HasUserValue("rsx") || HasUserValue("rsy") || (GetSelectedItems("cl").size() > 0)) { - m_ExtractROIFilter->SetInput(inImage); - m_ExtractROIFilter->SetStartX(GetParameterInt("rox")); - m_ExtractROIFilter->SetStartY(GetParameterInt("roy")); - m_ExtractROIFilter->SetSizeX(GetParameterInt("rsx")); - m_ExtractROIFilter->SetSizeY(GetParameterInt("rsy")); + extractROIFilter->SetInput(inImage); + extractROIFilter->SetStartX(GetParameterInt("rox")); + extractROIFilter->SetStartY(GetParameterInt("roy")); + extractROIFilter->SetSizeX(GetParameterInt("rsx")); + extractROIFilter->SetSizeY(GetParameterInt("rsy")); if ((GetSelectedItems("cl").size() > 0)) { for (unsigned int idx = 0; idx < GetSelectedItems("cl").size(); ++idx) { - m_ExtractROIFilter->SetChannel(GetSelectedItems("cl")[idx] + 1 ); + extractROIFilter->SetChannel(GetSelectedItems("cl")[idx] + 1 ); } } else @@ -230,14 +237,14 @@ bool CropRegionOfInterest() unsigned int nbComponents = inImage->GetNumberOfComponentsPerPixel(); for (unsigned int idx = 0; idx < nbComponents; ++idx) { - m_ExtractROIFilter->SetChannel(idx + 1); + extractROIFilter->SetChannel(idx + 1); } } - m_ResamplingFilter->SetInput( m_ExtractROIFilter->GetOutput() ); + resamplingFilter->SetInput( extractROIFilter->GetOutput() ); } else { - m_ResamplingFilter->SetInput(inImage); + resamplingFilter->SetInput(inImage); } unsigned int Ratio = static_cast<unsigned int>(GetParameterInt("sr")); @@ -273,15 +280,13 @@ bool CropRegionOfInterest() } otbAppLogINFO( << "Ratio used: "<<Ratio << "."); - m_ResamplingFilter->SetShrinkFactor( Ratio ); - m_ResamplingFilter->Update(); + resamplingFilter->SetShrinkFactor( Ratio ); + resamplingFilter->Update(); - SetParameterOutputImage("out", m_ResamplingFilter->GetOutput()); + SetParameterOutputImage("out", resamplingFilter->GetOutput()); + RegisterPipeline(); } - ExtractROIFilterType::Pointer m_ExtractROIFilter; - ShrinkImageFilterType::Pointer m_ResamplingFilter; - }; } diff --git a/Modules/Applications/AppImageUtils/app/otbReadImageInfo.cxx b/Modules/Applications/AppImageUtils/app/otbReadImageInfo.cxx index 74bb9c42dadb51c605f164d14c228f5a6e5602c3..54e38669174e69349a7be93759944f2e79410b4d 100644 --- a/Modules/Applications/AppImageUtils/app/otbReadImageInfo.cxx +++ b/Modules/Applications/AppImageUtils/app/otbReadImageInfo.cxx @@ -48,7 +48,7 @@ public: itkTypeMacro(ReadImageInfo, otb::Application); private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("ReadImageInfo"); SetDescription("Get information about the image"); @@ -67,10 +67,8 @@ private: AddParameter(ParameterType_InputImage, "in", "Input Image"); SetParameterDescription("in", "Input image to analyse"); - AddParameter(ParameterType_Empty, "keywordlist", "Display the OSSIM keywordlist"); + AddParameter(ParameterType_Bool, "keywordlist", "Display the OSSIM keywordlist"); SetParameterDescription("keywordlist", "Output the OSSIM keyword list. It contains metadata information (sensor model, geometry ). Information is stored in keyword list (pairs of key/value)"); - DisableParameter("keywordlist"); - MandatoryOff("keywordlist"); AddParameter(ParameterType_OutputFilename, "outkwl", "Write the OSSIM keywordlist to a geom file"); SetParameterDescription("outkwl", "This option allows extracting the OSSIM keywordlist of the image into a geom file."); @@ -250,12 +248,12 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do here : all parameters are independent } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { std::ostringstream ossOutput; FloatVectorImageType::Pointer inImage = GetParameterImage("in"); @@ -267,7 +265,7 @@ private: ImageMetadataInterfaceType::Pointer metadataInterface = ImageMetadataInterfaceFactory::CreateIMI(inImage->GetMetaDataDictionary()); //Get number of bands - SetParameterInt("numberbands",inImage->GetNumberOfComponentsPerPixel(), false); + SetParameterInt("numberbands",inImage->GetNumberOfComponentsPerPixel()); ossOutput << "\tNumber of bands : " << GetParameterInt("numberbands") << std::endl; std::vector<bool> noDataValueAvailable; bool ret = itk::ExposeMetaData<std::vector<bool> >(inImage->GetMetaDataDictionary(),MetaDataKey::NoDataValueAvailable,noDataValueAvailable); @@ -298,26 +296,26 @@ private: ossOutput<<std::endl; //Get image size - SetParameterInt("indexx",inImage->GetLargestPossibleRegion().GetIndex()[0], false); - SetParameterInt("indexy",inImage->GetLargestPossibleRegion().GetIndex()[1], false); + SetParameterInt("indexx",inImage->GetLargestPossibleRegion().GetIndex()[0]); + SetParameterInt("indexy",inImage->GetLargestPossibleRegion().GetIndex()[1]); ossOutput << "\tStart index : [" << GetParameterInt("indexx") << "," << GetParameterInt("indexy") << "]" << std::endl; //Get image size - SetParameterInt("sizex",inImage->GetLargestPossibleRegion().GetSize()[0], false); - SetParameterInt("sizey",inImage->GetLargestPossibleRegion().GetSize()[1], false); + SetParameterInt("sizex",inImage->GetLargestPossibleRegion().GetSize()[0]); + SetParameterInt("sizey",inImage->GetLargestPossibleRegion().GetSize()[1]); ossOutput << "\tSize : [" << GetParameterInt("sizex") << "," << GetParameterInt("sizey") << "]" << std::endl; //Get image origin - SetParameterFloat("originx",inImage->GetOrigin()[0], false); - SetParameterFloat("originy",inImage->GetOrigin()[1], false); + SetParameterFloat("originx",inImage->GetOrigin()[0]); + SetParameterFloat("originy",inImage->GetOrigin()[1]); ossOutput << "\tOrigin : [" << GetParameterFloat("originx") << "," << GetParameterFloat("originy") << "]" << std::endl; //Get image spacing - SetParameterFloat("spacingx",inImage->GetSignedSpacing()[0], false); - SetParameterFloat("spacingy",inImage->GetSignedSpacing()[1], false); + SetParameterFloat("spacingx",inImage->GetSignedSpacing()[0]); + SetParameterFloat("spacingy",inImage->GetSignedSpacing()[1]); ossOutput << "\tSpacing : [" << GetParameterFloat("spacingx") << "," << GetParameterFloat("spacingy") << "]" << std::endl; //Estimate ground spacing @@ -336,14 +334,14 @@ private: approxGroundSpacing = groundSpacing->EvaluateAtIndex(index); //Get image estimated ground spacing (in m) - SetParameterFloat("estimatedgroundspacingx",approxGroundSpacing[0], false); - SetParameterFloat("estimatedgroundspacingy",approxGroundSpacing[1], false); + SetParameterFloat("estimatedgroundspacingx",approxGroundSpacing[0]); + SetParameterFloat("estimatedgroundspacingy",approxGroundSpacing[1]); ossOutput << "\tEstimated ground spacing (in meters): [" << GetParameterFloat("estimatedgroundspacingx") << "," << GetParameterFloat("estimatedgroundspacingy") << "]" << std::endl; ossOutput << std::endl << "Image acquisition information:" << std::endl; - SetParameterString("sensor", metadataInterface->GetSensorID(), false); + SetParameterString("sensor", metadataInterface->GetSensorID()); ossOutput << "\tSensor : "; if (!GetParameterString("sensor").empty()) ossOutput << GetParameterString("sensor"); @@ -353,11 +351,11 @@ private: ossOutput << "\tImage identification number: "; if (metadataInterface->GetImageKeywordlist().HasKey("image_id")) { - SetParameterString("id", metadataInterface->GetImageKeywordlist().GetMetadataByKey("image_id"), false); + SetParameterString("id", metadataInterface->GetImageKeywordlist().GetMetadataByKey("image_id")); ossOutput << GetParameterString("id"); } ossOutput << std::endl; - SetParameterString("projectionref", metadataInterface->GetProjectionRef(), false); + SetParameterString("projectionref", metadataInterface->GetProjectionRef()); if (!GetParameterString("projectionref").empty()) ossOutput << "\tImage projection : " << GetParameterString("projectionref") << std::endl; @@ -381,7 +379,7 @@ private: osstime<<"0"; osstime<<metadataInterface->GetMinute(); osstime<<":00"; - SetParameterString("time", osstime.str(), false); + SetParameterString("time", osstime.str()); ossOutput << "\tAcquisition time : " << GetParameterString("time") << std::endl; } @@ -410,29 +408,29 @@ private: if( !coord2name->GetCountryName().empty() ) { - SetParameterString("country", coord2name->GetCountryName(), false); + SetParameterString("country", coord2name->GetCountryName()); ossOutput << "\tCountry : " << GetParameterString("country") << std::endl; } else - SetParameterString("country", "Not available", false); + SetParameterString("country", "Not available"); if( !coord2name->GetPlaceName().empty() ) { - SetParameterString("town", coord2name->GetPlaceName(), false); + SetParameterString("town", coord2name->GetPlaceName()); ossOutput << "\tTown : " << GetParameterString("town") << std::endl; } else - SetParameterString("town", "Not available", false); + SetParameterString("town", "Not available"); // Retrieve footprint - SetParameterFloat("ullat",ullat, false); - SetParameterFloat("ullon",ullon, false); - SetParameterFloat("urlat",urlat, false); - SetParameterFloat("urlon",urlon, false); - SetParameterFloat("lrlat",lrlat, false); - SetParameterFloat("lrlon",lrlon, false); - SetParameterFloat("lllat",lllat, false); - SetParameterFloat("lllon",lllon, false); + SetParameterFloat("ullat",ullat); + SetParameterFloat("ullon",ullon); + SetParameterFloat("urlat",urlat); + SetParameterFloat("urlon",urlon); + SetParameterFloat("lrlat",lrlat); + SetParameterFloat("lrlon",lrlon); + SetParameterFloat("lllat",lllat); + SetParameterFloat("lllon",lllon); ossOutput << std::endl << "Image footprint coordinates:" << std::endl; ossOutput << "\tUpper left corner (latitude, longitude) = [" << GetParameterFloat("ullat") << "," << GetParameterFloat("ullon") << "]" << std::endl; @@ -444,15 +442,15 @@ private: { } - SetParameterInt("rgb.r",metadataInterface->GetDefaultDisplay()[0], false); - SetParameterInt("rgb.g",metadataInterface->GetDefaultDisplay()[1], false); - SetParameterInt("rgb.b",metadataInterface->GetDefaultDisplay()[2], false); + SetParameterInt("rgb.r",metadataInterface->GetDefaultDisplay()[0]); + SetParameterInt("rgb.g",metadataInterface->GetDefaultDisplay()[1]); + SetParameterInt("rgb.b",metadataInterface->GetDefaultDisplay()[2]); ossOutput << std::endl << "Image default RGB composition:" << std::endl; ossOutput << "\t[R, G, B] = [" << GetParameterInt("rgb.r") << "," << GetParameterInt("rgb.g") << "," << GetParameterInt("rgb.b") << "]" << std::endl; - SetParameterInt("gcp.count",metadataInterface->GetGCPCount(), false); - SetParameterString("gcp.proj", metadataInterface->GetGCPProjection(), false); + SetParameterInt("gcp.count",metadataInterface->GetGCPCount()); + SetParameterString("gcp.proj", metadataInterface->GetGCPProjection()); ossOutput << std::endl << "Ground control points information:" << std::endl; ossOutput << "\tNumber of GCPs = " << GetParameterInt("gcp.count") << std::endl; @@ -481,16 +479,16 @@ private: ossOutput << "\t\tGround coordinates =" << gcp_geocoord.back() << std::endl; } - SetParameterStringList("gcp.ids", gcp_ids, false); - SetParameterStringList("gcp.imcoord", gcp_imcoord, false); - SetParameterStringList("gcp.geocoord", gcp_geocoord, false); - SetParameterStringList("gcp.info", gcp_infos, false); + SetParameterStringList("gcp.ids", gcp_ids); + SetParameterStringList("gcp.imcoord", gcp_imcoord); + SetParameterStringList("gcp.geocoord", gcp_geocoord); + SetParameterStringList("gcp.info", gcp_infos); - if ( IsParameterEnabled("keywordlist") ) + if ( GetParameterInt("keywordlist") ) { std::ostringstream osskeywordlist; osskeywordlist<<metadataInterface->GetImageKeywordlist() << std::endl; - SetParameterString("keyword", osskeywordlist.str(), false); + SetParameterString("keyword", osskeywordlist.str()); ossOutput << std::endl << "Image OSSIM keywordlist (optional):" << std::endl; ossOutput << "\t" << GetParameterString("keyword") << std::endl; @@ -499,7 +497,7 @@ private: //Display image information in the dedicated logger otbAppLogINFO( << ossOutput.str() ); - if(IsParameterEnabled("outkwl")) + if(IsParameterEnabled("outkwl") && HasValue("outkwl")) { WriteGeometry(metadataInterface->GetImageKeywordlist(),GetParameterString("outkwl")); } diff --git a/Modules/Applications/AppImageUtils/app/otbRescale.cxx b/Modules/Applications/AppImageUtils/app/otbRescale.cxx index f5c08c80a24bed127fb76e1fbc93f13d54d40915..ad0992f5048a89db4af581e732dc1e44859e806c 100644 --- a/Modules/Applications/AppImageUtils/app/otbRescale.cxx +++ b/Modules/Applications/AppImageUtils/app/otbRescale.cxx @@ -49,7 +49,7 @@ public: typedef otb::VectorRescaleIntensityImageFilter<FloatVectorImageType> RescaleImageFilterType; private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("Rescale"); SetDescription("Rescale the image between two given values."); @@ -90,34 +90,35 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do here for the parameters : all are independent } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { FloatVectorImageType::Pointer inImage = GetParameterImage("in"); otbAppLogDEBUG( << "Starting Min/Max computation" ) + + MinMaxFilterType::Pointer minMaxFilter = MinMaxFilterType::New(); + minMaxFilter->SetInput( inImage ); + minMaxFilter->GetStreamer()->SetAutomaticAdaptativeStreaming(GetParameterInt("ram")); - m_MinMaxFilter = MinMaxFilterType::New(); - m_MinMaxFilter->SetInput( inImage ); - m_MinMaxFilter->GetStreamer()->SetAutomaticAdaptativeStreaming(GetParameterInt("ram")); + AddProcess(minMaxFilter->GetStreamer(), "Min/Max computing"); + minMaxFilter->Update(); - AddProcess(m_MinMaxFilter->GetStreamer(), "Min/Max computing"); - m_MinMaxFilter->Update(); - - otbAppLogDEBUG( << "Min/Max computation done : min=" << m_MinMaxFilter->GetMinimum() - << " max=" << m_MinMaxFilter->GetMaximum() ) + otbAppLogDEBUG( << "Min/Max computation done : min=" << minMaxFilter->GetMinimum() + << " max=" << minMaxFilter->GetMaximum() ) FloatVectorImageType::PixelType inMin, inMax; - m_RescaleFilter = RescaleImageFilterType::New(); - m_RescaleFilter->SetInput( inImage ); - m_RescaleFilter->SetAutomaticInputMinMaxComputation(false); - m_RescaleFilter->SetInputMinimum( m_MinMaxFilter->GetMinimum() ); - m_RescaleFilter->SetInputMaximum( m_MinMaxFilter->GetMaximum() ); + RescaleImageFilterType::Pointer rescaleFilter = + RescaleImageFilterType::New(); + rescaleFilter->SetInput( inImage ); + rescaleFilter->SetAutomaticInputMinMaxComputation(false); + rescaleFilter->SetInputMinimum( minMaxFilter->GetMinimum() ); + rescaleFilter->SetInputMaximum( minMaxFilter->GetMaximum() ); FloatVectorImageType::PixelType outMin, outMax; outMin.SetSize( inImage->GetNumberOfComponentsPerPixel() ); @@ -125,15 +126,13 @@ private: outMin.Fill( GetParameterFloat("outmin") ); outMax.Fill( GetParameterFloat("outmax") ); - m_RescaleFilter->SetOutputMinimum( outMin ); - m_RescaleFilter->SetOutputMaximum( outMax ); - m_RescaleFilter->UpdateOutputInformation(); + rescaleFilter->SetOutputMinimum( outMin ); + rescaleFilter->SetOutputMaximum( outMax ); + rescaleFilter->UpdateOutputInformation(); - SetParameterOutputImage("out", m_RescaleFilter->GetOutput()); + SetParameterOutputImage("out", rescaleFilter->GetOutput()); + RegisterPipeline(); } - - RescaleImageFilterType::Pointer m_RescaleFilter; - MinMaxFilterType::Pointer m_MinMaxFilter; }; } diff --git a/Modules/Applications/AppImageUtils/app/otbSplitImage.cxx b/Modules/Applications/AppImageUtils/app/otbSplitImage.cxx index e23eaa57eb5697fc6805aeac63725d69c76f342c..3f73fba77a07e69fd3bd4a58f502dc4c285d90ea 100644 --- a/Modules/Applications/AppImageUtils/app/otbSplitImage.cxx +++ b/Modules/Applications/AppImageUtils/app/otbSplitImage.cxx @@ -49,7 +49,7 @@ public: FloatVectorImageType::InternalPixelType> FilterType; private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("SplitImage"); SetDescription("Split a N multiband image into N images."); @@ -83,12 +83,12 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do here for the parameters : all are independent } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { // Get the input image FloatVectorImageType::Pointer inImage = GetParameterImage("in"); @@ -103,13 +103,13 @@ private: ext = itksys::SystemTools::GetFilenameExtension(ofname); // Set the extract filter input image - m_Filter = FilterType::New(); - m_Filter->SetInput(inImage); + FilterType::Pointer filter = FilterType::New(); + filter->SetInput(inImage); for (unsigned int i = 0; i < inImage->GetNumberOfComponentsPerPixel(); ++i) { // Set the channel to extract - m_Filter->SetChannel(i+1); + filter->SetChannel(i+1); // build the current output filename std::ostringstream oss; @@ -129,7 +129,7 @@ private: // Set the filename of the current output image paramOut->SetFileName(oss.str()); otbAppLogINFO(<< "File: "<<paramOut->GetFileName() << " will be written."); - paramOut->SetValue(m_Filter->GetOutput()); + paramOut->SetValue(filter->GetOutput()); paramOut->SetPixelType(this->GetParameterOutputImagePixelType("out")); // Add the current level to be written paramOut->InitializeWriters(); @@ -140,9 +140,8 @@ private: // Disable the output Image parameter to avoid writing // the last image (Application::ExecuteAndWriteOutput method) DisableParameter("out"); + RegisterPipeline(); } - - FilterType::Pointer m_Filter; }; } } diff --git a/Modules/Applications/AppImageUtils/app/otbTileFusion.cxx b/Modules/Applications/AppImageUtils/app/otbTileFusion.cxx index 5dd80bc10e6bc37c46f3302b8978272a6be973e7..7ba75ba1a3007513cc3d864b0287a2aa340ea451 100644 --- a/Modules/Applications/AppImageUtils/app/otbTileFusion.cxx +++ b/Modules/Applications/AppImageUtils/app/otbTileFusion.cxx @@ -45,7 +45,7 @@ public: typedef otb::TileImageFilter<FloatVectorImageType> TileFilterType; private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("TileFusion"); SetDescription("Fusion of an image made of several tile files."); @@ -80,12 +80,12 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to be done } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { // Get the input image list FloatVectorImageListType::Pointer tileList = this->GetParameterImageList("il"); @@ -95,23 +95,22 @@ private: itkExceptionMacro("No input Image set..."); } - m_FusionFilter = TileFilterType::New(); + TileFilterType::Pointer fusionFilter = TileFilterType::New(); TileFilterType::SizeType layout; layout[0] = this->GetParameterInt("cols"); layout[1] = this->GetParameterInt("rows"); - m_FusionFilter->SetLayout(layout); + fusionFilter->SetLayout(layout); for (unsigned int i=0; i<(layout[0]*layout[1]); i++) { - m_FusionFilter->SetInput(i,tileList->GetNthElement(i)); + fusionFilter->SetInput(i,tileList->GetNthElement(i)); } - SetParameterOutputImage("out", m_FusionFilter->GetOutput()); + SetParameterOutputImage("out", fusionFilter->GetOutput()); + RegisterPipeline(); } - TileFilterType::Pointer m_FusionFilter; - }; } diff --git a/Modules/Applications/AppImageUtils/test/CMakeLists.txt b/Modules/Applications/AppImageUtils/test/CMakeLists.txt index d2852f4d46be0c1a130e293c101fdd1934e60aae..d428cc87bbeae493384dbbc4be46fb87b0807cc7 100644 --- a/Modules/Applications/AppImageUtils/test/CMakeLists.txt +++ b/Modules/Applications/AppImageUtils/test/CMakeLists.txt @@ -173,6 +173,14 @@ otb_test_application(NAME apTvUtExtractROIRightInputFile ${INPUTDATA}/couleurs_extrait.png ${TEMP}/apTvUtExtractROIRightInputFile.tif) +otb_test_application(NAME apTvUtExtractROIComplexInputFile + APP ExtractROI + OPTIONS -in ${INPUTDATA}/complexInputCfloat.tif + -out ${TEMP}/apTvUtExtractROIComplexInputFile.tif cfloat + VALID --compare-image ${NOTOL} + ${INPUTDATA}/complexInputCfloat.tif + ${TEMP}/apTvUtExtractROIComplexInputFile.tif) + #----------- Rescale TESTS ---------------- otb_test_application(NAME apTvUtRescaleTest @@ -207,6 +215,11 @@ otb_test_application(NAME apTuUtReadImageInfoExtendedFilename_reader OPTIONS -in ${INPUTDATA}/ToulouseExtract_WithGeom.tif?&skipgeom=true&skipcarto=true ) +otb_test_application(NAME apTuUtReadComplexImageInfoFilename_reader + APP ReadImageInfo + OPTIONS -in ${INPUTDATA}/complexInputCfloat.tif + ) + set(TESTNAME "gd-pleiades-1" #LARGEINPUT{PLEIADES/TLSE_JP2_DIMAPv2_PRIMARY_PMS_lossless_12bits/IMGPHR_201222215194743808/IMG_PHR1A_PMS_201201151100183_SEN_IPU_20120222_0901-001_R1C1.JP2} diff --git a/Modules/Applications/AppIndices/app/otbRadiometricIndices.cxx b/Modules/Applications/AppIndices/app/otbRadiometricIndices.cxx index 7204d68c7e2dae14ecb4ade41479c0205f6bba44..c9e5bdcb563de7a4d496a69e1d9a7a9af1ebff13 100644 --- a/Modules/Applications/AppIndices/app/otbRadiometricIndices.cxx +++ b/Modules/Applications/AppIndices/app/otbRadiometricIndices.cxx @@ -129,7 +129,7 @@ public: private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("RadiometricIndices"); SetDescription("Compute radiometric indices."); @@ -438,7 +438,7 @@ private: } } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { //Nothing to do here } @@ -488,7 +488,7 @@ private: otbAppLogINFO(<< m_Map[GetSelectedItems("list")[idx]].item << " added.");\ } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { int nbChan = GetParameterImage("in")->GetNumberOfComponentsPerPixel(); diff --git a/Modules/Applications/AppKMZ/app/otbKmzExport.cxx b/Modules/Applications/AppKMZ/app/otbKmzExport.cxx index efda73d3c981aa5015f0a5c573d738eea4b8692d..6d00a5e411f90a1b247bb7928ce84228f53e0f08 100644 --- a/Modules/Applications/AppKMZ/app/otbKmzExport.cxx +++ b/Modules/Applications/AppKMZ/app/otbKmzExport.cxx @@ -45,7 +45,7 @@ public: itkTypeMacro(KmzExport, otb::Application); private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("KmzExport"); SetDescription("Export the input image in a KMZ product."); @@ -91,12 +91,12 @@ private: } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do here for the parameters : all are independent } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { typedef otb::KmzProductWriter<FloatVectorImageType> KmzProductWriterType; diff --git a/Modules/Applications/AppMathParser/app/otbBandMath.cxx b/Modules/Applications/AppMathParser/app/otbBandMath.cxx index 37a9054ec90fca6c5a9cb629d6d5db56608459c1..2503d924eb04d348d1d5062e87195466ce0f1608 100644 --- a/Modules/Applications/AppMathParser/app/otbBandMath.cxx +++ b/Modules/Applications/AppMathParser/app/otbBandMath.cxx @@ -53,7 +53,7 @@ public: private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName( "BandMath" ); @@ -132,7 +132,7 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Check if the expression is correctly set if (HasValue("il")) @@ -203,7 +203,7 @@ private: } } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { // Get the input image list FloatVectorImageListType::Pointer inList = GetParameterImageList("il"); diff --git a/Modules/Applications/AppMathParserX/app/otbBandMathX.cxx b/Modules/Applications/AppMathParserX/app/otbBandMathX.cxx index 90a7f245a6f3e1adf1976c27634ec5bbb12c28fd..54be6d8f6345a738ca2574c84bdac83d513513fe 100644 --- a/Modules/Applications/AppMathParserX/app/otbBandMathX.cxx +++ b/Modules/Applications/AppMathParserX/app/otbBandMathX.cxx @@ -55,13 +55,11 @@ public: private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName( "BandMathX" ); - SetDescription( - "This application performs mathematical operations on several multiband images.\n" - ); + SetDescription("This application performs mathematical operations on several multiband images."); SetDocName( "Band Math X" ); @@ -251,7 +249,7 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // check if input context should be used bool useContext = this->ContextCheck(); @@ -289,7 +287,7 @@ private: if (useContext) { // only set the first expression, 'ManyExpression' is disabled. - this->SetParameterString("exp",dummyFilter->GetExpression(0), false); + this->SetParameterString("exp",dummyFilter->GetExpression(0)); } } } @@ -345,7 +343,7 @@ private: } } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { // Get the input image list FloatVectorImageListType::Pointer inList = GetParameterImageList("il"); diff --git a/Modules/Applications/AppMoments/app/otbLocalStatisticExtraction.cxx b/Modules/Applications/AppMoments/app/otbLocalStatisticExtraction.cxx index f04bb70a5a3c81e225704bff1d1dd179c5950d5e..095da8b17f0c1a4bbce2b64ad4dcdb82fe816eea 100644 --- a/Modules/Applications/AppMoments/app/otbLocalStatisticExtraction.cxx +++ b/Modules/Applications/AppMoments/app/otbLocalStatisticExtraction.cxx @@ -53,7 +53,7 @@ itkTypeMacro(LocalStatisticExtraction, otb::Application); private: -void DoInit() ITK_OVERRIDE +void DoInit() override { SetName("LocalStatisticExtraction"); SetDescription("Computes local statistical moments on every pixel in the selected channel of the input image"); @@ -95,12 +95,12 @@ SetDocExampleParameterValue("out", "Statistics.tif"); SetOfficialDocLink(); } -void DoUpdateParameters() ITK_OVERRIDE +void DoUpdateParameters() override { // Nothing to do here : all parameters are independent } -void DoExecute() ITK_OVERRIDE +void DoExecute() override { FloatVectorImageType::Pointer inImage = GetParameterImage("in"); inImage->UpdateOutputInformation(); diff --git a/Modules/Applications/AppMorphology/app/otbBinaryMorphologicalOperation.cxx b/Modules/Applications/AppMorphology/app/otbBinaryMorphologicalOperation.cxx index c4a59616b605639201acb521129a3d9cd91033e6..dada95c498c8546e5ccf87d5456a58e3f7061df8 100644 --- a/Modules/Applications/AppMorphology/app/otbBinaryMorphologicalOperation.cxx +++ b/Modules/Applications/AppMorphology/app/otbBinaryMorphologicalOperation.cxx @@ -74,7 +74,7 @@ itkTypeMacro(BinaryMorphologicalOperation, otb::Application); private: -void DoInit() ITK_OVERRIDE +void DoInit() override { SetName( "BinaryMorphologicalOperation" ); SetDescription( "Performs morphological operations on an input image channel" ); @@ -183,12 +183,12 @@ SetDocExampleParameterValue("filter", "erode"); SetOfficialDocLink(); } -void DoUpdateParameters() ITK_OVERRIDE +void DoUpdateParameters() override { // Nothing to do here : all parameters are independent } -void DoExecute() ITK_OVERRIDE +void DoExecute() override { FloatVectorImageType::Pointer inImage = GetParameterImage("in"); inImage->UpdateOutputInformation(); diff --git a/Modules/Applications/AppMorphology/app/otbGrayScaleMorphologicalOperation.cxx b/Modules/Applications/AppMorphology/app/otbGrayScaleMorphologicalOperation.cxx index e35aad5d0c0361706ad991cd7fcc691a5f699183..1e9a059f6e295a26eb3b0b5836dae23cdb813877 100644 --- a/Modules/Applications/AppMorphology/app/otbGrayScaleMorphologicalOperation.cxx +++ b/Modules/Applications/AppMorphology/app/otbGrayScaleMorphologicalOperation.cxx @@ -74,7 +74,7 @@ itkTypeMacro(GrayScaleMorphologicalOperation, otb::Application); private: -void DoInit() ITK_OVERRIDE +void DoInit() override { SetName("GrayScaleMorphologicalOperation"); SetDescription("Performs morphological operations on a grayscale input image"); @@ -142,12 +142,12 @@ SetDocExampleParameterValue("filter", "erode"); SetOfficialDocLink(); } -void DoUpdateParameters() ITK_OVERRIDE +void DoUpdateParameters() override { // Nothing to do here : all parameters are independent } -void DoExecute() ITK_OVERRIDE +void DoExecute() override { FloatVectorImageType::Pointer inImage = GetParameterImage("in"); inImage->UpdateOutputInformation(); diff --git a/Modules/Applications/AppMorphology/app/otbMorphologicalClassification.cxx b/Modules/Applications/AppMorphology/app/otbMorphologicalClassification.cxx index a117a2f178b4739695cc08ce4f50858b3ba988c9..bd47a89c76fa513d62c17a7226df82582de5527b 100644 --- a/Modules/Applications/AppMorphology/app/otbMorphologicalClassification.cxx +++ b/Modules/Applications/AppMorphology/app/otbMorphologicalClassification.cxx @@ -70,7 +70,7 @@ public: private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName( "MorphologicalClassification" ); SetDescription( "Performs morphological convex, concave and flat " @@ -153,12 +153,12 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do here : all parameters are independent } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { FloatVectorImageType::Pointer inImage = GetParameterImage( "in" ); diff --git a/Modules/Applications/AppMorphology/app/otbMorphologicalMultiScaleDecomposition.cxx b/Modules/Applications/AppMorphology/app/otbMorphologicalMultiScaleDecomposition.cxx index fc27fd88fad25b353ece317f50185d287578468d..052e8d9be3cf5eb312f5b542e4a47bec2a3841c4 100644 --- a/Modules/Applications/AppMorphology/app/otbMorphologicalMultiScaleDecomposition.cxx +++ b/Modules/Applications/AppMorphology/app/otbMorphologicalMultiScaleDecomposition.cxx @@ -65,7 +65,7 @@ public: private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName( "MorphologicalMultiScaleDecomposition" ); SetDescription( "Perform a geodesic morphology based image analysis on an input image channel" ); @@ -155,12 +155,12 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do here : all parameters are independent } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { FloatVectorImageType::Pointer inImage = GetParameterImage( "in" ); int nBComp = inImage->GetNumberOfComponentsPerPixel(); diff --git a/Modules/Applications/AppMorphology/app/otbMorphologicalProfilesAnalysis.cxx b/Modules/Applications/AppMorphology/app/otbMorphologicalProfilesAnalysis.cxx index c314b8d6ac2f8733fe1cfd91e1736a3f6073a910..a7bc15c56bfde1cc0cd1615327be8810a50f9b74 100644 --- a/Modules/Applications/AppMorphology/app/otbMorphologicalProfilesAnalysis.cxx +++ b/Modules/Applications/AppMorphology/app/otbMorphologicalProfilesAnalysis.cxx @@ -71,7 +71,7 @@ public: private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName( "MorphologicalProfilesAnalysis" ); SetDescription( "Performs morphological profiles analysis on an input image channel." ); @@ -173,12 +173,12 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do here : all parameters are independent } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { FloatVectorImageType::Pointer inImage = GetParameterImage( "in" ); diff --git a/Modules/Applications/AppOpticalCalibration/app/otbOpticalCalibration.cxx b/Modules/Applications/AppOpticalCalibration/app/otbOpticalCalibration.cxx index 87e7dc310fa0cc14efda2c900c0b29942d3feb11..311936b341f7fffce1270c5e377bb18a2f09707f 100644 --- a/Modules/Applications/AppOpticalCalibration/app/otbOpticalCalibration.cxx +++ b/Modules/Applications/AppOpticalCalibration/app/otbOpticalCalibration.cxx @@ -29,7 +29,7 @@ #include "otbReflectanceToRadianceImageFilter.h" #include "otbReflectanceToSurfaceReflectanceImageFilter.h" #include "itkMultiplyImageFilter.h" -#include "otbClampVectorImageFilter.h" +#include "otbClampImageFilter.h" #include "otbSurfaceAdjacencyEffectCorrectionSchemeFilter.h" #include "otbGroundSpacingImageFunction.h" #include "vnl/vnl_random.h" @@ -92,7 +92,7 @@ public: typedef itk::MultiplyImageFilter<DoubleVectorImageType,DoubleImageType,DoubleVectorImageType> ScaleFilterOutDoubleType; - typedef otb::ClampVectorImageFilter<DoubleVectorImageType, + typedef otb::ClampImageFilter<DoubleVectorImageType, DoubleVectorImageType> ClampFilterType; typedef ReflectanceToSurfaceReflectanceImageFilter<DoubleVectorImageType, @@ -124,7 +124,7 @@ private: std::string m_inImageName; bool m_currentEnabledStateOfFluxParam; - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("OpticalCalibration"); SetDescription("Perform optical calibration TOA/TOC (Top Of Atmosphere/Top Of Canopy). Supported sensors: QuickBird, Ikonos, WorldView2, Formosat, Spot5, Pleiades, Spot6, Spot7. For other sensors the application also allows providing calibration parameters manually."); @@ -197,18 +197,15 @@ private: AddChoice("level.toa", "Image to Top Of Atmosphere reflectance"); AddChoice("level.toatoim", "TOA reflectance to Image"); AddChoice("level.toc", "Image to Top Of Canopy reflectance (atmospheric corrections)"); - SetParameterString("level", "toa", false); + SetParameterString("level", "toa"); - AddParameter(ParameterType_Empty, "milli", "Convert to milli reflectance"); + AddParameter(ParameterType_Bool, "milli", "Convert to milli reflectance"); SetParameterDescription("milli", "Flag to use milli-reflectance instead of reflectance.\n" "This allows saving the image with integer pixel type (in the range [0, 1000] instead of floating point in the range [0, 1]. In order to do that, use this option and set the output pixel type (-out filename double for example)"); - DisableParameter("milli"); - MandatoryOff("milli"); - AddParameter(ParameterType_Empty, "clamp", "Clamp of reflectivity values between [0, 1]"); + AddParameter(ParameterType_Bool, "clamp", "Clamp of reflectivity values between [0, 1]"); SetParameterDescription("clamp", "Clamping in the range [0, 1]. It can be useful to preserve area with specular reflectance."); - EnableParameter("clamp"); - MandatoryOff("clamp"); + SetParameterInt("clamp",1); //Acquisition parameters AddParameter(ParameterType_Group,"acqui","Acquisition parameters"); @@ -278,8 +275,8 @@ private: SetDefaultParameterFloat("acqui.view.azim",0.0); //Gain & bias - AddParameter(ParameterType_InputFilename, "acqui.gainbias", "Gains | biases"); - SetParameterDescription("acqui.gainbias", "Gains | biases"); + AddParameter(ParameterType_InputFilename, "acqui.gainbias", "Gains or biases"); + SetParameterDescription("acqui.gainbias", "Gains or biases"); MandatoryOff("acqui.gainbias"); //Solar illuminations AddParameter(ParameterType_InputFilename, "acqui.solarilluminations", "Solar illuminations"); @@ -359,7 +356,7 @@ private: m_currentEnabledStateOfFluxParam=false; } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { std::ostringstream ossOutput; //ossOutput << std::endl << "--DoUpdateParameters--" << std::endl; @@ -429,21 +426,21 @@ private: ossOutput << "Acquisition Minute already set by user: no overload" <<std::endl; else { - SetParameterInt("acqui.minute",lImageMetadataInterface->GetMinute(), false); + SetParameterInt("acqui.minute",lImageMetadataInterface->GetMinute()); } if (HasUserValue("acqui.hour")) ossOutput << "Acquisition Hour already set by user: no overload" <<std::endl; else { - SetParameterInt("acqui.hour",lImageMetadataInterface->GetHour(), false); + SetParameterInt("acqui.hour",lImageMetadataInterface->GetHour()); } if (HasUserValue("acqui.day")) ossOutput << "Acquisition Day already set by user: no overload" <<std::endl; else { - SetParameterInt("acqui.day",lImageMetadataInterface->GetDay(), false); + SetParameterInt("acqui.day",lImageMetadataInterface->GetDay()); if (IsParameterEnabled("acqui.fluxnormcoeff")) DisableParameter("acqui.day"); } @@ -452,7 +449,7 @@ private: ossOutput << "Acquisition Month already set by user: no overload" <<std::endl; else { - SetParameterInt("acqui.month",lImageMetadataInterface->GetMonth(), false); + SetParameterInt("acqui.month",lImageMetadataInterface->GetMonth()); if (IsParameterEnabled("acqui.fluxnormcoeff")) DisableParameter("acqui.month"); } @@ -461,28 +458,28 @@ private: ossOutput << "Acquisition Year already set by user: no overload" <<std::endl; else { - SetParameterInt("acqui.year",lImageMetadataInterface->GetYear(), false); + SetParameterInt("acqui.year",lImageMetadataInterface->GetYear()); } if (HasUserValue("acqui.sun.elev")) ossOutput << "Acquisition Sun Elevation Angle already set by user: no overload" <<std::endl; else - SetParameterFloat("acqui.sun.elev",lImageMetadataInterface->GetSunElevation(), false); + SetParameterFloat("acqui.sun.elev",lImageMetadataInterface->GetSunElevation()); if (HasUserValue("acqui.sun.azim")) ossOutput << "Acquisition Sun Azimuth Angle already set by user: no overload" <<std::endl; else - SetParameterFloat("acqui.sun.azim",lImageMetadataInterface->GetSunAzimuth(), false); + SetParameterFloat("acqui.sun.azim",lImageMetadataInterface->GetSunAzimuth()); if (HasUserValue("acqui.view.elev")) ossOutput << "Acquisition Viewing Elevation Angle already set by user: no overload" <<std::endl; else - SetParameterFloat("acqui.view.elev",lImageMetadataInterface->GetSatElevation(), false); + SetParameterFloat("acqui.view.elev",lImageMetadataInterface->GetSatElevation()); if (HasUserValue("acqui.view.azim")) ossOutput << "Acquisition Viewing Azimuth Angle already set by user: no overload" <<std::endl; else - SetParameterFloat("acqui.view.azim",lImageMetadataInterface->GetSatAzimuth(), false); + SetParameterFloat("acqui.view.azim",lImageMetadataInterface->GetSatAzimuth()); // Set default value so that they are stored somewhere even if // they are overloaded by user values @@ -563,7 +560,7 @@ private: } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { //Main filters instantiations m_ImageToRadianceFilter = ImageToRadianceImageFilterType::New(); @@ -751,12 +748,12 @@ private: m_ImageToRadianceFilter->SetInput(inImage); m_RadianceToReflectanceFilter->SetInput(m_ImageToRadianceFilter->GetOutput()); - if (IsParameterEnabled("clamp")) + if (GetParameterInt("clamp")) { GetLogger()->Info("Clamp values between [0, 100]\n"); } - m_RadianceToReflectanceFilter->SetUseClamp(IsParameterEnabled("clamp")); + m_RadianceToReflectanceFilter->SetUseClamp(GetParameterInt("clamp")); m_RadianceToReflectanceFilter->UpdateOutputInformation(); m_ScaleFilter->SetInput(m_RadianceToReflectanceFilter->GetOutput()); } @@ -894,7 +891,7 @@ private: } //Rescale the surface reflectance in milli-reflectance - if (!IsParameterEnabled("clamp")) + if (!GetParameterInt("clamp")) { if (!adjComputation) m_ScaleFilter->SetInput(m_ReflectanceToSurfaceReflectanceFilter->GetOutput()); @@ -920,7 +917,7 @@ private: // Output Image double scale = 1.; - if (IsParameterEnabled("milli")) + if (GetParameterInt("milli")) { GetLogger()->Info("Use milli-reflectance\n"); if ( (GetParameterInt("level") == Level_IM_TOA) || (GetParameterInt("level") == Level_TOC) ) diff --git a/Modules/Applications/AppOpticalCalibration/test/CMakeLists.txt b/Modules/Applications/AppOpticalCalibration/test/CMakeLists.txt index a3068e1a64d109373ccb799f839f62a9c74c03b1..7be8316cb8ba425920d426bf402e6640b3c06001 100644 --- a/Modules/Applications/AppOpticalCalibration/test/CMakeLists.txt +++ b/Modules/Applications/AppOpticalCalibration/test/CMakeLists.txt @@ -87,7 +87,7 @@ otb_test_application(NAME apTvRaOpticalCalibration_UnknownSensor -acqui.sun.elev 62.7 -acqui.sun.azim 152.7 -acqui.view.elev 87.5 - -acqui.view.azim -77.0 + -acqui.view.azim 283 -acqui.solarilluminations ${INPUTDATA}/apTvRaOpticalCalibrationUnknownSensorSolarIllumations2.txt -atmo.rsr ${INPUTDATA}/apTvRaOpticalCalibrationUnknownSensorRSR.txt -atmo.pressure 1013.0 diff --git a/Modules/Applications/AppProjection/app/otbConvertCartoToGeoPoint.cxx b/Modules/Applications/AppProjection/app/otbConvertCartoToGeoPoint.cxx index dfecb742eab6f21f8bbeb72794f15aa68c5c849b..e1be569af52ef6e8c3673712eadafbf6ae3ec757 100644 --- a/Modules/Applications/AppProjection/app/otbConvertCartoToGeoPoint.cxx +++ b/Modules/Applications/AppProjection/app/otbConvertCartoToGeoPoint.cxx @@ -50,7 +50,7 @@ public: typedef otb::GenericRSTransform<> TransformType; private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("ConvertCartoToGeoPoint"); SetDescription("Convert cartographic coordinates to geographic ones."); @@ -93,11 +93,11 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { // Get the projectionRef std::string inputProjRef = MapProjectionParametersHandler::GetProjectionRefFromChoice(this, "mapproj"); @@ -122,8 +122,8 @@ private: otbAppLogINFO( << std::setprecision(10) << "Geographic Point (Long, Lat) : (" << geoPoint[0] << ", " << geoPoint[1] << ")" ); - SetParameterFloat( "long",geoPoint[0] , false); - SetParameterFloat( "lat",geoPoint[1] , false); + SetParameterFloat( "long",geoPoint[0]); + SetParameterFloat( "lat",geoPoint[1]); } }; diff --git a/Modules/Applications/AppProjection/app/otbConvertSensorToGeoPoint.cxx b/Modules/Applications/AppProjection/app/otbConvertSensorToGeoPoint.cxx index 384c892f14addbc1c66ac4b2f6b66d6ed28b460a..51f7ebc29cac09bc0acbc4b9b54c2c10a0fc1b48 100644 --- a/Modules/Applications/AppProjection/app/otbConvertSensorToGeoPoint.cxx +++ b/Modules/Applications/AppProjection/app/otbConvertSensorToGeoPoint.cxx @@ -49,7 +49,7 @@ public: private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("ConvertSensorToGeoPoint"); SetDescription("Sensor to geographic coordinates conversion."); @@ -101,11 +101,11 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { // Get input Image FloatVectorImageType::Pointer inImage = GetParameterImage("in"); @@ -130,8 +130,8 @@ private: outputPoint = model->TransformPoint(point); // Set the value computed - SetParameterFloat("output.idx",outputPoint[0], false); - SetParameterFloat("output.idy",outputPoint[1], false); + SetParameterFloat("output.idx",outputPoint[0]); + SetParameterFloat("output.idy",outputPoint[1]); // Set the town and the neaerest city CoordinateToName::Pointer coord2name = CoordinateToName::New(); @@ -139,8 +139,8 @@ private: coord2name->SetLat(outputPoint[1]); coord2name->Evaluate(); - SetParameterString("output.town", coord2name->GetPlaceName(), false); - SetParameterString("output.country", coord2name->GetCountryName(), false); + SetParameterString("output.town", coord2name->GetPlaceName()); + SetParameterString("output.country", coord2name->GetCountryName()); } }; diff --git a/Modules/Applications/AppProjection/app/otbGenerateRPCSensorModel.cxx b/Modules/Applications/AppProjection/app/otbGenerateRPCSensorModel.cxx index 1e3691514c23b39cd9b203a723d09b9817432009..c4b4b58d7df6ef3af0709c14d94012ca1d82f658 100644 --- a/Modules/Applications/AppProjection/app/otbGenerateRPCSensorModel.cxx +++ b/Modules/Applications/AppProjection/app/otbGenerateRPCSensorModel.cxx @@ -57,7 +57,7 @@ public: itkTypeMacro(GenerateRPCSensorModel, otb::Application); private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("GenerateRPCSensorModel"); SetDescription("Generate a RPC sensor model from a list of Ground Control Points."); @@ -108,12 +108,12 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do here : all parameters are independent } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { OGRMultiLineString mls; diff --git a/Modules/Applications/AppProjection/app/otbGridBasedImageResampling.cxx b/Modules/Applications/AppProjection/app/otbGridBasedImageResampling.cxx index 72c9073a536035db0bf7b54dce52958e420590d4..9df8a550f39702db9a5e998496bf898515a4384c 100644 --- a/Modules/Applications/AppProjection/app/otbGridBasedImageResampling.cxx +++ b/Modules/Applications/AppProjection/app/otbGridBasedImageResampling.cxx @@ -104,7 +104,7 @@ private: m_DisplacementFieldCaster = DisplacementFieldCastFilterType::New(); } - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("GridBasedImageResampling"); SetDescription("Resamples an image according to a resampling grid"); @@ -173,7 +173,7 @@ private: AddParameter(ParameterType_Radius, "interpolator.bco.radius", "Radius for bicubic interpolation"); SetParameterDescription("interpolator.bco.radius","This parameter allows controlling the size of the bicubic interpolation filter. If the target pixel size is higher than the input pixel size, increasing this parameter will reduce aliasing artifacts."); SetDefaultParameterInt("interpolator.bco.radius", 2); - SetParameterString("interpolator","bco", false); + SetParameterString("interpolator","bco"); AddRAMParameter(); @@ -188,12 +188,12 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do here } -void DoExecute() ITK_OVERRIDE +void DoExecute() override { // Get the input image FloatVectorImageType* inImage = GetParameterImage("io.in"); diff --git a/Modules/Applications/AppProjection/app/otbImageEnvelope.cxx b/Modules/Applications/AppProjection/app/otbImageEnvelope.cxx index cda6b1fc64307e1a0fabc79c508d934b03156a1c..d276558e6ffff0b7d056cf11f06efe11fe31d763 100644 --- a/Modules/Applications/AppProjection/app/otbImageEnvelope.cxx +++ b/Modules/Applications/AppProjection/app/otbImageEnvelope.cxx @@ -49,7 +49,7 @@ public: <FloatVectorImageType, VectorDataType> EnvelopeFilterType; private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("ImageEnvelope"); SetDescription("Extracts an image envelope."); @@ -93,12 +93,12 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to be done } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { FloatVectorImageType::Pointer input = GetParameterImage("in"); diff --git a/Modules/Applications/AppProjection/app/otbObtainUTMZoneFromGeoPoint.cxx b/Modules/Applications/AppProjection/app/otbObtainUTMZoneFromGeoPoint.cxx index 37d0ec7b74b4104ef1ab1e6e893a8dac585d513c..3e3a0765facc654571e7a0c5d534d6b6f06264f4 100644 --- a/Modules/Applications/AppProjection/app/otbObtainUTMZoneFromGeoPoint.cxx +++ b/Modules/Applications/AppProjection/app/otbObtainUTMZoneFromGeoPoint.cxx @@ -47,11 +47,11 @@ private: { } - ~ObtainUTMZoneFromGeoPoint() ITK_OVERRIDE + ~ObtainUTMZoneFromGeoPoint() override { } - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("ObtainUTMZoneFromGeoPoint"); SetDescription("UTM zone determination from a geographic point."); @@ -84,16 +84,16 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { int utmZone = otb::Utils::GetZoneFromGeoPoint(GetParameterFloat("lon"), GetParameterFloat("lat")); - SetParameterInt("utm",utmZone, false); + SetParameterInt("utm",utmZone); } }; diff --git a/Modules/Applications/AppProjection/app/otbOrthoRectification.cxx b/Modules/Applications/AppProjection/app/otbOrthoRectification.cxx index 3c91403e47100f50b352f436f2a7583d648a14de..0a08916483ec23fda919e25181ec71a0287b3176 100644 --- a/Modules/Applications/AppProjection/app/otbOrthoRectification.cxx +++ b/Modules/Applications/AppProjection/app/otbOrthoRectification.cxx @@ -87,15 +87,12 @@ public: typedef otb::BCOInterpolateImageFunction<FloatVectorImageType> BCOInterpolationType; private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("OrthoRectification"); - std::ostringstream oss; - oss << "This application allows ortho-rectifying optical and radar images from supported sensors." << std::endl; - SetDescription(oss.str()); - // Documentation + SetDescription("This application allows ortho-rectifying optical and radar images from supported sensors."); SetDocName("Ortho-rectification"); - oss.str(""); + std::ostringstream oss; oss<<"This application uses inverse sensor modelling combined with a choice of interpolation functions to resample a sensor geometry image into a ground geometry regular grid. "; oss<<"The ground geometry regular grid is defined with respect to a map projection (see map parameter). The application offers several modes to estimate the output grid parameters (origin and ground sampling distance), including automatic estimation of image size, ground sampling distance, or both, from image metadata, user-defined ROI corners, or another ortho-image."; oss<<"A digital Elevation Model along with a geoid file can be specified to account for terrain deformations."; @@ -177,13 +174,13 @@ private: MandatoryOff("outputs.lry"); MandatoryOff("outputs.ortho"); - AddParameter(ParameterType_Empty,"outputs.isotropic","Force isotropic spacing by default"); + AddParameter(ParameterType_Bool,"outputs.isotropic","Force isotropic spacing by default"); std::ostringstream isotropOss; isotropOss << "Default spacing (pixel size) values are estimated from the sensor modeling of the image. It can therefore result in a non-isotropic spacing. "; isotropOss << "This option allows you to force default values to be isotropic (in this case, the minimum of spacing in both direction is applied. "; isotropOss << "Values overridden by user are not affected by this option."; SetParameterDescription("outputs.isotropic", isotropOss.str()); - EnableParameter("outputs.isotropic"); + SetParameterInt("outputs.isotropic", 1); AddParameter(ParameterType_Float, "outputs.default", "Default pixel value"); SetParameterDescription("outputs.default","Default value to write when outside of input image."); @@ -237,7 +234,7 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { if (HasValue("io.in")) { @@ -259,7 +256,7 @@ private: typedef otb::ImageToGenericRSOutputParameters<FloatVectorImageType> OutputParametersEstimatorType; OutputParametersEstimatorType::Pointer genericRSEstimator = OutputParametersEstimatorType::New(); - if(IsParameterEnabled("outputs.isotropic")) + if(GetParameterInt("outputs.isotropic")) { genericRSEstimator->EstimateIsotropicSpacingOn(); } @@ -274,28 +271,28 @@ private: // Fill the Gui with the computed parameters if (!HasUserValue("outputs.sizex")) - SetParameterInt("outputs.sizex",genericRSEstimator->GetOutputSize()[0], false); + SetParameterInt("outputs.sizex",genericRSEstimator->GetOutputSize()[0]); if (!HasUserValue("outputs.sizey")) - SetParameterInt("outputs.sizey",genericRSEstimator->GetOutputSize()[1], false); + SetParameterInt("outputs.sizey",genericRSEstimator->GetOutputSize()[1]); if (!HasUserValue("outputs.spacingx")) - SetParameterFloat("outputs.spacingx",genericRSEstimator->GetOutputSpacing()[0], false); + SetParameterFloat("outputs.spacingx",genericRSEstimator->GetOutputSpacing()[0]); if (!HasUserValue("outputs.spacingy")) - SetParameterFloat("outputs.spacingy",genericRSEstimator->GetOutputSpacing()[1], false); + SetParameterFloat("outputs.spacingy",genericRSEstimator->GetOutputSpacing()[1]); if (!HasUserValue("outputs.ulx")) - SetParameterFloat("outputs.ulx",genericRSEstimator->GetOutputOrigin()[0] - 0.5 * genericRSEstimator->GetOutputSpacing()[0], false); + SetParameterFloat("outputs.ulx",genericRSEstimator->GetOutputOrigin()[0] - 0.5 * genericRSEstimator->GetOutputSpacing()[0]); if (!HasUserValue("outputs.uly")) - SetParameterFloat("outputs.uly",genericRSEstimator->GetOutputOrigin()[1] - 0.5 * genericRSEstimator->GetOutputSpacing()[1], false); + SetParameterFloat("outputs.uly",genericRSEstimator->GetOutputOrigin()[1] - 0.5 * genericRSEstimator->GetOutputSpacing()[1]); if (!HasUserValue("outputs.lrx")) - SetParameterFloat("outputs.lrx",GetParameterFloat("outputs.ulx") + GetParameterFloat("outputs.spacingx") * static_cast<double>(GetParameterInt("outputs.sizex")), false); + SetParameterFloat("outputs.lrx",GetParameterFloat("outputs.ulx") + GetParameterFloat("outputs.spacingx") * static_cast<double>(GetParameterInt("outputs.sizex"))); if (!HasUserValue("outputs.lry")) - SetParameterFloat("outputs.lry",GetParameterFloat("outputs.uly") + GetParameterFloat("outputs.spacingy") * static_cast<double>(GetParameterInt("outputs.sizey")), false); + SetParameterFloat("outputs.lry",GetParameterFloat("outputs.uly") + GetParameterFloat("outputs.spacingy") * static_cast<double>(GetParameterInt("outputs.sizey"))); // Handle the spacing and size field following the mode // chose by the user @@ -336,8 +333,8 @@ private: MandatoryOff("outputs.ortho"); // Update lower right - SetParameterFloat("outputs.lrx",GetParameterFloat("outputs.ulx") + GetParameterFloat("outputs.spacingx") * static_cast<double>(GetParameterInt("outputs.sizex")), false); - SetParameterFloat("outputs.lry",GetParameterFloat("outputs.uly") + GetParameterFloat("outputs.spacingy") * static_cast<double>(GetParameterInt("outputs.sizey")), false); + SetParameterFloat("outputs.lrx",GetParameterFloat("outputs.ulx") + GetParameterFloat("outputs.spacingx") * static_cast<double>(GetParameterInt("outputs.sizex"))); + SetParameterFloat("outputs.lry",GetParameterFloat("outputs.uly") + GetParameterFloat("outputs.spacingy") * static_cast<double>(GetParameterInt("outputs.sizey"))); } break; case Mode_AutomaticSize: @@ -382,16 +379,16 @@ private: genericRSEstimator->Compute(); // Set the processed size relative to this forced spacing - SetParameterInt("outputs.sizex",genericRSEstimator->GetOutputSize()[0], false); - SetParameterInt("outputs.sizey",genericRSEstimator->GetOutputSize()[1], false); + SetParameterInt("outputs.sizex",genericRSEstimator->GetOutputSize()[0]); + SetParameterInt("outputs.sizey",genericRSEstimator->GetOutputSize()[1]); // Reset Origin to default - SetParameterFloat("outputs.ulx",genericRSEstimator->GetOutputOrigin()[0] - 0.5 * genericRSEstimator->GetOutputSpacing()[0], false); - SetParameterFloat("outputs.uly",genericRSEstimator->GetOutputOrigin()[1] - 0.5 * genericRSEstimator->GetOutputSpacing()[1], false); + SetParameterFloat("outputs.ulx",genericRSEstimator->GetOutputOrigin()[0] - 0.5 * genericRSEstimator->GetOutputSpacing()[0]); + SetParameterFloat("outputs.uly",genericRSEstimator->GetOutputOrigin()[1] - 0.5 * genericRSEstimator->GetOutputSpacing()[1]); // Update lower right - SetParameterFloat("outputs.lrx",GetParameterFloat("outputs.ulx") + GetParameterFloat("outputs.spacingx") * static_cast<double>(GetParameterInt("outputs.sizex")), false); - SetParameterFloat("outputs.lry",GetParameterFloat("outputs.uly") + GetParameterFloat("outputs.spacingy") * static_cast<double>(GetParameterInt("outputs.sizey")), false); + SetParameterFloat("outputs.lrx",GetParameterFloat("outputs.ulx") + GetParameterFloat("outputs.spacingx") * static_cast<double>(GetParameterInt("outputs.sizex"))); + SetParameterFloat("outputs.lry",GetParameterFloat("outputs.uly") + GetParameterFloat("outputs.spacingy") * static_cast<double>(GetParameterInt("outputs.sizey"))); } break; case Mode_AutomaticSpacing: @@ -436,16 +433,16 @@ private: genericRSEstimator->Compute(); // Set the processed spacing relative to this forced size - SetParameterFloat("outputs.spacingx",genericRSEstimator->GetOutputSpacing()[0], false); - SetParameterFloat("outputs.spacingy",genericRSEstimator->GetOutputSpacing()[1], false); + SetParameterFloat("outputs.spacingx",genericRSEstimator->GetOutputSpacing()[0]); + SetParameterFloat("outputs.spacingy",genericRSEstimator->GetOutputSpacing()[1]); // Reset Origin to default - SetParameterFloat("outputs.ulx",genericRSEstimator->GetOutputOrigin()[0] - 0.5 * genericRSEstimator->GetOutputSpacing()[0], false); - SetParameterFloat("outputs.uly",genericRSEstimator->GetOutputOrigin()[1] - 0.5 * genericRSEstimator->GetOutputSpacing()[1], false); + SetParameterFloat("outputs.ulx",genericRSEstimator->GetOutputOrigin()[0] - 0.5 * genericRSEstimator->GetOutputSpacing()[0]); + SetParameterFloat("outputs.uly",genericRSEstimator->GetOutputOrigin()[1] - 0.5 * genericRSEstimator->GetOutputSpacing()[1]); // Update lower right - SetParameterFloat("outputs.lrx",GetParameterFloat("outputs.ulx") + GetParameterFloat("outputs.spacingx") * static_cast<double>(GetParameterInt("outputs.sizex")), false); - SetParameterFloat("outputs.lry",GetParameterFloat("outputs.uly") + GetParameterFloat("outputs.spacingy") * static_cast<double>(GetParameterInt("outputs.sizey")), false); + SetParameterFloat("outputs.lrx",GetParameterFloat("outputs.ulx") + GetParameterFloat("outputs.spacingx") * static_cast<double>(GetParameterInt("outputs.sizex"))); + SetParameterFloat("outputs.lry",GetParameterFloat("outputs.uly") + GetParameterFloat("outputs.spacingy") * static_cast<double>(GetParameterInt("outputs.sizey"))); } break; @@ -489,9 +486,9 @@ private: // Set the processed size relative to this forced spacing if (vcl_abs(spacing[0]) > 0.0) - SetParameterInt("outputs.sizex",static_cast<int>(vcl_ceil((GetParameterFloat("outputs.lrx")-GetParameterFloat("outputs.ulx"))/spacing[0])), false); + SetParameterInt("outputs.sizex",static_cast<int>(vcl_ceil((GetParameterFloat("outputs.lrx")-GetParameterFloat("outputs.ulx"))/spacing[0]))); if (vcl_abs(spacing[1]) > 0.0) - SetParameterInt("outputs.sizey",static_cast<int>(vcl_ceil((GetParameterFloat("outputs.lry")-GetParameterFloat("outputs.uly"))/spacing[1])), false); + SetParameterInt("outputs.sizey",static_cast<int>(vcl_ceil((GetParameterFloat("outputs.lry")-GetParameterFloat("outputs.uly"))/spacing[1]))); } break; case Mode_OrthoFit: @@ -541,11 +538,11 @@ private: SetParameterInt("outputs.sizey",size[1]); SetParameterFloat("outputs.spacingx",spacing[0]); SetParameterFloat("outputs.spacingy",spacing[1]); - SetParameterFloat("outputs.ulx",orig[0] - 0.5 * spacing[0], false); - SetParameterFloat("outputs.uly",orig[1] - 0.5 * spacing[1], false); + SetParameterFloat("outputs.ulx",orig[0] - 0.5 * spacing[0]); + SetParameterFloat("outputs.uly",orig[1] - 0.5 * spacing[1]); // Update lower right - SetParameterFloat("outputs.lrx",GetParameterFloat("outputs.ulx") + GetParameterFloat("outputs.spacingx") * static_cast<double>(GetParameterInt("outputs.sizex")), false); - SetParameterFloat("outputs.lry",GetParameterFloat("outputs.uly") + GetParameterFloat("outputs.spacingy") * static_cast<double>(GetParameterInt("outputs.sizey")), false); + SetParameterFloat("outputs.lrx",GetParameterFloat("outputs.ulx") + GetParameterFloat("outputs.spacingx") * static_cast<double>(GetParameterInt("outputs.sizex"))); + SetParameterFloat("outputs.lry",GetParameterFloat("outputs.uly") + GetParameterFloat("outputs.spacingy") * static_cast<double>(GetParameterInt("outputs.sizey"))); } } break; @@ -591,17 +588,17 @@ private: // Use the smallest spacing (more precise grid) double optimalSpacing = std::min( vcl_abs(xgridspacing), vcl_abs(ygridspacing) ); otbAppLogINFO( "Setting grid spacing to " << optimalSpacing ); - SetParameterFloat("opt.gridspacing",optimalSpacing, false); + SetParameterFloat("opt.gridspacing",optimalSpacing); } else // if (m_OutputProjectionRef == otb::GeoInformationConversion::ToWKT(4326)) { - SetParameterFloat("opt.gridspacing",DefaultGridSpacingMeter, false); + SetParameterFloat("opt.gridspacing",DefaultGridSpacingMeter); } // if (m_OutputProjectionRef == otb::GeoInformationConversion::ToWKT(4326)) } // if (!HasUserValue("opt.gridspacing")) } // if (HasValue("io.in")) } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { // Get the input image FloatVectorImageType* inImage = GetParameterImage("io.in"); diff --git a/Modules/Applications/AppProjection/app/otbRefineSensorModel.cxx b/Modules/Applications/AppProjection/app/otbRefineSensorModel.cxx index e5829eb1643d79c2ab859eee304960cb8c7b0232..653a4b77b8e278ca2a43336a87a6775640ec8f41 100644 --- a/Modules/Applications/AppProjection/app/otbRefineSensorModel.cxx +++ b/Modules/Applications/AppProjection/app/otbRefineSensorModel.cxx @@ -56,7 +56,7 @@ public: itkTypeMacro(RefineSensorModel, otb::Application); private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("RefineSensorModel"); SetDescription("Perform least-square fit of a sensor model to a set of tie points"); @@ -105,12 +105,12 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do here : all parameters are independent } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { OGRMultiLineString mls; diff --git a/Modules/Applications/AppProjection/app/otbRigidTransformResample.cxx b/Modules/Applications/AppProjection/app/otbRigidTransformResample.cxx index 7b6da7d245c8e9b2d37f7191e56867903a2a76af..1c1f5f2103c760ba0a7789b64f2525ce6729edba 100644 --- a/Modules/Applications/AppProjection/app/otbRigidTransformResample.cxx +++ b/Modules/Applications/AppProjection/app/otbRigidTransformResample.cxx @@ -80,7 +80,7 @@ public: private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("RigidTransformResample"); SetDescription("Resample an image with a rigid transform"); @@ -159,7 +159,7 @@ private: AddParameter(ParameterType_Radius, "interpolator.bco.radius", "Radius for bicubic interpolation"); SetParameterDescription("interpolator.bco.radius","This parameter allows controlling the size of the bicubic interpolation filter. If the target pixel size is higher than the input pixel size, increasing this parameter will reduce aliasing artifacts."); SetDefaultParameterInt("interpolator.bco.radius", 2); - SetParameterString("interpolator","bco", false); + SetParameterString("interpolator","bco"); // RAM available AddRAMParameter("ram"); @@ -176,12 +176,12 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do here : all parameters are independent } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { FloatVectorImageType* inputImage = GetParameterImage("in"); diff --git a/Modules/Applications/AppProjection/app/otbSuperimpose.cxx b/Modules/Applications/AppProjection/app/otbSuperimpose.cxx index 1d1018e8fc74a755fa8b425a86369e4c0afc7d22..df13e6edae2c9e774f839697a63085ca34905c18 100644 --- a/Modules/Applications/AppProjection/app/otbSuperimpose.cxx +++ b/Modules/Applications/AppProjection/app/otbSuperimpose.cxx @@ -81,7 +81,7 @@ public: FloatVectorImageType> BasicResamplerType; private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("Superimpose"); SetDescription("Using available image metadata, project one image onto another one"); @@ -159,17 +159,17 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { if(!HasUserValue("mode") && HasValue("inr") && HasValue("inm") && otb::PleiadesPToXSAffineTransformCalculator::CanCompute(GetParameterImage("inr"),GetParameterImage("inm"))) { otbAppLogWARNING("Forcing PHR mode with PHR data. You need to add \"-mode default\" to force the default mode with PHR images."); - SetParameterString("mode","phr", false); + SetParameterString("mode","phr"); } } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { // Get the inputs FloatVectorImageType* refImage = GetParameterImage("inr"); diff --git a/Modules/Applications/AppProjection/app/otbVectorDataReprojection.cxx b/Modules/Applications/AppProjection/app/otbVectorDataReprojection.cxx index fe9e070a8b592c14e2fc63b6d8f16a65e79cd2a7..8babbfa31460ee189d50ea0e67ad836f938444e2 100644 --- a/Modules/Applications/AppProjection/app/otbVectorDataReprojection.cxx +++ b/Modules/Applications/AppProjection/app/otbVectorDataReprojection.cxx @@ -60,16 +60,12 @@ public: ; private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("VectorDataReprojection"); - std::ostringstream oss; - oss << "Reproject a vector data using support image projection reference" - ", or a user specified map projection" << std::endl; - SetDescription(oss.str()); - // Documentation + SetDescription("Reproject a vector data using support image projection reference, or a user specified map projection"); SetDocName("Vector Data reprojection"); - oss.str(""); + std::ostringstream oss; oss <<" This application allows reprojecting a vector data using support image projection reference" ", or a user given map projection." << std::endl; oss <<" If given, image keywordlist can be added to reprojected vectordata."; @@ -117,12 +113,12 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { GetLogger()->Debug("Entering DoExecute\n"); diff --git a/Modules/Applications/AppSARCalibration/app/otbSARCalibration.cxx b/Modules/Applications/AppSARCalibration/app/otbSARCalibration.cxx index 4a91dda2f5183e34a8bd470684302805b54d5609..14698cce48a7f7c1da85cda338ecf977e0befe07 100644 --- a/Modules/Applications/AppSARCalibration/app/otbSARCalibration.cxx +++ b/Modules/Applications/AppSARCalibration/app/otbSARCalibration.cxx @@ -45,10 +45,10 @@ public: FloatImageType> CalibrationFilterType; private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("SARCalibration"); - SetDescription("Perform radiometric calibration of SAR images. Following sensors are supported: TerraSAR-X, Sentinel1 and Radarsat-2.Both Single Look Complex(SLC) and detected products are supported as input.\n"); + SetDescription("Perform radiometric calibration of SAR images. Following sensors are supported: TerraSAR-X, Sentinel1 and Radarsat-2.Both Single Look Complex(SLC) and detected products are supported as input."); // Documentation SetDocName("SAR Radiometric calibration"); @@ -60,7 +60,7 @@ private: AddDocTag(Tags::Calibration); AddDocTag(Tags::SAR); - AddParameter(ParameterType_ComplexInputImage, "in", "Input Image"); + AddParameter(ParameterType_InputImage, "in", "Input Image"); SetParameterDescription("in", "Input complex image"); AddParameter(ParameterType_OutputImage, "out", "Output Image"); @@ -68,9 +68,8 @@ private: AddRAMParameter(); - AddParameter(ParameterType_Empty, "noise", "Disable Noise"); + AddParameter(ParameterType_Bool, "noise", "Disable Noise"); SetParameterDescription("noise", "Flag to disable noise. For 5.2.0 release, the noise values are only read by TerraSARX product."); - MandatoryOff("noise"); AddParameter(ParameterType_Choice, "lut", "Lookup table sigma /gamma/ beta/ DN."); SetParameterDescription("lut", "Lookup table values are not available with all SAR products. Products that provide lookup table with metadata are: Sentinel1, Radarsat2."); @@ -91,12 +90,12 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { // Get the input complex image ComplexFloatImageType* floatComplexImage = GetParameterComplexFloatImage("in"); @@ -104,17 +103,8 @@ private: // Set the filer input m_CalibrationFilter = CalibrationFilterType::New(); m_CalibrationFilter->SetInput(floatComplexImage); - - if (IsParameterEnabled("noise")) - { - m_CalibrationFilter->SetEnableNoise(false); - } - - short lut = 0; - - lut = GetParameterInt("lut"); - - m_CalibrationFilter->SetLookupSelected(lut); + m_CalibrationFilter->SetEnableNoise( !bool(GetParameterInt("noise")) ); + m_CalibrationFilter->SetLookupSelected(GetParameterInt("lut")); // Set the output image SetParameterOutputImage("out", m_CalibrationFilter->GetOutput()); diff --git a/Modules/Applications/AppSARCalibration/app/otbSARDeburst.cxx b/Modules/Applications/AppSARCalibration/app/otbSARDeburst.cxx index 01e09464a313ffdabb1871be4266b8ade73948a0..0858e7e7146997530a067cb32929850e749e06f9 100644 --- a/Modules/Applications/AppSARCalibration/app/otbSARDeburst.cxx +++ b/Modules/Applications/AppSARCalibration/app/otbSARDeburst.cxx @@ -44,10 +44,10 @@ public: typedef otb::SarDeburstImageFilter<FloatVectorImageType> DeburstFilterType; private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("SARDeburst"); - SetDescription("This application performs deburst of Sentinel1 IW SLC images by removing redundant lines.\n"); + SetDescription("This application performs deburst of Sentinel1 IW SLC images by removing redundant lines."); // Documentation SetDocName("SAR Deburst"); @@ -88,10 +88,10 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override {} - void DoExecute() ITK_OVERRIDE + void DoExecute() override { // Get the input complex image FloatVectorImageType* in = GetParameterImage("in"); diff --git a/Modules/Applications/AppSARDecompositions/app/otbSARDecompositions.cxx b/Modules/Applications/AppSARDecompositions/app/otbSARDecompositions.cxx index 155795417f8c78b96317cd7676e4ed1294be90b4..2a6ccbcf089a62151541d4a69b242edd943003af 100644 --- a/Modules/Applications/AppSARDecompositions/app/otbSARDecompositions.cxx +++ b/Modules/Applications/AppSARDecompositions/app/otbSARDecompositions.cxx @@ -31,7 +31,7 @@ #include "otbSinclairToReciprocalCoherencyMatrixFunctor.h" #include "otbPerBandVectorImageFilter.h" #include "itkMeanImageFilter.h" -#include "otbNRIBandImagesToOneNComplexBandsImage.h" +// #include "otbNRIBandImagesToOneNComplexBandsImage.h" #include "otbImageListToVectorImageFilter.h" #include "otbImageList.h" @@ -84,7 +84,7 @@ public: itkTypeMacro(SARDecompositions, otb::Application); private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("SARDecompositions"); SetDescription("From one-band complex images (each one related to an element of the Sinclair matrix), returns the selected decomposition."); @@ -109,21 +109,21 @@ private: AddDocTag(Tags::SAR); - AddParameter(ParameterType_ComplexInputImage, "inhh", "Input Image"); + AddParameter(ParameterType_InputImage, "inhh", "Input Image"); SetParameterDescription("inhh", "Input image (HH)"); - AddParameter(ParameterType_ComplexInputImage, "inhv", "Input Image"); + AddParameter(ParameterType_InputImage, "inhv", "Input Image"); SetParameterDescription("inhv", "Input image (HV)"); MandatoryOff("inhv"); - AddParameter(ParameterType_ComplexInputImage, "invh", "Input Image"); + AddParameter(ParameterType_InputImage, "invh", "Input Image"); SetParameterDescription("invh", "Input image (VH)"); MandatoryOff("invh"); - AddParameter(ParameterType_ComplexInputImage, "invv", "Input Image"); + AddParameter(ParameterType_InputImage, "invv", "Input Image"); SetParameterDescription("invv", "Input image (VV)"); - AddParameter(ParameterType_ComplexOutputImage, "out", "Output Image"); + AddParameter(ParameterType_OutputImage, "out", "Output Image"); SetParameterDescription("out", "Output image"); AddParameter(ParameterType_Choice, "decomp", "Decompositions"); @@ -160,12 +160,12 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do here : all parameters are independent } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { bool inhv = HasUserValue("inhv"); @@ -201,7 +201,7 @@ private: m_MeanFilter->SetInput(m_SRFilter->GetOutput()); m_HAFilter->SetInput(m_MeanFilter->GetOutput()); - SetParameterComplexOutputImage("out", m_HAFilter->GetOutput() ); + SetParameterOutputImage("out", m_HAFilter->GetOutput() ); break; @@ -220,7 +220,7 @@ private: m_MeanFilter->SetInput(m_SRFilter->GetOutput()); m_BarnesFilter->SetInput(m_MeanFilter->GetOutput()); - SetParameterComplexOutputImage("out", m_BarnesFilter->GetOutput() ); + SetParameterOutputImage("out", m_BarnesFilter->GetOutput() ); break; @@ -239,7 +239,7 @@ private: m_MeanFilter->SetInput(m_SRFilter->GetOutput()); m_HuynenFilter->SetInput(m_MeanFilter->GetOutput()); - SetParameterComplexOutputImage("out", m_HuynenFilter->GetOutput() ); + SetParameterOutputImage("out", m_HuynenFilter->GetOutput() ); break; @@ -257,7 +257,7 @@ private: m_Concatener->SetInput( m_ImageList ); m_PauliFilter->SetInput(m_Concatener->GetOutput()); - SetParameterComplexOutputImage("out", m_PauliFilter->GetOutput() ); + SetParameterOutputImage("out", m_PauliFilter->GetOutput() ); break; } diff --git a/Modules/Applications/AppSARPolarMatrixConvert/app/otbSARPolarMatrixConvert.cxx b/Modules/Applications/AppSARPolarMatrixConvert/app/otbSARPolarMatrixConvert.cxx index 9c8c06211234eef4f9f8207c1762e6f10fbe88fb..c6a4122b0bb8c9e36e0ad727bbe839c5566f7fa8 100644 --- a/Modules/Applications/AppSARPolarMatrixConvert/app/otbSARPolarMatrixConvert.cxx +++ b/Modules/Applications/AppSARPolarMatrixConvert/app/otbSARPolarMatrixConvert.cxx @@ -184,7 +184,7 @@ public: itkTypeMacro(SARPolarMatrixConvert, otb::Application); private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("SARPolarMatrixConvert"); SetDescription("This applications allows converting classical polarimetric matrices to each other."); @@ -232,7 +232,7 @@ private: AddDocTag(Tags::SAR); - AddParameter(ParameterType_ComplexInputImage, "inc", "Input : multi-band complex image"); + AddParameter(ParameterType_InputImage, "inc", "Input : multi-band complex image"); SetParameterDescription("inc", "Input : multi-band complex image"); MandatoryOff("inc"); @@ -241,23 +241,23 @@ private: MandatoryOff("inf"); - AddParameter(ParameterType_ComplexInputImage, "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_ComplexInputImage, "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_ComplexInputImage, "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_ComplexInputImage, "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"); - AddParameter(ParameterType_ComplexOutputImage, "outc", "Output Complex Image"); + AddParameter(ParameterType_OutputImage, "outc", "Output Complex Image"); SetParameterDescription("outc", "Output Complex image."); MandatoryOff("outc"); @@ -356,7 +356,7 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { int convType = GetParameterInt("conv"); @@ -440,7 +440,7 @@ private: } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { //**************************************** @@ -509,7 +509,7 @@ private: m_RCohSRFilter->SetInputHH(GetParameterComplexDoubleImage("inhh")); m_RCohSRFilter->SetInputVV(GetParameterComplexDoubleImage("invv")); - SetParameterComplexOutputImage("outc", m_RCohSRFilter->GetOutput() ); // input : 3 x 1 complex channel | output : 6 complex channels + SetParameterOutputImage("outc", m_RCohSRFilter->GetOutput() ); // input : 3 x 1 complex channel | output : 6 complex channels break; @@ -526,7 +526,7 @@ private: m_RCovSRFilter->SetInputHH(GetParameterComplexDoubleImage("inhh")); m_RCovSRFilter->SetInputVV(GetParameterComplexDoubleImage("invv")); - SetParameterComplexOutputImage("outc", m_RCovSRFilter->GetOutput() ); // input : 3 x 1 complex channel | output : 6 complex channels + SetParameterOutputImage("outc", m_RCovSRFilter->GetOutput() ); // input : 3 x 1 complex channel | output : 6 complex channels break; @@ -544,7 +544,7 @@ private: m_RCCSRFilter->SetInputHH(GetParameterComplexDoubleImage("inhh")); m_RCCSRFilter->SetInputVV(GetParameterComplexDoubleImage("invv")); - SetParameterComplexOutputImage("outc", m_RCCSRFilter->GetOutput() ); // input : 3 x 1 complex channel | output : 6 complex channels + SetParameterOutputImage("outc", m_RCCSRFilter->GetOutput() ); // input : 3 x 1 complex channel | output : 6 complex channels break; @@ -565,7 +565,7 @@ private: m_RCCDFilter = RCCDFilterType::New(); m_RCCDFilter->SetInput(GetParameterComplexDoubleVectorImage("inc")); - SetParameterComplexOutputImage("outc", m_RCCDFilter->GetOutput() ); // input : 6 complex channels | 3 complex channels + SetParameterOutputImage("outc", m_RCCDFilter->GetOutput() ); // input : 6 complex channels | 3 complex channels break; @@ -575,7 +575,7 @@ private: m_RCRCFilter = RCRCFilterType::New(); m_RCRCFilter->SetInput(GetParameterComplexDoubleVectorImage("inc")); - SetParameterComplexOutputImage("outc", m_RCRCFilter->GetOutput() ); // input : 6 complex channels | 6 complex channels + SetParameterOutputImage("outc", m_RCRCFilter->GetOutput() ); // input : 6 complex channels | 6 complex channels break; @@ -586,7 +586,7 @@ private: m_RLCRCCFilter = RLCRCCFilterType::New(); m_RLCRCCFilter->SetInput(GetParameterComplexDoubleVectorImage("inc")); - SetParameterComplexOutputImage("outc", m_RLCRCCFilter->GetOutput() ); // input : 6 complex channels | output : 6 complex channels + SetParameterOutputImage("outc", m_RLCRCCFilter->GetOutput() ); // input : 6 complex channels | output : 6 complex channels break; @@ -597,7 +597,7 @@ private: m_MRCFilter->SetInput(GetParameterDoubleVectorImage("inf")); - SetParameterComplexOutputImage("outc", m_MRCFilter->GetOutput() ); // input : 16 real channels | output : 6 complex channels + SetParameterOutputImage("outc", m_MRCFilter->GetOutput() ); // input : 16 real channels | output : 6 complex channels break; @@ -615,7 +615,7 @@ private: m_CohSRFilter->SetInputVH(GetParameterComplexDoubleImage("invh")); m_CohSRFilter->SetInputVV(GetParameterComplexDoubleImage("invv")); - SetParameterComplexOutputImage("outc", m_CohSRFilter->GetOutput() ); // input : 4 x 1 complex channel | 10 complex channels + SetParameterOutputImage("outc", m_CohSRFilter->GetOutput() ); // input : 4 x 1 complex channel | 10 complex channels break; @@ -630,7 +630,7 @@ private: m_CovSRFilter->SetInputVH(GetParameterComplexDoubleImage("invh")); m_CovSRFilter->SetInputVV(GetParameterComplexDoubleImage("invv")); - SetParameterComplexOutputImage("outc", m_CovSRFilter->GetOutput() ); // input : 4 x 1 complex channel | output : 10 complex channels + SetParameterOutputImage("outc", m_CovSRFilter->GetOutput() ); // input : 4 x 1 complex channel | output : 10 complex channels break; @@ -644,7 +644,7 @@ private: m_CCSRFilter->SetInputVH(GetParameterComplexDoubleImage("invh")); m_CCSRFilter->SetInputVV(GetParameterComplexDoubleImage("invv")); - SetParameterComplexOutputImage("outc", m_CCSRFilter->GetOutput() ); // input : 4 x 1 complex channel | output : 10 complex channels + SetParameterOutputImage("outc", m_CCSRFilter->GetOutput() ); // input : 4 x 1 complex channel | output : 10 complex channels break; diff --git a/Modules/Applications/AppSARPolarSynth/app/otbSARPolarSynth.cxx b/Modules/Applications/AppSARPolarSynth/app/otbSARPolarSynth.cxx index 236ac0789fa1e8e2077e9903bcc5c4c0e8aa9733..8fb514d814f055b415f186d8b86e88dcc8fd195c 100644 --- a/Modules/Applications/AppSARPolarSynth/app/otbSARPolarSynth.cxx +++ b/Modules/Applications/AppSARPolarSynth/app/otbSARPolarSynth.cxx @@ -44,7 +44,7 @@ public: itkTypeMacro(SARPolarSynth, otb::Application); private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("SARPolarSynth"); SetDescription("Gives, for each pixel, the power that would have been received by a SAR system with a basis different from the classical (H,V) one (polarimetric synthetis)."); @@ -86,7 +86,7 @@ private: AddDocTag(Tags::SAR); - AddParameter(ParameterType_ComplexInputImage, "in", "Input Image"); + AddParameter(ParameterType_InputImage, "in", "Input Image"); SetParameterDescription("in", "Input image."); AddParameter(ParameterType_OutputImage, "out", "Output Image"); SetParameterDescription("out", "Output image."); @@ -154,12 +154,12 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do here : all parameters are independent } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { m_MCPSFilter = MCPSFilterType::New(); diff --git a/Modules/Applications/AppSARUtils/app/otbComputeModulusAndPhase.cxx b/Modules/Applications/AppSARUtils/app/otbComputeModulusAndPhase.cxx index 39db311e799737b730973d68c5156d273366896b..d6f580b773730ef3c1c28da95c495271f5d4fd8e 100644 --- a/Modules/Applications/AppSARUtils/app/otbComputeModulusAndPhase.cxx +++ b/Modules/Applications/AppSARUtils/app/otbComputeModulusAndPhase.cxx @@ -57,7 +57,7 @@ public: typedef itk::ComplexToPhaseImageFilter<ComplexFloatImageType, FloatImageType> PhaseFilterType; private: - void DoInit() + void DoInit() override { SetName("ComputeModulusAndPhase"); SetDescription("This application computes the modulus and the phase of a complex SAR image."); @@ -75,7 +75,7 @@ private: AddDocTag(Tags::SAR); AddDocTag(Tags::Manip); // Input images - AddParameter(ParameterType_ComplexInputImage, "in", "Input Image"); + AddParameter(ParameterType_InputImage, "in", "Input Image"); SetParameterDescription("in", "Input image (complex single band)"); // Outputs @@ -100,17 +100,17 @@ private: } // DoUpdateParameters() is called as soon as a parameter value change. - void DoUpdateParameters() + void DoUpdateParameters() override { } // DoExecute() contains the application core. - void DoExecute() + void DoExecute() override { m_Modulus = ModulusFilterType::New(); m_Phase = PhaseFilterType::New(); - ComplexFloatVectorImageType::Pointer inImage = GetParameterComplexImage("in"); + ComplexFloatVectorImageType::Pointer inImage = GetParameterComplexFloatVectorImage("in"); if (inImage->GetNumberOfComponentsPerPixel() != 1) { diff --git a/Modules/Applications/AppSARUtils/app/otbDespeckle.cxx b/Modules/Applications/AppSARUtils/app/otbDespeckle.cxx index f469402397ec95185ecdfb5ed8c99009b550b594..e1fd6c833371edd93aebf563691e3494aac945fe 100644 --- a/Modules/Applications/AppSARUtils/app/otbDespeckle.cxx +++ b/Modules/Applications/AppSARUtils/app/otbDespeckle.cxx @@ -54,7 +54,7 @@ public: itkTypeMacro(Despeckle, otb::Application); private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("Despeckle"); SetDescription("Perform speckle noise reduction on SAR image."); @@ -167,12 +167,12 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do here : all parameters are independent } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { FloatVectorImageType* inVImage = GetParameterImage("in"); diff --git a/Modules/Applications/AppSegmentation/app/otbConnectedComponentSegmentation.cxx b/Modules/Applications/AppSegmentation/app/otbConnectedComponentSegmentation.cxx index b9bc876f11d21efe230cbbea773c60e99cd78c55..fa1acfa4d9cea51d6bf49a721e88268c945726cd 100644 --- a/Modules/Applications/AppSegmentation/app/otbConnectedComponentSegmentation.cxx +++ b/Modules/Applications/AppSegmentation/app/otbConnectedComponentSegmentation.cxx @@ -69,7 +69,7 @@ public: <VectorDataType, VectorDataType> VectorDataProjectionFilterType; private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("ConnectedComponentSegmentation"); SetDescription("Connected component segmentation and object based image filtering of the input image according to user-defined criterions."); @@ -124,12 +124,12 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do here for the parameters : all are independent } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { InputVectorImageType::Pointer inputImage = GetParameterImage("in"); diff --git a/Modules/Applications/AppSegmentation/app/otbHooverCompareSegmentation.cxx b/Modules/Applications/AppSegmentation/app/otbHooverCompareSegmentation.cxx index 48dd57c2ad75d5f31c5eddd08ff606239f7aaa2a..34d62c2ecbeba6d40f0cca68a49d017553c3ccf4 100644 --- a/Modules/Applications/AppSegmentation/app/otbHooverCompareSegmentation.cxx +++ b/Modules/Applications/AppSegmentation/app/otbHooverCompareSegmentation.cxx @@ -130,7 +130,7 @@ public: <FloatPixelType, Int16PixelType> > HooverColorFilterType; private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("HooverCompareSegmentation"); SetDescription("Compare two segmentations with Hoover metrics"); @@ -202,12 +202,12 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do here : all parameters are independent } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { UInt32ImageType::Pointer inputGT = GetParameterUInt32Image("ingt"); UInt32ImageType::Pointer inputMS = GetParameterUInt32Image("inms"); @@ -297,10 +297,10 @@ private: m_InstanceFilter->Update(); - SetParameterFloat("rc",m_InstanceFilter->GetMeanRC(), false); - SetParameterFloat("rf",m_InstanceFilter->GetMeanRF(), false); - SetParameterFloat("ra",m_InstanceFilter->GetMeanRA(), false); - SetParameterFloat("rm",m_InstanceFilter->GetMeanRM(), false); + SetParameterFloat("rc",m_InstanceFilter->GetMeanRC()); + SetParameterFloat("rf",m_InstanceFilter->GetMeanRF()); + SetParameterFloat("ra",m_InstanceFilter->GetMeanRA()); + SetParameterFloat("rm",m_InstanceFilter->GetMeanRM()); } ImageToLabelMapFilterType::Pointer m_GTFilter; diff --git a/Modules/Applications/AppSegmentation/app/otbLSMSSegmentation.cxx b/Modules/Applications/AppSegmentation/app/otbLSMSSegmentation.cxx index 93694cc420dcc271c6dff0ac551d43d519acd2b4..290b393e841bbfef53018353985f4912a29f14e9 100644 --- a/Modules/Applications/AppSegmentation/app/otbLSMSSegmentation.cxx +++ b/Modules/Applications/AppSegmentation/app/otbLSMSSegmentation.cxx @@ -88,13 +88,14 @@ public: LabelImageType, AffineFunctorType> LabelShiftFilterType; - LSMSSegmentation(): m_FinalReader(),m_ImportGeoInformationFilter(),m_FilesToRemoveAfterExecute(),m_TmpDirCleanup(false){} + LSMSSegmentation(): //m_FinalReader(),m_ImportGeoInformationFilter(), + m_FilesToRemoveAfterExecute(),m_TmpDirCleanup(false){} - ~LSMSSegmentation() ITK_OVERRIDE{} + ~LSMSSegmentation() override{} private: - LabelImageReaderType::Pointer m_FinalReader; - ImportGeoInformationImageFilterType::Pointer m_ImportGeoInformationFilter; + // LabelImageReaderType::Pointer m_FinalReader; + // ImportGeoInformationImageFilterType::Pointer m_ImportGeoInformationFilter; std::vector<std::string> m_FilesToRemoveAfterExecute; bool m_TmpDirCleanup; @@ -139,7 +140,7 @@ private: void RemoveFile(std::string tile) { // Cleanup - if(IsParameterEnabled("cleanup")) + if(GetParameterInt("cleanup")) { // Try to remove the geom file if existing std::string geomfile = tile.substr(0,tile.size() - itksys::SystemTools::GetFilenameExtension(tile.c_str()).size()).append(".geom"); @@ -214,7 +215,7 @@ private: return vrtfname; } - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("LSMSSegmentation"); SetDescription("This application performs the second step of the exact Large-Scale Mean-Shift segmentation workflow (LSMS) [1]."); @@ -302,10 +303,9 @@ private: MandatoryOff("tmpdir"); DisableParameter("tmpdir"); - AddParameter(ParameterType_Empty,"cleanup","Temporary files cleaning"); - EnableParameter("cleanup"); + AddParameter(ParameterType_Bool,"cleanup","Temporary files cleaning"); SetParameterDescription("cleanup","If activated, the application will try to remove all temporary files it created."); - MandatoryOff("cleanup"); + SetParameterInt("cleanup",1); // Doc example parameter settings SetDocExampleParameterValue("in","smooth.tif"); @@ -320,11 +320,11 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { m_FilesToRemoveAfterExecute.clear(); @@ -709,22 +709,25 @@ private: otbAppLogINFO(<<"Elapsed time: "<<(double)(toc - tic) / CLOCKS_PER_SEC<<" seconds"); // Final writing - m_FinalReader = LabelImageReaderType::New(); - m_FinalReader->SetFileName(vrtfile); + LabelImageReaderType::Pointer finalReader = LabelImageReaderType::New(); + finalReader->SetFileName(vrtfile); - m_ImportGeoInformationFilter = ImportGeoInformationImageFilterType::New(); - m_ImportGeoInformationFilter->SetInput(m_FinalReader->GetOutput()); - m_ImportGeoInformationFilter->SetSource(imageIn); + ImportGeoInformationImageFilterType::Pointer + importGeoInformationFilter = + ImportGeoInformationImageFilterType::New(); + importGeoInformationFilter->SetInput(finalReader->GetOutput()); + importGeoInformationFilter->SetSource(imageIn); - SetParameterOutputImage("out",m_ImportGeoInformationFilter->GetOutput()); + SetParameterOutputImage("out",importGeoInformationFilter->GetOutput()); + RegisterPipeline(); } - void AfterExecuteAndWriteOutputs() ITK_OVERRIDE + void AfterExecuteAndWriteOutputs() override { // Release input files - m_FinalReader = ITK_NULLPTR; + // finalReader = ITK_NULLPTR; - if(IsParameterEnabled("cleanup")) + if(GetParameterInt("cleanup")) { otbAppLogINFO(<<"Final clean-up ..."); diff --git a/Modules/Applications/AppSegmentation/app/otbLSMSSmallRegionsMerging.cxx b/Modules/Applications/AppSegmentation/app/otbLSMSSmallRegionsMerging.cxx index 14c8354a143503d61ddbc3680512d5eb6ccb5143..afda10be1c517d130f6bce3162fae18681ed3172 100644 --- a/Modules/Applications/AppSegmentation/app/otbLSMSSmallRegionsMerging.cxx +++ b/Modules/Applications/AppSegmentation/app/otbLSMSSmallRegionsMerging.cxx @@ -73,7 +73,7 @@ public: private: ChangeLabelImageFilterType::Pointer m_ChangeLabelFilter; - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("LSMSSmallRegionsMerging"); SetDescription("This application performs the third (optional) step of the exact Large-Scale Mean-Shift segmentation workflow [1]."); @@ -144,11 +144,11 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { clock_t tic = clock(); diff --git a/Modules/Applications/AppSegmentation/app/otbLSMSVectorization.cxx b/Modules/Applications/AppSegmentation/app/otbLSMSVectorization.cxx index 166b87141dc47b313e1eb5b388f55cbfd2dccb01..9881309a6b921cadf3de84dcf428dfd563513879 100644 --- a/Modules/Applications/AppSegmentation/app/otbLSMSVectorization.cxx +++ b/Modules/Applications/AppSegmentation/app/otbLSMSVectorization.cxx @@ -66,7 +66,7 @@ public: itkTypeMacro(Vectorization, otb::Application); private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("LSMSVectorization"); SetDescription("This application performs the fourth step of the exact Large-Scale Mean-Shift segmentation workflow [1]."); @@ -124,11 +124,11 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { clock_t tic = clock(); diff --git a/Modules/Applications/AppSegmentation/app/otbLargeScaleMeanShift.cxx b/Modules/Applications/AppSegmentation/app/otbLargeScaleMeanShift.cxx index 27f8da837771c4eada660c43b6628e6fa32ec462..4422d5096f61414a4ecf9f9f7897453d9a41767d 100644 --- a/Modules/Applications/AppSegmentation/app/otbLargeScaleMeanShift.cxx +++ b/Modules/Applications/AppSegmentation/app/otbLargeScaleMeanShift.cxx @@ -50,7 +50,7 @@ public: itkTypeMacro(LargeScaleMeanShift, otb::CompositeApplication); private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("LargeScaleMeanShift"); SetDescription("Large-scale segmentation using MeanShift"); @@ -120,11 +120,10 @@ private: "The output raster image", "It corresponds to the output of the small region merging step."); - AddParameter( ParameterType_Empty, "cleanup", "Temporary files cleaning" ); - EnableParameter( "cleanup" ); + AddParameter( ParameterType_Bool, "cleanup", "Temporary files cleaning" ); SetParameterDescription( "cleanup", "If activated, the application will try to clean all temporary files it created" ); - MandatoryOff( "cleanup" ); + SetParameterInt("cleanup",1); // Setup RAM ShareParameter("ram","smoothing.ram"); @@ -153,10 +152,10 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override {} - void DoExecute() ITK_OVERRIDE + void DoExecute() override { bool isVector(GetParameterString("mode") == "vector"); std::string outPath(isVector ? diff --git a/Modules/Applications/AppSegmentation/app/otbMeanShiftSmoothing.cxx b/Modules/Applications/AppSegmentation/app/otbMeanShiftSmoothing.cxx index 8f63bf13ef99f1062726c988b7c6b18a8aa236d5..1d30963c546efd88ebc84ec613144f2463a6ade8 100644 --- a/Modules/Applications/AppSegmentation/app/otbMeanShiftSmoothing.cxx +++ b/Modules/Applications/AppSegmentation/app/otbMeanShiftSmoothing.cxx @@ -46,7 +46,7 @@ public: itkTypeMacro(MeanShiftSmoothing, otb::Application); private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("MeanShiftSmoothing"); SetDescription("This application smooths an image using the MeanShift algorithm."); @@ -159,10 +159,8 @@ private: SetMinimumParameterFloatValue("rangeramp", 0); MandatoryOff("rangeramp"); - AddParameter(ParameterType_Empty, "modesearch", "Mode search."); + AddParameter(ParameterType_Bool, "modesearch", "Mode search."); SetParameterDescription("modesearch", "If activated pixel iterative convergence is stopped if the path crosses an already converged pixel. Be careful, with this option, the result will slightly depend on thread number and the results will not be stable (see [4] for more details)."); - DisableParameter("modesearch"); - // Doc example parameter settings SetDocExampleParameterValue("in", "maur_rgb.png"); @@ -176,28 +174,28 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override {} - void DoExecute() ITK_OVERRIDE + void DoExecute() override { FloatVectorImageType* input = GetParameterImage("in"); - m_Filter = MSFilterType::New(); + MSFilterType::Pointer filter = MSFilterType::New(); - m_Filter->SetInput(input); + filter->SetInput(input); - m_Filter->SetSpatialBandwidth(GetParameterInt("spatialr")); - m_Filter->SetRangeBandwidth(GetParameterFloat("ranger")); - m_Filter->SetThreshold(GetParameterFloat("thres")); - m_Filter->SetMaxIterationNumber(GetParameterInt("maxiter")); - m_Filter->SetRangeBandwidthRamp(GetParameterFloat("rangeramp")); - m_Filter->SetModeSearch(IsParameterEnabled("modesearch")); + filter->SetSpatialBandwidth(GetParameterInt("spatialr")); + filter->SetRangeBandwidth(GetParameterFloat("ranger")); + filter->SetThreshold(GetParameterFloat("thres")); + filter->SetMaxIterationNumber(GetParameterInt("maxiter")); + filter->SetRangeBandwidthRamp(GetParameterFloat("rangeramp")); + filter->SetModeSearch(GetParameterInt("modesearch")); //Compute the margin used to ensure exact results (tile wise smoothing) //This margin is valid for the default uniform kernel used by the //MeanShiftSmoothing filter (bandwidth equal to radius in this case) - const unsigned int margin = (m_Filter->GetMaxIterationNumber() * m_Filter->GetSpatialBandwidth()) + 1; + const unsigned int margin = (filter->GetMaxIterationNumber() * filter->GetSpatialBandwidth()) + 1; otbAppLogINFO(<<"Margin of " << margin << " pixels applied to each tile to stabilized mean shift filtering." << std::endl); @@ -206,19 +204,18 @@ private: otbAppLogWARNING(<<"Margin value exceed the input image size." << std::endl); } - SetParameterOutputImage("fout", m_Filter->GetOutput()); + SetParameterOutputImage("fout", filter->GetOutput()); if (IsParameterEnabled("foutpos") && HasValue("foutpos")) { - SetParameterOutputImage("foutpos", m_Filter->GetSpatialOutput()); + SetParameterOutputImage("foutpos", filter->GetSpatialOutput()); } - if(!IsParameterEnabled("modesearch")) + if(!GetParameterInt("modesearch")) { otbAppLogINFO(<<"Mode Search is disabled." << std::endl); } + RegisterPipeline(); } - MSFilterType::Pointer m_Filter; - }; diff --git a/Modules/Applications/AppSegmentation/app/otbSegmentation.cxx b/Modules/Applications/AppSegmentation/app/otbSegmentation.cxx index 5b3bfd2361f211e9dccf19b383542596fd1b994a..2e86378055b27049db5842abe36e7170d2555a46 100644 --- a/Modules/Applications/AppSegmentation/app/otbSegmentation.cxx +++ b/Modules/Applications/AppSegmentation/app/otbSegmentation.cxx @@ -137,7 +137,7 @@ public: itkTypeMacro(Segmentation, otb::Application); private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("Segmentation"); SetDescription("Performs segmentation of an image, and output either a raster or a vector file. In vector mode, large input datasets are supported."); @@ -282,17 +282,13 @@ private: SetParameterDescription("mode.vector.inmask", "Only pixels whose mask value is strictly positive will be segmented."); MandatoryOff("mode.vector.inmask"); - AddParameter(ParameterType_Empty, "mode.vector.neighbor", "8-neighbor connectivity"); + AddParameter(ParameterType_Bool, "mode.vector.neighbor", "8-neighbor connectivity"); SetParameterDescription("mode.vector.neighbor", "Activate 8-Neighborhood connectivity (default is 4)."); - MandatoryOff("mode.vector.neighbor"); - DisableParameter("mode.vector.neighbor"); - - AddParameter(ParameterType_Empty,"mode.vector.stitch","Stitch polygons"); + AddParameter(ParameterType_Bool,"mode.vector.stitch","Stitch polygons"); SetParameterDescription("mode.vector.stitch", "Scan polygons on each side of tiles and stitch polygons which connect by more than one pixel."); - MandatoryOff("mode.vector.stitch"); - EnableParameter("mode.vector.stitch"); + SetParameterInt("mode.vector.stitch",1); AddParameter(ParameterType_Int, "mode.vector.minsize", "Minimum object size"); SetParameterDescription("mode.vector.minsize", @@ -311,11 +307,11 @@ private: AddParameter(ParameterType_String, "mode.vector.layername", "Layer name"); SetParameterDescription("mode.vector.layername", "Name of the layer in the vector file or database (default is Layer)."); - SetParameterString("mode.vector.layername", "layer", false); + SetParameterString("mode.vector.layername", "layer"); AddParameter(ParameterType_String, "mode.vector.fieldname", "Geometry index field name"); SetParameterDescription("mode.vector.fieldname", "Name of the field holding the geometry index in the output vector file or database."); - SetParameterString("mode.vector.fieldname", "DN", false); + SetParameterString("mode.vector.fieldname", "DN"); AddParameter(ParameterType_Int, "mode.vector.tilesize", "Tiles size"); SetParameterDescription("mode.vector.tilesize", @@ -348,7 +344,7 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do here : all parameters are independent } @@ -365,7 +361,7 @@ private: // Retrieve tile size parameter const unsigned int tileSize = static_cast<unsigned int> (this->GetParameterInt("mode.vector.tilesize")); // Retrieve the 8-connected option - bool use8connected = IsParameterEnabled("mode.vector.neighbor"); + bool use8connected = GetParameterInt("mode.vector.neighbor"); // Retrieve min object size parameter const unsigned int minSize = static_cast<unsigned int> (this->GetParameterInt("mode.vector.minsize")); @@ -457,7 +453,7 @@ private: return streamingVectorizedFilter->GetStreamSize(); } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { // Switch on segmentation mode const std::string segModeType = GetParameterString("mode"); @@ -673,7 +669,7 @@ private: ogrDS->SyncToDisk(); // Stitching mode - if (IsParameterEnabled("mode.vector.stitch")) + if (GetParameterInt("mode.vector.stitch")) { otbAppLogINFO(<<"Segmentation done, stiching polygons ..."); diff --git a/Modules/Applications/AppStereo/app/otbBlockMatching.cxx b/Modules/Applications/AppStereo/app/otbBlockMatching.cxx index 2ec8f7e63a0c00d90c3156c390ea71ce3af63573..138da7fef51fbf90a67e9fc92d4115dad34b68a2 100644 --- a/Modules/Applications/AppStereo/app/otbBlockMatching.cxx +++ b/Modules/Applications/AppStereo/app/otbBlockMatching.cxx @@ -124,7 +124,7 @@ private: m_VMedianFilter = MedianFilterType::New(); } - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("BlockMatching"); SetDescription("Performs block-matching to estimate pixel-wise disparities" @@ -202,7 +202,7 @@ private: DisableParameter("io.outmask"); MandatoryOff("io.outmask"); - AddParameter(ParameterType_Empty,"io.outmetric","Flag to output optimal " + AddParameter(ParameterType_Bool,"io.outmetric","Flag to output optimal " "metric values as well"); SetParameterDescription("io.outmetric","If enabled, the output image will " "have a third component with metric optimal values"); @@ -425,7 +425,7 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { if(IsParameterEnabled("mask.variancet") || IsParameterEnabled("mask.nodata")) { @@ -458,7 +458,7 @@ private: } } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { FloatImageType::Pointer leftImage = GetParameterFloatImage("io.inleft"); FloatImageType::Pointer rightImage = GetParameterFloatImage("io.inright"); @@ -847,7 +847,7 @@ private: m_OutputImageList->PushBack(hdispImage); m_OutputImageList->PushBack(vdispImage); - if(IsParameterEnabled("io.outmetric")) + if(GetParameterInt("io.outmetric")) { m_OutputImageList->PushBack(metricImage); } diff --git a/Modules/Applications/AppStereo/app/otbDisparityMapToElevationMap.cxx b/Modules/Applications/AppStereo/app/otbDisparityMapToElevationMap.cxx index 25e4b96189fc1549b2875f9e55c255a75611cd38..551ad0f1e4b267f87d2b57659ee9e27df61c88c5 100644 --- a/Modules/Applications/AppStereo/app/otbDisparityMapToElevationMap.cxx +++ b/Modules/Applications/AppStereo/app/otbDisparityMapToElevationMap.cxx @@ -62,7 +62,7 @@ private: m_DispToElev = DisparityToElevationFilterType::New(); } - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("DisparityMapToElevationMap"); SetDescription("Projects a disparity map into a regular elevation map."); @@ -163,12 +163,12 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { FloatVectorImageType::Pointer inputDisp = this->GetParameterImage("io.in"); FloatVectorImageType::Pointer sensorLeft = this->GetParameterImage("io.left"); diff --git a/Modules/Applications/AppStereo/app/otbFineRegistration.cxx b/Modules/Applications/AppStereo/app/otbFineRegistration.cxx index a7fed89a0e400d60eeeae15067c35f10e9e76293..64bf6ca0e4fc62c24b6c200dde2eb2b72b29ddf9 100644 --- a/Modules/Applications/AppStereo/app/otbFineRegistration.cxx +++ b/Modules/Applications/AppStereo/app/otbFineRegistration.cxx @@ -114,7 +114,7 @@ public: typedef otb::ImageFileReader<VectorImageType> InternalReaderType; private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("FineRegistration"); SetDescription("Estimate disparity map between two images."); @@ -266,12 +266,12 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { FloatVectorImageType::Pointer refImage = GetParameterImage("ref"); // fixed FloatVectorImageType::Pointer secImage = GetParameterImage("sec"); // moved diff --git a/Modules/Applications/AppStereo/app/otbGeneratePlyFile.cxx b/Modules/Applications/AppStereo/app/otbGeneratePlyFile.cxx index 928b1da3e6f9303a2c72fb39ce97e335e063abd1..4f1fce4ee29c2307c2c60dc6a6a01acaeb328d80 100644 --- a/Modules/Applications/AppStereo/app/otbGeneratePlyFile.cxx +++ b/Modules/Applications/AppStereo/app/otbGeneratePlyFile.cxx @@ -52,7 +52,7 @@ public: private: GeneratePlyFile(){} - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("GeneratePlyFile"); SetDescription("Generate a 3D Ply file from a DEM and a color image."); @@ -115,13 +115,13 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Update the UTM zone params MapProjectionParametersHandler::InitializeUTMParameters(this, "incolor", "map"); } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { std::string outfname = GetParameterString("out"); diff --git a/Modules/Applications/AppStereo/app/otbStereoFramework.cxx b/Modules/Applications/AppStereo/app/otbStereoFramework.cxx index 279c09ad2f9734bf45a95cb612408edb36efb8b8..01cd7ad687b9bbb284a0287554f4572cce7c526c 100644 --- a/Modules/Applications/AppStereo/app/otbStereoFramework.cxx +++ b/Modules/Applications/AppStereo/app/otbStereoFramework.cxx @@ -311,7 +311,7 @@ private: } - void DoInit() ITK_OVERRIDE + void DoInit() override { // TODO : implement this application as a CompositeApplication... SetName("StereoFramework"); @@ -368,7 +368,7 @@ private: "first and second image, a second couple with third and fourth image etc." " (in this case image list must be even)."); MandatoryOff("input.co"); - SetParameterString("input.co","", false); + SetParameterString("input.co",""); DisableParameter("input.co"); AddParameter(ParameterType_Int, "input.channel", "Input Image channel"); @@ -385,7 +385,7 @@ private: // // Build the Output Map Projection // for custom map projection MapProjectionParametersHandler::AddMapProjectionParameters(this, "map"); - SetParameterString("map","wgs", false); + SetParameterString("map","wgs"); AddParameter(ParameterType_Float, "output.res","Output resolution"); SetParameterDescription("output.res","Spatial sampling distance of the output elevation : the cell size (in m)"); @@ -525,20 +525,16 @@ private: AddParameter(ParameterType_Group,"postproc","Postprocessing parameters"); SetParameterDescription("postproc","This group of parameters allow use optional filters."); - AddParameter(ParameterType_Empty,"postproc.bij","Use bijection consistency" + AddParameter(ParameterType_Bool,"postproc.bij","Use bijection consistency" " in block matching strategy"); SetParameterDescription("postproc.bij","Use bijection consistency. " "Right to Left correlation is computed to validate Left to Right " "disparities. If bijection is not found, the disparity is rejected."); - MandatoryOff("postproc.bij"); - EnableParameter("postproc.bij"); + SetParameterInt("postproc.bij", 1); - AddParameter(ParameterType_Empty,"postproc.med","Use median disparities filtering"); + AddParameter(ParameterType_Bool,"postproc.med","Use median disparities filtering"); SetParameterDescription("postproc.med","Disparity map can be filtered using" " median post filtering (disabled by default)."); - MandatoryOff("postproc.med"); - DisableParameter("postproc.med"); - AddParameter(ParameterType_Float,"postproc.metrict","Correlation metric threshold"); SetParameterDescription("postproc.metrict","Use block matching metric " @@ -584,7 +580,7 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { if( HasValue("input.il") ) { @@ -624,7 +620,7 @@ private: } else blockMatcherFilter->MinimizeOff(); - if (IsParameterEnabled("postproc.bij")) + if (GetParameterInt("postproc.bij")) { invBlockMatcherFilter->SetLeftInput(rightImage); invBlockMatcherFilter->SetRightInput(leftImage); @@ -650,7 +646,7 @@ private: } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { // Setup the DSM Handler otb::Wrapper::ElevationParametersHandler::SetupDEMHandlerFromElevationParameters(this, "elev"); @@ -947,7 +943,7 @@ private: m_Filters.push_back(lBandMathFilter.GetPointer()); BandMathFilterType::Pointer finalMaskFilter; - if (IsParameterEnabled("postproc.bij")) + if (GetParameterInt("postproc.bij")) { finalMaskFilter = BandMathFilterType::New(); finalMaskFilter->SetNthInput(0, lBandMathFilter->GetOutput(), "inmask"); @@ -992,7 +988,7 @@ private: blockMatcherFilterPointer = SSDDivMeanBlockMatcherFilter.GetPointer(); m_Filters.push_back(blockMatcherFilterPointer); - if (IsParameterEnabled("postproc.bij")) + if (GetParameterInt("postproc.bij")) { //Reverse correlation invSSDDivMeanBlockMatcherFilter = SSDDivMeanBlockMatchingFilterType::New(); @@ -1025,7 +1021,7 @@ private: blockMatcherFilterPointer = SSDBlockMatcherFilter.GetPointer(); m_Filters.push_back(blockMatcherFilterPointer); - if (IsParameterEnabled("postproc.bij")) + if (GetParameterInt("postproc.bij")) { //Reverse correlation invSSDBlockMatcherFilter = SSDBlockMatchingFilterType::New(); @@ -1056,7 +1052,7 @@ private: blockMatcherFilterPointer = NCCBlockMatcherFilter.GetPointer(); m_Filters.push_back(blockMatcherFilterPointer); - if (IsParameterEnabled("postproc.bij")) + if (GetParameterInt("postproc.bij")) { //Reverse correlation invNCCBlockMatcherFilter = NCCBlockMatchingFilterType::New(); @@ -1090,7 +1086,7 @@ private: blockMatcherFilterPointer = LPBlockMatcherFilter.GetPointer(); m_Filters.push_back(blockMatcherFilterPointer); - if (IsParameterEnabled("postproc.bij")) + if (GetParameterInt("postproc.bij")) { //Reverse correlation invLPBlockMatcherFilter = LPBlockMatchingFilterType::New(); @@ -1119,7 +1115,7 @@ private: break; } - if (IsParameterEnabled("postproc.bij")) + if (GetParameterInt("postproc.bij")) { otbAppLogINFO(<<"Using reverse block-matching to filter incoherent disparity values."); bijectFilter = BijectionFilterType::New(); @@ -1149,7 +1145,7 @@ private: FloatImageType::Pointer hDispOutput = subPixelFilterPointer->GetOutput(0); FloatImageType::Pointer finalMaskImage=finalMaskFilter->GetOutput(); - if (IsParameterEnabled("postproc.med")) + if (GetParameterInt("postproc.med")) { MedianFilterType::Pointer hMedianFilter = MedianFilterType::New(); hMedianFilter->SetInput(subPixelFilterPointer->GetOutput(0)); @@ -1183,7 +1179,7 @@ private: FloatImageType::Pointer hDispOutput2 = disparityTranslateFilter->GetHorizontalDisparityMapOutput(); FloatImageType::Pointer vDispOutput2 = disparityTranslateFilter->GetVerticalDisparityMapOutput(); FloatImageType::Pointer translatedMaskImage = dispTranslateMaskFilter->GetOutput(); - if (IsParameterEnabled("postproc.med")) + if (GetParameterInt("postproc.med")) { MedianFilterType::Pointer hMedianFilter2 = MedianFilterType::New(); MedianFilterType::Pointer vMedianFilter2 = MedianFilterType::New(); diff --git a/Modules/Applications/AppStereo/app/otbStereoRectificationGridGenerator.cxx b/Modules/Applications/AppStereo/app/otbStereoRectificationGridGenerator.cxx index 616594a6bb40d025e53535a344b3e4fadea294e0..c95a08e1d4e0dd52eca5480dac962ea8f2e598e4 100644 --- a/Modules/Applications/AppStereo/app/otbStereoRectificationGridGenerator.cxx +++ b/Modules/Applications/AppStereo/app/otbStereoRectificationGridGenerator.cxx @@ -99,7 +99,7 @@ private: m_StatisticsFilter = StatisticsFilterType::New(); } - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("StereoRectificationGridGenerator"); SetDescription("Generates two deformation fields to resample in epipolar " @@ -249,12 +249,12 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do here } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { m_DisplacementFieldSource->SetLeftImage(GetParameterImage("io.inleft")); m_DisplacementFieldSource->SetRightImage(GetParameterImage("io.inright")); diff --git a/Modules/Applications/AppTest/app/otbTestApplication.cxx b/Modules/Applications/AppTest/app/otbTestApplication.cxx index a2e9ee940da3b473f8e69fbd152eda675c66256d..42f11fb32742a8f606a53f762b72516e3acde470 100644 --- a/Modules/Applications/AppTest/app/otbTestApplication.cxx +++ b/Modules/Applications/AppTest/app/otbTestApplication.cxx @@ -42,7 +42,7 @@ public: itkTypeMacro(TestApplication, otb::Application); private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("TestApplication"); SetDescription("This application helps developers to test parameters types"); @@ -56,7 +56,8 @@ private: AddDocTag("Test"); //std::cout << "TestApplication::DoInit" << std::endl; - AddParameter(ParameterType_Empty, "boolean", "Boolean"); + AddParameter(ParameterType_Empty, "empty", "Boolean (old impl.)"); + AddParameter(ParameterType_Bool, "boolean", "Boolean"); AddParameter(ParameterType_Int, "int", "Integer"); MandatoryOff("int"); AddParameter(ParameterType_Float, "float", "Float"); @@ -112,10 +113,10 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override {} - void DoExecute() ITK_OVERRIDE + void DoExecute() override { if( HasValue("il") && IsParameterEnabled("il") ) { diff --git a/Modules/Applications/AppTextures/app/otbHaralickTextureExtraction.cxx b/Modules/Applications/AppTextures/app/otbHaralickTextureExtraction.cxx index 43e6b0b0e1e69e44a6eac18428c299e2bbe5e316..fdf5f44e7c3f5c48e362711a2162c578878fa083 100644 --- a/Modules/Applications/AppTextures/app/otbHaralickTextureExtraction.cxx +++ b/Modules/Applications/AppTextures/app/otbHaralickTextureExtraction.cxx @@ -67,7 +67,7 @@ itkTypeMacro(HaralickTextureExtraction, otb::Application); private: -void DoInit() ITK_OVERRIDE +void DoInit() override { SetName("HaralickTextureExtraction"); SetDescription("Computes Haralick textural features on the selected channel of the input image"); @@ -192,12 +192,12 @@ SetDocExampleParameterValue("out", "HaralickTextures.tif"); SetOfficialDocLink(); } -void DoUpdateParameters() ITK_OVERRIDE +void DoUpdateParameters() override { // Nothing to do here : all parameters are independent } -void DoExecute() ITK_OVERRIDE +void DoExecute() override { FloatVectorImageType::Pointer inImage = GetParameterImage("in"); inImage->UpdateOutputInformation(); diff --git a/Modules/Applications/AppTextures/app/otbSFSTextureExtraction.cxx b/Modules/Applications/AppTextures/app/otbSFSTextureExtraction.cxx index 94fcc42905368aaf7678202968ae887d4b930d1f..13ade82049253a6e60d39e36e34b126b735ea904 100644 --- a/Modules/Applications/AppTextures/app/otbSFSTextureExtraction.cxx +++ b/Modules/Applications/AppTextures/app/otbSFSTextureExtraction.cxx @@ -56,7 +56,7 @@ itkTypeMacro(SFSTextureExtraction, otb::Application); private: -void DoInit() ITK_OVERRIDE +void DoInit() override { SetName("SFSTextureExtraction"); SetDescription("Computes Structural Feature Set textures on every pixel of the " @@ -129,12 +129,12 @@ SetDocExampleParameterValue("out", "SFSTextures.tif"); SetOfficialDocLink(); } -void DoUpdateParameters() ITK_OVERRIDE +void DoUpdateParameters() override { // Nothing to do here : all parameters are independent } -void DoExecute() ITK_OVERRIDE +void DoExecute() override { FloatVectorImageType::Pointer inImage = GetParameterImage("in"); inImage->UpdateOutputInformation(); diff --git a/Modules/Applications/AppVectorDataTranslation/app/otbRasterization.cxx b/Modules/Applications/AppVectorDataTranslation/app/otbRasterization.cxx index 748d8f27be36f75205398bcbf7114b4b66343856..4c0b30ae6e11e01f744a51d04c51cf46e76aa907 100644 --- a/Modules/Applications/AppVectorDataTranslation/app/otbRasterization.cxx +++ b/Modules/Applications/AppVectorDataTranslation/app/otbRasterization.cxx @@ -60,7 +60,7 @@ public: typedef otb::OGRDataSourceToLabelImageFilter<FloatImageType> OGRDataSourceToMapFilterType; private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("Rasterization"); SetDescription("Rasterize a vector dataset."); @@ -132,7 +132,7 @@ private: AddParameter(ParameterType_String,"mode.attribute.field","The attribute field to burn"); SetParameterDescription("mode.attribute.field","Name of the attribute field to burn"); - SetParameterString("mode.attribute.field","DN", false); + SetParameterString("mode.attribute.field","DN"); AddRAMParameter(); @@ -144,13 +144,13 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { otb::ogr::DataSource::Pointer ogrDS; UInt8ImageType::Pointer referenceImage; diff --git a/Modules/Applications/AppVectorUtils/app/otbConcatenateVectorData.cxx b/Modules/Applications/AppVectorUtils/app/otbConcatenateVectorData.cxx index 92b972eafc02587d0636bdfaf3771625b8824beb..d8b51471a3444be2777efbbb4be56c9bf8d4795e 100644 --- a/Modules/Applications/AppVectorUtils/app/otbConcatenateVectorData.cxx +++ b/Modules/Applications/AppVectorUtils/app/otbConcatenateVectorData.cxx @@ -47,7 +47,7 @@ public: typedef otb::ConcatenateVectorDataFilter<VectorDataType> ConcatenateFilterType; private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("ConcatenateVectorData"); SetDescription("Concatenate vector data files"); @@ -81,12 +81,12 @@ private: } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do here for the parameters : all are independent } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { // Get the input VectorData list VectorDataListType* vectorDataList = GetParameterVectorDataList("vd"); diff --git a/Modules/Applications/AppVectorUtils/app/otbOSMDownloader.cxx b/Modules/Applications/AppVectorUtils/app/otbOSMDownloader.cxx index d55626ed0bb0f79d3696a4a2940c59a870038217..389b0f0cf0c19e09f5d3eb2473568eb0fb47e2f7 100644 --- a/Modules/Applications/AppVectorUtils/app/otbOSMDownloader.cxx +++ b/Modules/Applications/AppVectorUtils/app/otbOSMDownloader.cxx @@ -50,7 +50,7 @@ public: typedef otb::OSMDataToVectorDataGenerator VectorDataProviderType; private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("OSMDownloader"); SetDescription("Download vector data from OSM and store it to file"); @@ -98,11 +98,10 @@ private: // Elevation ElevationParametersHandler::AddElevationParameters(this, "elev"); - AddParameter(ParameterType_Empty, "printclasses", "Displays available key/value classes"); + AddParameter(ParameterType_Bool, "printclasses", "Displays available key/value classes"); SetParameterDescription("printclasses","Print the key/value classes " "available for the selected support image. If enabled, the OSM tag Key " "(-key) and the output (-out) become optional" ); - MandatoryOff("printclasses"); // Doc example parameter settings SetDocExampleParameterValue("support", "qb_RoadExtract.tif"); @@ -113,24 +112,24 @@ private: } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // CASE: when the -print option is not required and the User // does not set the option OSMKey or the option Output or does not // set both of them - if ( !this->HasValue("printclasses") ) + if ( GetParameterInt("printclasses") ) { - MandatoryOn("out"); - MandatoryOn("key"); + MandatoryOff("out"); + MandatoryOff("key"); } else { - MandatoryOff("out"); - MandatoryOff("key"); + MandatoryOn("out"); + MandatoryOn("key"); } } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { typedef otb::ImageToEnvelopeVectorDataFilter<FloatVectorImageType, VectorDataType> EnvelopeFilterType; @@ -178,7 +177,7 @@ private: // If the user wants to print the Key/Values present in the XML file // downloaded : - if ( this->HasValue("printclasses")) + if ( GetParameterInt("printclasses")) { // Print the classes VectorDataProviderType::KeyMapType keymap = m_VdOSMGenerator->GetKeysMap(); diff --git a/Modules/Applications/AppVectorUtils/app/otbVectorDataExtractROI.cxx b/Modules/Applications/AppVectorUtils/app/otbVectorDataExtractROI.cxx index 1b4e8c8bf7cb404e6e117735310b24059d63f538..de6f6f9db7b816dd86f6f73645915cac9ded4778 100644 --- a/Modules/Applications/AppVectorUtils/app/otbVectorDataExtractROI.cxx +++ b/Modules/Applications/AppVectorUtils/app/otbVectorDataExtractROI.cxx @@ -65,7 +65,7 @@ public: typedef otb::RemoteSensingRegion<double> RemoteSensingRegionType; private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("VectorDataExtractROI"); SetDescription("Perform an extract ROI on the input vector data according to the input image extent"); @@ -106,12 +106,12 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do here for the parameters : all are independent } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { // Get the inputs VectorDataType* vd = GetParameterVectorData("io.vd"); diff --git a/Modules/Applications/AppVectorUtils/app/otbVectorDataSetField.cxx b/Modules/Applications/AppVectorUtils/app/otbVectorDataSetField.cxx index 696a48a7f2dd1f29f8a7b609be96f85d2b8c1344..21d09e16cea1076610cb3f65f45e709b9febfa9d 100644 --- a/Modules/Applications/AppVectorUtils/app/otbVectorDataSetField.cxx +++ b/Modules/Applications/AppVectorUtils/app/otbVectorDataSetField.cxx @@ -43,7 +43,7 @@ public: itkTypeMacro(VectorDataSetField, otb::Application); private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("VectorDataSetField"); SetDescription("Set a field in vector data."); @@ -76,12 +76,12 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do (for now) } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { m_InputData = GetParameterVectorData("in"); diff --git a/Modules/Applications/AppVectorUtils/app/otbVectorDataTransform.cxx b/Modules/Applications/AppVectorUtils/app/otbVectorDataTransform.cxx index be163190893c063b32711abab1f45f8c77e67d13..ba4614d77b0cf1852dac326d721e334d98d878bc 100644 --- a/Modules/Applications/AppVectorUtils/app/otbVectorDataTransform.cxx +++ b/Modules/Applications/AppVectorUtils/app/otbVectorDataTransform.cxx @@ -54,7 +54,7 @@ public: typedef itk::CenteredSimilarity2DTransform<double> TransformType; private: - void DoInit() ITK_OVERRIDE + void DoInit() override { SetName("VectorDataTransform"); SetDescription("Apply a transform to each vertex of the input VectorData"); @@ -129,12 +129,12 @@ private: SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // nothing to update } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { // Get the support image FloatVectorImageType* inImage = GetParameterImage("in"); diff --git a/Modules/Core/CommandLineParser/include/otbCommandLineArgumentParser.h b/Modules/Core/CommandLineParser/include/otbCommandLineArgumentParser.h index ba7fc9601fb30cc21c925ac51d8e6c97ecd0d377..0132979d2fbb9f76e939abf7894f9aea1b4ef339 100644 --- a/Modules/Core/CommandLineParser/include/otbCommandLineArgumentParser.h +++ b/Modules/Core/CommandLineParser/include/otbCommandLineArgumentParser.h @@ -140,7 +140,7 @@ public: // const char *GetOptionParameter(const char *option, unsigned int number = 0); int GetNumberOfParameters(const std::string& option); - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; #define otbGetParameterMacro(name, type) \ virtual type GetParameter ## name (const std::string& option, unsigned int number = 0) const \ @@ -170,7 +170,7 @@ public: protected: CommandLineArgumentParseResult(); - ~CommandLineArgumentParseResult() ITK_OVERRIDE; + ~CommandLineArgumentParseResult() override; private: template<typename TypeValeur> @@ -254,7 +254,7 @@ public: protected: CommandLineArgumentParser(); - ~CommandLineArgumentParser() ITK_OVERRIDE; + ~CommandLineArgumentParser() override; private: diff --git a/Modules/Core/Common/include/otbChannelSelectorFunctor.h b/Modules/Core/Common/include/otbChannelSelectorFunctor.h index d1cf2304d92a961127f83600edb4b57a4b14f991..f758fb7b2a3d4e5d4ceb508af5a9c43ddfa7bc2f 100644 --- a/Modules/Core/Common/include/otbChannelSelectorFunctor.h +++ b/Modules/Core/Common/include/otbChannelSelectorFunctor.h @@ -248,7 +248,7 @@ protected: } /** Destructor */ - ~ChannelSelectorFunctor() ITK_OVERRIDE {} + ~ChannelSelectorFunctor() override {} private: diff --git a/Modules/Core/Common/include/otbCommandProgressUpdate.h b/Modules/Core/Common/include/otbCommandProgressUpdate.h index c9e553703b6105cf5491b0b717c521c29f8a71eb..14e61cb8109e1ff9056e9f83d81017cfdd5047f3 100644 --- a/Modules/Core/Common/include/otbCommandProgressUpdate.h +++ b/Modules/Core/Common/include/otbCommandProgressUpdate.h @@ -48,9 +48,9 @@ protected: public: typedef const TFilter * FilterPointer; - void Execute(itk::Object *caller, const itk::EventObject& event) ITK_OVERRIDE; + void Execute(itk::Object *caller, const itk::EventObject& event) override; - void Execute(const itk::Object * object, const itk::EventObject& event) ITK_OVERRIDE; + void Execute(const itk::Object * object, const itk::EventObject& event) override; }; } // end namespace otb diff --git a/Modules/Core/Common/include/otbComplexToIntensityImageFilter.h b/Modules/Core/Common/include/otbComplexToIntensityImageFilter.h index e98900b9c3169382f04e6db29aa4be3b95018acb..a3faddf351878151e4ae6d5bc5f9efd42e7c2bf0 100644 --- a/Modules/Core/Common/include/otbComplexToIntensityImageFilter.h +++ b/Modules/Core/Common/include/otbComplexToIntensityImageFilter.h @@ -99,7 +99,7 @@ public: protected: ComplexToIntensityImageFilter() {} - ~ComplexToIntensityImageFilter() ITK_OVERRIDE {} + ~ComplexToIntensityImageFilter() override {} private: ComplexToIntensityImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Core/Common/include/otbComplexToVectorImageCastFilter.h b/Modules/Core/Common/include/otbComplexToVectorImageCastFilter.h index 377f537ee0b40732381092abc4a95007f4c7c0db..85598ccecb2531dd6a877ee90d040b4783445952 100644 --- a/Modules/Core/Common/include/otbComplexToVectorImageCastFilter.h +++ b/Modules/Core/Common/include/otbComplexToVectorImageCastFilter.h @@ -140,7 +140,7 @@ public: protected: ComplexToVectorImageCastFilter() {} - ~ComplexToVectorImageCastFilter() ITK_OVERRIDE {} + ~ComplexToVectorImageCastFilter() override {} template<class T> bool PixelIsSingle(const T& /*dummy*/) @@ -154,7 +154,7 @@ protected: return false; } - void GenerateOutputInformation() ITK_OVERRIDE + void GenerateOutputInformation() override { Superclass::GenerateOutputInformation(); InputPixelType dummy; diff --git a/Modules/Core/Common/include/otbConfigurationManager.h b/Modules/Core/Common/include/otbConfigurationManager.h index 8c8f9af7ccd5ab93838100e780fe1546b0d66a7a..71e45fe72763231c649d559c687f2c8b7dafe0b8 100644 --- a/Modules/Core/Common/include/otbConfigurationManager.h +++ b/Modules/Core/Common/include/otbConfigurationManager.h @@ -31,7 +31,7 @@ #include <string> #include <boost/cstdint.hpp> - +#include "itkLoggerBase.h" #include "OTBCommonExport.h" namespace otb @@ -84,6 +84,27 @@ public: */ static RAMValueType GetMaxRAMHint(); + /** + * Logger level controls the level of logging that OTB will output. + * + * This is used to set-up the otb::Logger class. + * + * If OTB_LOGGER_LEVEL environment variable is set to one of DEBUG, + * INFO, WARNING, CRITICAL or FATAL, the logger level will be + * set accordingly. + * + * Priority is DEBUG < INFO < WARNING < CRITICAL < FATAL. + * + * Only messages with a higher priority than the logger level will + * be displayed. + * + * By default (if OTB_LOGGER_LEVEL is not set or can not be + * decoded), level is INFO. + * + */ + static itk::LoggerBase::PriorityLevelType GetLoggerLevel(); + + private: ConfigurationManager(); //purposely not implemented ~ConfigurationManager(); //purposely not implemented diff --git a/Modules/Core/Common/include/otbDotProductImageFilter.h b/Modules/Core/Common/include/otbDotProductImageFilter.h index 49dc8e5df19a5f952ec2f16eda5bd13a9b0deb18..1112606acaf981d26dd9934864352ffd54434c71 100644 --- a/Modules/Core/Common/include/otbDotProductImageFilter.h +++ b/Modules/Core/Common/include/otbDotProductImageFilter.h @@ -140,9 +140,9 @@ public: protected: DotProductImageFilter(); - ~DotProductImageFilter() ITK_OVERRIDE {} + ~DotProductImageFilter() override {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: DotProductImageFilter(const Self &); //purposely not implemented diff --git a/Modules/IO/ExtendedFilename/include/otbExtendedFilenameHelper.h b/Modules/Core/Common/include/otbExtendedFilenameHelper.h similarity index 92% rename from Modules/IO/ExtendedFilename/include/otbExtendedFilenameHelper.h rename to Modules/Core/Common/include/otbExtendedFilenameHelper.h index b6d29171cd0ef81fd67ad3822c06366c417f2544..549ad2451d85745f196db750ceea2ba3a9156c12 100644 --- a/Modules/IO/ExtendedFilename/include/otbExtendedFilenameHelper.h +++ b/Modules/Core/Common/include/otbExtendedFilenameHelper.h @@ -23,6 +23,7 @@ #include "itkObject.h" #include "itkObjectFactory.h" +#include "OTBCommonExport.h" namespace otb { @@ -33,9 +34,10 @@ namespace otb * \sa ImageFileReader * * \ingroup OTBExtendedFilename + * \ingroup OTBCommon */ -class ITK_EXPORT ExtendedFilenameHelper : public itk::Object +class OTBCommon_EXPORT ExtendedFilenameHelper : public itk::Object { public: /** Standard class typedefs. */ @@ -55,7 +57,7 @@ public: itkGetStringMacro(ExtendedFileName); itkGetStringMacro(SimpleFileName); - struct GenericBandRange : std::pair<int,int> + struct OTBCommon_EXPORT GenericBandRange : std::pair<int,int> { GenericBandRange() {} @@ -81,7 +83,7 @@ public: protected: ExtendedFilenameHelper() {} - ~ExtendedFilenameHelper() ITK_OVERRIDE {} + ~ExtendedFilenameHelper() override {} private: ExtendedFilenameHelper(const Self &); //purposely not implemented diff --git a/Modules/Core/Common/include/otbFunctionToImageFilter.h b/Modules/Core/Common/include/otbFunctionToImageFilter.h index a126c9c3d1ef80a9b48f8d4c3def985c85c03c7d..29098833a9a38e56cd7218145887f4ebf27fafe9 100644 --- a/Modules/Core/Common/include/otbFunctionToImageFilter.h +++ b/Modules/Core/Common/include/otbFunctionToImageFilter.h @@ -108,11 +108,11 @@ public: protected: FunctionToImageFilter(); - ~FunctionToImageFilter() ITK_OVERRIDE {} + ~FunctionToImageFilter() override {} /** Validate the presence of all three inputs. If one or more inputs * are missing, throw an exception. */ - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; /** SpatialFunctionImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine @@ -125,7 +125,7 @@ protected: * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId) ITK_OVERRIDE; + itk::ThreadIdType threadId) override; private: FunctionToImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Core/Common/include/otbImageAndVectorImageOperationFilter.h b/Modules/Core/Common/include/otbImageAndVectorImageOperationFilter.h index d5e32b6564fe7903723d88f76a903395f99fd673..060b01ba29d41ce91d0980157745d31297b2e873 100644 --- a/Modules/Core/Common/include/otbImageAndVectorImageOperationFilter.h +++ b/Modules/Core/Common/include/otbImageAndVectorImageOperationFilter.h @@ -163,7 +163,7 @@ public: /** Set the input images of this process object. */ using Superclass::SetInput; - void SetInput(const InputImageType *input) ITK_OVERRIDE; + void SetInput(const InputImageType *input) override; void SetVectorInput(const VectorInputImageType *input); /** Get the input images of this process object. */ @@ -215,12 +215,12 @@ public: protected: ImageAndVectorImageOperationFilter(); - ~ImageAndVectorImageOperationFilter() ITK_OVERRIDE; + ~ImageAndVectorImageOperationFilter() override; /** This is a source, so it must set the spacing, size, and largest possible * region for the output image that it will produce. * \sa ProcessObject::GenerateOutputInformation() */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; private: ImageAndVectorImageOperationFilter(const ImageAndVectorImageOperationFilter &); //purposely not implemented diff --git a/Modules/Core/Common/include/otbImageRegionAdaptativeSplitter.h b/Modules/Core/Common/include/otbImageRegionAdaptativeSplitter.h index 3d65acecdc627ee0c8e514123d1270772e26f873..91bdde52147caa8a9d460e498a3d4a2ea0006467 100644 --- a/Modules/Core/Common/include/otbImageRegionAdaptativeSplitter.h +++ b/Modules/Core/Common/include/otbImageRegionAdaptativeSplitter.h @@ -123,16 +123,16 @@ public: * necessary. */ unsigned int GetNumberOfSplits(const RegionType& region, - unsigned int requestedNumber) ITK_OVERRIDE; + unsigned int requestedNumber) override; /** Calling this method will set the image region and the requested * number of splits, and call the EstimateSplitMap() method if * necessary. */ RegionType GetSplit(unsigned int i, unsigned int numberOfPieces, - const RegionType& region) ITK_OVERRIDE; + const RegionType& region) override; /** Make the Modified() method update the IsUpToDate flag */ - void Modified() const ITK_OVERRIDE + void Modified() const override { // Call superclass implementation Superclass::Modified(); @@ -149,8 +149,8 @@ protected: m_IsUpToDate(false) {} - ~ImageRegionAdaptativeSplitter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~ImageRegionAdaptativeSplitter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: /** This methods actually estimate the split map and stores it in a diff --git a/Modules/Core/Common/include/otbImageRegionNonUniformMultidimensionalSplitter.h b/Modules/Core/Common/include/otbImageRegionNonUniformMultidimensionalSplitter.h index 497122f769051da7170d6b226e9489ab63771084..dfd3132fb6017f4df1a3cc182951f745aef5b006 100644 --- a/Modules/Core/Common/include/otbImageRegionNonUniformMultidimensionalSplitter.h +++ b/Modules/Core/Common/include/otbImageRegionNonUniformMultidimensionalSplitter.h @@ -97,18 +97,18 @@ public: * method returns a number less than or equal to the requested number * of pieces. */ unsigned int GetNumberOfSplits(const RegionType& region, - unsigned int requestedNumber) ITK_OVERRIDE; + unsigned int requestedNumber) override; /** Get a region definition that represents the ith piece a specified region. * The "numberOfPieces" specified should be less than or equal to what * GetNumberOfSplits() returns. */ RegionType GetSplit(unsigned int i, unsigned int numberOfPieces, - const RegionType& region) ITK_OVERRIDE; + const RegionType& region) override; protected: ImageRegionNonUniformMultidimensionalSplitter() {} - ~ImageRegionNonUniformMultidimensionalSplitter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~ImageRegionNonUniformMultidimensionalSplitter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: ImageRegionNonUniformMultidimensionalSplitter(const Self &); //purposely not implemented diff --git a/Modules/Core/Common/include/otbImageRegionSquareTileSplitter.h b/Modules/Core/Common/include/otbImageRegionSquareTileSplitter.h index 3665210b5db9d99a7d431302ef747a3d3bf670b7..a26e4f826963c360cd4cd4f1d4c5bd7f356bcbe3 100644 --- a/Modules/Core/Common/include/otbImageRegionSquareTileSplitter.h +++ b/Modules/Core/Common/include/otbImageRegionSquareTileSplitter.h @@ -113,13 +113,13 @@ public: * a certain dimensions, then some splits will not be possible. */ unsigned int GetNumberOfSplits(const RegionType& region, - unsigned int requestedNumber) ITK_OVERRIDE; + unsigned int requestedNumber) override; /** Get a region definition that represents the ith piece a specified region. * The "numberOfPieces" specified should be less than or equal to what * GetNumberOfSplits() returns. */ RegionType GetSplit(unsigned int i, unsigned int numberOfPieces, - const RegionType& region) ITK_OVERRIDE; + const RegionType& region) override; itkGetMacro(TileSizeAlignment, unsigned int); itkSetMacro(TileSizeAlignment, unsigned int); @@ -128,8 +128,8 @@ public: protected: ImageRegionSquareTileSplitter() : m_SplitsPerDimension(0U), m_TileDimension(0), m_TileSizeAlignment(16) {} - ~ImageRegionSquareTileSplitter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~ImageRegionSquareTileSplitter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: ImageRegionSquareTileSplitter(const ImageRegionSquareTileSplitter &); //purposely not implemented diff --git a/Modules/Core/Common/include/otbImageRegionTileMapSplitter.h b/Modules/Core/Common/include/otbImageRegionTileMapSplitter.h index d8dd4dc0bc9017955c797ba4da7b38af5016ccd6..091ff9e88f159a5ebd09a42065711671e625bca9 100644 --- a/Modules/Core/Common/include/otbImageRegionTileMapSplitter.h +++ b/Modules/Core/Common/include/otbImageRegionTileMapSplitter.h @@ -114,18 +114,18 @@ public: * method returns a number less than or equal to the requested number * of pieces. */ unsigned int GetNumberOfSplits(const RegionType& region, - unsigned int requestedNumber) ITK_OVERRIDE; + unsigned int requestedNumber) override; /** Get a region definition that represents the ith piece a specified region. * The "numberOfPieces" specified should be less than or equal to what * GetNumberOfSplits() returns. */ RegionType GetSplit(unsigned int i, unsigned int numberOfPieces, - const RegionType& region) ITK_OVERRIDE; + const RegionType& region) override; protected: ImageRegionTileMapSplitter() : m_AlignStep(256){} - ~ImageRegionTileMapSplitter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~ImageRegionTileMapSplitter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: ImageRegionTileMapSplitter(const ImageRegionTileMapSplitter &); //purposely not implemented diff --git a/Modules/Core/Common/include/otbImageToModulusAndDirectionImageFilter.h b/Modules/Core/Common/include/otbImageToModulusAndDirectionImageFilter.h index f6cc79abffbcf280be0d202a13781e62f6801f72..32192a68331ffd3c7aa19365f2eaf742a48fdbcb 100644 --- a/Modules/Core/Common/include/otbImageToModulusAndDirectionImageFilter.h +++ b/Modules/Core/Common/include/otbImageToModulusAndDirectionImageFilter.h @@ -86,12 +86,12 @@ public: /** Return the output image direction */ OutputImageDirectionType * GetOutputDirection(); - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; protected: ImageToModulusAndDirectionImageFilter(); - ~ImageToModulusAndDirectionImageFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~ImageToModulusAndDirectionImageFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: ImageToModulusAndDirectionImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Core/Common/include/otbImaginaryImageToComplexImageFilter.h b/Modules/Core/Common/include/otbImaginaryImageToComplexImageFilter.h index 9ee44c5a2dbb28644a9298c7bcae2a7c5cd93679..26e99427a92c0c9dc4fdcb57b46bb2e9368f8ca0 100644 --- a/Modules/Core/Common/include/otbImaginaryImageToComplexImageFilter.h +++ b/Modules/Core/Common/include/otbImaginaryImageToComplexImageFilter.h @@ -92,7 +92,7 @@ public: protected: ImaginaryImageToComplexImageFilter() {} - ~ImaginaryImageToComplexImageFilter() ITK_OVERRIDE {} + ~ImaginaryImageToComplexImageFilter() override {} private: ImaginaryImageToComplexImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Core/Common/include/otbImportImageFilter.h b/Modules/Core/Common/include/otbImportImageFilter.h index 9f21873c3c5c8a57fe4f5132577a3737f551c519..4965422f0665652b2af5c59b5ecefb7bf94fdea4 100644 --- a/Modules/Core/Common/include/otbImportImageFilter.h +++ b/Modules/Core/Common/include/otbImportImageFilter.h @@ -143,26 +143,26 @@ public: protected: ImportImageFilter(); - ~ImportImageFilter() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~ImportImageFilter() override; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** This filter does not actually "produce" any data, rather it "wraps" * the user supplied data into an itk::Image. */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** This is a source, so it must set the spacing, size, and largest possible * region for the output image that it will produce. * \sa ProcessObject::GenerateOutputInformation() */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; /** This filter can only produce the amount of data that it is given, - * so we must ITK_OVERRIDE ProcessObject::EnlargeOutputRequestedRegion() + * so we must override ProcessObject::EnlargeOutputRequestedRegion() * (The default implementation of a source produces the amount of * data requested. This source, however, can only produce what it is * given.) * * \sa ProcessObject::EnlargeOutputRequestedRegion() */ - void EnlargeOutputRequestedRegion(itk::DataObject *output) ITK_OVERRIDE; + void EnlargeOutputRequestedRegion(itk::DataObject *output) override; private: ImportImageFilter(const ImportImageFilter &); //purposely not implemented diff --git a/Modules/Core/Common/include/otbImportVectorImageFilter.h b/Modules/Core/Common/include/otbImportVectorImageFilter.h index c7db035c2581d9d555eab57be384e855b71a48c6..b333f99ac9fbeb9c004b87de0dfe1cfdc99db5b5 100644 --- a/Modules/Core/Common/include/otbImportVectorImageFilter.h +++ b/Modules/Core/Common/include/otbImportVectorImageFilter.h @@ -160,7 +160,7 @@ protected: virtual void GenerateOutputInformation(); /** This filter can only produce the amount of data that it is given, - * so we must ITK_OVERRIDE ProcessObject::EnlargeOutputRequestedRegion() + * so we must override ProcessObject::EnlargeOutputRequestedRegion() * (The default implementation of a source produces the amount of * data requested. This source, however, can only produce what it is * given.) diff --git a/Modules/Wrappers/ApplicationEngine/include/otbLogger.h b/Modules/Core/Common/include/otbLogger.h similarity index 55% rename from Modules/Wrappers/ApplicationEngine/include/otbLogger.h rename to Modules/Core/Common/include/otbLogger.h index ba43072a199e2a1e29f481dc232022e457017389..0da8d382194a6815c31c19ccc21a3856a10fd383 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbLogger.h +++ b/Modules/Core/Common/include/otbLogger.h @@ -23,6 +23,7 @@ #include "itkLoggerBase.h" #include "itkLogger.h" +#include "OTBCommonExport.h" namespace otb { @@ -31,9 +32,9 @@ namespace otb { * * Sets OTB wide settings in its constructor * - * \ingroup OTBApplicationEngine + * \ingroup OTBCommon */ -class Logger : public itk::Logger +class OTBCommon_EXPORT Logger : public itk::Logger { public: typedef Logger Self; @@ -41,15 +42,44 @@ public: typedef itk::SmartPointer< Self > Pointer; typedef itk::SmartPointer< const Self > ConstPointer; - itkTypeMacro(Logger, Object); - itkNewMacro(Self); + itkTypeMacro(Logger, itk::Logger); + + /** + * If Logger crashes when called from the destructor of a static + * or global object, the singleton might have already been destroyed. + * You can prolong its lifetime by calling Logger::Instance() + * from that object's constructor. + * + * See https://stackoverflow.com/questions/335369/finding-c-static-initialization-order-problems#335746 + */ + static Pointer Instance(); + itkNewMacro(Self); + // Overwrite this to provide custom formatting of log entries - std::string BuildFormattedEntry(itk::Logger::PriorityLevelType, std::string const&) ITK_OVERRIDE; + std::string BuildFormattedEntry(itk::Logger::PriorityLevelType, std::string const&) override; + + /** Output logs about the RAM, caching and multi-threading settings */ + void LogSetupInformation(); + + /** Return true if the LogSetupInformation has already been called*/ + bool IsLogSetupInformationDone(); + + /** Set the flag m_LogSetupInfoDone to true */ + void LogSetupInformationDone(); protected: - Logger(); - virtual ~Logger(); + Logger(); + virtual ~Logger() ITK_OVERRIDE; + +private: + Logger(const Self &); //purposely not implemented + void operator =(const Self&); //purposely not implemented + + static Pointer CreateInstance(); + + bool m_LogSetupInfoDone; + }; // class Logger } // namespace otb diff --git a/Modules/Core/Common/include/otbMacro.h b/Modules/Core/Common/include/otbMacro.h index 84a5ffc77372e6bc0f6500b0f0a1e14146cf68fe..6a248d4551a2f3f57220b4de62f3550a7dee5ad0 100644 --- a/Modules/Core/Common/include/otbMacro.h +++ b/Modules/Core/Common/include/otbMacro.h @@ -31,6 +31,7 @@ #include "itkMacro.h" #include "itkObject.h" #include "otbConfigure.h" +#include "otbLogger.h" /** * \namespace otb @@ -42,86 +43,31 @@ namespace otb { } // end namespace otb - this is here for documentation purposes -/** This macro is used to print debug (or other information). They are - * also used to catch errors, etc. Example usage looks like: - * itkDebugMacro(<< "this is debug info" << this->SomeVariable); */ -#define otbDebugMacro(x) itkDebugMacro(x) -/* { if ( this->GetDebug() && *::itk::Object::GetGlobalWarningDisplay()) \ - { std::ostringstream itkmsg; \ - itkmsg << "Debug: In " __FILE__ ", line " << __LINE__ << "\n" \ - << this->GetNameOfClass() << " (" << this << "): " x \ - << "\n\n"; \ - ::itk::OutputWindowDisplayDebugText(itkmsg.str().c_str()); } \ -}*/ - -#define otbMsgDebugMacro(x) \ - { \ - if (this->GetDebug() && ::itk::Object::GetGlobalWarningDisplay()) \ - { \ - std::ostringstream itkmsg; \ - itkmsg << " Msg Debug: " x << "\n"; \ - ::itk::OutputWindowDisplayDebugText(itkmsg.str().c_str()); \ - } \ - } +#define otbFileContext(x) \ + << "file " __FILE__ ", line " << __LINE__<<", " x -#ifndef NDEBUG -#define otbGenericMsgDebugMacro(x) \ - { \ - if (::itk::Object::GetGlobalWarningDisplay()) \ - { \ - std::ostringstream itkmsg; \ - itkmsg << " Generic Msg Debug: " x << "\n"; \ - ::itk::OutputWindowDisplayDebugText(itkmsg.str().c_str()); \ - } \ - } -#else -#define otbGenericMsgDebugMacro(x) -#endif +#define otbClassContext(x) \ + << this->GetNameOfClass() << " (" << this << "): " x -#define otbGenericMsgTestingMacro(x) \ - { \ - std::cout x << std::endl; \ - } +// Beware that to log to CRITICAL level, level should be passed as "Error" +#define otbLogMacro(level,msg) \ + { \ + std::ostringstream itkmsg; \ + itkmsg msg << "\n"; \ + otb::Logger::Instance()->level(itkmsg.str().c_str()); \ + } -#ifdef OTB_SHOW_ALL_MSG_DEBUG -#define otbMsgDevMacro(x) \ - { \ - { \ - std::ostringstream itkmsg; \ - itkmsg << " Msg Dev: (" << __FILE__ << ":" << __LINE__ << ") " x << "\n"; \ - ::itk::OutputWindowDisplayDebugText(itkmsg.str().c_str()); \ - } \ - } -#else -#define otbMsgDevMacro(x) -#endif - -/** This macro is used to print warning information (i.e., unusual circumstance - * but not necessarily fatal.) Example usage looks like: - * itkWarningMacro(<< "this is warning info" << this->SomeVariable); */ -#define otbWarningMacro(x) \ - { \ - if (itk::Object::GetGlobalWarningDisplay()) \ - { \ - std::ostringstream itkmsg; \ - itkmsg << "WARNING: In " __FILE__ ", line " << __LINE__ << "\n" \ - << this->GetNameOfClass() << " (" << this << "): " x \ - << "\n\n"; \ - itk::OutputWindowDisplayWarningText(itkmsg.str().c_str()); \ - } \ - } - -#define otbGenericWarningMacro(x) \ - { \ - if (itk::Object::GetGlobalWarningDisplay()) \ - { \ - std::ostringstream itkmsg; \ - itkmsg << "WARNING: In " __FILE__ ", line " << __LINE__ << ": " x <<"\n";\ - itk::OutputWindowDisplayWarningText(itkmsg.str().c_str()); \ - } \ - } +// Re-definition of old log macros to use the otbLogMacro +#define otbDebugMacro(x) otbLogMacro(Debug,otbFileContext(otbClassContext(x))) +#define otbMsgDebugMacro(x) otbLogMacro(Debug,otbFileContext(x)) +#define otbGenericMsgDebugMacro(x) otbLogMacro(Debug,x) +#define otbMsgDevMacro(x) otbLogMacro(Debug,otbFileContext(x)) +#define otbWarningMacro(x) otbLogMacro(Warning,otbFileContext(otbClassContext(x))) +#define otbGenericWarningMacro(x) otbLogMacro(Warning,otbFileContext(x)) +#define otbGenericMsgTestingMAcro(x) otbLogMacro(Info,"[testing] "<<x) + /** This macro is used to control condition. It use ONLY by the OTB developers * */ diff --git a/Modules/Core/Common/include/otbModelComponentBase.h b/Modules/Core/Common/include/otbModelComponentBase.h index 1bb6180576b50fc517e10733d56c261981a0c944..758c887ac9cd301aa6187b831c06d02228623079 100644 --- a/Modules/Core/Common/include/otbModelComponentBase.h +++ b/Modules/Core/Common/include/otbModelComponentBase.h @@ -130,8 +130,8 @@ public: protected: ModelComponentBase(); - ~ModelComponentBase() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~ModelComponentBase() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; virtual void GenerateData(); diff --git a/Modules/Core/Common/include/otbModelComponentBase.txx b/Modules/Core/Common/include/otbModelComponentBase.txx index ff48935796f1178550e1637bd37bf407256fe5e5..74bf396ded0ee54cc40ca1bdf5239a9e4ef9dbd6 100644 --- a/Modules/Core/Common/include/otbModelComponentBase.txx +++ b/Modules/Core/Common/include/otbModelComponentBase.txx @@ -188,7 +188,7 @@ void ModelComponentBase<TSample> ::GenerateData() { - /** subclasses should ITK_OVERRIDE this function to perform + /** subclasses should override this function to perform * parameter estimation. But it allows switching m_SampleModified * when necessary. */ diff --git a/Modules/Core/Common/include/otbQuaternaryFunctorImageFilter.h b/Modules/Core/Common/include/otbQuaternaryFunctorImageFilter.h index cf3a1d8b272a53dfa82e729f7c2ee12980df9b0f..0373dbf769d80e83d4c1dfc3db3fedf4da7d83c2 100644 --- a/Modules/Core/Common/include/otbQuaternaryFunctorImageFilter.h +++ b/Modules/Core/Common/include/otbQuaternaryFunctorImageFilter.h @@ -142,11 +142,11 @@ public: protected: QuaternaryFunctorImageFilter(); - ~QuaternaryFunctorImageFilter() ITK_OVERRIDE {} + ~QuaternaryFunctorImageFilter() override {} /** Validate the presence of all three inputs. If one or more inputs * are missing, throw an exception. */ - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; /** QuaternaryFunctorImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine @@ -159,7 +159,7 @@ protected: * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId) ITK_OVERRIDE; + itk::ThreadIdType threadId) override; private: QuaternaryFunctorImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Core/Common/include/otbRGBAPixelConverter.h b/Modules/Core/Common/include/otbRGBAPixelConverter.h index 8384c3c81522ec2c3cbbfed51a1a9545ea7c5956..45741fb683821c4d4abe239eeaa363b7af005afb 100644 --- a/Modules/Core/Common/include/otbRGBAPixelConverter.h +++ b/Modules/Core/Common/include/otbRGBAPixelConverter.h @@ -66,8 +66,8 @@ public: protected: RGBAPixelConverter(){} - ~RGBAPixelConverter() ITK_OVERRIDE{} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + ~RGBAPixelConverter() override{} + void PrintSelf(std::ostream& os, itk::Indent indent) const override { Superclass::PrintSelf(os, indent); } @@ -103,8 +103,8 @@ public: protected: RGBAPixelConverter(){} - ~RGBAPixelConverter() ITK_OVERRIDE{} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + ~RGBAPixelConverter() override{} + void PrintSelf(std::ostream& os, itk::Indent indent) const override { Superclass::PrintSelf(os, indent); } @@ -140,8 +140,8 @@ public: protected: RGBAPixelConverter(){} - ~RGBAPixelConverter() ITK_OVERRIDE{} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + ~RGBAPixelConverter() override{} + void PrintSelf(std::ostream& os, itk::Indent indent) const override { Superclass::PrintSelf(os, indent); } diff --git a/Modules/Core/Common/include/otbRectangle.h b/Modules/Core/Common/include/otbRectangle.h index b5da22fd45c6146ead97a8113458bc2b564f3c79..17a90c6c29b538c57126ab1b7f93e8fa19c06868 100644 --- a/Modules/Core/Common/include/otbRectangle.h +++ b/Modules/Core/Common/include/otbRectangle.h @@ -100,10 +100,10 @@ protected: }; /** Destructor */ - ~Rectangle() ITK_OVERRIDE {} + ~Rectangle() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** */ virtual double ComputeEuclideanDistanceMetricToSegment(VertexType q1, VertexType q2, VertexType p) const; diff --git a/Modules/Core/Common/include/otbStandardFilterWatcher.h b/Modules/Core/Common/include/otbStandardFilterWatcher.h index 2e4670bc86c04622cf4b5e4c0ae0468f4a2db866..f9216d5077b0657450c879bd3eabc16f478fa6d9 100644 --- a/Modules/Core/Common/include/otbStandardFilterWatcher.h +++ b/Modules/Core/Common/include/otbStandardFilterWatcher.h @@ -83,13 +83,13 @@ public: protected: /** Callback method to show the ProgressEvent */ - void ShowProgress() ITK_OVERRIDE; + void ShowProgress() override; /** Callback method to show the StartEvent */ - void StartFilter() ITK_OVERRIDE; + void StartFilter() override; /** Callback method to show the EndEvent */ - void EndFilter() ITK_OVERRIDE; + void EndFilter() override; private: diff --git a/Modules/Core/Common/include/otbStandardOneLineFilterWatcher.h b/Modules/Core/Common/include/otbStandardOneLineFilterWatcher.h index 0f7ba0fe6ab6fecdab2de992374aae17f778720a..9ee3992b0b04f1de5d28226ba49d904dc063a31d 100644 --- a/Modules/Core/Common/include/otbStandardOneLineFilterWatcher.h +++ b/Modules/Core/Common/include/otbStandardOneLineFilterWatcher.h @@ -77,13 +77,13 @@ public: protected: /** Callback method to show the ProgressEvent */ - void ShowProgress() ITK_OVERRIDE; + void ShowProgress() override; /** Callback method to show the StartEvent */ - void StartFilter() ITK_OVERRIDE; + void StartFilter() override; /** Callback method to show the EndEvent */ - void EndFilter() ITK_OVERRIDE; + void EndFilter() override; private: diff --git a/Modules/Core/Common/include/otbStandardWriterWatcher.h b/Modules/Core/Common/include/otbStandardWriterWatcher.h index b66b1997925d126b7af27feabc7d99339ff47a13..ab3936d9b7a85bf5ee96e246b7103c97d01c0074 100644 --- a/Modules/Core/Common/include/otbStandardWriterWatcher.h +++ b/Modules/Core/Common/include/otbStandardWriterWatcher.h @@ -87,22 +87,22 @@ public: protected: /** Callback method to show the ProgressEvent */ - void ShowWriterProgress() ITK_OVERRIDE; + void ShowWriterProgress() override; /** Callback method to show the StartEvent */ - void StartWriter() ITK_OVERRIDE; + void StartWriter() override; /** Callback method to show the EndEvent */ - void EndWriter() ITK_OVERRIDE; + void EndWriter() override; /** Callback method to show the ProgressEvent */ - void ShowFilterProgress() ITK_OVERRIDE; + void ShowFilterProgress() override; /** Callback method to show the StartEvent */ - void StartFilter() ITK_OVERRIDE {} + void StartFilter() override {} /** Callback method to show the EndEvent */ - void EndFilter() ITK_OVERRIDE {} + void EndFilter() override {} /** This is the method invoked by ShowFilterProgress() and ShowWriterProgress() */ virtual void ShowProgress(); diff --git a/Modules/Core/Common/include/otbSubsampledImageRegionConstIterator.h b/Modules/Core/Common/include/otbSubsampledImageRegionConstIterator.h index 8301929fd1fb441372de6ce178827b294ace920c..1b80e8f8cff93230da6967a209d80199873596d4 100644 --- a/Modules/Core/Common/include/otbSubsampledImageRegionConstIterator.h +++ b/Modules/Core/Common/include/otbSubsampledImageRegionConstIterator.h @@ -166,7 +166,7 @@ public: /** Set the index. * It is moved to the next available (usable) index. * \sa GetIndex */ - void SetIndex(const IndexType& ind) ITK_OVERRIDE; + void SetIndex(const IndexType& ind) override; /** Get the Index. */ IndexType GetIndex() const diff --git a/Modules/Core/Common/include/otbUnaryFunctorImageFilter.h b/Modules/Core/Common/include/otbUnaryFunctorImageFilter.h index 2217de58baf54d756792382afc2c6080ccda5ddd..bfffcd8ad244755abaf5343309b70c03cb021810 100644 --- a/Modules/Core/Common/include/otbUnaryFunctorImageFilter.h +++ b/Modules/Core/Common/include/otbUnaryFunctorImageFilter.h @@ -58,7 +58,7 @@ public: protected: UnaryFunctorImageFilter() {}; - ~UnaryFunctorImageFilter() ITK_OVERRIDE {} + ~UnaryFunctorImageFilter() override {} /** UnaryFunctorImageFilter can produce an image which has a different number of bands * than its input image. As such, UnaryFunctorImageFilter @@ -68,7 +68,7 @@ protected: * below. * * \sa ProcessObject::GenerateOutputInformaton() */ - void GenerateOutputInformation() ITK_OVERRIDE + void GenerateOutputInformation() override { Superclass::GenerateOutputInformation(); typename Superclass::OutputImagePointer outputPtr = this->GetOutput(); diff --git a/Modules/Core/Common/include/otbUnaryFunctorNeighborhoodVectorImageFilter.h b/Modules/Core/Common/include/otbUnaryFunctorNeighborhoodVectorImageFilter.h index e38717f813bcf96bff0bb80f5f95997613d15610..bdd7dfbf72e33bdb706b63b71357a7e08908414e 100644 --- a/Modules/Core/Common/include/otbUnaryFunctorNeighborhoodVectorImageFilter.h +++ b/Modules/Core/Common/include/otbUnaryFunctorNeighborhoodVectorImageFilter.h @@ -108,7 +108,7 @@ public: protected: UnaryFunctorNeighborhoodVectorImageFilter(); - ~UnaryFunctorNeighborhoodVectorImageFilter() ITK_OVERRIDE { } + ~UnaryFunctorNeighborhoodVectorImageFilter() override { } /** UnaryFunctorNeighborhoodVectorImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine @@ -121,13 +121,13 @@ protected: * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId) ITK_OVERRIDE; + itk::ThreadIdType threadId) override; /** * Since the number of components per pixel depends on the radius range, one must reimplement * this method to set the proper number of component on the filter output. */ - void GenerateOutputInformation(void) ITK_OVERRIDE; + void GenerateOutputInformation(void) override; RadiusType m_Radius; diff --git a/Modules/Core/Common/include/otbUnaryFunctorVectorImageFilter.h b/Modules/Core/Common/include/otbUnaryFunctorVectorImageFilter.h index b83b659424aff4f3d53e8a968eb6fc391fc363a0..cd24feafdf3e0c5db8e89404a8fcaccb3d84e8e5 100644 --- a/Modules/Core/Common/include/otbUnaryFunctorVectorImageFilter.h +++ b/Modules/Core/Common/include/otbUnaryFunctorVectorImageFilter.h @@ -93,7 +93,7 @@ public: protected: UnaryFunctorVectorImageFilter(); - ~UnaryFunctorVectorImageFilter() ITK_OVERRIDE { } + ~UnaryFunctorVectorImageFilter() override { } /** UnaryFunctorVectorImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine @@ -106,13 +106,13 @@ protected: * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId) ITK_OVERRIDE; + itk::ThreadIdType threadId) override; /** * Since the number of components per pixel depends on the radius range, one must reimplement * this method to set the proper number of component on the filter output. */ - void GenerateOutputInformation(void) ITK_OVERRIDE; + void GenerateOutputInformation(void) override; private: UnaryFunctorVectorImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Core/Common/include/otbUnaryFunctorWithIndexWithOutputSizeImageFilter.h b/Modules/Core/Common/include/otbUnaryFunctorWithIndexWithOutputSizeImageFilter.h index edd0854c39eecc0e8ce15fe885122b156dcb95b5..ddaeca2e00b2ff946da0016ae9b9c8be5d8e884a 100644 --- a/Modules/Core/Common/include/otbUnaryFunctorWithIndexWithOutputSizeImageFilter.h +++ b/Modules/Core/Common/include/otbUnaryFunctorWithIndexWithOutputSizeImageFilter.h @@ -111,7 +111,7 @@ protected: /** * Destructor */ - ~UnaryFunctorWithIndexWithOutputSizeImageFilter() ITK_OVERRIDE {} + ~UnaryFunctorWithIndexWithOutputSizeImageFilter() override {} /** UnaryFunctorWithIndexWithOutputSizeImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine @@ -123,12 +123,12 @@ protected: * * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ - void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) override; /** * Pad the input requested region by radius */ - void GenerateInputRequestedRegion(void) ITK_OVERRIDE; + void GenerateInputRequestedRegion(void) override; /** UnaryFunctorWithIndexWithOutputSizeImageFilter can produce an image which has a different number of bands * than its input image. As such, UnaryFunctorImageFilter @@ -138,7 +138,7 @@ protected: * below. * * \sa ProcessObject::GenerateOutputInformaton() */ - void GenerateOutputInformation() ITK_OVERRIDE + void GenerateOutputInformation() override { Superclass::GenerateOutputInformation(); typename Superclass::OutputImagePointer outputPtr = this->GetOutput(); diff --git a/Modules/Core/Common/include/otbUtils.h b/Modules/Core/Common/include/otbUtils.h index da2ecc286ed4abf8e175a700b69f9e14a8483fb4..ec8ed5475928066f74af913491931433b1a4d6da 100644 --- a/Modules/Core/Common/include/otbUtils.h +++ b/Modules/Core/Common/include/otbUtils.h @@ -51,6 +51,9 @@ namespace Utils /** Function that prints nothing (useful to disable libsvm logs)*/ void OTBCommon_EXPORT PrintNothing(const char *s); + extern OTBCommon_EXPORT bool const TrueConstant; + + extern OTBCommon_EXPORT bool const FalseConstant; } } // namespace otb diff --git a/Modules/Core/Common/include/otbVariableLengthVectorConverter.h b/Modules/Core/Common/include/otbVariableLengthVectorConverter.h index 365df014e7b43a4cdd330b4a7141f22628e656f5..79c0c9718c6300bddefbba01e23fb8601dea4d82 100644 --- a/Modules/Core/Common/include/otbVariableLengthVectorConverter.h +++ b/Modules/Core/Common/include/otbVariableLengthVectorConverter.h @@ -73,8 +73,8 @@ public: protected: VariableLengthVectorConverter(){} - ~VariableLengthVectorConverter() ITK_OVERRIDE{} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + ~VariableLengthVectorConverter() override{} + void PrintSelf(std::ostream& os, itk::Indent indent) const override { Superclass::PrintSelf(os, indent); os << "Attempt to use inexistant implementation of the converter!" @@ -116,8 +116,8 @@ public: protected: VariableLengthVectorConverter(){} - ~VariableLengthVectorConverter() ITK_OVERRIDE{} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + ~VariableLengthVectorConverter() override{} + void PrintSelf(std::ostream& os, itk::Indent indent) const override { Superclass::PrintSelf(os, indent); os << "Attempt to use inexistant implementation of the converter!" @@ -157,8 +157,8 @@ public: protected: VariableLengthVectorConverter(){} - ~VariableLengthVectorConverter() ITK_OVERRIDE{} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + ~VariableLengthVectorConverter() override{} + void PrintSelf(std::ostream& os, itk::Indent indent) const override { Superclass::PrintSelf(os, indent); os << "Converter: std::vector<std::vector<RealType>> => VariableLengthVector<RealType>" @@ -198,8 +198,8 @@ public: protected: VariableLengthVectorConverter(){} - ~VariableLengthVectorConverter() ITK_OVERRIDE{} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + ~VariableLengthVectorConverter() override{} + void PrintSelf(std::ostream& os, itk::Indent indent) const override { Superclass::PrintSelf(os, indent); os << "Converter: std::vector<std::vector<std::complex<RealType>>> => VariableLengthVector<RealType>" @@ -239,8 +239,8 @@ public: protected: VariableLengthVectorConverter(){} - ~VariableLengthVectorConverter() ITK_OVERRIDE{} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + ~VariableLengthVectorConverter() override{} + void PrintSelf(std::ostream& os, itk::Indent indent) const override { Superclass::PrintSelf(os, indent); os << "Converter: itk::FixedArray<RealType, VArrayDimension> => VariableLengthVector<RealType>" @@ -279,8 +279,8 @@ public: protected: VariableLengthVectorConverter(){} - ~VariableLengthVectorConverter() ITK_OVERRIDE{} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + ~VariableLengthVectorConverter() override{} + void PrintSelf(std::ostream& os, itk::Indent indent) const override { Superclass::PrintSelf(os, indent); os << "Converter: itk::Statistics::Histogram<RealType, VMeasurementVectorSize, TFrequencyContainer> => VariableLengthVector<RealType>" diff --git a/Modules/Core/Common/include/otbVectorImageToASImageAdaptor.h b/Modules/Core/Common/include/otbVectorImageToASImageAdaptor.h index 36844c6136b3036de508cce021d167f5213f7270..9fa9bb3bc4927a48715f5763dddd45a6619f3479 100644 --- a/Modules/Core/Common/include/otbVectorImageToASImageAdaptor.h +++ b/Modules/Core/Common/include/otbVectorImageToASImageAdaptor.h @@ -66,7 +66,7 @@ public: protected: VectorImageToASImageAdaptor() {} - ~VectorImageToASImageAdaptor() ITK_OVERRIDE {} + ~VectorImageToASImageAdaptor() override {} private: VectorImageToASImageAdaptor(const Self &); //purposely not implemented diff --git a/Modules/Core/Common/otb-module.cmake b/Modules/Core/Common/otb-module.cmake index 97ba992dd7ca4a88b6ce1ac6475678f27eb1368b..b3276d69422b566872290eba6a5d817cb2b45be1 100644 --- a/Modules/Core/Common/otb-module.cmake +++ b/Modules/Core/Common/otb-module.cmake @@ -27,6 +27,8 @@ ENABLE_SHARED OTBITK #Add dependency to OTBGDAL as GDAL module need to set OTB_USE_GDAL_20 before configuring otbConfigure.h OTBGDAL + #Add dependency for extended filename helper class + OTBBoostAdapters TEST_DEPENDS OTBImageBase diff --git a/Modules/Core/Common/src/CMakeLists.txt b/Modules/Core/Common/src/CMakeLists.txt index 02ff6250e794704244acbe370fc7c562a13524c3..1aee98f792eca87f73212b1892b60e4571698bf2 100644 --- a/Modules/Core/Common/src/CMakeLists.txt +++ b/Modules/Core/Common/src/CMakeLists.txt @@ -29,12 +29,13 @@ set(OTBCommon_SRC otbWriterWatcherBase.cxx otbStopwatch.cxx otbStringToHTML.cxx + otbExtendedFilenameHelper.cxx + otbLogger.cxx ) add_library(OTBCommon ${OTBCommon_SRC}) target_link_libraries(OTBCommon - ${OTBITK_LIBRARIES} - + ${OTBITK_LIBRARIES} ${OTBGDAL_LIBRARIES} ) otb_module_target(OTBCommon) diff --git a/Modules/Core/Common/src/otbConfigurationManager.cxx b/Modules/Core/Common/src/otbConfigurationManager.cxx index de0ea045799aaded54294a9eba4cbfe68598fd65..d12d1833620ebce22b3cb1615457f7ec87057031 100644 --- a/Modules/Core/Common/src/otbConfigurationManager.cxx +++ b/Modules/Core/Common/src/otbConfigurationManager.cxx @@ -20,9 +20,13 @@ #include "otbConfigurationManager.h" +#include "otbMacro.h" + #include "itksys/SystemTools.hxx" #include <cstdlib> +#include <algorithm> +#include <string> namespace otb { @@ -59,6 +63,39 @@ ConfigurationManager::RAMValueType ConfigurationManager::GetMaxRAMHint() } return value; +} + +itk::LoggerBase::PriorityLevelType ConfigurationManager::GetLoggerLevel() +{ + std::string svalue; + // Default value is INFO + itk::LoggerBase::PriorityLevelType level = itk::LoggerBase::INFO; + + if(itksys::SystemTools::GetEnv("OTB_LOGGER_LEVEL",svalue)) + { + if(svalue.compare("DEBUG") == 0) + { + level = itk::LoggerBase::DEBUG; + } + else if(svalue.compare("INFO") == 0) + { + level = itk::LoggerBase::INFO; + } + else if(svalue.compare("WARNING") == 0) + { + level = itk::LoggerBase::WARNING; + } + else if(svalue.compare("CRITICAL") == 0) + { + level = itk::LoggerBase::CRITICAL; + } + else + { + otbLogMacro(Error,<<"Unknown value for OTB_LOGGER_LEVEL_MACRO. Possible values are DEBUG, INFO, WARNING, CRITICAL."); + } + } + return level; } + } diff --git a/Modules/Core/Common/src/otbConfigure.h.in b/Modules/Core/Common/src/otbConfigure.h.in index 5194398344bab96a44eb4bb622fda9dc1bf0ae46..2146cf15bffa6fdb90e30c766a9f3f483263944e 100644 --- a/Modules/Core/Common/src/otbConfigure.h.in +++ b/Modules/Core/Common/src/otbConfigure.h.in @@ -27,9 +27,6 @@ #cmakedefine OTB_BUILD_SHARED_LIBS -/* Show developer debug messages */ -#cmakedefine OTB_SHOW_ALL_MSG_DEBUG - #cmakedefine OTB_USE_GDAL_20 #cmakedefine OTB_USE_OPENMP diff --git a/Modules/IO/ExtendedFilename/src/otbExtendedFilenameHelper.cxx b/Modules/Core/Common/src/otbExtendedFilenameHelper.cxx similarity index 100% rename from Modules/IO/ExtendedFilename/src/otbExtendedFilenameHelper.cxx rename to Modules/Core/Common/src/otbExtendedFilenameHelper.cxx diff --git a/Modules/Wrappers/ApplicationEngine/src/otbLogger.cxx b/Modules/Core/Common/src/otbLogger.cxx similarity index 50% rename from Modules/Wrappers/ApplicationEngine/src/otbLogger.cxx rename to Modules/Core/Common/src/otbLogger.cxx index f7994eed4db3a1830b7fc2e1028bd23344c205eb..2c4bfd184d416c6be33fc6afda191e25519d7e9a 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbLogger.cxx +++ b/Modules/Core/Common/src/otbLogger.cxx @@ -20,29 +20,80 @@ #include "otbLogger.h" #include "itksys/SystemTools.hxx" +#include "otbConfigurationManager.h" +#include "itkStdStreamLogOutput.h" +#include <iostream> +#include "gdal.h" +#include "itkMultiThreader.h" namespace otb { -Logger::Logger() : - itk::Logger::Logger() +Logger::Pointer Logger::CreateInstance() { -#if OTB_DEBUG - this->SetPriorityLevel(itk::LoggerBase::DEBUG); -#else - this->SetPriorityLevel(itk::LoggerBase::INFO); -#endif + Logger::Pointer instance = Logger::New(); + + // By default, redirect logs to std::cout + itk::StdStreamLogOutput::Pointer defaultOutput = itk::StdStreamLogOutput::New(); + defaultOutput->SetStream(std::cout); + + instance->AddLogOutput(defaultOutput); + + return instance; +} + +Logger::Pointer Logger::Instance() +{ + // Static locales are initialized once in a thread-safe way + static Logger::Pointer instance = CreateInstance(); + + return instance; +} + +Logger::Logger() +{ + this->SetPriorityLevel(otb::ConfigurationManager::GetLoggerLevel()); this->SetLevelForFlushing(itk::LoggerBase::CRITICAL); this->SetTimeStampFormat(itk::LoggerBase::HUMANREADABLE); this->SetHumanReadableFormat("%Y-%m-%d %H:%M:%S"); + + m_LogSetupInfoDone = false; } Logger::~Logger() { } +void Logger::LogSetupInformation() +{ + if (! IsLogSetupInformationDone()) + { + std::ostringstream oss; + + oss<<"Default RAM limit for OTB is "<<otb::ConfigurationManager::GetMaxRAMHint()<<" MB"<<std::endl; + this->Info(oss.str()); + oss.str(""); + oss.clear(); + + oss<<"GDAL maximum cache size is "<<GDALGetCacheMax64()/(1024*1024)<<" MB"<<std::endl; + this->Info(oss.str()); + oss.str(""); + oss.clear(); + + oss<<"OTB will use at most "<<itk::MultiThreader::GetGlobalDefaultNumberOfThreads()<<" threads"<<std::endl; + this->Info(oss.str()); + oss.str(""); + oss.clear(); + + // ensure LogSetupInformation is done once per logger, and also that it is + // skipped by the singleton when it has already been printed by an other instance + LogSetupInformationDone(); + Instance()->LogSetupInformationDone(); + } +} + std::string Logger::BuildFormattedEntry(itk::Logger::PriorityLevelType level, std::string const & content) { static const std::string levelString[] = { "(MUSTFLUSH)", "(FATAL)", "(CRITICAL)", @@ -72,4 +123,14 @@ std::string Logger::BuildFormattedEntry(itk::Logger::PriorityLevelType level, st return s.str(); } +bool Logger::IsLogSetupInformationDone() +{ + return m_LogSetupInfoDone; +} + +void Logger::LogSetupInformationDone() +{ + m_LogSetupInfoDone = true; +} + } // namespace otb diff --git a/Modules/Core/Common/src/otbUtils.cxx b/Modules/Core/Common/src/otbUtils.cxx index f837789ba6ee406bb6739f527dc2ef103f780f9a..7bdf9edb7121801353360e316d8c15ac4836fe6b 100644 --- a/Modules/Core/Common/src/otbUtils.cxx +++ b/Modules/Core/Common/src/otbUtils.cxx @@ -41,6 +41,10 @@ void PrintNothing(const char * /* s */) { } +bool const TrueConstant = true; + +bool const FalseConstant = false; + } } diff --git a/Modules/Core/ImageBase/include/otbDefaultConvertPixelTraits.h b/Modules/Core/ImageBase/include/otbDefaultConvertPixelTraits.h index 3339a54a1a39b6be9d8ddd5dc17a757289a87213..be11633e7b98a62cded643e040e26aa76abd5d4c 100644 --- a/Modules/Core/ImageBase/include/otbDefaultConvertPixelTraits.h +++ b/Modules/Core/ImageBase/include/otbDefaultConvertPixelTraits.h @@ -1,5 +1,4 @@ /* - * Copyright (C) 1999-2011 Insight Software Consortium * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) * * This file is part of Orfeo Toolbox @@ -19,322 +18,67 @@ * limitations under the License. */ - #ifndef otbDefaultConvertPixelTraits_h #define otbDefaultConvertPixelTraits_h -#include "itkOffset.h" -#include "itkVector.h" -#include "itkMatrix.h" +#include "itkDefaultConvertPixelTraits.h" -namespace otb +namespace otb { -/** \class DefaultConvertPixelTraits - * \brief Traits class used to by ConvertPixels to convert blocks of pixels. - * - * TOutputPixelType is the destination type. The input type is inferred - * by the templated static function Convert. - * - * This implementation does a simple assignment operator, so if you are - * going from a higher bit representation to a lower bit one (int to - * char), you may want to specialize and add some sort of transfer function. - * - * \ingroup OTBImageBase - */ -template<typename PixelType> -class DefaultConvertPixelTraits + +template < typename PixelType> +class DefaultConvertPixelTraits +: public itk::DefaultConvertPixelTraits < PixelType > { public: - /** Determine the pixel data type. */ - typedef typename PixelType::ComponentType ComponentType; - - /** Return the number of components per pixel. */ - static unsigned int GetNumberOfComponents() - { return PixelType::GetNumberOfComponents(); } - - /** Return the nth component of the pixel. */ - static ComponentType GetNthComponent(int c, const PixelType& pixel) - { return pixel.GetNthComponent(c); } - - /** Set the nth component of the pixel. */ - static void SetNthComponent(int c, PixelType& pixel, const ComponentType& v) - { pixel.SetNthComponent(c, v); } - static void SetNthComponent(int itkNotUsed(c), PixelType & pixel, const PixelType& v) - { pixel = v; } + typedef itk::DefaultConvertPixelTraits < PixelType > SuperClass; + using typename SuperClass::ComponentType; - /** Return a single scalar value from this pixel. */ - static ComponentType GetScalarValue(const PixelType& pixel) - { return pixel.GetScalarValue(); } + using SuperClass::SetNthComponent; + static void SetNthComponent(int , PixelType & pixel, const PixelType & v) + { + pixel = v; + } }; -#define OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(type) \ -template<> \ -class DefaultConvertPixelTraits<type> \ -{ \ -public: \ - typedef type ComponentType; \ - static unsigned int GetNumberOfComponents() \ - { \ - return 1; \ - } \ - static void SetNthComponent(int , type& pixel, const ComponentType& v) \ - { \ - pixel = v; \ - } \ - static type GetScalarValue(const type& pixel) \ - { \ - return pixel; \ - } \ -}; - -OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(float) -OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(double) -OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(int) -OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(char) -OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(short) -OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(unsigned int) -OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(signed char) -OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(unsigned char) -OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(unsigned short) -OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(long) -OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(unsigned long) -OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(bool) - -#undef OTB_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL - -// -// Default traits for the Offset<> pixel type -// +template < typename T > +class DefaultConvertPixelTraits < ::std::complex < T > > +: public itk::DefaultConvertPixelTraits < ::std::complex < T > > +{ +public: -#define OTB_DEFAULTCONVERTTRAITS_OFFSET_TYPE(dimension) \ -template<> \ -class DefaultConvertPixelTraits< itk::Offset<dimension> > \ -{ \ -public: \ - typedef itk::Offset<dimension> TargetType; \ - typedef TargetType::OffsetValueType ComponentType; \ - static unsigned int GetNumberOfComponents() \ - { \ - return dimension; \ - } \ - static void SetNthComponent(int i, TargetType & pixel, const ComponentType& v) \ - { \ - pixel[i] = v; \ - } \ - static void SetNthComponent(int , TargetType & pixel, const TargetType& v) \ - { \ - pixel = v; \ - } \ - static ComponentType GetScalarValue(const TargetType& pixel) \ - { \ - return pixel[0]; \ - } \ + typedef itk::DefaultConvertPixelTraits < ::std::complex < T > > SuperClass; + using typename SuperClass::TargetType ; + using typename SuperClass::ComponentType ; + + using SuperClass::SetNthComponent ; + + static void SetNthComponent(int , TargetType & pixel, const TargetType & v) + { + pixel = v; + } + + static TargetType GetNthComponent ( int , const TargetType & pixel ) + { + return pixel; + } + + static ComponentType GetScalarValue(const TargetType& pixel) + { + /* + * This seems to be dead code, since the complex to scalar + * conversion is done by ConvertPixelBuffer + * + * Historically, it was returning std::norm, which causes + * compilation error on MacOSX 10.9. + * Now returns the equivalent implementation of std::norm. + */ + return static_cast<ComponentType>( pixel.real()*pixel.real() + + pixel.imag()*pixel.imag() ); + } }; - -// Define traits for Offset<> from dimensions 1 to 5 - OTB_DEFAULTCONVERTTRAITS_OFFSET_TYPE(1) - OTB_DEFAULTCONVERTTRAITS_OFFSET_TYPE(2) - OTB_DEFAULTCONVERTTRAITS_OFFSET_TYPE(3) - OTB_DEFAULTCONVERTTRAITS_OFFSET_TYPE(4) - OTB_DEFAULTCONVERTTRAITS_OFFSET_TYPE(5) - -// -// Default traits for the pixel types deriving from FixedArray<> -// - -#define OTB_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE(type,componenttype, dimension) \ -template<> \ -class DefaultConvertPixelTraits< type< componenttype, dimension> > \ -{ \ -public: \ - typedef type< componenttype, dimension > TargetType; \ - typedef componenttype ComponentType; \ - static unsigned int GetNumberOfComponents() \ - { \ - return dimension; \ - } \ - static void SetNthComponent(int i, TargetType & pixel, const ComponentType& v) \ - { \ - pixel[i] = v; \ - } \ - static void SetNthComponent(int , TargetType & pixel, const TargetType& v) \ - { \ - pixel = v; \ - } \ - static ComponentType GetScalarValue(const TargetType& pixel) \ - { \ - return pixel[0]; \ - } \ -}; \ - -// -// -// Define traits for Classed deriving from FixedArray from dimensions 1 to 6 -// These classes include: Vector, CovariantVector and Point. -// -// -#define OTB_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE_ALL_MACRO(ArrayType, Type) \ - OTB_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE(ArrayType,Type,1) \ - OTB_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE(ArrayType,Type,2) \ - OTB_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE(ArrayType,Type,3) \ - OTB_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE(ArrayType,Type,4) \ - OTB_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE(ArrayType,Type,5) \ - OTB_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE(ArrayType,Type,6) - -#define OTB_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE_ALL_TYPES_MACRO(ArrayType) \ - OTB_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE_ALL_MACRO(ArrayType, char); \ - OTB_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE_ALL_MACRO(ArrayType, signed char); \ - OTB_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE_ALL_MACRO(ArrayType, unsigned char); \ - OTB_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE_ALL_MACRO(ArrayType, short); \ - OTB_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE_ALL_MACRO(ArrayType, unsigned short); \ - OTB_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE_ALL_MACRO(ArrayType, int); \ - OTB_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE_ALL_MACRO(ArrayType, unsigned int); \ - OTB_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE_ALL_MACRO(ArrayType, long); \ - OTB_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE_ALL_MACRO(ArrayType, unsigned long); \ - OTB_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE_ALL_MACRO(ArrayType, float); \ - OTB_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE_ALL_MACRO(ArrayType, double); - - OTB_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE_ALL_TYPES_MACRO(itk::Vector); - OTB_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE_ALL_TYPES_MACRO(itk::CovariantVector); - OTB_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE_ALL_TYPES_MACRO(itk::Point); - OTB_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE_ALL_TYPES_MACRO(itk::FixedArray); - -// -// End of Traits for the classes deriving from FixedArray. -// -// - - -// -// Default traits for the pixel types deriving from Matrix<> -// - -#define OTB_DEFAULTCONVERTTRAITS_MATRIX_TYPE(type,componenttype,rows,cols) \ -template<> \ -class DefaultConvertPixelTraits< type< componenttype, rows, cols > > \ -{ \ -public: \ - typedef type< componenttype, rows, cols > TargetType; \ - typedef componenttype ComponentType; \ - static unsigned int GetNumberOfComponents() \ - { \ - return rows * cols; \ - } \ - static void SetNthComponent(int i, TargetType & pixel, const ComponentType& v) \ - { \ - const unsigned int row = i / cols; \ - const unsigned int col = i % cols; \ - pixel[row][col] = v; \ - } \ - static void SetNthComponent(int , TargetType & pixel, const TargetType& v) \ - { \ - pixel = v; \ - } \ - static ComponentType GetScalarValue(const TargetType& pixel) \ - { \ - return pixel[0][0]; \ - } \ -}; \ - -// -// -// Define traits for Classed deriving from Matrix from dimensions 1 to 6 -// -// -#define OTB_DEFAULTCONVERTTRAITS_MATRIX_TYPE_ALL_MACRO(ArrayType, Type) \ - OTB_DEFAULTCONVERTTRAITS_MATRIX_TYPE(ArrayType,Type,1,1) \ - OTB_DEFAULTCONVERTTRAITS_MATRIX_TYPE(ArrayType,Type,2,2) \ - OTB_DEFAULTCONVERTTRAITS_MATRIX_TYPE(ArrayType,Type,3,3) \ - OTB_DEFAULTCONVERTTRAITS_MATRIX_TYPE(ArrayType,Type,4,4) \ - OTB_DEFAULTCONVERTTRAITS_MATRIX_TYPE(ArrayType,Type,5,5) \ - OTB_DEFAULTCONVERTTRAITS_MATRIX_TYPE(ArrayType,Type,6,6) - -#define OTB_DEFAULTCONVERTTRAITS_MATRIX_TYPE_ALL_TYPES_MACRO(ArrayType) \ - OTB_DEFAULTCONVERTTRAITS_MATRIX_TYPE_ALL_MACRO(ArrayType, char); \ - OTB_DEFAULTCONVERTTRAITS_MATRIX_TYPE_ALL_MACRO(ArrayType, signed char); \ - OTB_DEFAULTCONVERTTRAITS_MATRIX_TYPE_ALL_MACRO(ArrayType, unsigned char); \ - OTB_DEFAULTCONVERTTRAITS_MATRIX_TYPE_ALL_MACRO(ArrayType, short); \ - OTB_DEFAULTCONVERTTRAITS_MATRIX_TYPE_ALL_MACRO(ArrayType, unsigned short); \ - OTB_DEFAULTCONVERTTRAITS_MATRIX_TYPE_ALL_MACRO(ArrayType, int); \ - OTB_DEFAULTCONVERTTRAITS_MATRIX_TYPE_ALL_MACRO(ArrayType, unsigned int); \ - OTB_DEFAULTCONVERTTRAITS_MATRIX_TYPE_ALL_MACRO(ArrayType, long); \ - OTB_DEFAULTCONVERTTRAITS_MATRIX_TYPE_ALL_MACRO(ArrayType, unsigned long); \ - OTB_DEFAULTCONVERTTRAITS_MATRIX_TYPE_ALL_MACRO(ArrayType, float); \ - OTB_DEFAULTCONVERTTRAITS_MATRIX_TYPE_ALL_MACRO(ArrayType, double); - -// -// Add here other classes that derive from Matrix or that have the same API -// - OTB_DEFAULTCONVERTTRAITS_MATRIX_TYPE_ALL_TYPES_MACRO(itk::Matrix); - -// -// End of Traits for the classes deriving from Matrix. -// -// - - -// -// Default traits for the pixel types deriving from std::complex<> -// - -#define OTB_DEFAULTCONVERTTRAITS_COMPLEX_TYPE( componenttype ) \ -template<> \ -class DefaultConvertPixelTraits< ::std::complex< componenttype > > \ -{ \ -public: \ - typedef ::std::complex< componenttype> TargetType; \ - typedef componenttype ComponentType; \ - static unsigned int GetNumberOfComponents() \ - { \ - return 2; \ - } \ - static void SetNthComponent(int i, TargetType & pixel, const ComponentType& v) \ - { \ - if( i == 0 ) \ - { \ - pixel = TargetType( v, pixel.imag() ); \ - } \ - else \ - { \ - pixel = TargetType( pixel.real(), v ); \ - } \ - } \ - static void SetNthComponent(int , TargetType & pixel, const TargetType& v) \ - { \ - pixel = v; \ - } \ - static ComponentType GetScalarValue(const TargetType& pixel) \ - { \ - /* \ - * This seems to be dead code, since the complex to scalar \ - * conversion is done by ConvertPixelBuffer \ - * \ - * Historically, it was returning std::norm, which causes \ - * compilation error on MacOSX 10.9. \ - * Now returns the equivalent implementation of std::norm. \ - */ \ - return static_cast<ComponentType>( pixel.real()*pixel.real() \ - + pixel.imag()*pixel.imag() ); \ - } \ -}; \ - -OTB_DEFAULTCONVERTTRAITS_COMPLEX_TYPE(float); -OTB_DEFAULTCONVERTTRAITS_COMPLEX_TYPE(double); -OTB_DEFAULTCONVERTTRAITS_COMPLEX_TYPE(signed int); -OTB_DEFAULTCONVERTTRAITS_COMPLEX_TYPE(unsigned int); -OTB_DEFAULTCONVERTTRAITS_COMPLEX_TYPE(short int); -OTB_DEFAULTCONVERTTRAITS_COMPLEX_TYPE(signed char); -OTB_DEFAULTCONVERTTRAITS_COMPLEX_TYPE(unsigned char); -OTB_DEFAULTCONVERTTRAITS_COMPLEX_TYPE(signed long); -OTB_DEFAULTCONVERTTRAITS_COMPLEX_TYPE(unsigned long); - -// -// End of Traits for the classes deriving from std::complex. -// -// - -} // end namespace otb +} // end namespace #endif diff --git a/Modules/Core/ImageBase/include/otbExtractROI.h b/Modules/Core/ImageBase/include/otbExtractROI.h index 52f45375d65a95ca0a8fe8ffba5159edce928334..e094ef471a3382b3062b8803a015c2c7f090bf52 100644 --- a/Modules/Core/ImageBase/include/otbExtractROI.h +++ b/Modules/Core/ImageBase/include/otbExtractROI.h @@ -80,17 +80,17 @@ public: OutputImageType::ImageDimension); void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId) ITK_OVERRIDE; + itk::ThreadIdType threadId) override; protected: ExtractROI(); - ~ExtractROI() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~ExtractROI() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** ExtractROI * * \sa ExtractROIBase::GenerateOutputInformaton() */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; private: ExtractROI(const Self &); //purposely not implemented diff --git a/Modules/Core/ImageBase/include/otbExtractROIBase.h b/Modules/Core/ImageBase/include/otbExtractROIBase.h index 6fbe6ed2947b25b536b192d510ec578c8d787fce..07906dfe078b6c7d90bb3885a645f765088e14dd 100644 --- a/Modules/Core/ImageBase/include/otbExtractROIBase.h +++ b/Modules/Core/ImageBase/include/otbExtractROIBase.h @@ -108,10 +108,10 @@ public: protected: ExtractROIBase(); - ~ExtractROIBase() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~ExtractROIBase() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; /** ExtractROIBase can produce an image which is a different * resolution than its input image. As such, ExtractROIBase @@ -121,7 +121,7 @@ protected: * below. * * \sa ProcessObject::GenerateOutputInformaton() */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; /** This function calls the actual region copier to do the mapping from * output image space to input image space. It uses a @@ -134,7 +134,7 @@ protected: * * \sa ImageToImageFilter::CallCopyRegion() */ void CallCopyOutputRegionToInputRegion(InputImageRegionType& destRegion, - const OutputImageRegionType& srcRegion) ITK_OVERRIDE; + const OutputImageRegionType& srcRegion) override; /** ExtractROIBase can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() @@ -149,7 +149,7 @@ protected: // ATTENTION bizarre void ThreadedGenerateData(const OutputImageRegionType& /*outputRegionForThread*/, - itk::ThreadIdType /*threadId*/) ITK_OVERRIDE + itk::ThreadIdType /*threadId*/) override { diff --git a/Modules/Core/ImageBase/include/otbExtractROIBase.txx b/Modules/Core/ImageBase/include/otbExtractROIBase.txx index 78f546387ffad9fd276030426eaf6abb1529480d..26108adf677fe834494606ae68f2d252778201ce 100644 --- a/Modules/Core/ImageBase/include/otbExtractROIBase.txx +++ b/Modules/Core/ImageBase/include/otbExtractROIBase.txx @@ -152,11 +152,6 @@ ExtractROIBase<TInputImage, TOutputImage> } requestedRegion.SetIndex(index); inputPtr->SetRequestedRegion(requestedRegion); - - otbMsgDevMacro(<< "InputRequestedRegion (otbExtractROIBase): "); - otbMsgDevMacro(<< " - index: " << requestedRegion.GetIndex()); - otbMsgDevMacro(<< " - size: " << requestedRegion.GetSize()); - } /** diff --git a/Modules/Core/ImageBase/include/otbImage.h b/Modules/Core/ImageBase/include/otbImage.h index 3bec599c720a7fbbfc72ecae5d44a537517a4826..73d3e271add0bb7acd772e6c8b4356cd04f97267 100644 --- a/Modules/Core/ImageBase/include/otbImage.h +++ b/Modules/Core/ImageBase/include/otbImage.h @@ -49,18 +49,18 @@ namespace internal } template < class InputImage , typename SpacingType > - void SetSignedSpacing( InputImage input , SpacingType spacing ) + void SetSignedSpacing( InputImage *input , SpacingType spacing ) { // TODO check for spacing size ==> error typename InputImage::DirectionType direction = input->GetDirection(); - for ( unsigned int i = 0 ; i < InputImage::VImageDimension ; i++ ) + for ( unsigned int i = 0 ; i < InputImage::ImageDimension ; i++ ) { // TODO check if spacing[i] = 0 ==> error if ( spacing[ i ] < 0 ) { if ( direction[i][i] > 0 ) { - for ( unsigned int j = 0 ; j < InputImage::VImageDimension ; j++ ) + for ( unsigned int j = 0 ; j < InputImage::ImageDimension ; j++ ) { direction[j][i] = - direction[j][i]; } @@ -245,14 +245,14 @@ public: virtual void SetImageKeywordList(const ImageKeywordlistType& kwl); - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /// Copy metadata from a DataObject - void CopyInformation(const itk::DataObject *) ITK_OVERRIDE; + void CopyInformation(const itk::DataObject *) override; protected: Image(); - ~Image() ITK_OVERRIDE {} + ~Image() override {} private: Image(const Self &) = delete; diff --git a/Modules/Core/ImageBase/include/otbImageFunctionAdaptor.h b/Modules/Core/ImageBase/include/otbImageFunctionAdaptor.h index 82ae1aa0847ee6423f9c25028ef48354c8edb258..2daa2aaefa584a8ffa5086edfc15d16be968dd57 100644 --- a/Modules/Core/ImageBase/include/otbImageFunctionAdaptor.h +++ b/Modules/Core/ImageBase/include/otbImageFunctionAdaptor.h @@ -88,17 +88,17 @@ class ITK_EXPORT ImageFunctionAdaptor : itkStaticConstMacro(ImageDimension, unsigned int, InputImageType::ImageDimension); // Evalulate the function at specified index // - OutputType EvaluateAtIndex(const IndexType& index) const ITK_OVERRIDE; + OutputType EvaluateAtIndex(const IndexType& index) const override; // Evaluate the function at non-integer positions // - OutputType Evaluate(const PointType& point) const ITK_OVERRIDE + OutputType Evaluate(const PointType& point) const override { IndexType index; this->ConvertPointToNearestIndex(point, index); return this->EvaluateAtIndex(index); } OutputType EvaluateAtContinuousIndex( - const ContinuousIndexType& cindex) const ITK_OVERRIDE + const ContinuousIndexType& cindex) const override { IndexType index; this->ConvertContinuousIndexToNearestIndex(cindex, index); @@ -111,8 +111,8 @@ class ITK_EXPORT ImageFunctionAdaptor : protected: ImageFunctionAdaptor(); - ~ImageFunctionAdaptor() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~ImageFunctionAdaptor() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: ImageFunctionAdaptor(const Self &); //purposely not implemented diff --git a/Modules/Core/ImageBase/include/otbImageIOBase.h b/Modules/Core/ImageBase/include/otbImageIOBase.h index e1c1d8411192d71b1d5b375d3f7d3bc2320a9cbb..6a7bf4e12d80c329ffb9ecf97e080f123ad48c99 100644 --- a/Modules/Core/ImageBase/include/otbImageIOBase.h +++ b/Modules/Core/ImageBase/include/otbImageIOBase.h @@ -429,8 +429,8 @@ public: protected: ImageIOBase(); - ~ImageIOBase() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~ImageIOBase() override; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Used internally to keep track of the type of the pixel. */ IOPixelType m_PixelType; diff --git a/Modules/Core/ImageBase/include/otbImageOfVectorsToMonoChannelExtractROI.h b/Modules/Core/ImageBase/include/otbImageOfVectorsToMonoChannelExtractROI.h index 21910ccb709e067c18a46948c39d7db447e6b1e8..40c2f86725b928723b2011145af5ff1e56d89fe4 100644 --- a/Modules/Core/ImageBase/include/otbImageOfVectorsToMonoChannelExtractROI.h +++ b/Modules/Core/ImageBase/include/otbImageOfVectorsToMonoChannelExtractROI.h @@ -86,8 +86,8 @@ public: protected: ImageOfVectorsToMonoChannelExtractROI(); - ~ImageOfVectorsToMonoChannelExtractROI() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~ImageOfVectorsToMonoChannelExtractROI() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** ExtractImageFilter can produce an image which is a different * resolution than its input image. As such, ExtractImageFilter @@ -97,13 +97,13 @@ protected: * below. * * \sa ProcessObject::GenerateOutputInformaton() */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; /** ExtractImageFilter can be implemented as a multithreaded filter. * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId) ITK_OVERRIDE; + itk::ThreadIdType threadId) override; private: ImageOfVectorsToMonoChannelExtractROI(const Self &); //purposely not implemented diff --git a/Modules/Core/ImageBase/include/otbMetaImageFunction.h b/Modules/Core/ImageBase/include/otbMetaImageFunction.h index 79f863b989c561bc2241d7e2994bd4197eeec516..d8eba8a50a4ae20d1015af12c7c4be3dc72de38c 100644 --- a/Modules/Core/ImageBase/include/otbMetaImageFunction.h +++ b/Modules/Core/ImageBase/include/otbMetaImageFunction.h @@ -75,7 +75,7 @@ public: typedef std::vector<FunctionPointerType> FunctionContainerType; /** Evaluate the function at the given location */ - OutputType Evaluate(const PointType & point) const ITK_OVERRIDE; + OutputType Evaluate(const PointType & point) const override; /** Add a new function to the functions vector */ void AddFunction(FunctionType * function); @@ -100,10 +100,10 @@ protected: MetaImageFunction(); /** Destructor */ - ~MetaImageFunction() ITK_OVERRIDE; + ~MetaImageFunction() override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: MetaImageFunction(const Self& ); //purposely not implemented diff --git a/Modules/Core/ImageBase/include/otbMultiChannelExtractROI.h b/Modules/Core/ImageBase/include/otbMultiChannelExtractROI.h index a087a123990b1f5522a917ec51922f306eaf6bc7..cf17b63d3c82fffa47bb713b26a206d70ef7e799 100644 --- a/Modules/Core/ImageBase/include/otbMultiChannelExtractROI.h +++ b/Modules/Core/ImageBase/include/otbMultiChannelExtractROI.h @@ -115,8 +115,8 @@ public: protected: MultiChannelExtractROI(); - ~MultiChannelExtractROI() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~MultiChannelExtractROI() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** MultiChannelExtractROI can produce an image which is a different * resolution than its input image. As such, MultiChannelExtractROI @@ -126,7 +126,7 @@ protected: * below. * * \sa ProcessObject::GenerateOutputInformaton() */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; /** Reinitialize channels vector for multiple Update.*/ void ChannelsReInitialization(); @@ -137,7 +137,7 @@ protected: * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId) ITK_OVERRIDE; + itk::ThreadIdType threadId) override; private: MultiChannelExtractROI(const Self &); //purposely not implemented diff --git a/Modules/Core/ImageBase/include/otbMultiToMonoChannelExtractROI.h b/Modules/Core/ImageBase/include/otbMultiToMonoChannelExtractROI.h index 2724bcf8e608fe9163a542fb09a6ab591499cc06..4733af545023ae341e5ed3cb1048187bffd6bf6d 100644 --- a/Modules/Core/ImageBase/include/otbMultiToMonoChannelExtractROI.h +++ b/Modules/Core/ImageBase/include/otbMultiToMonoChannelExtractROI.h @@ -93,8 +93,8 @@ public: protected: MultiToMonoChannelExtractROI(); - ~MultiToMonoChannelExtractROI() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~MultiToMonoChannelExtractROI() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** ExtractImageFilter can produce an image which is a different * resolution than its input image. As such, ExtractImageFilter @@ -104,13 +104,13 @@ protected: * below. * * \sa ProcessObject::GenerateOutputInformaton() */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; /** ExtractImageFilter can be implemented as a multithreaded filter. * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId) ITK_OVERRIDE; + itk::ThreadIdType threadId) override; private: MultiToMonoChannelExtractROI(const Self &); //purposely not implemented diff --git a/Modules/Core/ImageBase/include/otbRemoteSensingRegion.h b/Modules/Core/ImageBase/include/otbRemoteSensingRegion.h index 82eb5eebd4cd70beabc808bf84bc1616afa8d283..3c000d43bbbcef8369edb2bbd0b8e947e57eb897 100644 --- a/Modules/Core/ImageBase/include/otbRemoteSensingRegion.h +++ b/Modules/Core/ImageBase/include/otbRemoteSensingRegion.h @@ -81,7 +81,7 @@ public: /** ImageRegion typedef needed by the GetImageRegion() method */ typedef itk::ImageRegion<2> ImageRegionType; - typename Superclass::RegionType GetRegionType() const ITK_OVERRIDE + typename Superclass::RegionType GetRegionType() const override {return Superclass::ITK_STRUCTURED_REGION; } /** Constructor. RemoteSensingRegion is a lightweight object that is not reference @@ -106,7 +106,7 @@ public: /** Destructor. RemoteSensingRegion is a lightweight object that is not reference * counted, so the destructor is public. */ - ~RemoteSensingRegion() ITK_OVERRIDE{} + ~RemoteSensingRegion() override{} /** operator=. RemoteSensingRegion is a lightweight object that is not reference * counted, so operator= is public. */ @@ -334,7 +334,7 @@ public: protected: - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + void PrintSelf(std::ostream& os, itk::Indent indent) const override { os << std::setprecision(15); os << indent << "RemoteSensingRegion" << std::endl; diff --git a/Modules/Core/ImageBase/include/otbVectorImage.h b/Modules/Core/ImageBase/include/otbVectorImage.h index 2fa39e599a1811ef98b7930931c37a5031e19cd9..dcb2ec23770462997586915932ca1412843a18c8 100644 --- a/Modules/Core/ImageBase/include/otbVectorImage.h +++ b/Modules/Core/ImageBase/include/otbVectorImage.h @@ -164,9 +164,9 @@ public: virtual void SetImageKeywordList(const ImageKeywordlistType& kwl); /// Copy metadata from a DataObject - void CopyInformation(const itk::DataObject *) ITK_OVERRIDE; + void CopyInformation(const itk::DataObject *) override; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Return the Pixel Accessor object */ // AccessorType GetPixelAccessor( void ) @@ -194,7 +194,7 @@ public: protected: VectorImage(); - ~VectorImage() ITK_OVERRIDE {} + ~VectorImage() override {} private: VectorImage(const Self &); //purposely not implemented diff --git a/Modules/Core/Interpolation/include/otbBCOInterpolateImageFunction.h b/Modules/Core/Interpolation/include/otbBCOInterpolateImageFunction.h index 460414ab79219738a2423898ecd7ee16b6017bc3..6acb8b23acdb474d4799538dbf078ad8fe91af3c 100644 --- a/Modules/Core/Interpolation/include/otbBCOInterpolateImageFunction.h +++ b/Modules/Core/Interpolation/include/otbBCOInterpolateImageFunction.h @@ -109,12 +109,12 @@ public: * * ImageFunction::IsInsideBuffer() can be used to check bounds before * calling the method. */ - OutputType EvaluateAtContinuousIndex( const ContinuousIndexType & index ) const ITK_OVERRIDE = 0; + OutputType EvaluateAtContinuousIndex( const ContinuousIndexType & index ) const override = 0; protected: BCOInterpolateImageFunctionBase() : m_Radius(2), m_WinSize(5), m_Alpha(-0.5) {}; - ~BCOInterpolateImageFunctionBase() ITK_OVERRIDE {}; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~BCOInterpolateImageFunctionBase() override {}; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Compute the BCO coefficients. */ virtual CoefContainerType EvaluateCoef( const ContinuousIndexValueType & indexValue ) const; @@ -157,12 +157,12 @@ public: typedef typename Superclass::ContinuousIndexType ContinuousIndexType; typedef typename Superclass::CoefContainerType CoefContainerType; - OutputType EvaluateAtContinuousIndex( const ContinuousIndexType & index ) const ITK_OVERRIDE; + OutputType EvaluateAtContinuousIndex( const ContinuousIndexType & index ) const override; protected: BCOInterpolateImageFunction() {}; - ~BCOInterpolateImageFunction() ITK_OVERRIDE {}; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~BCOInterpolateImageFunction() override {}; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: BCOInterpolateImageFunction( const Self& ); //purposely not implemented @@ -196,12 +196,12 @@ public: typedef typename Superclass::ContinuousIndexType ContinuousIndexType; typedef typename Superclass::CoefContainerType CoefContainerType; - OutputType EvaluateAtContinuousIndex( const ContinuousIndexType & index ) const ITK_OVERRIDE; + OutputType EvaluateAtContinuousIndex( const ContinuousIndexType & index ) const override; protected: BCOInterpolateImageFunction() {}; - ~BCOInterpolateImageFunction() ITK_OVERRIDE {}; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~BCOInterpolateImageFunction() override {}; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: BCOInterpolateImageFunction( const Self& ); //purposely not implemented diff --git a/Modules/Core/Interpolation/include/otbBSplineDecompositionImageFilter.h b/Modules/Core/Interpolation/include/otbBSplineDecompositionImageFilter.h index d4199249b6cf7b0c06f173af6a9299483a0f61bc..627b18af548011794a8892d546149d59d8beb7f7 100644 --- a/Modules/Core/Interpolation/include/otbBSplineDecompositionImageFilter.h +++ b/Modules/Core/Interpolation/include/otbBSplineDecompositionImageFilter.h @@ -77,10 +77,10 @@ public: protected: BSplineDecompositionImageFilter(); - ~BSplineDecompositionImageFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~BSplineDecompositionImageFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** These are needed by the smoothing spline routine. */ std::vector<double> m_Scratch; // temp storage for processing of Coefficients diff --git a/Modules/Core/Interpolation/include/otbBSplineInterpolateImageFunction.h b/Modules/Core/Interpolation/include/otbBSplineInterpolateImageFunction.h index c5161bcdaa67ef67e3f3e2bb4c97b57bbb4b2e6b..fb653f3bebb668c806502f1cedeb3a0774929d0d 100644 --- a/Modules/Core/Interpolation/include/otbBSplineInterpolateImageFunction.h +++ b/Modules/Core/Interpolation/include/otbBSplineInterpolateImageFunction.h @@ -108,7 +108,7 @@ public: * ImageFunction::IsInsideBuffer() can be used to check bounds before * calling the method. */ OutputType EvaluateAtContinuousIndex( - const ContinuousIndexType& index) const ITK_OVERRIDE; + const ContinuousIndexType& index) const override; /** Derivative typedef support */ typedef itk::CovariantVector<OutputType, @@ -131,7 +131,7 @@ public: itkGetMacro(SplineOrder, int); /** Set the input image. This must be set by the user. */ - void SetInputImage(const TImageType * inputData) ITK_OVERRIDE; + void SetInputImage(const TImageType * inputData) override; /** Update coefficients filter. Coefficient filter are computed over the buffered region of the input image. */ @@ -139,9 +139,9 @@ public: protected: BSplineInterpolateImageFunction(); - ~BSplineInterpolateImageFunction() ITK_OVERRIDE {} + ~BSplineInterpolateImageFunction() override {} void operator =(const Self&); //purposely not implemented - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; // These are needed by the smoothing spline routine. std::vector<CoefficientDataType> m_Scratch; // temp storage for processing of Coefficients diff --git a/Modules/Core/Interpolation/include/otbGenericInterpolateImageFunction.h b/Modules/Core/Interpolation/include/otbGenericInterpolateImageFunction.h index a993e857e16d397aa286bc4e860924735cca2d64..1119453b2b358a465f8b16090fd6e9032ba57b21 100644 --- a/Modules/Core/Interpolation/include/otbGenericInterpolateImageFunction.h +++ b/Modules/Core/Interpolation/include/otbGenericInterpolateImageFunction.h @@ -86,7 +86,7 @@ public: * * ImageFunction::IsInsideBuffer() can be used to check bounds before * calling the method. */ - OutputType EvaluateAtContinuousIndex(const ContinuousIndexType& index) const ITK_OVERRIDE; + OutputType EvaluateAtContinuousIndex(const ContinuousIndexType& index) const override; /** Set/Get the window radius*/ virtual void SetRadius(unsigned int rad); @@ -115,12 +115,12 @@ public: protected: GenericInterpolateImageFunction(); - ~GenericInterpolateImageFunction() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~GenericInterpolateImageFunction() override; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Call the superclass implementation and set the TablesHaveBeenGenerated * flag to false */ - void Modified(void) const ITK_OVERRIDE; + void Modified(void) const override; /** Delete tables.*/ virtual void ResetOffsetTable(); diff --git a/Modules/Core/Interpolation/include/otbProlateInterpolateImageFunction.h b/Modules/Core/Interpolation/include/otbProlateInterpolateImageFunction.h index 6942e5798897a14e5c64a8c562257e1b537c5e13..1a057edfced9a4743615f7d3ce10d8cd91ea8ac3 100644 --- a/Modules/Core/Interpolation/include/otbProlateInterpolateImageFunction.h +++ b/Modules/Core/Interpolation/include/otbProlateInterpolateImageFunction.h @@ -313,8 +313,8 @@ public: protected: ProlateInterpolateImageFunction(); - ~ProlateInterpolateImageFunction() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~ProlateInterpolateImageFunction() override; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: ProlateInterpolateImageFunction(const Self &); //purposely not implemented diff --git a/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageBlackmanFunction.h b/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageBlackmanFunction.h index 7bd3a885465cb04b9652ec02007324a5fd067c76..36d1d7226497c37ffbf16b80b35229ec621d866c 100644 --- a/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageBlackmanFunction.h +++ b/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageBlackmanFunction.h @@ -134,8 +134,8 @@ public: protected: WindowedSincInterpolateImageBlackmanFunction() {}; - ~WindowedSincInterpolateImageBlackmanFunction() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + ~WindowedSincInterpolateImageBlackmanFunction() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override { Superclass::PrintSelf(os, indent); } diff --git a/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageCosineFunction.h b/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageCosineFunction.h index 34d2a79699534708605db0c7edf3c28b542fe40f..94cae64c241606f728da588c33cb91f5a65b6f24 100644 --- a/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageCosineFunction.h +++ b/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageCosineFunction.h @@ -127,8 +127,8 @@ public: protected: WindowedSincInterpolateImageCosineFunction() {}; - ~WindowedSincInterpolateImageCosineFunction() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + ~WindowedSincInterpolateImageCosineFunction() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override { Superclass::PrintSelf(os, indent); } diff --git a/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageFunctionBase.h b/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageFunctionBase.h index 34be4a944d7842e77b4fac07684d8a78e4cc5321..57703395bafa91c75318c02a1bb4cf45333e5cc9 100644 --- a/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageFunctionBase.h +++ b/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageFunctionBase.h @@ -179,8 +179,8 @@ public: protected: WindowedSincInterpolateImageFunctionBase(); - ~WindowedSincInterpolateImageFunctionBase() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~WindowedSincInterpolateImageFunctionBase() override; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: WindowedSincInterpolateImageFunctionBase(const Self &); //purposely not implemented diff --git a/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageGaussianFunction.h b/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageGaussianFunction.h index fde1fabcc2b226161dd15d8a268f768006b9cb85..ce0358ded4b3eee6fd7daf5885debc73c8ca54c2 100644 --- a/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageGaussianFunction.h +++ b/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageGaussianFunction.h @@ -127,8 +127,8 @@ public: protected: WindowedSincInterpolateImageGaussianFunction() {}; - ~WindowedSincInterpolateImageGaussianFunction() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + ~WindowedSincInterpolateImageGaussianFunction() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override { Superclass::PrintSelf(os, indent); } diff --git a/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageHammingFunction.h b/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageHammingFunction.h index d2371c037b688ce8fd701692020bbf90b8b77774..31fca5a236c6085d22efc6e1bc1747b5edf57777 100644 --- a/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageHammingFunction.h +++ b/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageHammingFunction.h @@ -128,8 +128,8 @@ public: protected: WindowedSincInterpolateImageHammingFunction() {}; - ~WindowedSincInterpolateImageHammingFunction() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + ~WindowedSincInterpolateImageHammingFunction() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override { Superclass::PrintSelf(os, indent); } diff --git a/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageLanczosFunction.h b/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageLanczosFunction.h index 33c51bb95741f9a817ec84c15d477d027bf88756..38da528f662a92c57e510ccc107bdcc0fe72b39f 100644 --- a/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageLanczosFunction.h +++ b/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageLanczosFunction.h @@ -138,8 +138,8 @@ public: protected: WindowedSincInterpolateImageLanczosFunction() {}; - ~WindowedSincInterpolateImageLanczosFunction() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + ~WindowedSincInterpolateImageLanczosFunction() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override { Superclass::PrintSelf(os, indent); } diff --git a/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageWelchFunction.h b/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageWelchFunction.h index fc1d52b85f435f57b1686d4f419bb72708108599..24245cea27a7290986647ed449edfd76da23716c 100644 --- a/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageWelchFunction.h +++ b/Modules/Core/Interpolation/include/otbWindowedSincInterpolateImageWelchFunction.h @@ -127,8 +127,8 @@ public: protected: WindowedSincInterpolateImageWelchFunction() {}; - ~WindowedSincInterpolateImageWelchFunction() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + ~WindowedSincInterpolateImageWelchFunction() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override { Superclass::PrintSelf(os, indent); } diff --git a/Modules/Core/LabelMap/include/otbAttributesMapLabelObject.h b/Modules/Core/LabelMap/include/otbAttributesMapLabelObject.h index 342c288105c09b2500a7a653c71f8e12e5c83366..4918ff363d2f28b4929a3dfe99fb7eb740d14018 100644 --- a/Modules/Core/LabelMap/include/otbAttributesMapLabelObject.h +++ b/Modules/Core/LabelMap/include/otbAttributesMapLabelObject.h @@ -306,10 +306,10 @@ protected: /** Constructor */ AttributesMapLabelObject() : m_Attributes(), m_Polygon(PolygonType::New()) {} /** Destructor */ - ~AttributesMapLabelObject() ITK_OVERRIDE {} + ~AttributesMapLabelObject() override {} /** The printself method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + void PrintSelf(std::ostream& os, itk::Indent indent) const override { Superclass::PrintSelf(os, indent); os << indent << "Attributes: " << std::endl; diff --git a/Modules/Core/LabelMap/include/otbAttributesMapLabelObjectWithClassLabel.h b/Modules/Core/LabelMap/include/otbAttributesMapLabelObjectWithClassLabel.h index 9573d6218a6297ab73ac0900b076d4ff79ec737a..f9d822cdd6e42d8260d6d1f77225d7917f53c320 100644 --- a/Modules/Core/LabelMap/include/otbAttributesMapLabelObjectWithClassLabel.h +++ b/Modules/Core/LabelMap/include/otbAttributesMapLabelObjectWithClassLabel.h @@ -105,7 +105,7 @@ public: m_HasClassLabel = false; } - void CopyAttributesFrom( const LabelObjectType * lo ) ITK_OVERRIDE + void CopyAttributesFrom( const LabelObjectType * lo ) override { Superclass::CopyAttributesFrom( lo ); @@ -125,10 +125,10 @@ protected: AttributesMapLabelObjectWithClassLabel() : m_ClassLabel(itk::NumericTraits<ClassLabelType>::Zero), m_HasClassLabel(false) {} /** Destructor */ - ~AttributesMapLabelObjectWithClassLabel() ITK_OVERRIDE {} + ~AttributesMapLabelObjectWithClassLabel() override {} /** The printself method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + void PrintSelf(std::ostream& os, itk::Indent indent) const override { Superclass::PrintSelf( os, indent ); if(m_HasClassLabel) diff --git a/Modules/Core/LabelMap/include/otbAttributesMapOpeningLabelMapFilter.h b/Modules/Core/LabelMap/include/otbAttributesMapOpeningLabelMapFilter.h index 1e10e1783a56baf8d41d9d27487e4645bbe7abe4..c8a138ffec62e367c871cb9908e318fa0c7f5e3c 100644 --- a/Modules/Core/LabelMap/include/otbAttributesMapOpeningLabelMapFilter.h +++ b/Modules/Core/LabelMap/include/otbAttributesMapOpeningLabelMapFilter.h @@ -71,16 +71,16 @@ public: AttributeAccessorType & GetAccessor(); - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; protected: /** Constructor */ AttributesMapOpeningLabelMapFilter(); /** Destructor */ - ~AttributesMapOpeningLabelMapFilter() ITK_OVERRIDE; + ~AttributesMapOpeningLabelMapFilter() override; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: diff --git a/Modules/Core/LabelMap/include/otbBandsStatisticsAttributesLabelMapFilter.h b/Modules/Core/LabelMap/include/otbBandsStatisticsAttributesLabelMapFilter.h index 2083db54d91ce56a59b5a17b2bfd33c8156ae89b..89ffbe232659ddaf49a4a91b0da87ddc8bdd4e17 100644 --- a/Modules/Core/LabelMap/include/otbBandsStatisticsAttributesLabelMapFilter.h +++ b/Modules/Core/LabelMap/include/otbBandsStatisticsAttributesLabelMapFilter.h @@ -191,19 +191,19 @@ protected: /** Constructor */ BandsStatisticsAttributesLabelMapFilter(); /** Destructor */ - ~BandsStatisticsAttributesLabelMapFilter() ITK_OVERRIDE {} + ~BandsStatisticsAttributesLabelMapFilter() override {} - void AllocateOutputs() ITK_OVERRIDE; + void AllocateOutputs() override; - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; - void EnlargeOutputRequestedRegion(itk::DataObject *) ITK_OVERRIDE{}; + void EnlargeOutputRequestedRegion(itk::DataObject *) override{}; /** Before threaded data generation */ - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: BandsStatisticsAttributesLabelMapFilter(const Self &); //purposely not implemented diff --git a/Modules/Core/LabelMap/include/otbImageToLabelMapWithAttributesFilter.h b/Modules/Core/LabelMap/include/otbImageToLabelMapWithAttributesFilter.h index e18b9ac7d1f084ec2c8d01b3b00cf00c723b6d7d..985e57cb9602fb889625345e6190cada1ccb1412 100644 --- a/Modules/Core/LabelMap/include/otbImageToLabelMapWithAttributesFilter.h +++ b/Modules/Core/LabelMap/include/otbImageToLabelMapWithAttributesFilter.h @@ -75,21 +75,21 @@ public: typedef BandsStatisticsAttributesLabelMapFilter<LabelMapType, InputImageType> BandStatisticsLabelMapFilterType; using Superclass::SetInput; - void SetInput( const InputImageType *image) ITK_OVERRIDE; + void SetInput( const InputImageType *image) override; virtual void SetLabeledImage( const LabeledImageType * image); const InputImageType * GetInput(void); const LabeledImageType * GetLabeledImage(); virtual LabelMapType* GetOutput(); - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; protected: /** Constructor */ ImageToLabelMapWithAttributesFilter(); /** Destructor */ - ~ImageToLabelMapWithAttributesFilter() ITK_OVERRIDE{}; + ~ImageToLabelMapWithAttributesFilter() override{}; - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; private: diff --git a/Modules/Core/LabelMap/include/otbKMeansAttributesLabelMapFilter.h b/Modules/Core/LabelMap/include/otbKMeansAttributesLabelMapFilter.h index 49125da9f7e980b3400ab36116376bf597242156..d65e2b3c0403ece03023cd7772055447e52bb5c2 100644 --- a/Modules/Core/LabelMap/include/otbKMeansAttributesLabelMapFilter.h +++ b/Modules/Core/LabelMap/include/otbKMeansAttributesLabelMapFilter.h @@ -123,7 +123,7 @@ public: protected: KMeansAttributesLabelMapFilter(); - ~KMeansAttributesLabelMapFilter() ITK_OVERRIDE {}; + ~KMeansAttributesLabelMapFilter() override {}; private: diff --git a/Modules/Core/LabelMap/include/otbLabelImageToLabelMapWithAdjacencyFilter.h b/Modules/Core/LabelMap/include/otbLabelImageToLabelMapWithAdjacencyFilter.h index 7612335023218c3dc4831a25f70ec68679cc6f68..2e3c61d5c86057c570abb2646077c1d41a8ce100 100644 --- a/Modules/Core/LabelMap/include/otbLabelImageToLabelMapWithAdjacencyFilter.h +++ b/Modules/Core/LabelMap/include/otbLabelImageToLabelMapWithAdjacencyFilter.h @@ -91,9 +91,9 @@ protected: /** Constructor */ LabelImageToLabelMapWithAdjacencyFilter(); /** Destructor */ - ~LabelImageToLabelMapWithAdjacencyFilter() ITK_OVERRIDE {}; + ~LabelImageToLabelMapWithAdjacencyFilter() override {}; /** Printself */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; // class to store a RLE class RLE @@ -121,16 +121,16 @@ protected: /** LabelImageToLabelMapWithAdjacencyFilter needs the entire input be * available. Thus, it needs to provide an implementation of * GenerateInputRequestedRegion(). */ - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; /** LabelImageToLabelMapWithAdjacencyFilter will produce the entire output. */ - void EnlargeOutputRequestedRegion(itk::DataObject *itkNotUsed(output)) ITK_OVERRIDE; + void EnlargeOutputRequestedRegion(itk::DataObject *itkNotUsed(output)) override; - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; - void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) override; - void AfterThreadedGenerateData() ITK_OVERRIDE; + void AfterThreadedGenerateData() override; /** Add a new adjacency */ void AddAdjacency(LabelType label1, LabelType label2, itk::ThreadIdType threadId); diff --git a/Modules/Core/LabelMap/include/otbLabelMapFeaturesFunctorImageFilter.h b/Modules/Core/LabelMap/include/otbLabelMapFeaturesFunctorImageFilter.h index 2ae6625d77c09de60faa3932e59a1ae4fb3f7f3e..56083fc5c7041000994449a99bf31e4b85d7cf5d 100644 --- a/Modules/Core/LabelMap/include/otbLabelMapFeaturesFunctorImageFilter.h +++ b/Modules/Core/LabelMap/include/otbLabelMapFeaturesFunctorImageFilter.h @@ -97,17 +97,17 @@ protected: LabelMapFeaturesFunctorImageFilter() : m_Functor() {} /** Destructor */ - ~LabelMapFeaturesFunctorImageFilter() ITK_OVERRIDE {} + ~LabelMapFeaturesFunctorImageFilter() override {} /** Threaded generate data */ - void ThreadedProcessLabelObject(LabelObjectType * labelObject) ITK_OVERRIDE + void ThreadedProcessLabelObject(LabelObjectType * labelObject) override { // Call the functor m_Functor(labelObject); } /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + void PrintSelf(std::ostream& os, itk::Indent indent) const override { // Call superclass implementation Superclass::PrintSelf(os, indent); diff --git a/Modules/Core/LabelMap/include/otbLabelMapSource.h b/Modules/Core/LabelMap/include/otbLabelMapSource.h index 489dd06e921041c12aeebe01eafe94f85faeb663..a03be1bd837b58913f9de220fd51d944f01b8b01 100644 --- a/Modules/Core/LabelMap/include/otbLabelMapSource.h +++ b/Modules/Core/LabelMap/include/otbLabelMapSource.h @@ -64,9 +64,9 @@ public: protected: LabelMapSource(); - ~LabelMapSource() ITK_OVERRIDE; + ~LabelMapSource() override; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Ensure that the output vector data are cleared before processing */ virtual void AllocateOutputs(); diff --git a/Modules/Core/LabelMap/include/otbLabelMapToAttributeImageFilter.h b/Modules/Core/LabelMap/include/otbLabelMapToAttributeImageFilter.h index 202b7e3792570979e4316b11d00a80c96579cb1c..50dcc9f616504fdcaed77c0c03b6646c5bb60c56 100644 --- a/Modules/Core/LabelMap/include/otbLabelMapToAttributeImageFilter.h +++ b/Modules/Core/LabelMap/include/otbLabelMapToAttributeImageFilter.h @@ -102,13 +102,13 @@ public: protected: LabelMapToAttributeImageFilter(); - ~LabelMapToAttributeImageFilter() ITK_OVERRIDE {}; + ~LabelMapToAttributeImageFilter() override {}; - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; - void ThreadedProcessLabelObject( LabelObjectType * labelObject ) ITK_OVERRIDE; + void ThreadedProcessLabelObject( LabelObjectType * labelObject ) override; private: /** Background pixel value */ diff --git a/Modules/Core/LabelMap/include/otbLabelMapToSampleListFilter.h b/Modules/Core/LabelMap/include/otbLabelMapToSampleListFilter.h index 3485f799442c4a92ebf899c57823f983f9a6fba6..55040a6e5e18d30ed6d5c161aaa404b0233fcf7b 100644 --- a/Modules/Core/LabelMap/include/otbLabelMapToSampleListFilter.h +++ b/Modules/Core/LabelMap/include/otbLabelMapToSampleListFilter.h @@ -96,15 +96,15 @@ public: protected: LabelMapToSampleListFilter(); - ~LabelMapToSampleListFilter() ITK_OVERRIDE; + ~LabelMapToSampleListFilter() override; - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** Make Output */ - DataObjectPointerType MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; + DataObjectPointerType MakeOutput(DataObjectPointerArraySizeType idx) override; using Superclass::MakeOutput; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: LabelMapToSampleListFilter(const Self&); //purposely not implemented diff --git a/Modules/Core/LabelMap/include/otbLabelMapWithAdjacency.h b/Modules/Core/LabelMap/include/otbLabelMapWithAdjacency.h index b1d9301980733a906e92439431969f37402d1efd..3400aec812ae4601b5ab278d46010159ddb7205f 100644 --- a/Modules/Core/LabelMap/include/otbLabelMapWithAdjacency.h +++ b/Modules/Core/LabelMap/include/otbLabelMapWithAdjacency.h @@ -218,16 +218,16 @@ protected: /** Constructor */ LabelMapWithAdjacency(){} /** Destructor */ - ~LabelMapWithAdjacency() ITK_OVERRIDE{} + ~LabelMapWithAdjacency() override{} /** Printself */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + void PrintSelf(std::ostream& os, itk::Indent indent) const override { Superclass::PrintSelf(os, indent); } /** Re-implement CopyInformation to pass the adjancency graph * through */ - void CopyInformation(const itk::DataObject * data) ITK_OVERRIDE + void CopyInformation(const itk::DataObject * data) override { // Call superclass implementation Superclass::CopyInformation(data); diff --git a/Modules/Core/LabelMap/include/otbLabelMapWithClassLabelToClassLabelImageFilter.h b/Modules/Core/LabelMap/include/otbLabelMapWithClassLabelToClassLabelImageFilter.h index 5f67ba3d9562a9024ec38627e17d040b1c176022..ccc3a6dd453159b903195923dda1df73475eb269 100644 --- a/Modules/Core/LabelMap/include/otbLabelMapWithClassLabelToClassLabelImageFilter.h +++ b/Modules/Core/LabelMap/include/otbLabelMapWithClassLabelToClassLabelImageFilter.h @@ -75,11 +75,11 @@ public: protected: LabelMapWithClassLabelToClassLabelImageFilter(); - ~LabelMapWithClassLabelToClassLabelImageFilter() ITK_OVERRIDE {}; + ~LabelMapWithClassLabelToClassLabelImageFilter() override {}; - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; - void ThreadedProcessLabelObject( LabelObjectType * labelObject ) ITK_OVERRIDE; + void ThreadedProcessLabelObject( LabelObjectType * labelObject ) override; private: LabelMapWithClassLabelToClassLabelImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Core/LabelMap/include/otbLabelMapWithClassLabelToLabeledSampleListFilter.h b/Modules/Core/LabelMap/include/otbLabelMapWithClassLabelToLabeledSampleListFilter.h index bf7f6859dafecd9de8465af0f1103adb0256dd88..cd4bc3086e39649e6cc35c54c151f1d1028c6605 100644 --- a/Modules/Core/LabelMap/include/otbLabelMapWithClassLabelToLabeledSampleListFilter.h +++ b/Modules/Core/LabelMap/include/otbLabelMapWithClassLabelToLabeledSampleListFilter.h @@ -100,14 +100,14 @@ public: protected: LabelMapWithClassLabelToLabeledSampleListFilter(); - ~LabelMapWithClassLabelToLabeledSampleListFilter() ITK_OVERRIDE; + ~LabelMapWithClassLabelToLabeledSampleListFilter() override; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** Make Output */ - DataObjectPointerType MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; + DataObjectPointerType MakeOutput(DataObjectPointerArraySizeType idx) override; using Superclass::MakeOutput; private: diff --git a/Modules/Core/LabelMap/include/otbMinMaxAttributesLabelMapFilter.h b/Modules/Core/LabelMap/include/otbMinMaxAttributesLabelMapFilter.h index 9a9f3251d13c57080bd37846a84fa137af398ea6..96ae25ce4cad1e44cce26d49c753119a9a9ca80d 100644 --- a/Modules/Core/LabelMap/include/otbMinMaxAttributesLabelMapFilter.h +++ b/Modules/Core/LabelMap/include/otbMinMaxAttributesLabelMapFilter.h @@ -89,14 +89,14 @@ public: AttributesMapObjectType* GetMaximumOutput(); const AttributesMapObjectType* GetMaximumOutput() const; - DataObjectPointerType MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; + DataObjectPointerType MakeOutput(DataObjectPointerArraySizeType idx) override; using Superclass::MakeOutput; protected: MinMaxAttributesLabelMapFilter(); - ~MinMaxAttributesLabelMapFilter() ITK_OVERRIDE {}; + ~MinMaxAttributesLabelMapFilter() override {}; - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; private: MinMaxAttributesLabelMapFilter(const Self&); //purposely not implemented diff --git a/Modules/Core/LabelMap/include/otbNormalizeAttributesLabelMapFilter.h b/Modules/Core/LabelMap/include/otbNormalizeAttributesLabelMapFilter.h index a3c01d3dbcdd37baf15fdfaf6040c6318fa6fc6d..afc376eabe1a218aed2172acf30bc83f416f27d8 100644 --- a/Modules/Core/LabelMap/include/otbNormalizeAttributesLabelMapFilter.h +++ b/Modules/Core/LabelMap/include/otbNormalizeAttributesLabelMapFilter.h @@ -143,10 +143,10 @@ protected: NormalizeAttributesLabelMapFilter(){} /** Destructor */ - ~NormalizeAttributesLabelMapFilter() ITK_OVERRIDE{} + ~NormalizeAttributesLabelMapFilter() override{} /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: NormalizeAttributesLabelMapFilter(const Self &); //purposely not implemented diff --git a/Modules/Core/LabelMap/include/otbShapeAttributesLabelMapFilter.h b/Modules/Core/LabelMap/include/otbShapeAttributesLabelMapFilter.h index eb2dfbc8fb48ed0c381d145721f137db4a62b3f6..083b4b7c1ffb140b341133df2ca45af44d015448 100644 --- a/Modules/Core/LabelMap/include/otbShapeAttributesLabelMapFilter.h +++ b/Modules/Core/LabelMap/include/otbShapeAttributesLabelMapFilter.h @@ -288,19 +288,19 @@ protected: ShapeAttributesLabelMapFilter(){} /** Destructor */ - ~ShapeAttributesLabelMapFilter() ITK_OVERRIDE{} + ~ShapeAttributesLabelMapFilter() override{} /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; - void AllocateOutputs() ITK_OVERRIDE; + void AllocateOutputs() override; /** Things to to before threaded data generation */ - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; - void EnlargeOutputRequestedRegion(itk::DataObject *) ITK_OVERRIDE{}; + void EnlargeOutputRequestedRegion(itk::DataObject *) override{}; private: ShapeAttributesLabelMapFilter(const Self &); //purposely not implemented diff --git a/Modules/Core/LabelMap/include/otbStatisticsAttributesLabelMapFilter.h b/Modules/Core/LabelMap/include/otbStatisticsAttributesLabelMapFilter.h index c0c2d1ed6cb4acf20ffc3c64e7585b6fbe8ea0fd..3f2826b78917e081e11c891dec588ec36d08cedd 100644 --- a/Modules/Core/LabelMap/include/otbStatisticsAttributesLabelMapFilter.h +++ b/Modules/Core/LabelMap/include/otbStatisticsAttributesLabelMapFilter.h @@ -195,13 +195,13 @@ protected: StatisticsAttributesLabelMapFilter(); /** Destructor */ - ~StatisticsAttributesLabelMapFilter() ITK_OVERRIDE; + ~StatisticsAttributesLabelMapFilter() override; /** Before threaded data generation */ - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: StatisticsAttributesLabelMapFilter(const Self &); //purposely not implemented diff --git a/Modules/Core/Metadata/include/otbDefaultImageMetadataInterface.h b/Modules/Core/Metadata/include/otbDefaultImageMetadataInterface.h index 6faccb6d41034f94f2fc0eb016d0de449f84afe3..f81e74966a96b86b796b1e9505369e69044ef92d 100644 --- a/Modules/Core/Metadata/include/otbDefaultImageMetadataInterface.h +++ b/Modules/Core/Metadata/include/otbDefaultImageMetadataInterface.h @@ -75,49 +75,49 @@ public: } /** Get the imaging acquisition day from the ossim metadata */ - int GetDay() const ITK_OVERRIDE + int GetDay() const override { itkExceptionMacro("GetDay not implemented in DefaultImageMetadataInterface, no captor type found"); } /** Get the imaging acquisition month from the ossim metadata */ - int GetMonth() const ITK_OVERRIDE + int GetMonth() const override { itkExceptionMacro("GetMonth not implemented in DefaultImageMetadataInterface, no captor type found"); } /** Get the imaging acquisition year from the ossim metadata */ - int GetYear() const ITK_OVERRIDE + int GetYear() const override { itkExceptionMacro("GetYear not implemented in DefaultImageMetadataInterface, no captor type found"); } /** Get the imaging acquisition hour from the ossim metadata */ - int GetHour() const ITK_OVERRIDE + int GetHour() const override { itkExceptionMacro("GetHour not implemented in DefaultImageMetadataInterface, no captor type found"); } /** Get the imaging acquisition minute from the ossim metadata */ - int GetMinute() const ITK_OVERRIDE + int GetMinute() const override { itkExceptionMacro("GetMinute not implemented in DefaultImageMetadataInterface, no captor type found"); } /** Get the imaging production day from the ossim metadata */ - int GetProductionDay() const ITK_OVERRIDE + int GetProductionDay() const override { itkExceptionMacro("GetProductionDay not implemented in DefaultImageMetadataInterface, no captor type found"); } /** Get the imaging production month from the ossim metadata */ - int GetProductionMonth() const ITK_OVERRIDE + int GetProductionMonth() const override { itkExceptionMacro("GetProductionMonth not implemented in DefaultImageMetadataInterface, no captor type found"); } /** Get the imaging production year from the ossim metadata */ - int GetProductionYear() const ITK_OVERRIDE + int GetProductionYear() const override { itkExceptionMacro("GetProductionYear not implemented in DefaultImageMetadataInterface, no captor type found"); } @@ -147,13 +147,13 @@ public: } /** Get the enhanced band names */ - std::vector<std::string> GetEnhancedBandNames() const ITK_OVERRIDE + std::vector<std::string> GetEnhancedBandNames() const override { itkExceptionMacro("GetEnhancedBandNames not implemented in DefaultImageMetadataInterface, no captor type found"); } - bool CanRead() const ITK_OVERRIDE + bool CanRead() const override { // This class is the default one, it has to be able to call every metadata return true; @@ -166,7 +166,7 @@ public: * When one spectral band is available : the only band is given to the R, G and B channel. * */ - std::vector<unsigned int> GetDefaultDisplay() const ITK_OVERRIDE + std::vector<unsigned int> GetDefaultDisplay() const override { unsigned int i = 0; std::vector<unsigned int> rgb(3); @@ -193,7 +193,7 @@ public: protected: DefaultImageMetadataInterface(){}; - ~DefaultImageMetadataInterface() ITK_OVERRIDE {} + ~DefaultImageMetadataInterface() override {} private: diff --git a/Modules/Core/Metadata/include/otbDefaultImageMetadataInterfaceFactory.h b/Modules/Core/Metadata/include/otbDefaultImageMetadataInterfaceFactory.h index aa0a851a2b447706614bb9a4114ba90db41695df..0f19d38b836bc8aa0295679377c815cc70fbb6a6 100644 --- a/Modules/Core/Metadata/include/otbDefaultImageMetadataInterfaceFactory.h +++ b/Modules/Core/Metadata/include/otbDefaultImageMetadataInterfaceFactory.h @@ -42,8 +42,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - const char* GetITKSourceVersion(void) const ITK_OVERRIDE; - const char* GetDescription(void) const ITK_OVERRIDE; + const char* GetITKSourceVersion(void) const override; + const char* GetDescription(void) const override; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -60,7 +60,7 @@ public: protected: DefaultImageMetadataInterfaceFactory(); - ~DefaultImageMetadataInterfaceFactory() ITK_OVERRIDE; + ~DefaultImageMetadataInterfaceFactory() override; private: DefaultImageMetadataInterfaceFactory(const Self &); //purposely not implemented diff --git a/Modules/Core/Metadata/include/otbFormosatImageMetadataInterface.h b/Modules/Core/Metadata/include/otbFormosatImageMetadataInterface.h index df122554b542614f8dac93cb9a6649ffd996d02d..271d3d8d81fc10262edb633beb2264f2eab41b45 100644 --- a/Modules/Core/Metadata/include/otbFormosatImageMetadataInterface.h +++ b/Modules/Core/Metadata/include/otbFormosatImageMetadataInterface.h @@ -54,55 +54,55 @@ public: typedef Superclass::ImageKeywordlistType ImageKeywordlistType; /** Get the radiometric bias from the ossim metadata */ - VariableLengthVectorType GetPhysicalBias() const ITK_OVERRIDE; + VariableLengthVectorType GetPhysicalBias() const override; /** Get the radiometric gain from the ossim metadata */ - VariableLengthVectorType GetPhysicalGain() const ITK_OVERRIDE; + VariableLengthVectorType GetPhysicalGain() const override; /** Get the solar irradiance from the ossim metadata */ - VariableLengthVectorType GetSolarIrradiance() const ITK_OVERRIDE; + VariableLengthVectorType GetSolarIrradiance() const override; /** Get the imaging acquisition day from the ossim metadata : IMAGING_DATE metadata variable */ - int GetDay() const ITK_OVERRIDE; + int GetDay() const override; /** Get the imaging acquisition month from the ossim metadata : IMAGING_DATE metadata variable */ - int GetMonth() const ITK_OVERRIDE; + int GetMonth() const override; /** Get the imaging acquisition year from the ossim metadata : IMAGING_DATE metadata variable */ - int GetYear() const ITK_OVERRIDE; + int GetYear() const override; /** Get the imaging acquisition hour from the ossim metadata : IMAGING_DATE metadata variable */ - int GetHour() const ITK_OVERRIDE; + int GetHour() const override; /** Get the imaging acquisition year from the ossim metadata : IMAGING_DATE metadata variable */ - int GetMinute() const ITK_OVERRIDE; + int GetMinute() const override; /** Get the imaging production day from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */ - int GetProductionDay() const ITK_OVERRIDE; + int GetProductionDay() const override; /** Get the imaging production month from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */ - int GetProductionMonth() const ITK_OVERRIDE; + int GetProductionMonth() const override; /** Get the imaging production year from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */ - int GetProductionYear() const ITK_OVERRIDE; + int GetProductionYear() const override; /** Get the sat elevation from the ossim metadata */ - double GetSatElevation() const ITK_OVERRIDE; + double GetSatElevation() const override; /** Get the sat azimuth from the ossim metadata */ - double GetSatAzimuth() const ITK_OVERRIDE; + double GetSatAzimuth() const override; /** Get the first wavelength for the spectral band definition */ - VariableLengthVectorType GetFirstWavelengths() const ITK_OVERRIDE; + VariableLengthVectorType GetFirstWavelengths() const override; /** Get the last wavelength for the spectral band definition */ - VariableLengthVectorType GetLastWavelengths() const ITK_OVERRIDE; + VariableLengthVectorType GetLastWavelengths() const override; /** Get Instrument */ std::string GetInstrument() const; /** Get the enhanced band names (here nothing because the metadata did not provide band names) */ - std::vector<std::string> GetEnhancedBandNames() const ITK_OVERRIDE + std::vector<std::string> GetEnhancedBandNames() const override { return this->Superclass::GetBandName(); } @@ -114,21 +114,21 @@ public: * in most cases, this method won't change the value, but for SPOT data, the bands are set up as * 2 1 0 3 in the tiff file, this method which is overloaded for SPOT enables to retrieve the * proper band. */ - unsigned int BandIndexToWavelengthPosition(unsigned int i) const ITK_OVERRIDE; + unsigned int BandIndexToWavelengthPosition(unsigned int i) const override; /** Get the 3 spectral band numbers corresponding to the default display for visualization, * in the order R, G, B */ - std::vector<unsigned int> GetDefaultDisplay() const ITK_OVERRIDE; + std::vector<unsigned int> GetDefaultDisplay() const override; - bool CanRead() const ITK_OVERRIDE; + bool CanRead() const override; /** Vector that contains the filter function value in 6S format (step of 0.0025 micro m). * There values a computed by 6S. */ - WavelengthSpectralBandVectorType GetSpectralSensitivity() const ITK_OVERRIDE; + WavelengthSpectralBandVectorType GetSpectralSensitivity() const override; protected: FormosatImageMetadataInterface(); - ~FormosatImageMetadataInterface() ITK_OVERRIDE {} + ~FormosatImageMetadataInterface() override {} private: diff --git a/Modules/Core/Metadata/include/otbFormosatImageMetadataInterfaceFactory.h b/Modules/Core/Metadata/include/otbFormosatImageMetadataInterfaceFactory.h index dcd95d08c64bcccf568ba97b09910365f17fc7d7..372212d77d5bc03ee702e28b097fc4e1937ae0d0 100644 --- a/Modules/Core/Metadata/include/otbFormosatImageMetadataInterfaceFactory.h +++ b/Modules/Core/Metadata/include/otbFormosatImageMetadataInterfaceFactory.h @@ -41,8 +41,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - const char* GetITKSourceVersion(void) const ITK_OVERRIDE; - const char* GetDescription(void) const ITK_OVERRIDE; + const char* GetITKSourceVersion(void) const override; + const char* GetDescription(void) const override; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -59,7 +59,7 @@ public: protected: FormosatImageMetadataInterfaceFactory(); - ~FormosatImageMetadataInterfaceFactory() ITK_OVERRIDE; + ~FormosatImageMetadataInterfaceFactory() override; private: FormosatImageMetadataInterfaceFactory(const Self &); //purposely not implemented diff --git a/Modules/Core/Metadata/include/otbIkonosImageMetadataInterface.h b/Modules/Core/Metadata/include/otbIkonosImageMetadataInterface.h index f4f2ccbf45a06ca9e637893b7119232eba4c7bdf..6d39a3eafd091323af19d562a26620870ecd0368 100644 --- a/Modules/Core/Metadata/include/otbIkonosImageMetadataInterface.h +++ b/Modules/Core/Metadata/include/otbIkonosImageMetadataInterface.h @@ -54,66 +54,66 @@ public: typedef Superclass::ImageKeywordlistType ImageKeywordlistType; /** Get the radiometric bias from the ossim metadata */ - VariableLengthVectorType GetPhysicalBias() const ITK_OVERRIDE; + VariableLengthVectorType GetPhysicalBias() const override; /** Get the radiometric gain from the ossim metadata */ - VariableLengthVectorType GetPhysicalGain() const ITK_OVERRIDE; + VariableLengthVectorType GetPhysicalGain() const override; /** Get the solar irradiance from the ossim metadata */ - VariableLengthVectorType GetSolarIrradiance() const ITK_OVERRIDE; + VariableLengthVectorType GetSolarIrradiance() const override; /** Get the imaging acquisition day from the ossim metadata : "Acquisition Date/Time" metadata variable */ - int GetDay() const ITK_OVERRIDE; + int GetDay() const override; /** Get the imaging acquisition month from the ossim metadata : "Acquisition Date/Time" metadata variable */ - int GetMonth() const ITK_OVERRIDE; + int GetMonth() const override; /** Get the imaging acquisition year from the ossim metadata : "Acquisition Date/Time" metadata variable */ - int GetYear() const ITK_OVERRIDE; + int GetYear() const override; /** Get the imaging acquisition hour from the ossim metadata : "Acquisition Date/Time" metadata variable */ - int GetHour() const ITK_OVERRIDE; + int GetHour() const override; /** Get the imaging acquisition year from the ossim metadata : "Acquisition Date/Time" metadata variable */ - int GetMinute() const ITK_OVERRIDE; + int GetMinute() const override; /** Get the imaging production day from the ossim metadata : "Creation Date" metadata variable */ - int GetProductionDay() const ITK_OVERRIDE; + int GetProductionDay() const override; /** Get the imaging production month from the ossim metadata : "Creation Date" metadata variable */ - int GetProductionMonth() const ITK_OVERRIDE; + int GetProductionMonth() const override; /** Get the imaging production year from the ossim metadata : "Creation Date" metadata variable */ - int GetProductionYear() const ITK_OVERRIDE; + int GetProductionYear() const override; /** Get the sat elevation from the ossim metadata */ - double GetSatElevation() const ITK_OVERRIDE; + double GetSatElevation() const override; /** Get the sat azimuth from the ossim metadata */ - double GetSatAzimuth() const ITK_OVERRIDE; + double GetSatAzimuth() const override; /** Get the first wavelength for the spectral band definition */ - VariableLengthVectorType GetFirstWavelengths() const ITK_OVERRIDE; + VariableLengthVectorType GetFirstWavelengths() const override; /** Get the last wavelength for the spectral band definition */ - VariableLengthVectorType GetLastWavelengths() const ITK_OVERRIDE; + VariableLengthVectorType GetLastWavelengths() const override; - bool CanRead() const ITK_OVERRIDE; + bool CanRead() const override; /** Get the enhanced band names of Ikonos data*/ - std::vector<std::string> GetEnhancedBandNames() const ITK_OVERRIDE; + std::vector<std::string> GetEnhancedBandNames() const override; /** Get the 3 spectral band numbers corresponding to the default display for visualization, * in the order R, G, B */ - std::vector<unsigned int> GetDefaultDisplay() const ITK_OVERRIDE; + std::vector<unsigned int> GetDefaultDisplay() const override; /** Vector that contains the filter function value in 6S format (step of 0.0025 micro m). * There values a computed by 6S. */ - WavelengthSpectralBandVectorType GetSpectralSensitivity() const ITK_OVERRIDE; + WavelengthSpectralBandVectorType GetSpectralSensitivity() const override; protected: IkonosImageMetadataInterface(); - ~IkonosImageMetadataInterface() ITK_OVERRIDE {} + ~IkonosImageMetadataInterface() override {} private: diff --git a/Modules/Core/Metadata/include/otbIkonosImageMetadataInterfaceFactory.h b/Modules/Core/Metadata/include/otbIkonosImageMetadataInterfaceFactory.h index a0118eb5a011e5bc2d2475403ac6024b36426d23..b19c1e4d3a2cb7fa5cbd00f08f581d9268139913 100644 --- a/Modules/Core/Metadata/include/otbIkonosImageMetadataInterfaceFactory.h +++ b/Modules/Core/Metadata/include/otbIkonosImageMetadataInterfaceFactory.h @@ -41,8 +41,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - const char* GetITKSourceVersion(void) const ITK_OVERRIDE; - const char* GetDescription(void) const ITK_OVERRIDE; + const char* GetITKSourceVersion(void) const override; + const char* GetDescription(void) const override; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -59,7 +59,7 @@ public: protected: IkonosImageMetadataInterfaceFactory(); - ~IkonosImageMetadataInterfaceFactory() ITK_OVERRIDE; + ~IkonosImageMetadataInterfaceFactory() override; private: IkonosImageMetadataInterfaceFactory(const Self &); //purposely not implemented diff --git a/Modules/Core/Metadata/include/otbImageMetadataInterfaceBase.h b/Modules/Core/Metadata/include/otbImageMetadataInterfaceBase.h index 0d4c891042db2c71d7612753d2040d9127f7d6aa..218cbe12aef16c117c102b89fc34fed5e0fdfee8 100644 --- a/Modules/Core/Metadata/include/otbImageMetadataInterfaceBase.h +++ b/Modules/Core/Metadata/include/otbImageMetadataInterfaceBase.h @@ -214,9 +214,9 @@ public: protected: ImageMetadataInterfaceBase(); - ~ImageMetadataInterfaceBase() ITK_OVERRIDE {} + ~ImageMetadataInterfaceBase() override {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; MetaDataDictionaryType m_MetaDataDictionary; diff --git a/Modules/Core/Metadata/include/otbImageMetadataInterfaceFactory.h b/Modules/Core/Metadata/include/otbImageMetadataInterfaceFactory.h index c20f95b535f31deec54bfc0624483f58ee428181..0b1f1fd78e82136bbd6260232bcc35d02217589b 100644 --- a/Modules/Core/Metadata/include/otbImageMetadataInterfaceFactory.h +++ b/Modules/Core/Metadata/include/otbImageMetadataInterfaceFactory.h @@ -61,7 +61,7 @@ public: protected: ImageMetadataInterfaceFactory(); - ~ImageMetadataInterfaceFactory() ITK_OVERRIDE; + ~ImageMetadataInterfaceFactory() override; private: ImageMetadataInterfaceFactory(const Self &); //purposely not implemented diff --git a/Modules/Core/Metadata/include/otbOpticalDefaultImageMetadataInterface.h b/Modules/Core/Metadata/include/otbOpticalDefaultImageMetadataInterface.h index da26a6f01515ed865d8c21b16d46c0d54e484e56..dcd33a74262cafd7dbb419a76ec1f44f2f1243d4 100644 --- a/Modules/Core/Metadata/include/otbOpticalDefaultImageMetadataInterface.h +++ b/Modules/Core/Metadata/include/otbOpticalDefaultImageMetadataInterface.h @@ -57,103 +57,103 @@ public: typedef Superclass::ImageKeywordlistType ImageKeywordlistType; /** Get the radiometric bias from the ossim metadata */ - VariableLengthVectorType GetPhysicalBias() const ITK_OVERRIDE + VariableLengthVectorType GetPhysicalBias() const override { itkExceptionMacro("GetPhysicalBias not implemented in OpticalDefaultImageMetadataInterface, no captor type found"); } /** Get the radiometric gain from the ossim metadata */ - VariableLengthVectorType GetPhysicalGain() const ITK_OVERRIDE + VariableLengthVectorType GetPhysicalGain() const override { itkExceptionMacro("GetPhysicalGain not implemented in OpticalDefaultImageMetadataInterface, no captor type found"); } /** Get the solar irradiance from the ossim metadata */ - VariableLengthVectorType GetSolarIrradiance() const ITK_OVERRIDE + VariableLengthVectorType GetSolarIrradiance() const override { itkExceptionMacro("GetSolarIrradiance not implemented in OpticalDefaultImageMetadataInterface, no captor type found"); } /** Get the imaging acquisition day from the ossim metadata */ - int GetDay() const ITK_OVERRIDE + int GetDay() const override { itkExceptionMacro("GetDay not implemented in OpticalDefaultImageMetadataInterface, no captor type found"); } /** Get the imaging acquisition month from the ossim metadata */ - int GetMonth() const ITK_OVERRIDE + int GetMonth() const override { itkExceptionMacro("GetMonth not implemented in OpticalDefaultImageMetadataInterface, no captor type found"); } /** Get the imaging acquisition year from the ossim metadata */ - int GetYear() const ITK_OVERRIDE + int GetYear() const override { itkExceptionMacro("GetYear not implemented in OpticalDefaultImageMetadataInterface, no captor type found"); } /** Get the imaging acquisition hour from the ossim metadata */ - int GetHour() const ITK_OVERRIDE + int GetHour() const override { itkExceptionMacro("GetHour not implemented in OpticalDefaultImageMetadataInterface, no captor type found"); } /** Get the imaging acquisition minute from the ossim metadata */ - int GetMinute() const ITK_OVERRIDE + int GetMinute() const override { itkExceptionMacro("GetMinute not implemented in OpticalDefaultImageMetadataInterface, no captor type found"); } /** Get the imaging production day from the ossim metadata */ - int GetProductionDay() const ITK_OVERRIDE + int GetProductionDay() const override { itkExceptionMacro("GetProductionDay not implemented in OpticalDefaultImageMetadataInterface, no captor type found"); } /** Get the imaging production month from the ossim metadata */ - int GetProductionMonth() const ITK_OVERRIDE + int GetProductionMonth() const override { itkExceptionMacro("GetProductionMonth not implemented in OpticalDefaultImageMetadataInterface, no captor type found"); } /** Get the imaging production year from the ossim metadata */ - int GetProductionYear() const ITK_OVERRIDE + int GetProductionYear() const override { itkExceptionMacro("GetProductionYear not implemented in OpticalDefaultImageMetadataInterface, no captor type found"); } /** Get the sat elevation from the ossim metadata */ - double GetSatElevation() const ITK_OVERRIDE + double GetSatElevation() const override { itkExceptionMacro("GetSatElevation not implemented in OpticalDefaultImageMetadataInterface, no captor type found"); } /** Get the sat azimuth from the ossim metadata */ - double GetSatAzimuth() const ITK_OVERRIDE + double GetSatAzimuth() const override { itkExceptionMacro("GetSatElevation not implemented in OpticalDefaultImageMetadataInterface, no captor type found"); } /** Get the first wavelength for the spectral band definition */ - VariableLengthVectorType GetFirstWavelengths() const ITK_OVERRIDE + VariableLengthVectorType GetFirstWavelengths() const override { itkExceptionMacro("GetFirstWavelengths not implemented in OpticalDefaultImageMetadataInterface, no captor type found"); } /** Get the last wavelength for the spectral band definition */ - VariableLengthVectorType GetLastWavelengths() const ITK_OVERRIDE + VariableLengthVectorType GetLastWavelengths() const override { itkExceptionMacro("GetLastWavelengths not implemented in OpticalDefaultImageMetadataInterface, no captor type found"); } /** Get the enhanced band names (here nothing because the sensor is not identify) */ - std::vector<std::string> GetEnhancedBandNames() const ITK_OVERRIDE + std::vector<std::string> GetEnhancedBandNames() const override { std::vector<std::string> nothing; return nothing; } - bool CanRead() const ITK_OVERRIDE + bool CanRead() const override { // This class is the default one, it has to be able to call every metadata return false; @@ -161,7 +161,7 @@ public: /** Get the 3 spectral band numbers corresponding to the default display for visualization, * in the order R, G, B */ - std::vector<unsigned int> GetDefaultDisplay() const ITK_OVERRIDE + std::vector<unsigned int> GetDefaultDisplay() const override { std::vector<unsigned int> rgb(3); rgb[0] = 0; @@ -172,14 +172,14 @@ public: /** Vector that contains the filter function value in 6S format (step of 0.0025 micro m). * There values a computed by 6S. */ - WavelengthSpectralBandVectorType GetSpectralSensitivity() const ITK_OVERRIDE + WavelengthSpectralBandVectorType GetSpectralSensitivity() const override { itkExceptionMacro("GetSpectralSensitivity not implemented in OpticalDefaultImageMetadataInterface, no captor type found"); } protected: OpticalDefaultImageMetadataInterface(){}; - ~OpticalDefaultImageMetadataInterface() ITK_OVERRIDE {} + ~OpticalDefaultImageMetadataInterface() override {} private: diff --git a/Modules/Core/Metadata/include/otbOpticalDefaultImageMetadataInterfaceFactory.h b/Modules/Core/Metadata/include/otbOpticalDefaultImageMetadataInterfaceFactory.h index 0d8db3ce03224866cf51edc9303b23c4d5f892e1..e4226adf6b9b068105c3d31cabe0474f72cc4cab 100644 --- a/Modules/Core/Metadata/include/otbOpticalDefaultImageMetadataInterfaceFactory.h +++ b/Modules/Core/Metadata/include/otbOpticalDefaultImageMetadataInterfaceFactory.h @@ -42,8 +42,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - const char* GetITKSourceVersion(void) const ITK_OVERRIDE; - const char* GetDescription(void) const ITK_OVERRIDE; + const char* GetITKSourceVersion(void) const override; + const char* GetDescription(void) const override; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -60,7 +60,7 @@ public: protected: OpticalDefaultImageMetadataInterfaceFactory(); - ~OpticalDefaultImageMetadataInterfaceFactory() ITK_OVERRIDE; + ~OpticalDefaultImageMetadataInterfaceFactory() override; private: OpticalDefaultImageMetadataInterfaceFactory(const Self &); //purposely not implemented diff --git a/Modules/Core/Metadata/include/otbOpticalImageMetadataInterface.h b/Modules/Core/Metadata/include/otbOpticalImageMetadataInterface.h index 210534ce3d3a1abf4c5e8d5cbc83b5b44d17963f..8a948309809ad317576ba1790d82d073f89701f7 100644 --- a/Modules/Core/Metadata/include/otbOpticalImageMetadataInterface.h +++ b/Modules/Core/Metadata/include/otbOpticalImageMetadataInterface.h @@ -86,7 +86,7 @@ public: virtual VariableLengthVectorType GetLastWavelengths() const = 0; /** Get the enhanced band names */ - std::vector<std::string> GetEnhancedBandNames() const ITK_OVERRIDE = 0; + std::vector<std::string> GetEnhancedBandNames() const override = 0; /** This method is to handle the permutation of the spectral band by some image provider * in most cases, this method won't change the value, but for SPOT data, the bands are set up as @@ -99,9 +99,9 @@ public: virtual WavelengthSpectralBandVectorType GetSpectralSensitivity () const = 0; protected: OpticalImageMetadataInterface(); - ~OpticalImageMetadataInterface() ITK_OVERRIDE {} + ~OpticalImageMetadataInterface() override {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: diff --git a/Modules/Core/Metadata/include/otbOpticalImageMetadataInterfaceFactory.h b/Modules/Core/Metadata/include/otbOpticalImageMetadataInterfaceFactory.h index 314f0b7edfecd776b9d928ca4c98701a9506c9d0..a543c766e0a1a36c65b649628d8c2009e0971211 100644 --- a/Modules/Core/Metadata/include/otbOpticalImageMetadataInterfaceFactory.h +++ b/Modules/Core/Metadata/include/otbOpticalImageMetadataInterfaceFactory.h @@ -61,7 +61,7 @@ public: protected: OpticalImageMetadataInterfaceFactory(); - ~OpticalImageMetadataInterfaceFactory() ITK_OVERRIDE; + ~OpticalImageMetadataInterfaceFactory() override; private: OpticalImageMetadataInterfaceFactory(const Self &); //purposely not implemented diff --git a/Modules/Core/Metadata/include/otbPleiadesImageMetadataInterface.h b/Modules/Core/Metadata/include/otbPleiadesImageMetadataInterface.h index ddc9bc114f28c37450195a5c0ece8915fb5d0092..65412134ca828c4d867e7403da1d0d83e0a1d9ab 100644 --- a/Modules/Core/Metadata/include/otbPleiadesImageMetadataInterface.h +++ b/Modules/Core/Metadata/include/otbPleiadesImageMetadataInterface.h @@ -54,49 +54,49 @@ public: typedef Superclass::ImageKeywordlistType ImageKeywordlistType; /** Get the radiometric bias from the ossim metadata */ - VariableLengthVectorType GetPhysicalBias() const ITK_OVERRIDE; + VariableLengthVectorType GetPhysicalBias() const override; /** Get the radiometric gain from the ossim metadata */ - VariableLengthVectorType GetPhysicalGain() const ITK_OVERRIDE; + VariableLengthVectorType GetPhysicalGain() const override; /** Get the solar irradiance from the ossim metadata */ - VariableLengthVectorType GetSolarIrradiance() const ITK_OVERRIDE; + VariableLengthVectorType GetSolarIrradiance() const override; /** Get the imaging acquisition day from the ossim metadata : IMAGING_DATE metadata variable */ - int GetDay() const ITK_OVERRIDE; + int GetDay() const override; /** Get the imaging acquisition month from the ossim metadata : IMAGING_DATE metadata variable */ - int GetMonth() const ITK_OVERRIDE; + int GetMonth() const override; /** Get the imaging acquisition year from the ossim metadata : IMAGING_DATE metadata variable */ - int GetYear() const ITK_OVERRIDE; + int GetYear() const override; /** Get the imaging acquisition hour from the ossim metadata : IMAGING_DATE metadata variable */ - int GetHour() const ITK_OVERRIDE; + int GetHour() const override; /** Get the imaging acquisition year from the ossim metadata : IMAGING_DATE metadata variable */ - int GetMinute() const ITK_OVERRIDE; + int GetMinute() const override; /** Get the imaging production day from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */ - int GetProductionDay() const ITK_OVERRIDE; + int GetProductionDay() const override; /** Get the imaging production month from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */ - int GetProductionMonth() const ITK_OVERRIDE; + int GetProductionMonth() const override; /** Get the imaging production year from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */ - int GetProductionYear() const ITK_OVERRIDE; + int GetProductionYear() const override; /** Get the sat elevation from the ossim metadata */ - double GetSatElevation() const ITK_OVERRIDE; + double GetSatElevation() const override; /** Get the sat azimuth from the ossim metadata */ - double GetSatAzimuth() const ITK_OVERRIDE; + double GetSatAzimuth() const override; /** Get the first wavelength for the spectral band definition */ - VariableLengthVectorType GetFirstWavelengths() const ITK_OVERRIDE; + VariableLengthVectorType GetFirstWavelengths() const override; /** Get the last wavelength for the spectral band definition */ - VariableLengthVectorType GetLastWavelengths() const ITK_OVERRIDE; + VariableLengthVectorType GetLastWavelengths() const override; /** Get Instrument */ std::string GetInstrument() const; @@ -108,25 +108,25 @@ public: * in most cases, this method won't change the value, but for SPOT data, the bands are set up as * 2 1 0 3 in the tiff file, this method which is overloaded for SPOT enables to retrieve the * proper band. */ - unsigned int BandIndexToWavelengthPosition(unsigned int i) const ITK_OVERRIDE; + unsigned int BandIndexToWavelengthPosition(unsigned int i) const override; /** Get the 3 spectral band numbers corresponding to the default display for visualization, * in the order R, G, B */ - std::vector<unsigned int> GetDefaultDisplay() const ITK_OVERRIDE; + std::vector<unsigned int> GetDefaultDisplay() const override; - bool CanRead() const ITK_OVERRIDE; + bool CanRead() const override; /** Get the enhanced band names of the Pleiades data */ - std::vector<std::string> GetEnhancedBandNames() const ITK_OVERRIDE; + std::vector<std::string> GetEnhancedBandNames() const override; /** Vector that contains the filter function value in 6S format (step of 0.0025 micro m). * There values a computed by 6S. */ - WavelengthSpectralBandVectorType GetSpectralSensitivity() const ITK_OVERRIDE; + WavelengthSpectralBandVectorType GetSpectralSensitivity() const override; protected: PleiadesImageMetadataInterface(); - ~PleiadesImageMetadataInterface() ITK_OVERRIDE {} + ~PleiadesImageMetadataInterface() override {} private: diff --git a/Modules/Core/Metadata/include/otbPleiadesImageMetadataInterfaceFactory.h b/Modules/Core/Metadata/include/otbPleiadesImageMetadataInterfaceFactory.h index 8384183d18f7e3d014420e9a81527160ee8888b7..a1a95784454ccf4b32d251e554af748ed34c77d8 100644 --- a/Modules/Core/Metadata/include/otbPleiadesImageMetadataInterfaceFactory.h +++ b/Modules/Core/Metadata/include/otbPleiadesImageMetadataInterfaceFactory.h @@ -41,8 +41,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - const char* GetITKSourceVersion(void) const ITK_OVERRIDE; - const char* GetDescription(void) const ITK_OVERRIDE; + const char* GetITKSourceVersion(void) const override; + const char* GetDescription(void) const override; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -59,7 +59,7 @@ public: protected: PleiadesImageMetadataInterfaceFactory(); - ~PleiadesImageMetadataInterfaceFactory() ITK_OVERRIDE; + ~PleiadesImageMetadataInterfaceFactory() override; private: PleiadesImageMetadataInterfaceFactory(const Self &); //purposely not implemented diff --git a/Modules/Core/Metadata/include/otbQuickBirdImageMetadataInterface.h b/Modules/Core/Metadata/include/otbQuickBirdImageMetadataInterface.h index b8bd98555d890dab3254f1a97d6bc3e00d38499b..836056c5f1d10114ce0dc380f15b77371f73ca2c 100644 --- a/Modules/Core/Metadata/include/otbQuickBirdImageMetadataInterface.h +++ b/Modules/Core/Metadata/include/otbQuickBirdImageMetadataInterface.h @@ -54,65 +54,65 @@ public: typedef Superclass::ImageKeywordlistType ImageKeywordlistType; /** Get the radiometric bias from the ossim metadata */ - VariableLengthVectorType GetPhysicalBias() const ITK_OVERRIDE; + VariableLengthVectorType GetPhysicalBias() const override; /** Get the radiometric gain from the ossim metadata */ - VariableLengthVectorType GetPhysicalGain() const ITK_OVERRIDE; + VariableLengthVectorType GetPhysicalGain() const override; /** Get the solar irradiance from the ossim metadata */ - VariableLengthVectorType GetSolarIrradiance() const ITK_OVERRIDE; + VariableLengthVectorType GetSolarIrradiance() const override; /** Get the imaging acquisition day from the ossim metadata : TLCTime metadata value */ - int GetDay() const ITK_OVERRIDE; + int GetDay() const override; /** Get the imaging acquisition month from the ossim metadata : TLCTime metadata value */ - int GetMonth() const ITK_OVERRIDE; + int GetMonth() const override; /** Get the imaging acquisition year from the ossim metadata : TLCTime metadata value */ - int GetYear() const ITK_OVERRIDE; + int GetYear() const override; /** Get the imaging acquisition hour from the ossim metadata : TLCTime metadata value */ - int GetHour() const ITK_OVERRIDE; + int GetHour() const override; /** Get the imaging acquisition year from the ossim metadata : TLCTime metadata value */ - int GetMinute() const ITK_OVERRIDE; + int GetMinute() const override; /** Get the imaging production day from the ossim metadata : generationTime metadata value */ - int GetProductionDay() const ITK_OVERRIDE; + int GetProductionDay() const override; /** Get the imaging production month from the ossim metadata : generationTime metadata value */ - int GetProductionMonth() const ITK_OVERRIDE; + int GetProductionMonth() const override; /** Get the imaging production year from the ossim metadata : generationTime metadata value */ - int GetProductionYear() const ITK_OVERRIDE; + int GetProductionYear() const override; /** Get the sat elevation from the ossim metadata */ - double GetSatElevation() const ITK_OVERRIDE; + double GetSatElevation() const override; /** Get the sat azimuth from the ossim metadata */ - double GetSatAzimuth() const ITK_OVERRIDE; + double GetSatAzimuth() const override; /** Get the first wavelength for the spectral band definition */ - VariableLengthVectorType GetFirstWavelengths() const ITK_OVERRIDE; + VariableLengthVectorType GetFirstWavelengths() const override; /** Get the last wavelength for the spectral band definition */ - VariableLengthVectorType GetLastWavelengths() const ITK_OVERRIDE; + VariableLengthVectorType GetLastWavelengths() const override; /** Get the enhanced band names of QuickBird data */ - std::vector<std::string> GetEnhancedBandNames() const ITK_OVERRIDE; + std::vector<std::string> GetEnhancedBandNames() const override; - bool CanRead() const ITK_OVERRIDE; + bool CanRead() const override; /** Get the 3 spectral band numbers corresponding to the default display for visualization, * in the order R, G, B */ - std::vector<unsigned int> GetDefaultDisplay() const ITK_OVERRIDE; + std::vector<unsigned int> GetDefaultDisplay() const override; /** Vector that contains the filter function value in 6S format (step of 0.0025 micro m). * There values a computed by 6S. */ - WavelengthSpectralBandVectorType GetSpectralSensitivity() const ITK_OVERRIDE; + WavelengthSpectralBandVectorType GetSpectralSensitivity() const override; protected: QuickBirdImageMetadataInterface(); - ~QuickBirdImageMetadataInterface() ITK_OVERRIDE {} + ~QuickBirdImageMetadataInterface() override {} private: diff --git a/Modules/Core/Metadata/include/otbQuickBirdImageMetadataInterfaceFactory.h b/Modules/Core/Metadata/include/otbQuickBirdImageMetadataInterfaceFactory.h index 8f6eb08cbae6987141ea63c8d9e14bd7a2aa5b88..bd00c02bf7cce3b1476d51741940d8171b4c25d7 100644 --- a/Modules/Core/Metadata/include/otbQuickBirdImageMetadataInterfaceFactory.h +++ b/Modules/Core/Metadata/include/otbQuickBirdImageMetadataInterfaceFactory.h @@ -41,8 +41,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - const char* GetITKSourceVersion(void) const ITK_OVERRIDE; - const char* GetDescription(void) const ITK_OVERRIDE; + const char* GetITKSourceVersion(void) const override; + const char* GetDescription(void) const override; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -59,7 +59,7 @@ public: protected: QuickBirdImageMetadataInterfaceFactory(); - ~QuickBirdImageMetadataInterfaceFactory() ITK_OVERRIDE; + ~QuickBirdImageMetadataInterfaceFactory() override; private: QuickBirdImageMetadataInterfaceFactory(const Self &); //purposely not implemented diff --git a/Modules/Core/Metadata/include/otbRadarsat2ImageMetadataInterface.h b/Modules/Core/Metadata/include/otbRadarsat2ImageMetadataInterface.h index 2d720a164416caf645c600142180bafb9aa62d3c..2c4d231fb3a6f8ddaa7864503e2635ae215ef448 100644 --- a/Modules/Core/Metadata/include/otbRadarsat2ImageMetadataInterface.h +++ b/Modules/Core/Metadata/include/otbRadarsat2ImageMetadataInterface.h @@ -58,40 +58,40 @@ public: /*ImageMetadataInterfaceBase pure virtuals */ /** Get the imaging production day from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */ - int GetProductionDay() const ITK_OVERRIDE; + int GetProductionDay() const override; /** Get the imaging production month from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */ - int GetProductionMonth() const ITK_OVERRIDE; + int GetProductionMonth() const override; /** Get the imaging production year from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */ - int GetProductionYear() const ITK_OVERRIDE; + int GetProductionYear() const override; /** check sensor ID */ - bool CanRead() const ITK_OVERRIDE; + bool CanRead() const override; - int GetDay() const ITK_OVERRIDE; + int GetDay() const override; - int GetMonth() const ITK_OVERRIDE; + int GetMonth() const override; - int GetYear() const ITK_OVERRIDE; + int GetYear() const override; - int GetHour() const ITK_OVERRIDE; + int GetHour() const override; - int GetMinute() const ITK_OVERRIDE; + int GetMinute() const override; - UIntVectorType GetDefaultDisplay() const ITK_OVERRIDE; + UIntVectorType GetDefaultDisplay() const override; /*SarImageMetadataInterface pure virutals rituals */ - double GetPRF() const ITK_OVERRIDE; + double GetPRF() const override; - double GetRSF() const ITK_OVERRIDE; + double GetRSF() const override; - double GetRadarFrequency() const ITK_OVERRIDE; + double GetRadarFrequency() const override; - double GetCenterIncidenceAngle() const ITK_OVERRIDE; + double GetCenterIncidenceAngle() const override; /*get lookup data for calculating backscatter */ - void CreateCalibrationLookupData(const short type) ITK_OVERRIDE; + void CreateCalibrationLookupData(const short type) override; protected: @@ -99,7 +99,7 @@ protected: Radarsat2ImageMetadataInterface(); /* class desctructor */ - ~Radarsat2ImageMetadataInterface() ITK_OVERRIDE {} + ~Radarsat2ImageMetadataInterface() override {} private: Radarsat2ImageMetadataInterface(const Self &); //purposely not implemented @@ -147,7 +147,7 @@ public: } - ~Radarsat2CalibrationLookupData() ITK_OVERRIDE + ~Radarsat2CalibrationLookupData() override { } @@ -159,7 +159,7 @@ public: m_Gains = gains; } - double GetValue(const IndexValueType x, const IndexValueType itkNotUsed(y)) const ITK_OVERRIDE + double GetValue(const IndexValueType x, const IndexValueType itkNotUsed(y)) const override { double lutVal = 1.0; @@ -175,7 +175,7 @@ public: return lutVal; } - void PrintSelf(std::ostream & os, itk::Indent indent) const ITK_OVERRIDE + void PrintSelf(std::ostream & os, itk::Indent indent) const override { os << indent << " offset:'" << m_Offset << "'" << std::endl; os << " referenceNoiseLevel.gain: " << std::endl; diff --git a/Modules/Core/Metadata/include/otbRadarsat2ImageMetadataInterfaceFactory.h b/Modules/Core/Metadata/include/otbRadarsat2ImageMetadataInterfaceFactory.h index ca77603d2ea6c1db670a3978d970b3789aeedf66..df837f6e6e2b736ab03b564316f4cae682200b11 100644 --- a/Modules/Core/Metadata/include/otbRadarsat2ImageMetadataInterfaceFactory.h +++ b/Modules/Core/Metadata/include/otbRadarsat2ImageMetadataInterfaceFactory.h @@ -41,8 +41,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - const char* GetITKSourceVersion(void) const ITK_OVERRIDE; - const char* GetDescription(void) const ITK_OVERRIDE; + const char* GetITKSourceVersion(void) const override; + const char* GetDescription(void) const override; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -59,7 +59,7 @@ public: protected: Radarsat2ImageMetadataInterfaceFactory(); - ~Radarsat2ImageMetadataInterfaceFactory() ITK_OVERRIDE; + ~Radarsat2ImageMetadataInterfaceFactory() override; private: Radarsat2ImageMetadataInterfaceFactory(const Self &); //purposely not implemented diff --git a/Modules/Core/Metadata/include/otbSarCalibrationLookupData.h b/Modules/Core/Metadata/include/otbSarCalibrationLookupData.h index 98669c72050aa55541abc2331e4ebf9f42feb104..04328dfaff0fab4177e332a72c3a91bb4ac7f234 100644 --- a/Modules/Core/Metadata/include/otbSarCalibrationLookupData.h +++ b/Modules/Core/Metadata/include/otbSarCalibrationLookupData.h @@ -59,7 +59,7 @@ class OTBMetadata_EXPORT SarCalibrationLookupData : public itk::LightObject { { } - ~SarCalibrationLookupData() ITK_OVERRIDE + ~SarCalibrationLookupData() override { } @@ -75,7 +75,7 @@ class OTBMetadata_EXPORT SarCalibrationLookupData : public itk::LightObject { itkGetMacro(Type, short); - void PrintSelf(std::ostream & os, itk::Indent indent) const ITK_OVERRIDE + void PrintSelf(std::ostream & os, itk::Indent indent) const override { os << indent << " lookup table type:'" << m_Type << "'" << std::endl; Superclass::PrintSelf(os, indent); diff --git a/Modules/Core/Metadata/include/otbSarDefaultImageMetadataInterface.h b/Modules/Core/Metadata/include/otbSarDefaultImageMetadataInterface.h index c842d4fcadc89f58f5d53f5802a3b54847d5ac60..0782320bfdbf82a83286b0bf872bc47d3415bc50 100644 --- a/Modules/Core/Metadata/include/otbSarDefaultImageMetadataInterface.h +++ b/Modules/Core/Metadata/include/otbSarDefaultImageMetadataInterface.h @@ -61,134 +61,134 @@ public: typedef double RealType; typedef PointSetType::PointType PointType; - RealType GetRadiometricCalibrationScale() const ITK_OVERRIDE + RealType GetRadiometricCalibrationScale() const override { itkExceptionMacro("GetRadiometricCalibrationScale() not implemented in SarDefaultImageMetadataInterface, no captor type found"); } - PointSetPointer GetRadiometricCalibrationAntennaPatternNewGain() const ITK_OVERRIDE + PointSetPointer GetRadiometricCalibrationAntennaPatternNewGain() const override { itkExceptionMacro("GetRadiometricCalibrationAntennaPatternNewGain() not implemented in SarDefaultImageMetadataInterface, no captor type found"); } - PointSetPointer GetRadiometricCalibrationAntennaPatternOldGain() const ITK_OVERRIDE + PointSetPointer GetRadiometricCalibrationAntennaPatternOldGain() const override { itkExceptionMacro("GetRadiometricCalibrationAntennaPatternOldGain() not implemented in SarDefaultImageMetadataInterface, no captor type found"); } - PointSetPointer GetRadiometricCalibrationIncidenceAngle() const ITK_OVERRIDE + PointSetPointer GetRadiometricCalibrationIncidenceAngle() const override { itkExceptionMacro("GetRadiometricCalibrationIncidenceAngle() not implemented in SarDefaultImageMetadataInterface, no captor type found"); } - PointSetPointer GetRadiometricCalibrationRangeSpreadLoss() const ITK_OVERRIDE + PointSetPointer GetRadiometricCalibrationRangeSpreadLoss() const override { itkExceptionMacro("GetRadiometricCalibrationRangeSpreadLoss() not implemented in SarDefaultImageMetadataInterface, no captor type found"); } - PointSetPointer GetRadiometricCalibrationNoise() const ITK_OVERRIDE + PointSetPointer GetRadiometricCalibrationNoise() const override { itkExceptionMacro("GetRadiometricCalibrationNoise() not implemented in SarDefaultImageMetadataInterface, no captor type found"); } - IndexType GetRadiometricCalibrationAntennaPatternNewGainPolynomialDegree() const ITK_OVERRIDE + IndexType GetRadiometricCalibrationAntennaPatternNewGainPolynomialDegree() const override { itkExceptionMacro("GetRadiometricCalibrationAntennaPatternNewGainPolynomialDegree() not implemented in SarDefaultImageMetadataInterface, no captor type found"); } - IndexType GetRadiometricCalibrationAntennaPatternOldGainPolynomialDegree() const ITK_OVERRIDE + IndexType GetRadiometricCalibrationAntennaPatternOldGainPolynomialDegree() const override { itkExceptionMacro("GetRadiometricCalibrationAntennaPatternOldGainPolynomialDegree() not implemented in SarDefaultImageMetadataInterface, no captor type found"); } - IndexType GetRadiometricCalibrationIncidenceAnglePolynomialDegree() const ITK_OVERRIDE + IndexType GetRadiometricCalibrationIncidenceAnglePolynomialDegree() const override { itkExceptionMacro("GetRadiometricCalibrationIncidenceAnglePolynomialDegree() not implemented in SarDefaultImageMetadataInterface, no captor type found"); } - IndexType GetRadiometricCalibrationRangeSpreadLossPolynomialDegree() const ITK_OVERRIDE + IndexType GetRadiometricCalibrationRangeSpreadLossPolynomialDegree() const override { itkExceptionMacro("GetRadiometricCalibrationRangeSpreadLossPolynomialDegree() not implemented in SarDefaultImageMetadataInterface, no captor type found"); } - IndexType GetRadiometricCalibrationNoisePolynomialDegree() const ITK_OVERRIDE + IndexType GetRadiometricCalibrationNoisePolynomialDegree() const override { itkExceptionMacro("GetRadiometricCalibrationNoisePolynomialDegree() not implemented in SarDefaultImageMetadataInterface, no captor type found"); } /** Get the imaging acquisition day from the ossim metadata */ - int GetDay() const ITK_OVERRIDE + int GetDay() const override { itkExceptionMacro("GetDay not implemented in SarDefaultImageMetadataInterface, no captor type found"); } /** Get the imaging acquisition month from the ossim metadata */ - int GetMonth() const ITK_OVERRIDE + int GetMonth() const override { itkExceptionMacro("GetMonth not implemented in SarDefaultImageMetadataInterface, no captor type found"); } /** Get the imaging acquisition year from the ossim metadata */ - int GetYear() const ITK_OVERRIDE + int GetYear() const override { itkExceptionMacro("GetYear not implemented in SarDefaultImageMetadataInterface, no captor type found"); } /** Get the imaging acquisition hour from the ossim metadata */ - int GetHour() const ITK_OVERRIDE + int GetHour() const override { itkExceptionMacro("GetHour not implemented in SarDefaultImageMetadataInterface, no captor type found"); } /** Get the imaging acquisition minute from the ossim metadata */ - int GetMinute() const ITK_OVERRIDE + int GetMinute() const override { itkExceptionMacro("GetMinute not implemented in SarDefaultImageMetadataInterface, no captor type found"); } /** Get the imaging production day from the ossim metadata */ - int GetProductionDay() const ITK_OVERRIDE + int GetProductionDay() const override { itkExceptionMacro("GetProductionDay not implemented in SarDefaultImageMetadataInterface, no captor type found"); } /** Get the imaging production month from the ossim metadata */ - int GetProductionMonth() const ITK_OVERRIDE + int GetProductionMonth() const override { itkExceptionMacro("GetProductionMonth not implemented in SarDefaultImageMetadataInterface, no captor type found"); } /** Get the imaging production year from the ossim metadata */ - int GetProductionYear() const ITK_OVERRIDE + int GetProductionYear() const override { itkExceptionMacro("GetProductionYear not implemented in SarDefaultImageMetadataInterface, no captor type found"); } /** Get the PRF */ - double GetPRF() const ITK_OVERRIDE + double GetPRF() const override { itkExceptionMacro("GetPRF not implemented in SarDefaultImageMetadataInterface, no captor type found"); } /** Get the RSF */ - double GetRSF() const ITK_OVERRIDE + double GetRSF() const override { itkExceptionMacro("GetRSF not implemented in SarDefaultImageMetadataInterface, no captor type found"); } /** Get the radar frequency */ - double GetRadarFrequency() const ITK_OVERRIDE + double GetRadarFrequency() const override { itkExceptionMacro("GetRadarFrequency not implemented in SarDefaultImageMetadataInterface, no captor type found"); } /** Get the center incidence angle */ - double GetCenterIncidenceAngle() const ITK_OVERRIDE + double GetCenterIncidenceAngle() const override { itkExceptionMacro("GetCenterIncidenceAngle not implemented in SarDefaultImageMetadataInterface, no captor type found"); } - bool CanRead() const ITK_OVERRIDE + bool CanRead() const override { // This class is the default one, it has to be able to call every metadata return false; @@ -196,7 +196,7 @@ public: /** Get the 3 spectral band numbers corresponding to the default display for visualization, * in the order R, G, B */ - UIntVectorType GetDefaultDisplay() const ITK_OVERRIDE + UIntVectorType GetDefaultDisplay() const override { UIntVectorType rgb(3); rgb[0] = 0; @@ -207,7 +207,7 @@ public: protected: SarDefaultImageMetadataInterface(){}; - ~SarDefaultImageMetadataInterface() ITK_OVERRIDE {} + ~SarDefaultImageMetadataInterface() override {} private: diff --git a/Modules/Core/Metadata/include/otbSarDefaultImageMetadataInterfaceFactory.h b/Modules/Core/Metadata/include/otbSarDefaultImageMetadataInterfaceFactory.h index 957a9867e92c4785e8c3a328930d0fa723044005..3d30545b75a8d45731831f443a74501441a26d68 100644 --- a/Modules/Core/Metadata/include/otbSarDefaultImageMetadataInterfaceFactory.h +++ b/Modules/Core/Metadata/include/otbSarDefaultImageMetadataInterfaceFactory.h @@ -42,8 +42,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - const char* GetITKSourceVersion(void) const ITK_OVERRIDE; - const char* GetDescription(void) const ITK_OVERRIDE; + const char* GetITKSourceVersion(void) const override; + const char* GetDescription(void) const override; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -60,7 +60,7 @@ public: protected: SarDefaultImageMetadataInterfaceFactory(); - ~SarDefaultImageMetadataInterfaceFactory() ITK_OVERRIDE; + ~SarDefaultImageMetadataInterfaceFactory() override; private: SarDefaultImageMetadataInterfaceFactory(const Self &); //purposely not implemented diff --git a/Modules/Core/Metadata/include/otbSarImageMetadataInterface.h b/Modules/Core/Metadata/include/otbSarImageMetadataInterface.h index 32fc7e3cfca783a0198715e60cb70ec23e4d2294..efd60bd15e96fa91c51cc181ece6e841e8a154e3 100644 --- a/Modules/Core/Metadata/include/otbSarImageMetadataInterface.h +++ b/Modules/Core/Metadata/include/otbSarImageMetadataInterface.h @@ -104,7 +104,7 @@ public: virtual const std::string GetAcquisitionMode() const; /** Get the enhanced band names (No enhanced band name support for SAR) */ - StringVectorType GetEnhancedBandNames() const ITK_OVERRIDE + StringVectorType GetEnhancedBandNames() const override { StringVectorType nothing; return nothing; @@ -112,12 +112,12 @@ public: protected: SarImageMetadataInterface(); - ~SarImageMetadataInterface() ITK_OVERRIDE {} + ~SarImageMetadataInterface() override {} PointSetPointer GetConstantValuePointSet(const RealType& value) const; IndexType GetConstantPolynomialDegree() const; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; LookupDataPointerType m_SarLut; diff --git a/Modules/Core/Metadata/include/otbSarImageMetadataInterfaceFactory.h b/Modules/Core/Metadata/include/otbSarImageMetadataInterfaceFactory.h index 9e1c1803954114325a1d44f245526364bf25f2b8..b9cd10bc282f2881ec8512f96b5dba912f902352 100644 --- a/Modules/Core/Metadata/include/otbSarImageMetadataInterfaceFactory.h +++ b/Modules/Core/Metadata/include/otbSarImageMetadataInterfaceFactory.h @@ -61,7 +61,7 @@ public: protected: SarImageMetadataInterfaceFactory(); - ~SarImageMetadataInterfaceFactory() ITK_OVERRIDE; + ~SarImageMetadataInterfaceFactory() override; private: SarImageMetadataInterfaceFactory(const Self &); //purposely not implemented diff --git a/Modules/Core/Metadata/include/otbSentinel1ImageMetadataInterface.h b/Modules/Core/Metadata/include/otbSentinel1ImageMetadataInterface.h index ebefb705539c604ff5dbe7ad587450577a056198..c8636398587041b1ce523b8481d80da0e6d70c8d 100644 --- a/Modules/Core/Metadata/include/otbSentinel1ImageMetadataInterface.h +++ b/Modules/Core/Metadata/include/otbSentinel1ImageMetadataInterface.h @@ -59,40 +59,40 @@ public: typedef Superclass::LookupDataPointerType LookupDataPointerType; /** Get the imaging production day from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */ - int GetProductionDay() const ITK_OVERRIDE; + int GetProductionDay() const override; /** Get the imaging production month from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */ - int GetProductionMonth() const ITK_OVERRIDE; + int GetProductionMonth() const override; /** Get the imaging production year from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */ - int GetProductionYear() const ITK_OVERRIDE; + int GetProductionYear() const override; /** check sensor ID */ - bool CanRead() const ITK_OVERRIDE; + bool CanRead() const override; - int GetDay() const ITK_OVERRIDE; + int GetDay() const override; - int GetMonth() const ITK_OVERRIDE; + int GetMonth() const override; - int GetYear() const ITK_OVERRIDE; + int GetYear() const override; - int GetHour() const ITK_OVERRIDE; + int GetHour() const override; - int GetMinute() const ITK_OVERRIDE; + int GetMinute() const override; - UIntVectorType GetDefaultDisplay() const ITK_OVERRIDE; + UIntVectorType GetDefaultDisplay() const override; /*SarImageMetadataInterface pure virutals rituals */ - double GetPRF() const ITK_OVERRIDE; + double GetPRF() const override; - double GetRSF() const ITK_OVERRIDE; + double GetRSF() const override; - double GetRadarFrequency() const ITK_OVERRIDE; + double GetRadarFrequency() const override; - double GetCenterIncidenceAngle() const ITK_OVERRIDE; + double GetCenterIncidenceAngle() const override; /*get lookup data for calculating backscatter */ - void CreateCalibrationLookupData(const short type) ITK_OVERRIDE; + void CreateCalibrationLookupData(const short type) override; protected: @@ -100,7 +100,7 @@ protected: Sentinel1ImageMetadataInterface(); /* class dtor */ - ~Sentinel1ImageMetadataInterface() ITK_OVERRIDE {} + ~Sentinel1ImageMetadataInterface() override {} private: @@ -159,7 +159,7 @@ public: { } - ~Sentinel1CalibrationLookupData() ITK_OVERRIDE + ~Sentinel1CalibrationLookupData() override { } @@ -176,7 +176,7 @@ public: lineTimeInterval = (lt - ft) / ((lines - 1) * 1.0); } - double GetValue(const IndexValueType x, const IndexValueType y) const ITK_OVERRIDE + double GetValue(const IndexValueType x, const IndexValueType y) const override { const int calVecIdx = GetVectorIndex(y); assert(calVecIdx>=0 && calVecIdx < count-1); diff --git a/Modules/Core/Metadata/include/otbSentinel1ImageMetadataInterfaceFactory.h b/Modules/Core/Metadata/include/otbSentinel1ImageMetadataInterfaceFactory.h index cfdfea8dcdd5bc0f6cfeadc304a1774e1ff4f165..fafe69dd8fc845189f3e90961f15c89f21e7f613 100644 --- a/Modules/Core/Metadata/include/otbSentinel1ImageMetadataInterfaceFactory.h +++ b/Modules/Core/Metadata/include/otbSentinel1ImageMetadataInterfaceFactory.h @@ -41,8 +41,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - const char* GetITKSourceVersion(void) const ITK_OVERRIDE; - const char* GetDescription(void) const ITK_OVERRIDE; + const char* GetITKSourceVersion(void) const override; + const char* GetDescription(void) const override; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -59,7 +59,7 @@ public: protected: Sentinel1ImageMetadataInterfaceFactory(); - ~Sentinel1ImageMetadataInterfaceFactory() ITK_OVERRIDE; + ~Sentinel1ImageMetadataInterfaceFactory() override; private: Sentinel1ImageMetadataInterfaceFactory(const Self &); //purposely not implemented diff --git a/Modules/Core/Metadata/include/otbSpot6ImageMetadataInterface.h b/Modules/Core/Metadata/include/otbSpot6ImageMetadataInterface.h index f3af38e7a920ce2e142729e9812ca0e16b695a25..a63b9fa3621660b46b6c2e11c1233a47a6a54411 100644 --- a/Modules/Core/Metadata/include/otbSpot6ImageMetadataInterface.h +++ b/Modules/Core/Metadata/include/otbSpot6ImageMetadataInterface.h @@ -54,49 +54,49 @@ public: typedef Superclass::ImageKeywordlistType ImageKeywordlistType; /** Get the radiometric bias from the ossim metadata */ - VariableLengthVectorType GetPhysicalBias() const ITK_OVERRIDE; + VariableLengthVectorType GetPhysicalBias() const override; /** Get the radiometric gain from the ossim metadata */ - VariableLengthVectorType GetPhysicalGain() const ITK_OVERRIDE; + VariableLengthVectorType GetPhysicalGain() const override; /** Get the solar irradiance from the ossim metadata */ - VariableLengthVectorType GetSolarIrradiance() const ITK_OVERRIDE; + VariableLengthVectorType GetSolarIrradiance() const override; /** Get the imaging acquisition day from the ossim metadata : IMAGING_DATE metadata variable */ - int GetDay() const ITK_OVERRIDE; + int GetDay() const override; /** Get the imaging acquisition month from the ossim metadata : IMAGING_DATE metadata variable */ - int GetMonth() const ITK_OVERRIDE; + int GetMonth() const override; /** Get the imaging acquisition year from the ossim metadata : IMAGING_DATE metadata variable */ - int GetYear() const ITK_OVERRIDE; + int GetYear() const override; /** Get the imaging acquisition hour from the ossim metadata : IMAGING_DATE metadata variable */ - int GetHour() const ITK_OVERRIDE; + int GetHour() const override; /** Get the imaging acquisition year from the ossim metadata : IMAGING_DATE metadata variable */ - int GetMinute() const ITK_OVERRIDE; + int GetMinute() const override; /** Get the imaging production day from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */ - int GetProductionDay() const ITK_OVERRIDE; + int GetProductionDay() const override; /** Get the imaging production month from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */ - int GetProductionMonth() const ITK_OVERRIDE; + int GetProductionMonth() const override; /** Get the imaging production year from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */ - int GetProductionYear() const ITK_OVERRIDE; + int GetProductionYear() const override; /** Get the sat elevation from the ossim metadata */ - double GetSatElevation() const ITK_OVERRIDE; + double GetSatElevation() const override; /** Get the sat azimuth from the ossim metadata */ - double GetSatAzimuth() const ITK_OVERRIDE; + double GetSatAzimuth() const override; /** Get the first wavelength for the spectral band definition */ - VariableLengthVectorType GetFirstWavelengths() const ITK_OVERRIDE; + VariableLengthVectorType GetFirstWavelengths() const override; /** Get the last wavelength for the spectral band definition */ - VariableLengthVectorType GetLastWavelengths() const ITK_OVERRIDE; + VariableLengthVectorType GetLastWavelengths() const override; /** Get Instrument */ std::string GetInstrument() const; @@ -108,25 +108,25 @@ public: * in most cases, this method won't change the value, but for SPOT data, the bands are set up as * 2 1 0 3 in the tiff file, this method which is overloaded for SPOT enables to retrieve the * proper band. */ - unsigned int BandIndexToWavelengthPosition(unsigned int i) const ITK_OVERRIDE; + unsigned int BandIndexToWavelengthPosition(unsigned int i) const override; /** Get the 3 spectral band numbers corresponding to the default display for visualization, * in the order R, G, B */ - std::vector<unsigned int> GetDefaultDisplay() const ITK_OVERRIDE; + std::vector<unsigned int> GetDefaultDisplay() const override; - bool CanRead() const ITK_OVERRIDE; + bool CanRead() const override; /** Get the enhanced band names of the Spot6 data */ - std::vector<std::string> GetEnhancedBandNames() const ITK_OVERRIDE; + std::vector<std::string> GetEnhancedBandNames() const override; /** Vector that contains the filter function value in 6S format (step of 0.0025 micro m). * There values a computed by 6S. */ - WavelengthSpectralBandVectorType GetSpectralSensitivity() const ITK_OVERRIDE; + WavelengthSpectralBandVectorType GetSpectralSensitivity() const override; protected: Spot6ImageMetadataInterface(); - ~Spot6ImageMetadataInterface() ITK_OVERRIDE {} + ~Spot6ImageMetadataInterface() override {} private: diff --git a/Modules/Core/Metadata/include/otbSpot6ImageMetadataInterfaceFactory.h b/Modules/Core/Metadata/include/otbSpot6ImageMetadataInterfaceFactory.h index 139181d54e65412f8255636282c666a5b20b2729..83e9ee40ec26535a70c4ff46885c3cdb2f74acd3 100644 --- a/Modules/Core/Metadata/include/otbSpot6ImageMetadataInterfaceFactory.h +++ b/Modules/Core/Metadata/include/otbSpot6ImageMetadataInterfaceFactory.h @@ -41,8 +41,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - const char* GetITKSourceVersion(void) const ITK_OVERRIDE; - const char* GetDescription(void) const ITK_OVERRIDE; + const char* GetITKSourceVersion(void) const override; + const char* GetDescription(void) const override; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -59,7 +59,7 @@ public: protected: Spot6ImageMetadataInterfaceFactory(); - ~Spot6ImageMetadataInterfaceFactory() ITK_OVERRIDE; + ~Spot6ImageMetadataInterfaceFactory() override; private: Spot6ImageMetadataInterfaceFactory(const Self &); //purposely not implemented diff --git a/Modules/Core/Metadata/include/otbSpotImageMetadataInterface.h b/Modules/Core/Metadata/include/otbSpotImageMetadataInterface.h index 7ccdb45d6096b652e165365f523d4ea5859d0fd6..3f855595eefdd4f86971c18a4c888b547573febc 100644 --- a/Modules/Core/Metadata/include/otbSpotImageMetadataInterface.h +++ b/Modules/Core/Metadata/include/otbSpotImageMetadataInterface.h @@ -54,52 +54,52 @@ public: typedef Superclass::ImageKeywordlistType ImageKeywordlistType; /** Get the radiometric bias from the ossim metadata */ - VariableLengthVectorType GetPhysicalBias() const ITK_OVERRIDE; + VariableLengthVectorType GetPhysicalBias() const override; /** Get the radiometric gain from the ossim metadata */ - VariableLengthVectorType GetPhysicalGain() const ITK_OVERRIDE; + VariableLengthVectorType GetPhysicalGain() const override; /** Get the solar irradiance from the ossim metadata */ - VariableLengthVectorType GetSolarIrradiance() const ITK_OVERRIDE; + VariableLengthVectorType GetSolarIrradiance() const override; /** Get the imaging acquisition day from the ossim metadata : IMAGING_DATE metadata variable */ - int GetDay() const ITK_OVERRIDE; + int GetDay() const override; /** Get the imaging acquisition month from the ossim metadata : IMAGING_DATE metadata variable */ - int GetMonth() const ITK_OVERRIDE; + int GetMonth() const override; /** Get the imaging acquisition year from the ossim metadata : IMAGING_DATE metadata variable */ - int GetYear() const ITK_OVERRIDE; + int GetYear() const override; /** Get the imaging acquisition hour from the ossim metadata : IMAGING_DATE metadata variable */ - int GetHour() const ITK_OVERRIDE; + int GetHour() const override; /** Get the imaging acquisition year from the ossim metadata : IMAGING_DATE metadata variable */ - int GetMinute() const ITK_OVERRIDE; + int GetMinute() const override; /** Get the imaging production day from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */ - int GetProductionDay() const ITK_OVERRIDE; + int GetProductionDay() const override; /** Get the imaging production month from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */ - int GetProductionMonth() const ITK_OVERRIDE; + int GetProductionMonth() const override; /** Get the imaging production year from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */ - int GetProductionYear() const ITK_OVERRIDE; + int GetProductionYear() const override; /** Get the sat elevation from the ossim metadata */ - double GetSatElevation() const ITK_OVERRIDE; + double GetSatElevation() const override; /** Get the sat azimuth from the ossim metadata */ - double GetSatAzimuth() const ITK_OVERRIDE; + double GetSatAzimuth() const override; /** Get the first wavelength for the spectral band definition */ - VariableLengthVectorType GetFirstWavelengths() const ITK_OVERRIDE; + VariableLengthVectorType GetFirstWavelengths() const override; /** Get the last wavelength for the spectral band definition */ - VariableLengthVectorType GetLastWavelengths() const ITK_OVERRIDE; + VariableLengthVectorType GetLastWavelengths() const override; /** Get the enhanced band names (here nothing because the metadata did not provide band names) */ - std::vector<std::string> GetEnhancedBandNames() const ITK_OVERRIDE + std::vector<std::string> GetEnhancedBandNames() const override { return this->Superclass::GetBandName(); } @@ -114,21 +114,21 @@ public: * in most cases, this method won't change the value, but for SPOT data, the bands are set up as * 2 1 0 3 in the tiff file, this method which is overloaded for SPOT enables to retrieve the * proper band. */ - unsigned int BandIndexToWavelengthPosition(unsigned int i) const ITK_OVERRIDE; + unsigned int BandIndexToWavelengthPosition(unsigned int i) const override; /** Get the 3 spectral band numbers corresponding to the default display for visualization, * in the order R, G, B */ - std::vector<unsigned int> GetDefaultDisplay() const ITK_OVERRIDE; + std::vector<unsigned int> GetDefaultDisplay() const override; - bool CanRead() const ITK_OVERRIDE; + bool CanRead() const override; /** Vector that contains the filter function value in 6S format (step of 0.0025 micro m). * There values a computed by 6S. */ - WavelengthSpectralBandVectorType GetSpectralSensitivity() const ITK_OVERRIDE; + WavelengthSpectralBandVectorType GetSpectralSensitivity() const override; protected: SpotImageMetadataInterface(); - ~SpotImageMetadataInterface() ITK_OVERRIDE {} + ~SpotImageMetadataInterface() override {} private: diff --git a/Modules/Core/Metadata/include/otbSpotImageMetadataInterfaceFactory.h b/Modules/Core/Metadata/include/otbSpotImageMetadataInterfaceFactory.h index 8b4af6d83d8d8ac94b3e419c36ed4b28318e289e..8516b694b5dbd0be3cf6e6a0f7d5d3bd0e10637a 100644 --- a/Modules/Core/Metadata/include/otbSpotImageMetadataInterfaceFactory.h +++ b/Modules/Core/Metadata/include/otbSpotImageMetadataInterfaceFactory.h @@ -41,8 +41,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - const char* GetITKSourceVersion(void) const ITK_OVERRIDE; - const char* GetDescription(void) const ITK_OVERRIDE; + const char* GetITKSourceVersion(void) const override; + const char* GetDescription(void) const override; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -59,7 +59,7 @@ public: protected: SpotImageMetadataInterfaceFactory(); - ~SpotImageMetadataInterfaceFactory() ITK_OVERRIDE; + ~SpotImageMetadataInterfaceFactory() override; private: SpotImageMetadataInterfaceFactory(const Self &); //purposely not implemented diff --git a/Modules/Core/Metadata/include/otbTerraSarImageMetadataInterface.h b/Modules/Core/Metadata/include/otbTerraSarImageMetadataInterface.h index 17d8a7fde52f410d4ea7188f44a5a72b1da0760e..321623631fd442c0b77a78d6ecd6b7c89a57f4ea 100644 --- a/Modules/Core/Metadata/include/otbTerraSarImageMetadataInterface.h +++ b/Modules/Core/Metadata/include/otbTerraSarImageMetadataInterface.h @@ -67,28 +67,28 @@ public: typedef double RealType; /** Get the imaging start acquisition day from the ossim metadata */ - int GetDay() const ITK_OVERRIDE; + int GetDay() const override; /** Get the imaging start acquisition month from the ossim metadata */ - int GetMonth() const ITK_OVERRIDE; + int GetMonth() const override; /** Get the imaging start acquisition year from the ossim metadata */ - int GetYear() const ITK_OVERRIDE; + int GetYear() const override; /** Get the imaging start acquisition hour from the ossim metadata */ - int GetHour() const ITK_OVERRIDE; + int GetHour() const override; /** Get the imaging start acquisition minute from the ossim metadata */ - int GetMinute() const ITK_OVERRIDE; + int GetMinute() const override; /** Get the imaging production day from the ossim metadata : generationTime variable */ - int GetProductionDay() const ITK_OVERRIDE; + int GetProductionDay() const override; /** Get the imaging production month from the ossim metadata : generationTime variable */ - int GetProductionMonth() const ITK_OVERRIDE; + int GetProductionMonth() const override; /** Get the imaging production year from the ossim metadata : generationTime variable */ - int GetProductionYear() const ITK_OVERRIDE; + int GetProductionYear() const override; /** Get the calibration.calFactor : generationTime variable */ double GetCalibrationFactor() const; @@ -115,13 +115,13 @@ public: DoubleVectorType GetNoiseReferencePointList() const; /** Get the radar frequency */ - double GetRadarFrequency() const ITK_OVERRIDE; + double GetRadarFrequency() const override; /** Get the PRF */ - double GetPRF() const ITK_OVERRIDE; + double GetPRF() const override; /** Get the RSF */ - double GetRSF() const ITK_OVERRIDE; + double GetRSF() const override; /** Get the number of corner incidence angles */ unsigned int GetNumberOfCornerIncidenceAngles() const; @@ -130,7 +130,7 @@ public: double GetMeanIncidenceAngles() const; /** Get the center incidence angle */ - double GetCenterIncidenceAngle() const ITK_OVERRIDE; + double GetCenterIncidenceAngle() const override; /** Get the center index */ IndexType GetCenterIncidenceAngleIndex() const; @@ -142,26 +142,26 @@ public: IndexVectorType GetCornersIncidenceAnglesIndex() const; /** Get the constant calibration factor */ - RealType GetRadiometricCalibrationScale() const ITK_OVERRIDE; + RealType GetRadiometricCalibrationScale() const override; - PointSetPointer GetRadiometricCalibrationNoise() const ITK_OVERRIDE; - IndexType GetRadiometricCalibrationNoisePolynomialDegree() const ITK_OVERRIDE; + PointSetPointer GetRadiometricCalibrationNoise() const override; + IndexType GetRadiometricCalibrationNoisePolynomialDegree() const override; //PointSetPointer GetRadiometricCalibrationAntennaPatternOldGain() const; - PointSetPointer GetRadiometricCalibrationIncidenceAngle() const ITK_OVERRIDE; - IndexType GetRadiometricCalibrationIncidenceAnglePolynomialDegree() const ITK_OVERRIDE; + PointSetPointer GetRadiometricCalibrationIncidenceAngle() const override; + IndexType GetRadiometricCalibrationIncidenceAnglePolynomialDegree() const override; - bool CanRead() const ITK_OVERRIDE; + bool CanRead() const override; /** Get the 3 spectral band numbers corresponding to the default display for visualization, * in the order R, G, B */ - std::vector<unsigned int> GetDefaultDisplay() const ITK_OVERRIDE; + std::vector<unsigned int> GetDefaultDisplay() const override; protected: TerraSarImageMetadataInterface(); - ~TerraSarImageMetadataInterface() ITK_OVERRIDE {} + ~TerraSarImageMetadataInterface() override {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Evaluate polynom with Horner scheme*/ inline double Horner(std::vector<double>& coefficients, const double tauMinusTauRef) const; diff --git a/Modules/Core/Metadata/include/otbTerraSarImageMetadataInterfaceFactory.h b/Modules/Core/Metadata/include/otbTerraSarImageMetadataInterfaceFactory.h index 2bd3f8b7f49c8f6347cdcedb565efc546b3b6a5c..3d68e5b6de4feac9e4062ed133feeb7083580f28 100644 --- a/Modules/Core/Metadata/include/otbTerraSarImageMetadataInterfaceFactory.h +++ b/Modules/Core/Metadata/include/otbTerraSarImageMetadataInterfaceFactory.h @@ -41,8 +41,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - const char* GetITKSourceVersion(void) const ITK_OVERRIDE; - const char* GetDescription(void) const ITK_OVERRIDE; + const char* GetITKSourceVersion(void) const override; + const char* GetDescription(void) const override; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -59,7 +59,7 @@ public: protected: TerraSarImageMetadataInterfaceFactory(); - ~TerraSarImageMetadataInterfaceFactory() ITK_OVERRIDE; + ~TerraSarImageMetadataInterfaceFactory() override; private: TerraSarImageMetadataInterfaceFactory(const Self &); //purposely not implemented diff --git a/Modules/Core/Metadata/include/otbWorldView2ImageMetadataInterface.h b/Modules/Core/Metadata/include/otbWorldView2ImageMetadataInterface.h index 0bcc79936a7e121411ca0c7d4ff0ea75c698bf4b..3d219588485639a79e7532190c6aa7f54cbd0d57 100644 --- a/Modules/Core/Metadata/include/otbWorldView2ImageMetadataInterface.h +++ b/Modules/Core/Metadata/include/otbWorldView2ImageMetadataInterface.h @@ -54,66 +54,66 @@ public: typedef Superclass::ImageKeywordlistType ImageKeywordlistType; /** Get the radiometric bias from the ossim metadata */ - VariableLengthVectorType GetPhysicalBias() const ITK_OVERRIDE; + VariableLengthVectorType GetPhysicalBias() const override; /** Get the radiometric gain from the ossim metadata */ - VariableLengthVectorType GetPhysicalGain() const ITK_OVERRIDE; + VariableLengthVectorType GetPhysicalGain() const override; /** Get the solar irradiance from the ossim metadata */ - VariableLengthVectorType GetSolarIrradiance() const ITK_OVERRIDE; + VariableLengthVectorType GetSolarIrradiance() const override; /** Get the imaging acquisition day from the ossim metadata : TLCTime metadata value */ - int GetDay() const ITK_OVERRIDE; + int GetDay() const override; /** Get the imaging acquisition month from the ossim metadata : TLCTime metadata value */ - int GetMonth() const ITK_OVERRIDE; + int GetMonth() const override; /** Get the imaging acquisition year from the ossim metadata : TLCTime metadata value */ - int GetYear() const ITK_OVERRIDE; + int GetYear() const override; /** Get the imaging acquisition hour from the ossim metadata : TLCTime metadata value */ - int GetHour() const ITK_OVERRIDE; + int GetHour() const override; /** Get the imaging acquisition year from the ossim metadata : TLCTime metadata value */ - int GetMinute() const ITK_OVERRIDE; + int GetMinute() const override; /** Get the imaging production day from the ossim metadata : generationTime metadata value */ - int GetProductionDay() const ITK_OVERRIDE; + int GetProductionDay() const override; /** Get the imaging production month from the ossim metadata : generationTime metadata value */ - int GetProductionMonth() const ITK_OVERRIDE; + int GetProductionMonth() const override; /** Get the imaging production year from the ossim metadata : generationTime metadata value */ - int GetProductionYear() const ITK_OVERRIDE; + int GetProductionYear() const override; /** Get the sat elevation from the ossim metadata */ - double GetSatElevation() const ITK_OVERRIDE; + double GetSatElevation() const override; /** Get the sat azimuth from the ossim metadata */ - double GetSatAzimuth() const ITK_OVERRIDE; + double GetSatAzimuth() const override; /** Get the first wavelength for the spectral band definition */ - VariableLengthVectorType GetFirstWavelengths() const ITK_OVERRIDE; + VariableLengthVectorType GetFirstWavelengths() const override; /** Get the last wavelength for the spectral band definition */ - VariableLengthVectorType GetLastWavelengths() const ITK_OVERRIDE; + VariableLengthVectorType GetLastWavelengths() const override; - bool CanRead() const ITK_OVERRIDE; + bool CanRead() const override; /** Get the 3 spectral band numbers corresponding to the default display for visualization, * in the order R, G, B */ - std::vector<unsigned int> GetDefaultDisplay() const ITK_OVERRIDE; + std::vector<unsigned int> GetDefaultDisplay() const override; /** Vector that contains the filter function value in 6S format (step of 0.0025 micro m). * There values a computed by 6S. */ - WavelengthSpectralBandVectorType GetSpectralSensitivity() const ITK_OVERRIDE; + WavelengthSpectralBandVectorType GetSpectralSensitivity() const override; /** Get the enhanced band names from band names collected by ossim */ - std::vector<std::string> GetEnhancedBandNames() const ITK_OVERRIDE; + std::vector<std::string> GetEnhancedBandNames() const override; protected: WorldView2ImageMetadataInterface(); - ~WorldView2ImageMetadataInterface() ITK_OVERRIDE {} + ~WorldView2ImageMetadataInterface() override {} private: diff --git a/Modules/Core/Metadata/include/otbWorldView2ImageMetadataInterfaceFactory.h b/Modules/Core/Metadata/include/otbWorldView2ImageMetadataInterfaceFactory.h index 597306f622cf99b151cda2692d781b90fd7a836d..b48d21fa40ef08891fc618d19cf70e16c36d6e32 100644 --- a/Modules/Core/Metadata/include/otbWorldView2ImageMetadataInterfaceFactory.h +++ b/Modules/Core/Metadata/include/otbWorldView2ImageMetadataInterfaceFactory.h @@ -41,8 +41,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - const char* GetITKSourceVersion(void) const ITK_OVERRIDE; - const char* GetDescription(void) const ITK_OVERRIDE; + const char* GetITKSourceVersion(void) const override; + const char* GetDescription(void) const override; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -60,7 +60,7 @@ public: protected: WorldView2ImageMetadataInterfaceFactory(); - ~WorldView2ImageMetadataInterfaceFactory() ITK_OVERRIDE; + ~WorldView2ImageMetadataInterfaceFactory() override; private: WorldView2ImageMetadataInterfaceFactory(const Self &); //purposely not implemented diff --git a/Modules/Core/ObjectList/include/otbDataObjectListInterface.h b/Modules/Core/ObjectList/include/otbDataObjectListInterface.h new file mode 100644 index 0000000000000000000000000000000000000000..c1a1ac722fd9398613bac3953252dcc1b8c2af0b --- /dev/null +++ b/Modules/Core/ObjectList/include/otbDataObjectListInterface.h @@ -0,0 +1,55 @@ +/* + * 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 otbDataObjectListInterface_h +#define otbDataObjectListInterface_h + +#include "itkDataObject.h" +#include <boost/noncopyable.hpp> + +namespace otb +{ + +class DataObjectListInterface : private boost::noncopyable +{ +/** \class DataObjectListInterface + * \brief This non template class is an interface that wrapp ObjectList + * + * New method that do not need the template parameter of ObjectList + * should be declare here. + * + * \ingroup OTBObjectList + */ +public: + /** + Get the nth element of the list as a DataObject *. + */ + virtual itk::DataObject * GetNthDataObject(unsigned int index) const = 0; + + virtual std::size_t Size(void) const = 0; + +protected: + DataObjectListInterface() = default ; + virtual ~DataObjectListInterface() = default ; +}; + +} // end of otb namespace + +#endif diff --git a/Modules/Core/ObjectList/include/otbImageList.h b/Modules/Core/ObjectList/include/otbImageList.h index 611d84a47a18efdb93a79085fa4a764968338ddf..cc7d167bcbc506dcc2c0c1a06661dce1528f62c1 100644 --- a/Modules/Core/ObjectList/include/otbImageList.h +++ b/Modules/Core/ObjectList/include/otbImageList.h @@ -63,18 +63,20 @@ public: /** * Update images in the list. */ - void UpdateOutputInformation(void) ITK_OVERRIDE; + void UpdateOutputInformation(void) override; void PropagateRequestedRegion(void) - throw (itk::InvalidRequestedRegionError) ITK_OVERRIDE; - void UpdateOutputData(void) ITK_OVERRIDE; + throw (itk::InvalidRequestedRegionError) override; + void UpdateOutputData(void) override; + void SetRequestedRegion(const itk::DataObject * source) override; + protected: /** Constructor */ ImageList() {}; /** Destructor */ - ~ImageList() ITK_OVERRIDE {} + ~ImageList() override {} /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + void PrintSelf(std::ostream& os, itk::Indent indent) const override { Superclass::PrintSelf(os, indent); } diff --git a/Modules/Core/ObjectList/include/otbImageList.txx b/Modules/Core/ObjectList/include/otbImageList.txx index dc0cbc9b6fef35e3430891fb9cd08a7e4324aefd..dec0ab8b3e5ce3a834ee5a6dc9a247831d432f5b 100644 --- a/Modules/Core/ObjectList/include/otbImageList.txx +++ b/Modules/Core/ObjectList/include/otbImageList.txx @@ -39,10 +39,32 @@ ImageList<TImage> || it.Get()->GetDataReleased() || it.Get()->RequestedRegionIsOutsideOfTheBufferedRegion()) { + if(it.Get()->GetSource()) + { + it.Get()->GetSource()->UpdateOutputData(it.Get()); + } + } + } +} + +template <class TImage> +void +ImageList<TImage> +::PropagateRequestedRegion() throw (itk::InvalidRequestedRegionError) + { + Superclass::PropagateRequestedRegion(); + + for (ConstIterator it = this->Begin(); it != this->End(); ++it) + { + if (it.Get()->GetUpdateMTime() < it.Get()->GetPipelineMTime() + || it.Get()->GetDataReleased() + || it.Get()->RequestedRegionIsOutsideOfTheBufferedRegion()) + { + if (it.Get()->GetSource()) { it.Get()->GetSource()->PropagateRequestedRegion(it.Get()); - + // Check that the requested region lies within the largest possible region if (!it.Get()->VerifyRequestedRegion()) { @@ -51,23 +73,24 @@ ImageList<TImage> e.SetLocation(ITK_LOCATION); e.SetDataObject(it.Get()); e.SetDescription("Requested region is (at least partially) outside the largest possible region."); - + throw e; } - - it.Get()->GetSource()->UpdateOutputData(it.Get()); } } } -} + } -template <class TImage> +template<class TImage> void ImageList<TImage> -::PropagateRequestedRegion() throw (itk::InvalidRequestedRegionError) - { - Superclass::PropagateRequestedRegion(); - } +::SetRequestedRegion(const itk::DataObject * source) +{ + for (ConstIterator it = this->Begin(); it != this->End(); ++it) + { + it.Get()->SetRequestedRegion(source); + } +} template <class TImage> void diff --git a/Modules/Core/ObjectList/include/otbImageListSource.h b/Modules/Core/ObjectList/include/otbImageListSource.h index d37f0721855eb34206ddb4fd737b9b10ffb40389..1ebbd143ef80989c8b21309a83f5a6624ec662de 100644 --- a/Modules/Core/ObjectList/include/otbImageListSource.h +++ b/Modules/Core/ObjectList/include/otbImageListSource.h @@ -65,9 +65,9 @@ protected: /** Constructor */ ImageListSource(); /** Destructor */ - ~ImageListSource() ITK_OVERRIDE {} + ~ImageListSource() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: ImageListSource(const Self &); //purposely not implemented diff --git a/Modules/Core/ObjectList/include/otbImageListToImageFilter.h b/Modules/Core/ObjectList/include/otbImageListToImageFilter.h index a322ca085af987450b13bbe4021ef8562d316f49..67c27465b62e63371957a5072edbf1f680b52eed 100644 --- a/Modules/Core/ObjectList/include/otbImageListToImageFilter.h +++ b/Modules/Core/ObjectList/include/otbImageListToImageFilter.h @@ -75,9 +75,9 @@ protected: /** Constructor */ ImageListToImageFilter(); /** Destructor */ - ~ImageListToImageFilter() ITK_OVERRIDE {} + ~ImageListToImageFilter() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: ImageListToImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Core/ObjectList/include/otbImageListToImageListApplyFilter.h b/Modules/Core/ObjectList/include/otbImageListToImageListApplyFilter.h index 9501d330787ee71247e3f4312acca8bb06c69f78..9865945dc4503f92563b52308848f3a357f59e18 100644 --- a/Modules/Core/ObjectList/include/otbImageListToImageListApplyFilter.h +++ b/Modules/Core/ObjectList/include/otbImageListToImageListApplyFilter.h @@ -81,20 +81,20 @@ public: /** Generate output information for the ImageList and for each image in the list. */ - void GenerateOutputInformation(void) ITK_OVERRIDE; + void GenerateOutputInformation(void) override; /** Generate input requested region for each image in the list. */ - void GenerateInputRequestedRegion(void) ITK_OVERRIDE; + void GenerateInputRequestedRegion(void) override; protected: /** Main computation method */ - void GenerateData(void) ITK_OVERRIDE; + void GenerateData(void) override; /** Constructor */ ImageListToImageListApplyFilter(); /** Destructor */ - ~ImageListToImageListApplyFilter() ITK_OVERRIDE {} + ~ImageListToImageListApplyFilter() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: ImageListToImageListApplyFilter(const Self &); //purposely not implemented diff --git a/Modules/Core/ObjectList/include/otbImageListToImageListFilter.h b/Modules/Core/ObjectList/include/otbImageListToImageListFilter.h index cde7284b199fb7f5d5acc25a4a11165a081a91cd..1a4838622037f7517cfdfb05898eb83195b72803 100644 --- a/Modules/Core/ObjectList/include/otbImageListToImageListFilter.h +++ b/Modules/Core/ObjectList/include/otbImageListToImageListFilter.h @@ -73,9 +73,9 @@ protected: /** Constructor */ ImageListToImageListFilter(); /** Destructor */ - ~ImageListToImageListFilter() ITK_OVERRIDE {} + ~ImageListToImageListFilter() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: ImageListToImageListFilter(const Self &); //purposely not implemented diff --git a/Modules/Core/ObjectList/include/otbImageListToSingleImageFilter.h b/Modules/Core/ObjectList/include/otbImageListToSingleImageFilter.h index 164bb2d9bd083da3d567b12c0bc15880cacf2172..d290e9e849e043e3a303b89a45e046926d178a56 100644 --- a/Modules/Core/ObjectList/include/otbImageListToSingleImageFilter.h +++ b/Modules/Core/ObjectList/include/otbImageListToSingleImageFilter.h @@ -73,13 +73,13 @@ protected: /** Constructor */ ImageListToSingleImageFilter(); /** Destructor */ - ~ImageListToSingleImageFilter() ITK_OVERRIDE {} + ~ImageListToSingleImageFilter() override {} /** Main computation method */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: diff --git a/Modules/Core/ObjectList/include/otbImageListToVectorImageFilter.h b/Modules/Core/ObjectList/include/otbImageListToVectorImageFilter.h index 7149869c746a5fc581719e3633ef11c8a2daea55..ac84491ee543d5c8dcafd322fb47e6727a9d388d 100644 --- a/Modules/Core/ObjectList/include/otbImageListToVectorImageFilter.h +++ b/Modules/Core/ObjectList/include/otbImageListToVectorImageFilter.h @@ -67,26 +67,26 @@ public: protected: /** Main computation method */ - void GenerateData(void) ITK_OVERRIDE; + void GenerateData(void) override; /** GenerateOutputInformation * Set the number of bands of the output. * Copy information from the first image of the list if existing. **/ - void GenerateOutputInformation(void) ITK_OVERRIDE; + void GenerateOutputInformation(void) override; /** * GenerateInputRequestedRegion * Set the requested region of each image in the list. */ - void GenerateInputRequestedRegion(void) ITK_OVERRIDE; + void GenerateInputRequestedRegion(void) override; /** Constructor */ ImageListToVectorImageFilter() {}; /** Destructor */ - ~ImageListToVectorImageFilter() ITK_OVERRIDE {} + ~ImageListToVectorImageFilter() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: ImageListToVectorImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Core/ObjectList/include/otbImageToImageListFilter.h b/Modules/Core/ObjectList/include/otbImageToImageListFilter.h index 26047d998e7ba6d6a475871f305d02e5871edccb..1978e6966fa2dc94c9d11f2a0b7a30ebefad6bfe 100644 --- a/Modules/Core/ObjectList/include/otbImageToImageListFilter.h +++ b/Modules/Core/ObjectList/include/otbImageToImageListFilter.h @@ -71,9 +71,9 @@ protected: /** Constructor */ ImageToImageListFilter(); /** Destructor */ - ~ImageToImageListFilter() ITK_OVERRIDE {} + ~ImageToImageListFilter() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: ImageToImageListFilter(const Self &); //purposely not implemented diff --git a/Modules/Core/ObjectList/include/otbObjectList.h b/Modules/Core/ObjectList/include/otbObjectList.h index b9db494becf30b3c3bf956c318f28c0d9a1cbc9a..80464782d4af1ccf21c9f93b13f406d4017831e6 100644 --- a/Modules/Core/ObjectList/include/otbObjectList.h +++ b/Modules/Core/ObjectList/include/otbObjectList.h @@ -23,6 +23,7 @@ #include <vector> #include "itkDataObject.h" +#include "otbDataObjectListInterface.h" #include "itkObjectFactory.h" namespace otb @@ -36,7 +37,7 @@ namespace otb * \ingroup OTBObjectList */ template <class TObject> -class ITK_EXPORT ObjectList : public itk::DataObject +class ITK_EXPORT ObjectList : public itk::DataObject , public DataObjectListInterface { public: /** Standard typedefs */ @@ -71,7 +72,7 @@ public: * Get the number of elements in the vector. * \return The number of elements in the vector. */ - InternalContainerSizeType Size(void) const; + InternalContainerSizeType Size(void) const override; /** * Resize the maximal list capacity. * \param size The new maximal size of the list. @@ -99,6 +100,11 @@ public: * \return The pointer to the nth element of the list. */ ObjectPointerType GetNthElement(unsigned int index) const; + /** + * Get the nth element of the list as a DataObject *. + * \param index The index of the object to get. + */ + Superclass * GetNthDataObject(unsigned int index) const override; /** * Return the first element of the list. * \return The first element of the list. @@ -462,7 +468,7 @@ public: friend class ConstIterator; friend class ReverseIterator; /** typedef of the internal iterator */ - typedef typename InternalContainerType::reverse_iterator InternalReverseConstIteratorType; + typedef typename InternalContainerType::const_reverse_iterator InternalReverseConstIteratorType; /** Constructor */ ReverseConstIterator() {}; /** Constructor with iternal iterator parameter */ @@ -600,9 +606,9 @@ protected: /** Constructor */ ObjectList(); /** Destructor */ - ~ObjectList() ITK_OVERRIDE {} + ~ObjectList() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: ObjectList(const Self &); //purposely not implemented diff --git a/Modules/Core/ObjectList/include/otbObjectList.txx b/Modules/Core/ObjectList/include/otbObjectList.txx index 26044b1432f2023d2c34ecbdb57afa8374bab3e3..84f600c6fd2480db7c8dfedca12e923fa602f7da 100644 --- a/Modules/Core/ObjectList/include/otbObjectList.txx +++ b/Modules/Core/ObjectList/include/otbObjectList.txx @@ -162,6 +162,16 @@ ObjectList<TObject> } return m_InternalContainer[index]; } + +template <class TObject> +typename ObjectList<TObject>::Superclass * +ObjectList<TObject> +::GetNthDataObject(unsigned int index) const +{ + + return dynamic_cast<itk::DataObject *> ( GetNthElement(index).GetPointer() ); +} + /** * Return the first element of the list. * \return The first element of the list. @@ -236,7 +246,11 @@ typename ObjectList<TObject>::ReverseIterator ObjectList<TObject> ::Insert(ReverseIterator position, ObjectPointerType element) { - ReverseIterator iter(m_InternalContainer.insert(position.GetIter(), element)); + ReverseIterator iter( + InternalContainerType::reverse_iterator( + m_InternalContainer.insert(position.GetIter().base(), element) + ) + ); this->Modified(); return iter; } diff --git a/Modules/Core/ObjectList/include/otbObjectListSource.h b/Modules/Core/ObjectList/include/otbObjectListSource.h index 183c90c93def6b1d26646f5c0cb6a18de0ac2775..586bd3535a4d4649e2a93f9eaaf5c0e85879a110 100644 --- a/Modules/Core/ObjectList/include/otbObjectListSource.h +++ b/Modules/Core/ObjectList/include/otbObjectListSource.h @@ -79,7 +79,7 @@ public: * SmartPointer to a DataObject. If a subclass of ImageSource has * multiple outputs of different types, then that class must provide * an implementation of MakeOutput(). */ - DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override; using Superclass::MakeOutput; /** Graft the specified DataObject onto this ProcessObject's output. @@ -173,9 +173,9 @@ protected: /** Constructor */ ObjectListSource(); /** Destructor */ - ~ObjectListSource() ITK_OVERRIDE {} + ~ObjectListSource() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Ensure that the output lists are cleared before processing */ virtual void AllocateOutputs(); @@ -190,7 +190,7 @@ protected: * * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ - void GenerateData(void) ITK_OVERRIDE; + void GenerateData(void) override; private: ObjectListSource(const Self &); //purposely not implemented diff --git a/Modules/Core/ObjectList/include/otbObjectListSource.txx b/Modules/Core/ObjectList/include/otbObjectListSource.txx index 20163671fee565e858966d3b7963fc244ad4d521..10bf6116a74291525a213f5beab47d32844f4128 100644 --- a/Modules/Core/ObjectList/include/otbObjectListSource.txx +++ b/Modules/Core/ObjectList/include/otbObjectListSource.txx @@ -145,7 +145,7 @@ void ObjectListSource<TOutputList> ::GenerateData(void) { - itkExceptionMacro("subclass should ITK_OVERRIDE this method!!!"); + itkExceptionMacro("subclass should override this method!!!"); } /** diff --git a/Modules/Core/ObjectList/include/otbObjectListToObjectListFilter.h b/Modules/Core/ObjectList/include/otbObjectListToObjectListFilter.h index 28ee8ea75e246b8d2fc384eb58ab5e49fe461d1b..1b8bfec0ec7bd27269569c3a656637dd3b255156 100644 --- a/Modules/Core/ObjectList/include/otbObjectListToObjectListFilter.h +++ b/Modules/Core/ObjectList/include/otbObjectListToObjectListFilter.h @@ -77,11 +77,11 @@ protected: /** Constructor */ ObjectListToObjectListFilter(); /** Destructor */ - ~ObjectListToObjectListFilter() ITK_OVERRIDE {} + ~ObjectListToObjectListFilter() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; - void GenerateData(void) ITK_OVERRIDE; + void GenerateData(void) override; /** Multi-threading implementation */ diff --git a/Modules/Core/ObjectList/include/otbObjectListToObjectListFilter.txx b/Modules/Core/ObjectList/include/otbObjectListToObjectListFilter.txx index 471131c726f270d7eb335778ceb7004c5f10156f..2104ebf4eae5afea2711d8c35894923df68464c0 100644 --- a/Modules/Core/ObjectList/include/otbObjectListToObjectListFilter.txx +++ b/Modules/Core/ObjectList/include/otbObjectListToObjectListFilter.txx @@ -134,12 +134,12 @@ ObjectListToObjectListFilter<TInputList, TOutputList> ::ThreadedGenerateData(unsigned int /*startIndex*/, unsigned int /*stopIndex*/, itk::ThreadIdType /*threadId*/) { // The following code is equivalent to: - // itkExceptionMacro("subclass should ITK_OVERRIDE this method!!!"); + // itkExceptionMacro("subclass should override this method!!!"); // The ExceptionMacro is not used because gcc warns that a // 'noreturn' function does return std::ostringstream message; message << "itk::ERROR: " << this->GetNameOfClass() - << "(" << this << "): " << "Subclass should ITK_OVERRIDE this method!!!"; + << "(" << this << "): " << "Subclass should override this method!!!"; itk::ExceptionObject e_(__FILE__, __LINE__, message.str().c_str(), ITK_LOCATION); throw e_; diff --git a/Modules/Core/ObjectList/include/otbUnaryFunctorObjectListBooleanFilter.h b/Modules/Core/ObjectList/include/otbUnaryFunctorObjectListBooleanFilter.h index 46985fc3bdd757c3bcaa5b3b90c8b72dc30fdf41..8f6fa80b675e902c01397df9c463ea4db44cb814 100644 --- a/Modules/Core/ObjectList/include/otbUnaryFunctorObjectListBooleanFilter.h +++ b/Modules/Core/ObjectList/include/otbUnaryFunctorObjectListBooleanFilter.h @@ -93,15 +93,15 @@ public: protected: UnaryFunctorObjectListBooleanFilter(); - ~UnaryFunctorObjectListBooleanFilter() ITK_OVERRIDE {} + ~UnaryFunctorObjectListBooleanFilter() override {} /** Multi-threading implementation */ - void AfterThreadedGenerateData() ITK_OVERRIDE; + void AfterThreadedGenerateData() override; /** startIndex and stopIndex represent the indices of the Objects to examine in thread threadId */ - void ThreadedGenerateData(unsigned int startIndex, unsigned int stopIndex, itk::ThreadIdType threadId) ITK_OVERRIDE; + void ThreadedGenerateData(unsigned int startIndex, unsigned int stopIndex, itk::ThreadIdType threadId) override; /** Internal structure used for passing image data into the threading library */ struct ThreadStruct diff --git a/Modules/Core/ObjectList/include/otbUnaryFunctorObjectListFilter.h b/Modules/Core/ObjectList/include/otbUnaryFunctorObjectListFilter.h index 3b8a023dce28e31be3cc6facaddb1bac08c1b4a2..bf101d61818fd6f45307c2588316d6ce43cbf433 100644 --- a/Modules/Core/ObjectList/include/otbUnaryFunctorObjectListFilter.h +++ b/Modules/Core/ObjectList/include/otbUnaryFunctorObjectListFilter.h @@ -94,15 +94,15 @@ public: protected: UnaryFunctorObjectListFilter(); - ~UnaryFunctorObjectListFilter() ITK_OVERRIDE {} + ~UnaryFunctorObjectListFilter() override {} /** Multi-threading implementation */ - void AfterThreadedGenerateData() ITK_OVERRIDE; + void AfterThreadedGenerateData() override; /** startIndex and stopIndex represent the indices of the Objects to examine in thread threadId */ - void ThreadedGenerateData(unsigned int startIndex, unsigned int stopIndex, itk::ThreadIdType threadId) ITK_OVERRIDE; + void ThreadedGenerateData(unsigned int startIndex, unsigned int stopIndex, itk::ThreadIdType threadId) override; /** End Multi-threading implementation */ diff --git a/Modules/Core/ObjectList/include/otbVectorImageToImageListFilter.h b/Modules/Core/ObjectList/include/otbVectorImageToImageListFilter.h index fe62ef5cc55339848336a28549a0e1e382c7cd72..dc864f192cea57f2325dad1018a98630984afb5d 100644 --- a/Modules/Core/ObjectList/include/otbVectorImageToImageListFilter.h +++ b/Modules/Core/ObjectList/include/otbVectorImageToImageListFilter.h @@ -67,22 +67,22 @@ public: typedef typename OutputImageType::Pointer OutputImagePointerType; /** Generate the input requested region from the first element in the list. */ - void GenerateInputRequestedRegion(void) ITK_OVERRIDE; + void GenerateInputRequestedRegion(void) override; /** Generate the output information by building the output list. */ - void GenerateOutputInformation(void) ITK_OVERRIDE; + void GenerateOutputInformation(void) override; protected: /** Main computation method */ - void GenerateData(void) ITK_OVERRIDE; + void GenerateData(void) override; /** Constructor */ VectorImageToImageListFilter() {}; /** Destructor */ - ~VectorImageToImageListFilter() ITK_OVERRIDE {} + ~VectorImageToImageListFilter() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: VectorImageToImageListFilter(const Self &); //purposely not implemented diff --git a/Modules/Core/PointSet/include/otbImageToPointSetFilter.h b/Modules/Core/PointSet/include/otbImageToPointSetFilter.h index f200163aef92ce716c2768aac3c009eda44708e2..c14ed78b7752a8a6c5d8efbc12d545e14fdf7921 100644 --- a/Modules/Core/PointSet/include/otbImageToPointSetFilter.h +++ b/Modules/Core/PointSet/include/otbImageToPointSetFilter.h @@ -79,14 +79,14 @@ public: const InputImageType * GetInput(); /** Prepare the output */ - void GenerateOutputInformation(void) ITK_OVERRIDE; + void GenerateOutputInformation(void) override; protected: ImageToPointSetFilter(); - ~ImageToPointSetFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~ImageToPointSetFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; - void GenerateData(void) ITK_OVERRIDE; + void GenerateData(void) override; /** Multi-threading implementation */ diff --git a/Modules/Core/PointSet/include/otbImageToPointSetFilter.txx b/Modules/Core/PointSet/include/otbImageToPointSetFilter.txx index 405aa2a2b203bbe8487f383e6e89f78bd44029aa..91e3d755f64f0a2dec6013795c31293f4006cbd8 100644 --- a/Modules/Core/PointSet/include/otbImageToPointSetFilter.txx +++ b/Modules/Core/PointSet/include/otbImageToPointSetFilter.txx @@ -259,12 +259,12 @@ ImageToPointSetFilter<TInputImage, TOutputPointSet> ::ThreadedGenerateData(const InputImageRegionType&, itk::ThreadIdType) { // The following code is equivalent to: - // itkExceptionMacro("subclass should ITK_OVERRIDE this method!!!"); + // itkExceptionMacro("subclass should override this method!!!"); // The ExceptionMacro is not used because gcc warns that a // 'noreturn' function does return std::ostringstream message; message << "itk::ERROR: " << this->GetNameOfClass() - << "(" << this << "): " << "Subclass should ITK_OVERRIDE this method!!!"; + << "(" << this << "): " << "Subclass should override this method!!!"; itk::ExceptionObject e_(__FILE__, __LINE__, message.str().c_str(), ITK_LOCATION); throw e_; diff --git a/Modules/Core/PointSet/include/otbPointSetExtractROI.h b/Modules/Core/PointSet/include/otbPointSetExtractROI.h index 76e3c757c011aeff35c5019b0c2c57584b33f7a2..158bfae6f745e705f21693443a6838193de54479 100644 --- a/Modules/Core/PointSet/include/otbPointSetExtractROI.h +++ b/Modules/Core/PointSet/include/otbPointSetExtractROI.h @@ -78,11 +78,11 @@ public: protected: PointSetExtractROI(); - ~PointSetExtractROI() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~PointSetExtractROI() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Generate Requested Data */ - void GenerateData(void) ITK_OVERRIDE; + void GenerateData(void) override; private: PointSetExtractROI(const PointSetExtractROI &); //purposely not implemented diff --git a/Modules/Core/PointSet/include/otbPointSetFunction.h b/Modules/Core/PointSet/include/otbPointSetFunction.h index a13340f2839c49e89a41875e028080df93b9e502..785753bac21c639a2ebbb301fc47c3679e43fa21 100644 --- a/Modules/Core/PointSet/include/otbPointSetFunction.h +++ b/Modules/Core/PointSet/include/otbPointSetFunction.h @@ -71,9 +71,9 @@ public: protected: PointSetFunction(); - ~PointSetFunction() ITK_OVERRIDE {} + ~PointSetFunction() override {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: PointSetFunction(const Self &); //purposely not implemented diff --git a/Modules/Core/PointSet/include/otbPointSetSource.h b/Modules/Core/PointSet/include/otbPointSetSource.h index 8a545d4bbea96a0cc24c4ae0548b11d93af26094..601c8b65dbe63fe9a4dc2de8cdc0788dd390c025 100644 --- a/Modules/Core/PointSet/include/otbPointSetSource.h +++ b/Modules/Core/PointSet/include/otbPointSetSource.h @@ -125,18 +125,18 @@ public: * SmartPointer to a DataObject. If a subclass of MeshSource has * multiple outputs of different types, then that class must provide * an implementation of MakeOutput(). */ - DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override; using Superclass::MakeOutput; protected: PointSetSource(); - ~PointSetSource() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~PointSetSource() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Requested region of Point Set is specified as i of N unstructured regions. * Since all DataObjects should be able to set the requested region in * unstructured form, just copy output->RequestedRegion all inputs. */ - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; private: PointSetSource(const Self &); //purposely not implemented diff --git a/Modules/Core/PointSet/include/otbPointSetToPointSetFilter.h b/Modules/Core/PointSet/include/otbPointSetToPointSetFilter.h index f208cb6140aa6f466da2ecec6dac83a2d806771d..bbe2091f4bc3500ebb0b69e385900191a2d4568c 100644 --- a/Modules/Core/PointSet/include/otbPointSetToPointSetFilter.h +++ b/Modules/Core/PointSet/include/otbPointSetToPointSetFilter.h @@ -73,8 +73,8 @@ public: protected: PointSetToPointSetFilter(); - ~PointSetToPointSetFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~PointSetToPointSetFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: PointSetToPointSetFilter(const PointSetToPointSetFilter &); //purposely not implemented diff --git a/Modules/Core/PointSet/include/otbRandomPointSetSource.h b/Modules/Core/PointSet/include/otbRandomPointSetSource.h index 34f3ad64f210169f51012c136a8881e8f86b060c..e84e807a0abfe1d295bd390d1cef6a1f67b56877 100644 --- a/Modules/Core/PointSet/include/otbRandomPointSetSource.h +++ b/Modules/Core/PointSet/include/otbRandomPointSetSource.h @@ -87,9 +87,9 @@ public: protected: RandomPointSetSource(); - ~RandomPointSetSource() ITK_OVERRIDE {} + ~RandomPointSetSource() override {} - void GenerateData(void) ITK_OVERRIDE; + void GenerateData(void) override; private: RandomPointSetSource(const Self &); //purposely not implemented diff --git a/Modules/Core/PointSet/include/otbThresholdImageToPointSetFilter.h b/Modules/Core/PointSet/include/otbThresholdImageToPointSetFilter.h index 0115bbef31d7ebeddc6febc3104651c1808aca68..b3a7fca7078fe762589381479a7fc49d2aef04f3 100644 --- a/Modules/Core/PointSet/include/otbThresholdImageToPointSetFilter.h +++ b/Modules/Core/PointSet/include/otbThresholdImageToPointSetFilter.h @@ -84,11 +84,11 @@ public: protected: ThresholdImageToPointSetFilter(); - ~ThresholdImageToPointSetFilter() ITK_OVERRIDE {} + ~ThresholdImageToPointSetFilter() override {} - void ThreadedGenerateData(const InputImageRegionType& inputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void ThreadedGenerateData(const InputImageRegionType& inputRegionForThread, itk::ThreadIdType threadId) override; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: ThresholdImageToPointSetFilter(const Self &); //purposely not implemented diff --git a/Modules/Core/PointSet/include/otbTransformPointSetFilter.h b/Modules/Core/PointSet/include/otbTransformPointSetFilter.h index 16f9c5e920bfaf62a649825326eb41cf0e886461..06867c5a98c4ee60bc2ee3e071850de3475bf6ef 100644 --- a/Modules/Core/PointSet/include/otbTransformPointSetFilter.h +++ b/Modules/Core/PointSet/include/otbTransformPointSetFilter.h @@ -75,11 +75,11 @@ public: protected: TransformPointSetFilter(); - ~TransformPointSetFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~TransformPointSetFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Generate Requested Data */ - void GenerateData(void) ITK_OVERRIDE; + void GenerateData(void) override; /** Transform to apply to all the PointSet points. */ typename TransformType::Pointer m_Transform; diff --git a/Modules/Core/SpatialObjects/include/otbDrawLineSpatialObjectFilter.h b/Modules/Core/SpatialObjects/include/otbDrawLineSpatialObjectFilter.h index 6001dec77a2819f7b80d0e9f9bb985faae971fea..fd49d3ec5ead9cc22fba5877c7517fa8931c476f 100644 --- a/Modules/Core/SpatialObjects/include/otbDrawLineSpatialObjectFilter.h +++ b/Modules/Core/SpatialObjects/include/otbDrawLineSpatialObjectFilter.h @@ -101,10 +101,10 @@ public: protected: DrawLineSpatialObjectFilter(); - ~DrawLineSpatialObjectFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~DrawLineSpatialObjectFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; private: DrawLineSpatialObjectFilter(const Self &); //purposely not implemented diff --git a/Modules/Core/SpatialObjects/include/otbDrawLineSpatialObjectListFilter.h b/Modules/Core/SpatialObjects/include/otbDrawLineSpatialObjectListFilter.h index 74e752e0438d14fa0c6422925dd22ca63916b67e..72a6854b6ec17c1d1d5a5b891aa32ed36d963a86 100644 --- a/Modules/Core/SpatialObjects/include/otbDrawLineSpatialObjectListFilter.h +++ b/Modules/Core/SpatialObjects/include/otbDrawLineSpatialObjectListFilter.h @@ -92,10 +92,10 @@ public: protected: DrawLineSpatialObjectListFilter(); - ~DrawLineSpatialObjectListFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~DrawLineSpatialObjectListFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; - void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) override; /** * compute the intersection of the segment to draw with the region diff --git a/Modules/Core/SpatialObjects/include/otbImageToLineSpatialObjectListFilter.h b/Modules/Core/SpatialObjects/include/otbImageToLineSpatialObjectListFilter.h index 673ada59a9eb4fc30dfafc7b39809892744e49a4..f4af3ce59b931ce1e8adafa1663010d1f60d2527 100644 --- a/Modules/Core/SpatialObjects/include/otbImageToLineSpatialObjectListFilter.h +++ b/Modules/Core/SpatialObjects/include/otbImageToLineSpatialObjectListFilter.h @@ -85,8 +85,8 @@ public: protected: ImageToLineSpatialObjectListFilter(); - ~ImageToLineSpatialObjectListFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~ImageToLineSpatialObjectListFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: ImageToLineSpatialObjectListFilter(const Self &); //purposely not implemented diff --git a/Modules/Core/SpatialObjects/include/otbLineSpatialObject.h b/Modules/Core/SpatialObjects/include/otbLineSpatialObject.h index a4adf2d0548ce1eb525d6b1804eb484455d12961..536f2b305be1f4a17fc999359a0375847560f723 100644 --- a/Modules/Core/SpatialObjects/include/otbLineSpatialObject.h +++ b/Modules/Core/SpatialObjects/include/otbLineSpatialObject.h @@ -74,19 +74,19 @@ public: void SetPoints(PointListType& newPoints); /** Return a point in the list given the index */ - const SpatialObjectPointType* GetPoint(IdentifierType id) const ITK_OVERRIDE + const SpatialObjectPointType* GetPoint(IdentifierType id) const override { return &(m_Points[id]); } /** Return a point in the list given the index */ - SpatialObjectPointType* GetPoint(IdentifierType id) ITK_OVERRIDE + SpatialObjectPointType* GetPoint(IdentifierType id) override { return &(m_Points[id]); } /** Return the number of points in the list */ - SizeValueType GetNumberOfPoints(void) const ITK_OVERRIDE + SizeValueType GetNumberOfPoints(void) const override { return m_Points.size(); } @@ -94,18 +94,18 @@ public: /** Returns true if the line is evaluable at the requested point, * false otherwise. */ bool IsEvaluableAt(const PointType& point, - unsigned int depth = 0, char * name = ITK_NULLPTR) const ITK_OVERRIDE; + unsigned int depth = 0, char * name = ITK_NULLPTR) const override; /** Returns the value of the line at that point. * Currently this function returns a binary value, * but it might want to return a degree of membership * in case of fuzzy Lines. */ bool ValueAt(const PointType& point, double& value, - unsigned int depth = 0, char * name = ITK_NULLPTR) const ITK_OVERRIDE; + unsigned int depth = 0, char * name = ITK_NULLPTR) const override; /** Returns true if the point is inside the line, false otherwise. */ bool IsInside(const PointType& point, - unsigned int depth, char * name) const ITK_OVERRIDE; + unsigned int depth, char * name) const override; /** Test whether a point is inside or outside the object * For computational speed purposes, it is faster if the method does not @@ -113,15 +113,15 @@ public: virtual bool IsInside(const PointType& point) const; /** Compute the boundaries of the line.*/ - bool ComputeLocalBoundingBox() const ITK_OVERRIDE; + bool ComputeLocalBoundingBox() const override; protected: /** Constructor */ LineSpatialObject(); /** Destructor */ - ~LineSpatialObject() ITK_OVERRIDE; + ~LineSpatialObject() override; /** Method to print the object. */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: LineSpatialObject(const Self &); //purposely not implemented diff --git a/Modules/Core/SpatialObjects/include/otbLineSpatialObjectList.h b/Modules/Core/SpatialObjects/include/otbLineSpatialObjectList.h index 794b1efdc69b8b70a6adc80b864fdf3f845da267..c1ab636cb3b4bad147a2f39ab4e4ea7ee646ebc0 100644 --- a/Modules/Core/SpatialObjects/include/otbLineSpatialObjectList.h +++ b/Modules/Core/SpatialObjects/include/otbLineSpatialObjectList.h @@ -58,7 +58,7 @@ public: protected: LineSpatialObjectList() {}; - ~LineSpatialObjectList() ITK_OVERRIDE {} + ~LineSpatialObjectList() override {} private: LineSpatialObjectList(const Self &); //purposely not implemented diff --git a/Modules/Core/SpatialObjects/include/otbLineSpatialObjectListToPointSetFilter.h b/Modules/Core/SpatialObjects/include/otbLineSpatialObjectListToPointSetFilter.h index 9d15dcf2197e4c88fb3fb7f204468ac269d8dfb1..9da17bfef6ee4c72d96feacf671c5feca1006c13 100644 --- a/Modules/Core/SpatialObjects/include/otbLineSpatialObjectListToPointSetFilter.h +++ b/Modules/Core/SpatialObjects/include/otbLineSpatialObjectListToPointSetFilter.h @@ -74,8 +74,8 @@ public: protected: LineSpatialObjectListToPointSetFilter(); - ~LineSpatialObjectListToPointSetFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~LineSpatialObjectListToPointSetFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: LineSpatialObjectListToPointSetFilter(const Self &); //purposely not implemented diff --git a/Modules/Core/SpatialObjects/include/otbSpatialObjectSource.h b/Modules/Core/SpatialObjects/include/otbSpatialObjectSource.h index 05a54394645475430a355602b9ea9862205dc905..fadfaff42ab6263640e67554600c6df3bd175cdf 100644 --- a/Modules/Core/SpatialObjects/include/otbSpatialObjectSource.h +++ b/Modules/Core/SpatialObjects/include/otbSpatialObjectSource.h @@ -67,9 +67,9 @@ protected: /** Constructor */ SpatialObjectSource(); /** Destructor */ - ~SpatialObjectSource() ITK_OVERRIDE {} + ~SpatialObjectSource() override {} /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: SpatialObjectSource(const Self &); //purposely not implemented diff --git a/Modules/Core/SpatialObjects/include/otbSpatialObjectToImageDrawingFilter.h b/Modules/Core/SpatialObjects/include/otbSpatialObjectToImageDrawingFilter.h index aa10112f6e976d9a640e8b6ffc499c8e1700edc4..26326dc30cf2edcadfc65755397caa3c26600f6a 100644 --- a/Modules/Core/SpatialObjects/include/otbSpatialObjectToImageDrawingFilter.h +++ b/Modules/Core/SpatialObjects/include/otbSpatialObjectToImageDrawingFilter.h @@ -140,10 +140,10 @@ public: protected: SpatialObjectToImageDrawingFilter(); - ~SpatialObjectToImageDrawingFilter() ITK_OVERRIDE; + ~SpatialObjectToImageDrawingFilter() override; - void GenerateOutputInformation() ITK_OVERRIDE; // do nothing - void GenerateData() ITK_OVERRIDE; + void GenerateOutputInformation() override; // do nothing + void GenerateData() override; SizeType m_Size; double m_Spacing[OutputImageDimension]; @@ -153,7 +153,7 @@ protected: ValueType m_OutsideValue; bool m_UseObjectValue; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: SpatialObjectToImageDrawingFilter(const Self &); //purposely not implemented diff --git a/Modules/Core/Streaming/include/otbNumberOfDivisionsStrippedStreamingManager.h b/Modules/Core/Streaming/include/otbNumberOfDivisionsStrippedStreamingManager.h index e1045bcdc1bb5c21f5a96046a0ba87cfa7c520af..10283c7db89a51f110380291b965771e437b5eb8 100644 --- a/Modules/Core/Streaming/include/otbNumberOfDivisionsStrippedStreamingManager.h +++ b/Modules/Core/Streaming/include/otbNumberOfDivisionsStrippedStreamingManager.h @@ -68,11 +68,11 @@ public: itkGetMacro(NumberOfDivisions, unsigned int); /** Actually computes the stream divisions given a DataObject and its region to write */ - void PrepareStreaming(itk::DataObject * /*input*/, const RegionType ®ion) ITK_OVERRIDE; + void PrepareStreaming(itk::DataObject * /*input*/, const RegionType ®ion) override; protected: NumberOfDivisionsStrippedStreamingManager(); - ~NumberOfDivisionsStrippedStreamingManager() ITK_OVERRIDE; + ~NumberOfDivisionsStrippedStreamingManager() override; /** The splitter type used to generate the different strips */ typedef itk::ImageRegionSplitterSlowDimension SplitterType; diff --git a/Modules/Core/Streaming/include/otbNumberOfDivisionsTiledStreamingManager.h b/Modules/Core/Streaming/include/otbNumberOfDivisionsTiledStreamingManager.h index 0b72ca8f92c80af7943832e1ed6e25c374999d6a..270dc471e7017e756068eecffaaa784f8f1d50d1 100644 --- a/Modules/Core/Streaming/include/otbNumberOfDivisionsTiledStreamingManager.h +++ b/Modules/Core/Streaming/include/otbNumberOfDivisionsTiledStreamingManager.h @@ -67,11 +67,11 @@ public: itkGetMacro(NumberOfDivisions, unsigned int); /** Actually computes the stream divisions given a DataObject and its region to write */ - void PrepareStreaming(itk::DataObject * input, const RegionType ®ion) ITK_OVERRIDE; + void PrepareStreaming(itk::DataObject * input, const RegionType ®ion) override; protected: NumberOfDivisionsTiledStreamingManager(); - ~NumberOfDivisionsTiledStreamingManager() ITK_OVERRIDE; + ~NumberOfDivisionsTiledStreamingManager() override; /** The number of lines per strip desired by the user. * This may be different than the one computed by the Splitter */ diff --git a/Modules/Core/Streaming/include/otbNumberOfLinesStrippedStreamingManager.h b/Modules/Core/Streaming/include/otbNumberOfLinesStrippedStreamingManager.h index a6b5c1bf2d85fe26a1a2535bdb5030ffbf907d44..6426c858b62e6de2aa328a051d11adb2b91a3cd3 100644 --- a/Modules/Core/Streaming/include/otbNumberOfLinesStrippedStreamingManager.h +++ b/Modules/Core/Streaming/include/otbNumberOfLinesStrippedStreamingManager.h @@ -69,11 +69,11 @@ public: /** Actually computes the stream divisions, according to the specified streaming mode, * eventually using the input parameter to estimate memory consumption */ - void PrepareStreaming(itk::DataObject * /*input*/, const RegionType ®ion) ITK_OVERRIDE; + void PrepareStreaming(itk::DataObject * /*input*/, const RegionType ®ion) override; protected: NumberOfLinesStrippedStreamingManager(); - ~NumberOfLinesStrippedStreamingManager() ITK_OVERRIDE; + ~NumberOfLinesStrippedStreamingManager() override; /** The splitter type used to generate the different strips */ typedef itk::ImageRegionSplitter<itkGetStaticConstMacro(ImageDimension)> SplitterType; diff --git a/Modules/Core/Streaming/include/otbPersistentFilterStreamingDecorator.h b/Modules/Core/Streaming/include/otbPersistentFilterStreamingDecorator.h index 47c08879e6f974f82d90eaf9fb0c8c7a6d543981..692848d8332cdd05fa6c02e548aa720ec3523aae 100644 --- a/Modules/Core/Streaming/include/otbPersistentFilterStreamingDecorator.h +++ b/Modules/Core/Streaming/include/otbPersistentFilterStreamingDecorator.h @@ -73,17 +73,17 @@ public: itkGetConstObjectMacro(Filter, FilterType); itkGetObjectMacro(Streamer, StreamerType); - void Update(void) ITK_OVERRIDE; + void Update(void) override; protected: /** Constructor */ PersistentFilterStreamingDecorator(); /** Destructor */ - ~PersistentFilterStreamingDecorator() ITK_OVERRIDE {} + ~PersistentFilterStreamingDecorator() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; - void GenerateData(void) ITK_OVERRIDE; + void GenerateData(void) override; /// Object responsible for streaming StreamerPointerType m_Streamer; diff --git a/Modules/Core/Streaming/include/otbPersistentImageFilter.h b/Modules/Core/Streaming/include/otbPersistentImageFilter.h index 69267fd73082bf9963a98aa863806f1791fdd483..f40159b95ec7d10afd7ba4452c9619f531175bbf 100644 --- a/Modules/Core/Streaming/include/otbPersistentImageFilter.h +++ b/Modules/Core/Streaming/include/otbPersistentImageFilter.h @@ -73,9 +73,9 @@ protected: /** Constructor */ PersistentImageFilter() {} /** Destructor */ - ~PersistentImageFilter() ITK_OVERRIDE {} + ~PersistentImageFilter() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + void PrintSelf(std::ostream& os, itk::Indent indent) const override { Superclass::PrintSelf(os, indent); } diff --git a/Modules/Core/Streaming/include/otbPipelineMemoryPrintCalculator.h b/Modules/Core/Streaming/include/otbPipelineMemoryPrintCalculator.h index 826478711d24b2c9ab3ac7e75d4e8586354c8afb..bda15b231d1f51cb876a8539b78371eff9c79f02 100644 --- a/Modules/Core/Streaming/include/otbPipelineMemoryPrintCalculator.h +++ b/Modules/Core/Streaming/include/otbPipelineMemoryPrintCalculator.h @@ -114,24 +114,24 @@ public: itkSetObjectMacro(DataToWrite, DataObjectType); /** Compute pipeline memory print */ - void Compute(); + void Compute(bool propagate=true); /** Const conversion factor */ static const double ByteToMegabyte; static const double MegabyteToByte; /** Evaluate the print (in bytes) of a single data object */ - MemoryPrintType EvaluateDataObjectPrint(DataObjectType * data) const; + MemoryPrintType EvaluateDataObjectPrint(DataObjectType * data); protected: /** Constructor */ PipelineMemoryPrintCalculator(); /** Destructor */ - ~PipelineMemoryPrintCalculator() ITK_OVERRIDE; + ~PipelineMemoryPrintCalculator() override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Recursive method to evaluate memory print in bytes */ MemoryPrintType EvaluateProcessObjectPrintRecursive(ProcessObjectType * process); diff --git a/Modules/Core/Streaming/include/otbRAMDrivenAdaptativeStreamingManager.h b/Modules/Core/Streaming/include/otbRAMDrivenAdaptativeStreamingManager.h index 2fd479680324e3e5d6cb16ea0ec4cc7d2389fecf..2ddeccf21547d0f37b79972354a7f5a078406892 100644 --- a/Modules/Core/Streaming/include/otbRAMDrivenAdaptativeStreamingManager.h +++ b/Modules/Core/Streaming/include/otbRAMDrivenAdaptativeStreamingManager.h @@ -83,11 +83,11 @@ public: /** Actually computes the stream divisions, according to the specified streaming mode, * eventually using the input parameter to estimate memory consumption */ - void PrepareStreaming(itk::DataObject * input, const RegionType ®ion) ITK_OVERRIDE; + void PrepareStreaming(itk::DataObject * input, const RegionType ®ion) override; protected: RAMDrivenAdaptativeStreamingManager(); - ~RAMDrivenAdaptativeStreamingManager() ITK_OVERRIDE; + ~RAMDrivenAdaptativeStreamingManager() override; /** The number of MegaBytes of RAM available */ unsigned int m_AvailableRAMInMB; diff --git a/Modules/Core/Streaming/include/otbRAMDrivenAdaptativeStreamingManager.txx b/Modules/Core/Streaming/include/otbRAMDrivenAdaptativeStreamingManager.txx index 07dcdbd82dbac30b545398f9e17f7af23bc38e53..743d5de28151ab5a78646e113ff5217b7b1296b1 100644 --- a/Modules/Core/Streaming/include/otbRAMDrivenAdaptativeStreamingManager.txx +++ b/Modules/Core/Streaming/include/otbRAMDrivenAdaptativeStreamingManager.txx @@ -72,7 +72,7 @@ RAMDrivenAdaptativeStreamingManager<TImage>::PrepareStreaming( itk::DataObject * this->m_Splitter = splitter; this->m_ComputedNumberOfSplits = this->m_Splitter->GetNumberOfSplits(region, nbDivisions); - otbMsgDevMacro(<< "Number of split : " << this->m_ComputedNumberOfSplits) + this->m_Region = region; } diff --git a/Modules/Core/Streaming/include/otbRAMDrivenStrippedStreamingManager.h b/Modules/Core/Streaming/include/otbRAMDrivenStrippedStreamingManager.h index 1fc33b9ac1dbcf6961e50b1d1a631c724b1dd0cb..332c2610d29417bbc27bd05df00831d4f8f03762 100644 --- a/Modules/Core/Streaming/include/otbRAMDrivenStrippedStreamingManager.h +++ b/Modules/Core/Streaming/include/otbRAMDrivenStrippedStreamingManager.h @@ -78,11 +78,11 @@ public: /** Actually computes the stream divisions, according to the specified streaming mode, * eventually using the input parameter to estimate memory consumption */ - void PrepareStreaming(itk::DataObject * input, const RegionType ®ion) ITK_OVERRIDE; + void PrepareStreaming(itk::DataObject * input, const RegionType ®ion) override; protected: RAMDrivenStrippedStreamingManager(); - ~RAMDrivenStrippedStreamingManager() ITK_OVERRIDE; + ~RAMDrivenStrippedStreamingManager() override; /** The splitter type used to generate the different strips */ typedef itk::ImageRegionSplitter<itkGetStaticConstMacro(ImageDimension)> SplitterType; diff --git a/Modules/Core/Streaming/include/otbRAMDrivenTiledStreamingManager.h b/Modules/Core/Streaming/include/otbRAMDrivenTiledStreamingManager.h index 6ea176b708b6d399b43da34cfa3540be80b5bece..d5b40a858c5790102815ad80135984cdc79ddb02 100644 --- a/Modules/Core/Streaming/include/otbRAMDrivenTiledStreamingManager.h +++ b/Modules/Core/Streaming/include/otbRAMDrivenTiledStreamingManager.h @@ -77,11 +77,11 @@ public: /** Actually computes the stream divisions, according to the specified streaming mode, * eventually using the input parameter to estimate memory consumption */ - void PrepareStreaming(itk::DataObject * input, const RegionType ®ion) ITK_OVERRIDE; + void PrepareStreaming(itk::DataObject * input, const RegionType ®ion) override; protected: RAMDrivenTiledStreamingManager(); - ~RAMDrivenTiledStreamingManager() ITK_OVERRIDE; + ~RAMDrivenTiledStreamingManager() override; /** The number of MegaBytes of RAM available */ unsigned int m_AvailableRAMInMB; diff --git a/Modules/Core/Streaming/include/otbStreamingImageVirtualWriter.h b/Modules/Core/Streaming/include/otbStreamingImageVirtualWriter.h index feff1c60c5f9fc4d22bb40fe105df908a63345fd..29fafc6bf528190377325ff63be8fb2e5b67664b 100644 --- a/Modules/Core/Streaming/include/otbStreamingImageVirtualWriter.h +++ b/Modules/Core/Streaming/include/otbStreamingImageVirtualWriter.h @@ -24,6 +24,7 @@ #include "itkMacro.h" #include "itkImageToImageFilter.h" #include "otbStreamingManager.h" +#include "itkFastMutexLock.h" namespace otb { @@ -140,18 +141,23 @@ public: /** Override Update() from ProcessObject * This filter does not produce an output */ - void Update() ITK_OVERRIDE; + void Update() override; + + /** This override doesn't return a const ref on the actual boolean */ + const bool & GetAbortGenerateData() const override; + + void SetAbortGenerateData(const bool val) override; protected: StreamingImageVirtualWriter(); - ~StreamingImageVirtualWriter() ITK_OVERRIDE; + ~StreamingImageVirtualWriter() override; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; - void GenerateData(void) ITK_OVERRIDE; + void GenerateData(void) override; - void GenerateInputRequestedRegion(void) ITK_OVERRIDE; + void GenerateInputRequestedRegion(void) override; private: StreamingImageVirtualWriter(const StreamingImageVirtualWriter &); //purposely not implemented @@ -186,6 +192,9 @@ private: bool m_IsObserving; unsigned long m_ObserverID; + + /** Lock to ensure thread-safety (added for the AbortGenerateData flag) */ + itk::SimpleFastMutexLock m_Lock; }; } // end namespace otb diff --git a/Modules/Core/Streaming/include/otbStreamingImageVirtualWriter.txx b/Modules/Core/Streaming/include/otbStreamingImageVirtualWriter.txx index b4fc50fbfacba49a145987ad00fdc73a6d80dd82..7336993ed392de64e980c05a7178fdc4cbe66ca7 100644 --- a/Modules/Core/Streaming/include/otbStreamingImageVirtualWriter.txx +++ b/Modules/Core/Streaming/include/otbStreamingImageVirtualWriter.txx @@ -32,6 +32,7 @@ #include "otbTileDimensionTiledStreamingManager.h" #include "otbRAMDrivenTiledStreamingManager.h" #include "otbRAMDrivenAdaptativeStreamingManager.h" +#include "otbUtils.h" namespace otb { @@ -182,6 +183,8 @@ void StreamingImageVirtualWriter<TInputImage> ::GenerateData(void) { + otb::Logger::Instance()->LogSetupInformation(); + /** * Prepare all the outputs. This may deallocate previous bulk data. */ @@ -227,11 +230,11 @@ StreamingImageVirtualWriter<TInputImage> m_ObserverID = source->AddObserver(itk::ProgressEvent(), command); m_IsObserving = true; } - else - { - itkWarningMacro(<< "Could not get the source process object. Progress report might be buggy"); - } + const auto firstSplitSize = m_StreamingManager->GetSplit(0).GetSize(); + otbLogMacro(Info,<<"Estimation will be performed in "<<m_NumberOfDivisions<<" blocks of "<<firstSplitSize[0]<<"x"<<firstSplitSize[1]<<" pixels"); + + /** * Loop over the number of pieces, execute the upstream pipeline on each * piece, and copy the results into the output image. @@ -242,7 +245,6 @@ StreamingImageVirtualWriter<TInputImage> m_CurrentDivision++, m_DivisionProgress = 0, this->UpdateFilterProgress()) { streamRegion = m_StreamingManager->GetSplit(m_CurrentDivision); - otbMsgDevMacro(<< "Processing region : " << streamRegion ) //inputPtr->ReleaseData(); //inputPtr->SetRequestedRegion(streamRegion); //inputPtr->Update(); @@ -259,6 +261,13 @@ StreamingImageVirtualWriter<TInputImage> { this->UpdateProgress(1.0); } + else + { + itk::ProcessAborted e(__FILE__, __LINE__); + e.SetLocation(ITK_LOCATION); + e.SetDescription("Image streaming has been aborted"); + throw e; + } // Notify end event observers this->InvokeEvent(itk::EndEvent()); @@ -286,6 +295,27 @@ StreamingImageVirtualWriter<TInputImage> this->ReleaseInputs(); } +template <class TInputImage> +const bool & +StreamingImageVirtualWriter<TInputImage> +::GetAbortGenerateData() const +{ + m_Lock.Lock(); + bool ret = Superclass::GetAbortGenerateData(); + m_Lock.Unlock(); + if (ret) return otb::Utils::TrueConstant; + return otb::Utils::FalseConstant; +} + +template <class TInputImage> +void +StreamingImageVirtualWriter<TInputImage> +::SetAbortGenerateData(bool val) +{ + m_Lock.Lock(); + Superclass::SetAbortGenerateData(val); + m_Lock.Unlock(); +} } // end namespace otb diff --git a/Modules/Core/Streaming/include/otbStreamingManager.h b/Modules/Core/Streaming/include/otbStreamingManager.h index 2095e48e8f8199a9d8882a6fb2b690f7b9cbb012..0bffd7e95779c755c41e2a94a276a72360845e1d 100644 --- a/Modules/Core/Streaming/include/otbStreamingManager.h +++ b/Modules/Core/Streaming/include/otbStreamingManager.h @@ -67,6 +67,7 @@ public: typedef typename ImageType::InternalPixelType PixelType; typedef otb::PipelineMemoryPrintCalculator::MemoryPrintType MemoryPrintType; + typedef itk::ImageRegionSplitterBase AbstractSplitterType; /** Type macro */ itkTypeMacro(StreamingManager, itk::LightObject); @@ -74,6 +75,8 @@ public: /** Dimension of input image. */ itkStaticConstMacro(ImageDimension, unsigned int, ImageType::ImageDimension); + const AbstractSplitterType * GetSplitter() const; + /** Actually computes the stream divisions, according to the specified streaming mode, * eventually using the input parameter to estimate memory consumption */ virtual void PrepareStreaming(itk::DataObject * input, const RegionType ®ion) = 0; @@ -88,9 +91,12 @@ public: * GetNumberOfSplits() returns. */ virtual RegionType GetSplit(unsigned int i); + itkSetMacro(DefaultRAM, MemoryPrintType); + itkGetMacro(DefaultRAM, MemoryPrintType); + protected: StreamingManager(); - ~StreamingManager() ITK_OVERRIDE; + ~StreamingManager() override; virtual unsigned int EstimateOptimalNumberOfDivisions(itk::DataObject * input, const RegionType ®ion, MemoryPrintType availableRAMInMB, @@ -103,7 +109,6 @@ protected: RegionType m_Region; /** The splitter used to compute the different strips */ - typedef itk::ImageRegionSplitterBase AbstractSplitterType; typedef typename AbstractSplitterType::Pointer AbstractSplitterPointerType; AbstractSplitterPointerType m_Splitter; @@ -111,11 +116,13 @@ private: StreamingManager(const StreamingManager &); //purposely not implemented void operator =(const StreamingManager&); //purposely not implemented - /* Compute the available RAM from configuration settings if the input parameter is 0, - * otherwise, simply returns the input parameter */ + /** Compute the available RAM in Bytes from an input value in MByte. + * If the input value is 0, it uses the m_DefaultRAM value. + * If m_DefaultRAM is also 0, it uses the configuration settings */ MemoryPrintType GetActualAvailableRAMInBytes(MemoryPrintType availableRAMInMB); - + /** Default available RAM in MB */ + MemoryPrintType m_DefaultRAM; }; } // End namespace otb diff --git a/Modules/Core/Streaming/include/otbStreamingManager.txx b/Modules/Core/Streaming/include/otbStreamingManager.txx index b0fdfced068fffe79695afedc671b6f7d3d22d67..9d2f3ddbd8243ed40946058cafe96d6060d2926d 100644 --- a/Modules/Core/Streaming/include/otbStreamingManager.txx +++ b/Modules/Core/Streaming/include/otbStreamingManager.txx @@ -31,6 +31,7 @@ namespace otb template <class TImage> StreamingManager<TImage>::StreamingManager() : m_ComputedNumberOfSplits(0) + , m_DefaultRAM(0) { } @@ -39,6 +40,13 @@ StreamingManager<TImage>::~StreamingManager() { } +template <class TImage> +const typename StreamingManager<TImage>::AbstractSplitterType * +StreamingManager<TImage>::GetSplitter() const +{ + return m_Splitter; +} + template <class TImage> typename StreamingManager<TImage>::MemoryPrintType StreamingManager<TImage>::GetActualAvailableRAMInBytes(MemoryPrintType availableRAMInMB) @@ -47,12 +55,16 @@ StreamingManager<TImage>::GetActualAvailableRAMInBytes(MemoryPrintType available if (availableRAMInBytes == 0) { - otbMsgDevMacro(<< "Retrieving available RAM size from configuration"); - // Retrieve it from the configuration - availableRAMInBytes = 1024*1024*ConfigurationManager::GetMaxRAMHint(); + if (m_DefaultRAM != 0) + { + availableRAMInBytes = 1024*1024*m_DefaultRAM; + } + else + { + // Retrieve it from the configuration + availableRAMInBytes = 1024*1024*ConfigurationManager::GetMaxRAMHint(); + } } - - otbMsgDevMacro("RAM used to estimate memory footprint : " << availableRAMInBytes / 1024 / 1024 << " MB") return availableRAMInBytes; } @@ -62,8 +74,6 @@ StreamingManager<TImage>::EstimateOptimalNumberOfDivisions(itk::DataObject * inp MemoryPrintType availableRAM, double bias) { - otbMsgDevMacro(<< "availableRAM " << availableRAM) - MemoryPrintType availableRAMInBytes = GetActualAvailableRAMInBytes(availableRAM); otb::PipelineMemoryPrintCalculator::Pointer memoryPrintCalculator; @@ -103,7 +113,6 @@ StreamingManager<TImage>::EstimateOptimalNumberOfDivisions(itk::DataObject * inp if (smallRegionSuccess) { - otbMsgDevMacro("Using an extract to estimate memory : " << smallRegion) // the region is well behaved, inside the largest possible region memoryPrintCalculator->SetDataToWrite(extractFilter->GetOutput() ); @@ -114,7 +123,6 @@ StreamingManager<TImage>::EstimateOptimalNumberOfDivisions(itk::DataObject * inp } else { - otbMsgDevMacro("Using the input region to estimate memory : " << region) // the region is not well behaved // use the full region memoryPrintCalculator->SetDataToWrite(input); @@ -148,11 +156,8 @@ StreamingManager<TImage>::EstimateOptimalNumberOfDivisions(itk::DataObject * inp unsigned int optimalNumberOfDivisions = otb::PipelineMemoryPrintCalculator::EstimateOptimalNumberOfStreamDivisions(pipelineMemoryPrint, availableRAMInBytes); - otbMsgDevMacro( "Estimated Memory print for the full image : " - << static_cast<unsigned int>(pipelineMemoryPrint * otb::PipelineMemoryPrintCalculator::ByteToMegabyte ) << std::endl) - otbMsgDevMacro( "Optimal number of stream divisions: " - << optimalNumberOfDivisions << std::endl) - + otbLogMacro(Info,<<"Estimated memory for full processing: "<<pipelineMemoryPrint * otb::PipelineMemoryPrintCalculator::ByteToMegabyte<<"MB (avail.: "<<availableRAMInBytes * otb::PipelineMemoryPrintCalculator::ByteToMegabyte<<" MB), optimal image partitioning: "<<optimalNumberOfDivisions<<" blocks"); + return optimalNumberOfDivisions; } diff --git a/Modules/Core/Streaming/include/otbTileDimensionTiledStreamingManager.h b/Modules/Core/Streaming/include/otbTileDimensionTiledStreamingManager.h index 0bb3ee36dd0ef947f571d4c3db196e1f9d155e9b..a4286febb0361ccb687d85cdf4d81cd665d61656 100644 --- a/Modules/Core/Streaming/include/otbTileDimensionTiledStreamingManager.h +++ b/Modules/Core/Streaming/include/otbTileDimensionTiledStreamingManager.h @@ -72,11 +72,11 @@ public: /** Actually computes the stream divisions, according to the specified streaming mode, * eventually using the input parameter to estimate memory consumption */ - void PrepareStreaming(itk::DataObject * input, const RegionType ®ion) ITK_OVERRIDE; + void PrepareStreaming(itk::DataObject * input, const RegionType ®ion) override; protected: TileDimensionTiledStreamingManager(); - ~TileDimensionTiledStreamingManager() ITK_OVERRIDE; + ~TileDimensionTiledStreamingManager() override; /** The number of lines per strip desired by the user. * This may be different than the one computed by the Splitter */ diff --git a/Modules/Core/Streaming/src/otbPipelineMemoryPrintCalculator.cxx b/Modules/Core/Streaming/src/otbPipelineMemoryPrintCalculator.cxx index 033c58bc379fed6aba092e28e346b1d58ab35b84..4d629c4c6932fbf9ac8e108f6d92c938b2a6b64f 100644 --- a/Modules/Core/Streaming/src/otbPipelineMemoryPrintCalculator.cxx +++ b/Modules/Core/Streaming/src/otbPipelineMemoryPrintCalculator.cxx @@ -71,15 +71,18 @@ PipelineMemoryPrintCalculator void PipelineMemoryPrintCalculator -::Compute() +::Compute(bool propagate) { // Clear the visited process objects set m_VisitedProcessObjects.clear(); // Dry run of pipeline synchronisation - m_DataToWrite->UpdateOutputInformation(); - m_DataToWrite->SetRequestedRegionToLargestPossibleRegion(); - m_DataToWrite->PropagateRequestedRegion(); + if (propagate) + { + m_DataToWrite->UpdateOutputInformation(); + m_DataToWrite->SetRequestedRegionToLargestPossibleRegion(); + m_DataToWrite->PropagateRequestedRegion(); + } // Get the source process object ProcessObjectType * source = m_DataToWrite->GetSource(); @@ -105,7 +108,7 @@ PipelineMemoryPrintCalculator::MemoryPrintType PipelineMemoryPrintCalculator ::EvaluateProcessObjectPrintRecursive(ProcessObjectType * process) { - otbMsgDevMacro(<< "EvaluateMemoryPrint for " << process->GetNameOfClass() << " (" << process << ")") + otbLogMacro(Debug,<<"Recursive evaluation of memory print for ProcessObject" << process->GetNameOfClass() << " (" << process << ")"); // This variable will store the final print MemoryPrintType print = 0; @@ -162,10 +165,11 @@ PipelineMemoryPrintCalculator PipelineMemoryPrintCalculator::MemoryPrintType PipelineMemoryPrintCalculator -::EvaluateDataObjectPrint(DataObjectType * data) const +::EvaluateDataObjectPrint(DataObjectType * data) { - otbMsgDevMacro(<< "EvaluateMemoryPrint for " << data->GetNameOfClass() << " (" << data << ")") - + + otbLogMacro(Debug,<<"Evaluation of memory print for DataObject " << data->GetNameOfClass() << " (" << data << ")"); + #define OTB_IMAGE_SIZE_BLOCK(type) \ if(dynamic_cast<itk::Image<type, 2> *>(data) != NULL) \ { \ @@ -183,11 +187,13 @@ PipelineMemoryPrintCalculator { \ ImageList<Image<type, 2> > * imageList = dynamic_cast<otb::ImageList<otb::Image<type, 2> > *>(data); \ MemoryPrintType print(0); \ - for(ImageList<Image<type, 2> >::ConstIterator it = imageList->Begin(); \ + for(ImageList<Image<type, 2> >::Iterator it = imageList->Begin(); \ it != imageList->End(); ++it) \ { \ - print += it.Get()->GetRequestedRegion().GetNumberOfPixels() \ - * it.Get()->GetNumberOfComponentsPerPixel() * sizeof(type); \ + if(it.Get()->GetSource()) \ + print += this->EvaluateProcessObjectPrintRecursive(it.Get()->GetSource());\ + else \ + print += this->EvaluateDataObjectPrint(it.Get()); \ } \ return print; \ } \ @@ -198,8 +204,10 @@ PipelineMemoryPrintCalculator for(ImageList<VectorImage<type, 2> >::ConstIterator it = imageList->Begin(); \ it != imageList->End(); ++it) \ { \ - print += it.Get()->GetRequestedRegion().GetNumberOfPixels() \ - * it.Get()->GetNumberOfComponentsPerPixel() * sizeof(type); \ + if(it.Get()->GetSource()) \ + print += this->EvaluateProcessObjectPrintRecursive(it.Get()->GetSource());\ + else \ + print += this->EvaluateDataObjectPrint(it.Get()); \ } \ return print; \ } \ diff --git a/Modules/Core/Transform/include/otbCompositeTransform.h b/Modules/Core/Transform/include/otbCompositeTransform.h index 3a5e8a643e35dff75004c1354b2efe2bb4337b26..f638c972335b9f833dd41ea45562d2ef36236616 100644 --- a/Modules/Core/Transform/include/otbCompositeTransform.h +++ b/Modules/Core/Transform/include/otbCompositeTransform.h @@ -118,7 +118,7 @@ public: itkGetConstReferenceMacro(SecondTransform, SecondTransformPointerType); /** Method to transform a point. */ - SecondTransformOutputPointType TransformPoint(const FirstTransformInputPointType&) const ITK_OVERRIDE; + SecondTransformOutputPointType TransformPoint(const FirstTransformInputPointType&) const override; /** Method to transform a vector. */ // virtual OutputVectorType TransformVector(const InputVectorType &) const; @@ -131,7 +131,7 @@ public: protected: CompositeTransform(); - ~CompositeTransform() ITK_OVERRIDE; + ~CompositeTransform() override; FirstTransformPointerType m_FirstTransform; SecondTransformPointerType m_SecondTransform; diff --git a/Modules/Core/Transform/include/otbForwardSensorModel.h b/Modules/Core/Transform/include/otbForwardSensorModel.h index eb09f6f2094ae44d9f14faf1dcae33f427c00156..c15842667466ecf61249ecbde81cbebde1f20936 100644 --- a/Modules/Core/Transform/include/otbForwardSensorModel.h +++ b/Modules/Core/Transform/include/otbForwardSensorModel.h @@ -74,14 +74,14 @@ public: itkStaticConstMacro(OutputSpaceDimension, unsigned int, NOutputDimensions); /** Compute the world coordinates. */ - OutputPointType TransformPoint(const InputPointType& point) const ITK_OVERRIDE; + OutputPointType TransformPoint(const InputPointType& point) const override; protected: ForwardSensorModel(); - ~ForwardSensorModel() ITK_OVERRIDE; + ~ForwardSensorModel() override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: diff --git a/Modules/Core/Transform/include/otbGenericMapProjection.h b/Modules/Core/Transform/include/otbGenericMapProjection.h index d7030760b47399069b2b16309ce06847b04a1d40..4e6d5f15ff3621384cd10bb84a8dfb1c14be0b6b 100644 --- a/Modules/Core/Transform/include/otbGenericMapProjection.h +++ b/Modules/Core/Transform/include/otbGenericMapProjection.h @@ -98,7 +98,7 @@ public: virtual void PrintMap() const; - OutputPointType TransformPoint(const InputPointType& point) const ITK_OVERRIDE; + OutputPointType TransformPoint(const InputPointType& point) const override; virtual bool InstantiateProjection(); @@ -111,9 +111,9 @@ public: protected: GenericMapProjection(); - ~GenericMapProjection() ITK_OVERRIDE; + ~GenericMapProjection() override; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; MapProjectionAdapter::Pointer m_MapProjection; diff --git a/Modules/Core/Transform/include/otbGenericRSTransform.h b/Modules/Core/Transform/include/otbGenericRSTransform.h index aac8f9468435e2b2b8e57508fcabcaa4278d316a..35f0bc7cde4fbed8eddaeebcee1d4f922d596b6f 100644 --- a/Modules/Core/Transform/include/otbGenericRSTransform.h +++ b/Modules/Core/Transform/include/otbGenericRSTransform.h @@ -168,31 +168,31 @@ public: /** Methods prototypes */ virtual const TransformType * GetTransform() const; - OutputPointType TransformPoint(const InputPointType& point) const ITK_OVERRIDE; + OutputPointType TransformPoint(const InputPointType& point) const override; virtual void InstantiateTransform(); // Get inverse methods bool GetInverse(Self * inverseTransform) const; - InverseTransformBasePointer GetInverseTransform() const ITK_OVERRIDE; + InverseTransformBasePointer GetInverseTransform() const override; // Dummy set parameter method - void SetParameters(const typename Superclass::ParametersType &) ITK_OVERRIDE {} + void SetParameters(const typename Superclass::ParametersType &) override {} // Dummy ComputeJacobianWithRespectToParameters method - void ComputeJacobianWithRespectToParameters(const InputPointType &, JacobianType& ) const ITK_OVERRIDE {} + void ComputeJacobianWithRespectToParameters(const InputPointType &, JacobianType& ) const override {} protected: GenericRSTransform(); - ~GenericRSTransform() ITK_OVERRIDE {} + ~GenericRSTransform() override {} - void Modified() const ITK_OVERRIDE + void Modified() const override { this->Superclass::Modified(); m_TransformUpToDate = false; } - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: GenericRSTransform(const Self &); //purposely not implemented diff --git a/Modules/Core/Transform/include/otbGeocentricTransform.h b/Modules/Core/Transform/include/otbGeocentricTransform.h index c7874d5413600917d46996b0c2ba5f867bcc2c5b..9d53f04f14136d02c08b51b9611381046b41126c 100644 --- a/Modules/Core/Transform/include/otbGeocentricTransform.h +++ b/Modules/Core/Transform/include/otbGeocentricTransform.h @@ -66,11 +66,11 @@ public: itkStaticConstMacro(SpaceDimension, unsigned int, NInputDimensions); itkStaticConstMacro(ParametersDimension, unsigned int, NInputDimensions * (NInputDimensions + 1)); - OutputPointType TransformPoint(const InputPointType& point) const ITK_OVERRIDE; + OutputPointType TransformPoint(const InputPointType& point) const override; protected: GeocentricTransform(); - ~GeocentricTransform() ITK_OVERRIDE; + ~GeocentricTransform() override; EllipsoidAdapter::Pointer m_Ellipsoid; private: diff --git a/Modules/Core/Transform/include/otbImageToGenericRSOutputParameters.h b/Modules/Core/Transform/include/otbImageToGenericRSOutputParameters.h index 27742733b67b9ad06bd3705b4f3e2555ff6e0420..79850a27d9ab2c86c2c957bdb63869e5f55b44db 100644 --- a/Modules/Core/Transform/include/otbImageToGenericRSOutputParameters.h +++ b/Modules/Core/Transform/include/otbImageToGenericRSOutputParameters.h @@ -163,7 +163,7 @@ public: protected: ImageToGenericRSOutputParameters(); - ~ImageToGenericRSOutputParameters() ITK_OVERRIDE {} + ~ImageToGenericRSOutputParameters() override {} private: ImageToGenericRSOutputParameters(const Self&); //purposely not implemented diff --git a/Modules/Core/Transform/include/otbInverseLogPolarTransform.h b/Modules/Core/Transform/include/otbInverseLogPolarTransform.h index 99b220d91a7d2b43b0f272d5b7193f03fd4ecc78..14d60db886f406eae1b8e1125d055c4e049682e8 100644 --- a/Modules/Core/Transform/include/otbInverseLogPolarTransform.h +++ b/Modules/Core/Transform/include/otbInverseLogPolarTransform.h @@ -83,50 +83,50 @@ public: * Set the transform parameters through the standard interface. * \param parameters The parameters of the transform. */ - void SetParameters(const ParametersType& parameters) ITK_OVERRIDE; + void SetParameters(const ParametersType& parameters) override; /** * Get the transform parameters through the standard interface. * \return The parameters of the transform. */ - ParametersType& GetParameters(void) const ITK_OVERRIDE; + ParametersType& GetParameters(void) const override; /** * Set the Fixed Parameters * \param param The fixed parameters of the transform. */ - void SetFixedParameters( const ParametersType & param) ITK_OVERRIDE + void SetFixedParameters( const ParametersType & param) override { this->m_FixedParameters = param; } /** * Get the Fixed Parameters * \return The Fixed parameters of the transform. */ - const ParametersType& GetFixedParameters(void) const ITK_OVERRIDE{return this->m_FixedParameters; } + const ParametersType& GetFixedParameters(void) const override{return this->m_FixedParameters; } /** * Transform a point. * \param point The point to transform. * \return The transformed point. */ using Superclass::TransformVector; - OutputPointType TransformPoint(const InputPointType& point) const ITK_OVERRIDE; + OutputPointType TransformPoint(const InputPointType& point) const override; /** * Transform a vector representing a point. * \param vector The point to transform. * \return The transformed point. */ - OutputVectorType TransformVector(const InputVectorType& vector) const ITK_OVERRIDE; + OutputVectorType TransformVector(const InputVectorType& vector) const override; /** * Transform a vnl vector representing a point. * \param vector The point to transform. * \return The transformed point. */ - OutputVnlVectorType TransformVector(const InputVnlVectorType& vector) const ITK_OVERRIDE; + OutputVnlVectorType TransformVector(const InputVnlVectorType& vector) const override; protected: /** Constructor */ InverseLogPolarTransform(); /** Destructor */ - ~InverseLogPolarTransform() ITK_OVERRIDE; + ~InverseLogPolarTransform() override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: InverseLogPolarTransform(const Self &); // purposely not implemented diff --git a/Modules/Core/Transform/include/otbInverseSensorModel.h b/Modules/Core/Transform/include/otbInverseSensorModel.h index 92461591c541793dcfe3df6232dc877b4b8821fb..acb24a2f5ebbdb76cb24f8e2384003e023fe1db7 100644 --- a/Modules/Core/Transform/include/otbInverseSensorModel.h +++ b/Modules/Core/Transform/include/otbInverseSensorModel.h @@ -74,16 +74,16 @@ public: itkStaticConstMacro(OutputSpaceDimension, unsigned int, NOutputDimensions); // Transform of geographic point in image sensor index - OutputPointType TransformPoint(const InputPointType& point) const ITK_OVERRIDE; + OutputPointType TransformPoint(const InputPointType& point) const override; // Transform of geographic point in image sensor index -- Backward Compatibility // OutputPointType TransformPoint(const InputPointType &point, double height) const; protected: InverseSensorModel(); - ~InverseSensorModel() ITK_OVERRIDE; + ~InverseSensorModel() override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: diff --git a/Modules/Core/Transform/include/otbLogPolarTransform.h b/Modules/Core/Transform/include/otbLogPolarTransform.h index 19081e97be2e3b95dbabd8b369afd01bd26a9d9f..110595ffa993af2cadea4bb3ab449d88652cac23 100644 --- a/Modules/Core/Transform/include/otbLogPolarTransform.h +++ b/Modules/Core/Transform/include/otbLogPolarTransform.h @@ -84,53 +84,53 @@ public: * Set the transform parameters through the standard interface. * \param parameters The parameters of the transform. */ - void SetParameters(const ParametersType& parameters) ITK_OVERRIDE; + void SetParameters(const ParametersType& parameters) override; /** * Get the transform parameters through the standard interface. * \return The parameters of the transform. */ - ParametersType& GetParameters(void) const ITK_OVERRIDE; + ParametersType& GetParameters(void) const override; /** * Set the Fixed Parameters * \param param The fixed parameters of the transform. */ - void SetFixedParameters( const ParametersType & param) ITK_OVERRIDE + void SetFixedParameters( const ParametersType & param) override { this->m_FixedParameters = param; } /** * Get the Fixed Parameters * \return The Fixed parameters of the transform. */ - const ParametersType& GetFixedParameters(void) const ITK_OVERRIDE{return this->m_FixedParameters; } + const ParametersType& GetFixedParameters(void) const override{return this->m_FixedParameters; } /** * Transform a point. * \param point The point to transform. * \return The transformed point. */ - OutputPointType TransformPoint(const InputPointType& point) const ITK_OVERRIDE; + OutputPointType TransformPoint(const InputPointType& point) const override; /** * Transform a vector representing a point. * \param vector The point to transform. * \return The transformed point. */ using Superclass::TransformVector; - OutputVectorType TransformVector(const InputVectorType& vector) const ITK_OVERRIDE; + OutputVectorType TransformVector(const InputVectorType& vector) const override; /** * Transform a vnl vector representing a point. * \param vector The point to transform. * \return The transformed point. */ - OutputVnlVectorType TransformVector(const InputVnlVectorType& vector) const ITK_OVERRIDE; + OutputVnlVectorType TransformVector(const InputVnlVectorType& vector) const override; protected: /** Constructor */ LogPolarTransform(); /** Destructor */ - ~LogPolarTransform() ITK_OVERRIDE; + ~LogPolarTransform() override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: LogPolarTransform(const Self &); // purposely not implemented diff --git a/Modules/Core/Transform/include/otbSensorModelBase.h b/Modules/Core/Transform/include/otbSensorModelBase.h index 07d4e2353f9aa75e5b10245299b6d7b445960d1b..f2ae212e5dc0a142a9308bfd4934891466d5bf34 100644 --- a/Modules/Core/Transform/include/otbSensorModelBase.h +++ b/Modules/Core/Transform/include/otbSensorModelBase.h @@ -92,10 +92,10 @@ public: protected: SensorModelBase(); - ~SensorModelBase() ITK_OVERRIDE; + ~SensorModelBase() override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** ImageKeywordlist */ ImageKeywordlist m_ImageKeywordlist; diff --git a/Modules/Core/Transform/include/otbStreamingWarpImageFilter.h b/Modules/Core/Transform/include/otbStreamingWarpImageFilter.h index 97a32a5701e1dabd1e78ba1aaf5f2aa7d8eb2fa2..41b7058b528737bcd5ee371a129ee32a496e8ed8 100644 --- a/Modules/Core/Transform/include/otbStreamingWarpImageFilter.h +++ b/Modules/Core/Transform/include/otbStreamingWarpImageFilter.h @@ -96,22 +96,22 @@ protected: /** Constructor */ StreamingWarpImageFilter(); /** Destructor */ - ~StreamingWarpImageFilter() ITK_OVERRIDE {} + ~StreamingWarpImageFilter() override {} /** PrintSelf */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** * This filters requires only a part of the input and of the displacement field to * produce its output. As such, we need to overload the GenerateInputRequestedRegion() method. */ - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; /** * Re-implement the method ThreadedGenerateData to mask area outside the deformation grid */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId ) ITK_OVERRIDE; + itk::ThreadIdType threadId ) override; private: StreamingWarpImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Core/Transform/include/otbTransform.h b/Modules/Core/Transform/include/otbTransform.h index 41e90ac5ec8a85e708b2c1e7ce6744a0c2b49bda..17dd9e92e0a17362eb1f65b4ec2eca25e799aa92 100644 --- a/Modules/Core/Transform/include/otbTransform.h +++ b/Modules/Core/Transform/include/otbTransform.h @@ -58,10 +58,10 @@ public: itkStaticConstMacro(OutputSpaceDimension, unsigned int, NOutputDimensions); /** Get the size of the input space */ - unsigned int GetInputSpaceDimension(void) const ITK_OVERRIDE { return NInputDimensions; } + unsigned int GetInputSpaceDimension(void) const override { return NInputDimensions; } /** Get the size of the output space */ - unsigned int GetOutputSpaceDimension(void) const ITK_OVERRIDE { return NOutputDimensions; } + unsigned int GetOutputSpaceDimension(void) const override { return NOutputDimensions; } /** Type of the scalar representing coordinate and vector elements. */ typedef TScalarType ScalarType; @@ -98,12 +98,12 @@ public: /** Method to transform a point. */ - OutputPointType TransformPoint(const InputPointType & ) const ITK_OVERRIDE + OutputPointType TransformPoint(const InputPointType & ) const override { return OutputPointType(); } using Superclass::TransformVector; /** Method to transform a vector. */ - OutputVectorType TransformVector(const InputVectorType &) const ITK_OVERRIDE + OutputVectorType TransformVector(const InputVectorType &) const override { return OutputVectorType(); } /** Method to transform a vnl_vector. */ @@ -113,7 +113,7 @@ public: using Superclass::TransformCovariantVector; /** Method to transform a CovariantVector. */ OutputCovariantVectorType TransformCovariantVector( - const InputCovariantVectorType &) const ITK_OVERRIDE + const InputCovariantVectorType &) const override { return OutputCovariantVectorType(); } @@ -124,12 +124,12 @@ public: * SetParametersByValue. * \sa SetParametersByValue */ - void SetParameters( const ParametersType & ) ITK_OVERRIDE - { itkExceptionMacro( << "Subclasses should ITK_OVERRIDE this method (SetParameters)" ) } + void SetParameters( const ParametersType & ) override + { itkExceptionMacro( << "Subclasses should override this method (SetParameters)" ) } - void ComputeJacobianWithRespectToParameters(const InputPointType &, JacobianType& ) const ITK_OVERRIDE + void ComputeJacobianWithRespectToParameters(const InputPointType &, JacobianType& ) const override { - itkExceptionMacro(<< "Subclasses should ITK_OVERRIDE this method (ComputeJacobianWithRespectToParameters)" ); + itkExceptionMacro(<< "Subclasses should override this method (ComputeJacobianWithRespectToParameters)" ); } /** Set the transformation parameters and update internal transformation. @@ -139,23 +139,23 @@ public: * by keeping a reference to the parameters. * \sa SetParameters */ - void SetParametersByValue(const ParametersType & p) ITK_OVERRIDE + void SetParametersByValue(const ParametersType & p) override { this->SetParameters (p); } /** Get the Transformation Parameters. */ - const ParametersType & GetParameters(void) const ITK_OVERRIDE + const ParametersType & GetParameters(void) const override { return m_Parameters; } /** Set the fixed parameters and update internal transformation. */ - void SetFixedParameters( const ParametersType & ) ITK_OVERRIDE - { itkExceptionMacro( << "Subclasses should ITK_OVERRIDE this method (SetFixedParameters)" ) } + void SetFixedParameters( const ParametersType & ) override + { itkExceptionMacro( << "Subclasses should override this method (SetFixedParameters)" ) } /** Get the Fixed Parameters. */ - const ParametersType& GetFixedParameters(void) const ITK_OVERRIDE + const ParametersType& GetFixedParameters(void) const override { - itkExceptionMacro( << "Subclasses should ITK_OVERRIDE this method (GetFixedParameters)" ); + itkExceptionMacro( << "Subclasses should override this method (GetFixedParameters)" ); // Next line is needed to avoid errors due to: // "function must return a value". return this->m_FixedParameters; @@ -190,14 +190,14 @@ public: * */ virtual const JacobianType & GetJacobian(const InputPointType &) const { - itkExceptionMacro( << "Subclass should ITK_OVERRIDE this method (GetJacobian)" ); + itkExceptionMacro( << "Subclass should override this method (GetJacobian)" ); // Next line is needed to avoid errors due to: // "function must return a value" . return this->m_Jacobian; } /** Return the number of parameters that completely define the Transfom */ - NumberOfParametersType GetNumberOfParameters(void) const ITK_OVERRIDE + NumberOfParametersType GetNumberOfParameters(void) const override { return this->m_Parameters.Size(); } protected: @@ -208,9 +208,9 @@ protected: : Superclass::Transform(numberOfParameters) {} - ~Transform() ITK_OVERRIDE {} + ~Transform() override {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + void PrintSelf(std::ostream& os, itk::Indent indent) const override { Superclass::PrintSelf(os, indent); #if 0 diff --git a/Modules/Core/VectorDataBase/include/otbDataNode.h b/Modules/Core/VectorDataBase/include/otbDataNode.h index b1669467fcf06d16bbb50493e0588a9512393984..f3752c8c88398204a525301c40e028906b54b498 100644 --- a/Modules/Core/VectorDataBase/include/otbDataNode.h +++ b/Modules/Core/VectorDataBase/include/otbDataNode.h @@ -290,9 +290,9 @@ protected: /** Constructor */ DataNode(); /** Destructor */ - ~DataNode() ITK_OVERRIDE {} + ~DataNode() override {} /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; OGRGeometry* ConvertDataNodeToOGRGeometry(const DataNode* dataNode); diff --git a/Modules/Core/VectorDataBase/include/otbDataNodeFunctionBase.h b/Modules/Core/VectorDataBase/include/otbDataNodeFunctionBase.h index b3264ded63516c0e08451cb9fc88d0efb2714a47..33016b73da44cd0cc28519ae3ee8858314e8b798 100644 --- a/Modules/Core/VectorDataBase/include/otbDataNodeFunctionBase.h +++ b/Modules/Core/VectorDataBase/include/otbDataNodeFunctionBase.h @@ -32,7 +32,7 @@ namespace otb * the abstract method Evaluate() maps a DataNode from the input space to a element * in the output space. * - * Subclasses must ITK_OVERRIDE Evaluate(). + * Subclasses must override Evaluate(). * * This class is template over the input DataNode type and * the output (range) type. @@ -66,11 +66,11 @@ public: typedef TOutput OutputType; /** Evaluate at the specified input position */ - OutputType Evaluate( const DataNodeType& node ) const ITK_OVERRIDE = 0; + OutputType Evaluate( const DataNodeType& node ) const override = 0; protected: DataNodeFunctionBase(){}; - ~DataNodeFunctionBase() ITK_OVERRIDE{}; + ~DataNodeFunctionBase() override{}; private: DataNodeFunctionBase(const Self& ); //purposely not implemented diff --git a/Modules/Core/VectorDataBase/include/otbDataNodeImageFunction.h b/Modules/Core/VectorDataBase/include/otbDataNodeImageFunction.h index ece3dc41b8276d02dffde079aeb1365316162d8c..5f389b35b625acc114bc80f6953a19298174accc 100644 --- a/Modules/Core/VectorDataBase/include/otbDataNodeImageFunction.h +++ b/Modules/Core/VectorDataBase/include/otbDataNodeImageFunction.h @@ -107,7 +107,7 @@ public: /** Evaluate the function at specified DataNode position. * Subclasses must provide this method. */ - TOutput Evaluate( const DataNodeType& node ) const ITK_OVERRIDE = 0; + TOutput Evaluate( const DataNodeType& node ) const override = 0; /** Check if an index is inside the image buffer. * we take into account the fact that each voxel has its @@ -186,8 +186,8 @@ public: protected: DataNodeImageFunction(); - ~DataNodeImageFunction() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~DataNodeImageFunction() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Const pointer to the input image. */ InputImageConstPointer m_Image; diff --git a/Modules/Core/VectorDataBase/include/otbDataNodeVectorDataFunction.h b/Modules/Core/VectorDataBase/include/otbDataNodeVectorDataFunction.h index 7adb0b06ad2318453c18f63daaa82448772a2394..798dd99dbe894fc14c873a67a0aa0e6e0be8d40d 100644 --- a/Modules/Core/VectorDataBase/include/otbDataNodeVectorDataFunction.h +++ b/Modules/Core/VectorDataBase/include/otbDataNodeVectorDataFunction.h @@ -88,12 +88,12 @@ public: /** Evaluate the function at specified DataNode position. * Subclasses must provide this method. */ - TOutput Evaluate( const DataNodeType& node ) const ITK_OVERRIDE = 0; + TOutput Evaluate( const DataNodeType& node ) const override = 0; protected: DataNodeVectorDataFunction(); - ~DataNodeVectorDataFunction() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~DataNodeVectorDataFunction() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Const pointer to the input VectorData. */ VectorDataConstPointerType m_VectorData; diff --git a/Modules/Core/VectorDataBase/include/otbPolyLineParametricPathWithValue.h b/Modules/Core/VectorDataBase/include/otbPolyLineParametricPathWithValue.h index a6ff72468a51dc72f7b02e04634d9eec7a14e892..1a54429a791c7e55c04c69ac44eb69866162a6f2 100644 --- a/Modules/Core/VectorDataBase/include/otbPolyLineParametricPathWithValue.h +++ b/Modules/Core/VectorDataBase/include/otbPolyLineParametricPathWithValue.h @@ -117,13 +117,13 @@ protected: /** Constructor */ PolyLineParametricPathWithValue(); /** Destructor */ - ~PolyLineParametricPathWithValue() ITK_OVERRIDE {} + ~PolyLineParametricPathWithValue() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; virtual void ComputeLength() const; virtual void ComputeBoundingRegion() const; - void Modified() const ITK_OVERRIDE; + void Modified() const override; private: PolyLineParametricPathWithValue(const Self &); //purposely not implemented diff --git a/Modules/Core/VectorDataBase/include/otbPolygon.h b/Modules/Core/VectorDataBase/include/otbPolygon.h index a85c8a138a1c8e4e68a32141b02b170f7c2c50ef..1d7cd20faed2054731c54c5ba38ab3c2ac53abfd 100644 --- a/Modules/Core/VectorDataBase/include/otbPolygon.h +++ b/Modules/Core/VectorDataBase/include/otbPolygon.h @@ -126,9 +126,9 @@ public: * Return the polygon length (perimeter). * \return The length. */ - double GetLength() const ITK_OVERRIDE; + double GetLength() const override; - void AddVertex(const ContinuousIndexType& vertex) ITK_OVERRIDE; + void AddVertex(const ContinuousIndexType& vertex) override; protected: /** Constructor */ @@ -140,13 +140,13 @@ protected: }; /** Destructor */ - ~Polygon() ITK_OVERRIDE {} + ~Polygon() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; virtual void ComputeArea() const; - void Modified() const ITK_OVERRIDE; + void Modified() const override; private: Polygon(const Self &); //purposely not implemented diff --git a/Modules/Core/VectorDataBase/include/otbVectorData.h b/Modules/Core/VectorDataBase/include/otbVectorData.h index 0a1b8968e07179d3c599dc99374c16e38dea897e..75c1f0bee44b36fd04fa014fc14871f5be701244 100644 --- a/Modules/Core/VectorDataBase/include/otbVectorData.h +++ b/Modules/Core/VectorDataBase/include/otbVectorData.h @@ -129,15 +129,15 @@ public: * SmartPointers to the same VectorData since separate DataObjects are * still maintained. This method is similar to * VectorDataSource::GraftOutput(). */ - void Graft(const itk::DataObject *data) ITK_OVERRIDE; + void Graft(const itk::DataObject *data) override; protected: /** Constructor */ VectorData(); /** Destructor */ - ~VectorData() ITK_OVERRIDE {} + ~VectorData() override {} /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: VectorData(const Self&); //purposely not implemented diff --git a/Modules/Core/VectorDataBase/include/otbVectorDataIOBase.h b/Modules/Core/VectorDataBase/include/otbVectorDataIOBase.h index de1e241fc20c42e0436288a1bcf247c0b1891bba..fac29ae71b9e4f0384ca5909324837e25dc9523a 100644 --- a/Modules/Core/VectorDataBase/include/otbVectorDataIOBase.h +++ b/Modules/Core/VectorDataBase/include/otbVectorDataIOBase.h @@ -153,9 +153,9 @@ public: protected: VectorDataIOBase(); - ~VectorDataIOBase() ITK_OVERRIDE; + ~VectorDataIOBase() override; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Big or Little Endian, and the type of the file. (May be ignored.) */ ByteOrder m_ByteOrder; diff --git a/Modules/Core/VectorDataBase/include/otbVectorDataProperties.h b/Modules/Core/VectorDataBase/include/otbVectorDataProperties.h index f1e8633b23c00bdb3a0bd698c6dd5bc5ed976a0b..59f22cca0e9d75014866b3212148c9d065084ffd 100644 --- a/Modules/Core/VectorDataBase/include/otbVectorDataProperties.h +++ b/Modules/Core/VectorDataBase/include/otbVectorDataProperties.h @@ -86,9 +86,9 @@ protected: /** Constructor */ VectorDataProperties() : m_VectorDataObject(ITK_NULLPTR) {}; /** Destructor */ - ~VectorDataProperties() ITK_OVERRIDE {} + ~VectorDataProperties() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; void ProcessNode(InternalTreeNodeType * source); bool IsBoundingRegionNull(); diff --git a/Modules/Core/VectorDataBase/include/otbVectorDataSource.h b/Modules/Core/VectorDataBase/include/otbVectorDataSource.h index 7700768b4cec22e2ada3046ff9674965f9110b68..4031a0b46618eff76d1c9bbbaa64fc192c0fd061 100644 --- a/Modules/Core/VectorDataBase/include/otbVectorDataSource.h +++ b/Modules/Core/VectorDataBase/include/otbVectorDataSource.h @@ -83,9 +83,9 @@ public: protected: VectorDataSource(); - ~VectorDataSource() ITK_OVERRIDE; + ~VectorDataSource() override; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Ensure that the output vector data are cleared before processing */ virtual void AllocateOutputs(); diff --git a/Modules/Detection/CloudDetection/include/otbCloudDetectionFilter.h b/Modules/Detection/CloudDetection/include/otbCloudDetectionFilter.h index 51f432a1a49a9051fc5f2ee5031b5e9c86a7ba32..024c296191fae5b2c212f72fcdb4a2e27bff5f10 100644 --- a/Modules/Detection/CloudDetection/include/otbCloudDetectionFilter.h +++ b/Modules/Detection/CloudDetection/include/otbCloudDetectionFilter.h @@ -71,11 +71,11 @@ public: protected: CloudDetectionFilter(); - ~CloudDetectionFilter() ITK_OVERRIDE {} + ~CloudDetectionFilter() override {} - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: CloudDetectionFilter(const Self &); //purposely not implemented diff --git a/Modules/Detection/CloudDetection/include/otbCloudEstimatorFilter.h b/Modules/Detection/CloudDetection/include/otbCloudEstimatorFilter.h index 5f0d5eadc7840d10aa856208dd11b6a0e9aeb3ca..fc795bbf1fca85721c9880f98954f3f7c3b0c641 100644 --- a/Modules/Detection/CloudDetection/include/otbCloudEstimatorFilter.h +++ b/Modules/Detection/CloudDetection/include/otbCloudEstimatorFilter.h @@ -73,11 +73,11 @@ public: protected: CloudEstimatorFilter(); - ~CloudEstimatorFilter() ITK_OVERRIDE {} + ~CloudEstimatorFilter() override {} - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: CloudEstimatorFilter(const Self &); //purposely not implemented diff --git a/Modules/Detection/ObjectDetection/include/otbDescriptorsListSampleGenerator.h b/Modules/Detection/ObjectDetection/include/otbDescriptorsListSampleGenerator.h index a7d582d84814cd45b2fbb61e1a84ea56b5a3946d..3ab76e6b4511dc8c1e452ec89e01148326bba4c0 100644 --- a/Modules/Detection/ObjectDetection/include/otbDescriptorsListSampleGenerator.h +++ b/Modules/Detection/ObjectDetection/include/otbDescriptorsListSampleGenerator.h @@ -151,31 +151,31 @@ public: /** Make a DataObject of the correct type to be used as the specified * output. */ - itk::DataObject::Pointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; + itk::DataObject::Pointer MakeOutput(DataObjectPointerArraySizeType idx) override; using Superclass::MakeOutput; - void AllocateOutputs() ITK_OVERRIDE; - void GenerateOutputInformation() ITK_OVERRIDE; - void Reset(void) ITK_OVERRIDE; - void Synthetize(void) ITK_OVERRIDE; + void AllocateOutputs() override; + void GenerateOutputInformation() override; + void Reset(void) override; + void Synthetize(void) override; - void AddInput(itk::DataObject * dataObject) ITK_OVERRIDE + void AddInput(itk::DataObject * dataObject) override { Superclass::AddInput(dataObject); } protected: PersistentDescriptorsListSampleGenerator(); - ~PersistentDescriptorsListSampleGenerator() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~PersistentDescriptorsListSampleGenerator() override; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; /** Multi-thread version GenerateData. */ void ThreadedGenerateData(const RegionType& outputRegionForThread, - itk::ThreadIdType threadId) ITK_OVERRIDE; + itk::ThreadIdType threadId) override; private: PersistentDescriptorsListSampleGenerator(const Self &); //purposely not implemented @@ -303,7 +303,7 @@ public: return this->GetFilter()->GetInput(); } - void AddInput(itk::DataObject * dataObject) ITK_OVERRIDE + void AddInput(itk::DataObject * dataObject) override { this->GetFilter()->AddInput(dataObject); } @@ -363,7 +363,7 @@ public: DescriptorsListSampleGenerator(); /** Destructor */ - ~DescriptorsListSampleGenerator() ITK_OVERRIDE; + ~DescriptorsListSampleGenerator() override; private: DescriptorsListSampleGenerator(const Self &); //purposely not implemented diff --git a/Modules/Detection/ObjectDetection/include/otbFlusserMomentsIFFactory.h b/Modules/Detection/ObjectDetection/include/otbFlusserMomentsIFFactory.h index 8aff97fc815832c648c68e9c22ccb09fbd7b7ae0..46ff16f5af8aa71a5865777d840d53c736673047 100644 --- a/Modules/Detection/ObjectDetection/include/otbFlusserMomentsIFFactory.h +++ b/Modules/Detection/ObjectDetection/include/otbFlusserMomentsIFFactory.h @@ -82,8 +82,8 @@ public: protected: FlusserMomentsIFFactory(){} - ~FlusserMomentsIFFactory() ITK_OVERRIDE{} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~FlusserMomentsIFFactory() override{} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: FlusserMomentsIFFactory(const Self& ); //purposely not implemented diff --git a/Modules/Detection/ObjectDetection/include/otbFourierMellinDescriptorsIFFactory.h b/Modules/Detection/ObjectDetection/include/otbFourierMellinDescriptorsIFFactory.h index 36f7890b0c8df423ad16b53b78405849a00ebd7c..4a55751a558ada83bcff0e032f6a05acc3b529ff 100644 --- a/Modules/Detection/ObjectDetection/include/otbFourierMellinDescriptorsIFFactory.h +++ b/Modules/Detection/ObjectDetection/include/otbFourierMellinDescriptorsIFFactory.h @@ -81,8 +81,8 @@ public: protected: FourierMellinDescriptorsIFFactory(){} - ~FourierMellinDescriptorsIFFactory() ITK_OVERRIDE{} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~FourierMellinDescriptorsIFFactory() override{} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: FourierMellinDescriptorsIFFactory(const Self& ); //purposely not implemented diff --git a/Modules/Detection/ObjectDetection/include/otbHaralickTexturesIFFactory.h b/Modules/Detection/ObjectDetection/include/otbHaralickTexturesIFFactory.h index 570ba05b999055fb29b54954c55e400594c5f49c..1169695ab10f0b4225a1c259d470ba23ba31db18 100644 --- a/Modules/Detection/ObjectDetection/include/otbHaralickTexturesIFFactory.h +++ b/Modules/Detection/ObjectDetection/include/otbHaralickTexturesIFFactory.h @@ -83,8 +83,8 @@ public: protected: HaralickTexturesIFFactory(){} - ~HaralickTexturesIFFactory() ITK_OVERRIDE{} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~HaralickTexturesIFFactory() override{} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: HaralickTexturesIFFactory(const Self& ); //purposely not implemented diff --git a/Modules/Detection/ObjectDetection/include/otbLabeledSampleLocalizationGenerator.h b/Modules/Detection/ObjectDetection/include/otbLabeledSampleLocalizationGenerator.h index a0d118d046d858c1f874dbdd3555532f3e1d8652..75d2d09a9cbdeb98cc0b5e95a1b6e31cd3326d33 100644 --- a/Modules/Detection/ObjectDetection/include/otbLabeledSampleLocalizationGenerator.h +++ b/Modules/Detection/ObjectDetection/include/otbLabeledSampleLocalizationGenerator.h @@ -116,11 +116,11 @@ public: protected: LabeledSampleLocalizationGenerator(); - ~LabeledSampleLocalizationGenerator() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~LabeledSampleLocalizationGenerator() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Triggers the Computation of the sample list */ - void GenerateData(void) ITK_OVERRIDE; + void GenerateData(void) override; PointVectorType RandomPointsGenerator(DataNodeType * node); diff --git a/Modules/Detection/ObjectDetection/include/otbLocalHistogramIFFactory.h b/Modules/Detection/ObjectDetection/include/otbLocalHistogramIFFactory.h index f52cc96fb72765ce28c616afb34d4be452ccae7a..2ff4b90c983b72799ab44bffb9f26ca3a60b229d 100644 --- a/Modules/Detection/ObjectDetection/include/otbLocalHistogramIFFactory.h +++ b/Modules/Detection/ObjectDetection/include/otbLocalHistogramIFFactory.h @@ -82,8 +82,8 @@ public: protected: LocalHistogramIFFactory(){} - ~LocalHistogramIFFactory() ITK_OVERRIDE{} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~LocalHistogramIFFactory() override{} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: LocalHistogramIFFactory(const Self& ); //purposely not implemented diff --git a/Modules/Detection/ObjectDetection/include/otbObjectDetectionClassifier.h b/Modules/Detection/ObjectDetection/include/otbObjectDetectionClassifier.h index c051b33997673d423c5c306dc0b6aa2026313c9c..276062f0f06f120e2e0119cf66f0f39a9de2bfe7 100644 --- a/Modules/Detection/ObjectDetection/include/otbObjectDetectionClassifier.h +++ b/Modules/Detection/ObjectDetection/include/otbObjectDetectionClassifier.h @@ -123,7 +123,7 @@ public: typedef itk::Statistics::ListSample<DescriptorType> ListSampleType; - void AddInput(itk::DataObject * dataObject) ITK_OVERRIDE + void AddInput(itk::DataObject * dataObject) override { this->Superclass::AddInput(dataObject); } @@ -161,29 +161,29 @@ public: /** Make a DataObject of the correct type to be used as the specified * output. */ - itk::DataObject::Pointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; + itk::DataObject::Pointer MakeOutput(DataObjectPointerArraySizeType idx) override; using Superclass::MakeOutput; - void AllocateOutputs() ITK_OVERRIDE; + void AllocateOutputs() override; - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; - void Reset(void) ITK_OVERRIDE; + void Reset(void) override; - void Synthetize(void) ITK_OVERRIDE; + void Synthetize(void) override; protected: PersistentObjectDetectionClassifier(); - ~PersistentObjectDetectionClassifier() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~PersistentObjectDetectionClassifier() override; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; /** Multi-thread version GenerateData. */ void ThreadedGenerateData(const RegionType& outputRegionForThread, - itk::ThreadIdType threadId) ITK_OVERRIDE; + itk::ThreadIdType threadId) override; private: PersistentObjectDetectionClassifier(const Self &); //purposely not implemented @@ -319,7 +319,7 @@ public: return this->GetFilter()->GetOutputVectorData(); } - void AddInput(itk::DataObject * dataObject) ITK_OVERRIDE + void AddInput(itk::DataObject * dataObject) override { this->GetFilter()->AddInput(dataObject); } @@ -377,7 +377,7 @@ public: ObjectDetectionClassifier(); /** Destructor */ - ~ObjectDetectionClassifier() ITK_OVERRIDE; + ~ObjectDetectionClassifier() override; private: ObjectDetectionClassifier(const Self &); //purposely not implemented diff --git a/Modules/Detection/ObjectDetection/include/otbRadiometricMomentsIFFactory.h b/Modules/Detection/ObjectDetection/include/otbRadiometricMomentsIFFactory.h index 6d642ec5049cfc89ebed91cab6bfb3edb2cd79ee..9d971e97b202a7f376963cedd891c407c5ae4486 100644 --- a/Modules/Detection/ObjectDetection/include/otbRadiometricMomentsIFFactory.h +++ b/Modules/Detection/ObjectDetection/include/otbRadiometricMomentsIFFactory.h @@ -82,8 +82,8 @@ public: protected: RadiometricMomentsIFFactory(){} - ~RadiometricMomentsIFFactory() ITK_OVERRIDE{} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~RadiometricMomentsIFFactory() override{} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: RadiometricMomentsIFFactory(const Self& ); //purposely not implemented diff --git a/Modules/Detection/ObjectDetection/include/otbStandardMetaImageFunctionBuilder.h b/Modules/Detection/ObjectDetection/include/otbStandardMetaImageFunctionBuilder.h index eb747ff5a7c5a2bb79355291f65e5a243558855a..3d03e06d991bd7a17c50bcd09720a5bea70e6d08 100644 --- a/Modules/Detection/ObjectDetection/include/otbStandardMetaImageFunctionBuilder.h +++ b/Modules/Detection/ObjectDetection/include/otbStandardMetaImageFunctionBuilder.h @@ -170,8 +170,8 @@ public: protected: StandardMetaImageFunctionBuilder(); - ~StandardMetaImageFunctionBuilder() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~StandardMetaImageFunctionBuilder() override; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: StandardMetaImageFunctionBuilder(const Self& ); //purposely not implemented diff --git a/Modules/Detection/RoadExtraction/include/otbBreakAngularPathListFilter.h b/Modules/Detection/RoadExtraction/include/otbBreakAngularPathListFilter.h index 2b75f86699fb3fcdb88b8a51a654c9ac1ab73e30..6781f42e6496bc54959ab370640d31cd3bf42947 100644 --- a/Modules/Detection/RoadExtraction/include/otbBreakAngularPathListFilter.h +++ b/Modules/Detection/RoadExtraction/include/otbBreakAngularPathListFilter.h @@ -67,11 +67,11 @@ protected: /** Constructor */ BreakAngularPathListFilter(); /** Destructor */ - ~BreakAngularPathListFilter() ITK_OVERRIDE {} + ~BreakAngularPathListFilter() override {} /** GenerateData method */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: BreakAngularPathListFilter(const Self &); //purposely not implemented diff --git a/Modules/Detection/RoadExtraction/include/otbGenericRoadExtractionFilter.h b/Modules/Detection/RoadExtraction/include/otbGenericRoadExtractionFilter.h index e016246411ba8c21863fc060da8f548eb237d747..e3680973f1a6584e90c08d434ecf9ae4545510f0 100644 --- a/Modules/Detection/RoadExtraction/include/otbGenericRoadExtractionFilter.h +++ b/Modules/Detection/RoadExtraction/include/otbGenericRoadExtractionFilter.h @@ -189,7 +189,7 @@ protected: /** Constructor */ GenericRoadExtractionFilter(); /** Destructor */ - ~GenericRoadExtractionFilter() ITK_OVERRIDE {} + ~GenericRoadExtractionFilter() override {} /** Prepare main computation method * Note : this function isn't called @@ -197,9 +197,9 @@ protected: void BeforeGenerateData(void); /** Main computation method */ - void GenerateData(void) ITK_OVERRIDE; + void GenerateData(void) override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: diff --git a/Modules/Detection/RoadExtraction/include/otbImageToPathListAlignFilter.h b/Modules/Detection/RoadExtraction/include/otbImageToPathListAlignFilter.h index 5002375fe46044e82e27d1a939b15346be7c5af4..a6dd5526b435755d1fdba0bce7924d9a77acc5c3 100644 --- a/Modules/Detection/RoadExtraction/include/otbImageToPathListAlignFilter.h +++ b/Modules/Detection/RoadExtraction/include/otbImageToPathListAlignFilter.h @@ -121,10 +121,10 @@ public: protected: ImageToPathListAlignFilter(); - ~ImageToPathListAlignFilter() ITK_OVERRIDE; + ~ImageToPathListAlignFilter() override; - void GenerateOutputInformation() ITK_OVERRIDE {} // do nothing - void GenerateData() ITK_OVERRIDE; + void GenerateOutputInformation() override {} // do nothing + void GenerateData() override; virtual std::vector<double> tab(int n, double p, double m); virtual void AngleCalculate(const InputImageType* InputImageIn); @@ -134,7 +134,7 @@ protected: ValueType m_PathValue; ValueType m_BackgroundValue; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: ImageToPathListAlignFilter(const Self &); //purposely not implemented diff --git a/Modules/Detection/RoadExtraction/include/otbLikelihoodPathListFilter.h b/Modules/Detection/RoadExtraction/include/otbLikelihoodPathListFilter.h index 85f0a3109db1277a9a7fdc1acb18ccc8aca50623..9d34f04ff76765b0e2ee8445730503e5d4c2cd92 100644 --- a/Modules/Detection/RoadExtraction/include/otbLikelihoodPathListFilter.h +++ b/Modules/Detection/RoadExtraction/include/otbLikelihoodPathListFilter.h @@ -85,11 +85,11 @@ protected: /** Constructor */ LikelihoodPathListFilter(); /** Destructor */ - ~LikelihoodPathListFilter() ITK_OVERRIDE {} + ~LikelihoodPathListFilter() override {} /** GenerateData method */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: LikelihoodPathListFilter(const Self &); //purposely not implemented diff --git a/Modules/Detection/RoadExtraction/include/otbLinkPathListFilter.h b/Modules/Detection/RoadExtraction/include/otbLinkPathListFilter.h index 772ec632f3a1635518df3f55ab33f027db4d11fd..e5ab1942d43fba315af0f47c8da4bab98ef70ff5 100644 --- a/Modules/Detection/RoadExtraction/include/otbLinkPathListFilter.h +++ b/Modules/Detection/RoadExtraction/include/otbLinkPathListFilter.h @@ -84,11 +84,11 @@ protected: /** Constructor */ LinkPathListFilter(); /** Destructor */ - ~LinkPathListFilter() ITK_OVERRIDE {} + ~LinkPathListFilter() override {} /** GenerateData method */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** * Verify the angular condition to link a path. diff --git a/Modules/Detection/RoadExtraction/include/otbModulusAndDirectionImageToImageFilter.h b/Modules/Detection/RoadExtraction/include/otbModulusAndDirectionImageToImageFilter.h index 22f4468f823e08450863cf5860f05d07fd6fd31b..83e8345b9b709bdd6370c2eea20a2eb23f9fb546 100644 --- a/Modules/Detection/RoadExtraction/include/otbModulusAndDirectionImageToImageFilter.h +++ b/Modules/Detection/RoadExtraction/include/otbModulusAndDirectionImageToImageFilter.h @@ -70,15 +70,15 @@ public: /** Set/Get the image input of this process object. */ using Superclass::SetInput; - void SetInput(const InputImageType *input) ITK_OVERRIDE; + void SetInput(const InputImageType *input) override; virtual void SetInputDirection(const InputImageDirectionType *direction); const InputImageType * GetInput(void); const InputImageDirectionType * GetInputDirection(void); protected: ModulusAndDirectionImageToImageFilter(); - ~ModulusAndDirectionImageToImageFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~ModulusAndDirectionImageToImageFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: ModulusAndDirectionImageToImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Detection/RoadExtraction/include/otbNeighborhoodScalarProductFilter.h b/Modules/Detection/RoadExtraction/include/otbNeighborhoodScalarProductFilter.h index 2a7ec8dd620d61b7368d0d6f649bfc8d33a654a5..6e24abebee35550566826266ab5f4a44b3c0c1de 100644 --- a/Modules/Detection/RoadExtraction/include/otbNeighborhoodScalarProductFilter.h +++ b/Modules/Detection/RoadExtraction/include/otbNeighborhoodScalarProductFilter.h @@ -84,9 +84,9 @@ protected: /** Constructor */ NeighborhoodScalarProductFilter(); /** Destructor */ - ~NeighborhoodScalarProductFilter() ITK_OVERRIDE {} + ~NeighborhoodScalarProductFilter() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** NeighborhoodScalarProductImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine * which is called for each processing thread. The output image data is @@ -98,7 +98,7 @@ protected: * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId) ITK_OVERRIDE; + itk::ThreadIdType threadId) override; private: NeighborhoodScalarProductFilter(const Self &); //purposely not implemented void operator =(const Self&); //purposely not implemented diff --git a/Modules/Detection/RoadExtraction/include/otbNonMaxRemovalByDirectionFilter.h b/Modules/Detection/RoadExtraction/include/otbNonMaxRemovalByDirectionFilter.h index e428d28601445e46e21d9b7d0af59832c03bc838..fb60b080f34dc1338b8449e505037550bfe4f8ee 100644 --- a/Modules/Detection/RoadExtraction/include/otbNonMaxRemovalByDirectionFilter.h +++ b/Modules/Detection/RoadExtraction/include/otbNonMaxRemovalByDirectionFilter.h @@ -136,14 +136,14 @@ protected: /** Constructor */ NonMaxRemovalByDirectionFilter() {}; /** Destructor */ - ~NonMaxRemovalByDirectionFilter() ITK_OVERRIDE {} + ~NonMaxRemovalByDirectionFilter() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + void PrintSelf(std::ostream& os, itk::Indent indent) const override { Superclass::PrintSelf(os, indent); } /** Main computation method */ - void GenerateData(void) ITK_OVERRIDE + void GenerateData(void) override { typename ComputingFilterType::Pointer filter = ComputingFilterType::New(); filter->SetInput1(this->GetInput()); diff --git a/Modules/Detection/RoadExtraction/include/otbParallelLinePathListFilter.h b/Modules/Detection/RoadExtraction/include/otbParallelLinePathListFilter.h index d39d37eee1a517daa4fbf33fd246e258edaaeba1..ff27709602a2fa7ffabbe8919a8cd1ca3bdb9b01 100644 --- a/Modules/Detection/RoadExtraction/include/otbParallelLinePathListFilter.h +++ b/Modules/Detection/RoadExtraction/include/otbParallelLinePathListFilter.h @@ -90,11 +90,11 @@ protected: /** Constructor */ ParallelLinePathListFilter(); /** Destructor */ - ~ParallelLinePathListFilter() ITK_OVERRIDE {} + ~ParallelLinePathListFilter() override {} /** GenerateData method */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** * Verify the angular condition to find parallel lines. diff --git a/Modules/Detection/RoadExtraction/include/otbRemoveIsolatedByDirectionFilter.h b/Modules/Detection/RoadExtraction/include/otbRemoveIsolatedByDirectionFilter.h index d937c7108d5098698179a87f8c7fe5d5ef04bbd7..ca4a40efdd9acbab74ba1bb5bd5f21832fd00f8e 100644 --- a/Modules/Detection/RoadExtraction/include/otbRemoveIsolatedByDirectionFilter.h +++ b/Modules/Detection/RoadExtraction/include/otbRemoveIsolatedByDirectionFilter.h @@ -109,14 +109,14 @@ protected: /** Constructor */ RemoveIsolatedByDirectionFilter() {}; /** Destructor */ - ~RemoveIsolatedByDirectionFilter() ITK_OVERRIDE {} + ~RemoveIsolatedByDirectionFilter() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + void PrintSelf(std::ostream& os, itk::Indent indent) const override { Superclass::PrintSelf(os, indent); } /** Main computation method */ - void GenerateData(void) ITK_OVERRIDE + void GenerateData(void) override { typename ComputingFilterType::Pointer filter = ComputingFilterType::New(); filter->SetInput1(this->GetInput()); diff --git a/Modules/Detection/RoadExtraction/include/otbRemoveWrongDirectionFilter.h b/Modules/Detection/RoadExtraction/include/otbRemoveWrongDirectionFilter.h index 4733c42fa47d006a89427c67dde24f298672dc16..8812c85fa2de5c247aa01d712fc9c318ff018f88 100644 --- a/Modules/Detection/RoadExtraction/include/otbRemoveWrongDirectionFilter.h +++ b/Modules/Detection/RoadExtraction/include/otbRemoveWrongDirectionFilter.h @@ -104,14 +104,14 @@ protected: /** Constructor */ RemoveWrongDirectionFilter() {}; /** Destructor */ - ~RemoveWrongDirectionFilter() ITK_OVERRIDE {} + ~RemoveWrongDirectionFilter() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + void PrintSelf(std::ostream& os, itk::Indent indent) const override { Superclass::PrintSelf(os, indent); } /** Main computation method */ - void GenerateData(void) ITK_OVERRIDE + void GenerateData(void) override { typename ComputingFilterType::Pointer filter = ComputingFilterType::New(); filter->SetInput1(this->GetInput()); diff --git a/Modules/Detection/RoadExtraction/include/otbRoadExtractionFilter.h b/Modules/Detection/RoadExtraction/include/otbRoadExtractionFilter.h index d58dd5166ca331d4b38765de634b994440b306c0..79e05822d315e5ddcaac772a9ef633f4a2630579 100644 --- a/Modules/Detection/RoadExtraction/include/otbRoadExtractionFilter.h +++ b/Modules/Detection/RoadExtraction/include/otbRoadExtractionFilter.h @@ -141,15 +141,15 @@ protected: /** Constructor */ RoadExtractionFilter(); /** Destructor */ - ~RoadExtractionFilter() ITK_OVERRIDE {} + ~RoadExtractionFilter() override {} /** Prepare main computation method */ void BeforeGenerateData(void); /** Main computation method */ - void GenerateData(void) ITK_OVERRIDE; + void GenerateData(void) override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: diff --git a/Modules/Detection/RoadExtraction/include/otbVectorDataToRoadDescriptionFilter.h b/Modules/Detection/RoadExtraction/include/otbVectorDataToRoadDescriptionFilter.h index ab759a79ba4be960079ad8a851b178fa1a25a8c4..48744453c0b4d6ffe97ecd2cc356e637b2c586c6 100644 --- a/Modules/Detection/RoadExtraction/include/otbVectorDataToRoadDescriptionFilter.h +++ b/Modules/Detection/RoadExtraction/include/otbVectorDataToRoadDescriptionFilter.h @@ -116,11 +116,11 @@ protected: /** Constructor */ VectorDataToRoadDescriptionFilter(); /** Destructor */ - ~VectorDataToRoadDescriptionFilter() ITK_OVERRIDE {} + ~VectorDataToRoadDescriptionFilter() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Triggers the Computation of the Descriptors */ - void GenerateData(void) ITK_OVERRIDE; + void GenerateData(void) override; private: VectorDataToRoadDescriptionFilter(const Self &); //purposely not implemented diff --git a/Modules/Detection/UrbanArea/include/otbUrbanAreaDetectionImageFilter.h b/Modules/Detection/UrbanArea/include/otbUrbanAreaDetectionImageFilter.h index a5b50ddf108979832bae7490f816e65b58687815..f8c133af97480b0f9ef8006940f09d78d3fa81a8 100644 --- a/Modules/Detection/UrbanArea/include/otbUrbanAreaDetectionImageFilter.h +++ b/Modules/Detection/UrbanArea/include/otbUrbanAreaDetectionImageFilter.h @@ -232,11 +232,11 @@ public: itkSetMacro(SobelUpperThreshold, double); /** Methods */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; protected: UrbanAreaDetectionImageFilter(); - ~UrbanAreaDetectionImageFilter() ITK_OVERRIDE{} + ~UrbanAreaDetectionImageFilter() override{} private: UrbanAreaDetectionImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Feature/Corner/include/otbHarrisImageFilter.h b/Modules/Feature/Corner/include/otbHarrisImageFilter.h index 38aadf4acfbf58ddfbd51d8492d1b5f4f6e931aa..f784a3159aa4aa976d22aea8338774eff9fe0917 100644 --- a/Modules/Feature/Corner/include/otbHarrisImageFilter.h +++ b/Modules/Feature/Corner/include/otbHarrisImageFilter.h @@ -104,11 +104,11 @@ public: protected: HarrisImageFilter(); - ~HarrisImageFilter() ITK_OVERRIDE {} + ~HarrisImageFilter() override {} - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: HarrisImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Feature/Corner/include/otbHarrisImageToPointSetFilter.h b/Modules/Feature/Corner/include/otbHarrisImageToPointSetFilter.h index 8069c053c0e90a3b3289c5092b20139c07cd03c7..badc48a0d16249ce2a8a7e775150f90608174db6 100644 --- a/Modules/Feature/Corner/include/otbHarrisImageToPointSetFilter.h +++ b/Modules/Feature/Corner/include/otbHarrisImageToPointSetFilter.h @@ -78,11 +78,11 @@ public: protected: HarrisImageToPointSetFilter(); - ~HarrisImageToPointSetFilter() ITK_OVERRIDE {} + ~HarrisImageToPointSetFilter() override {} - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: HarrisImageToPointSetFilter(const Self &); //purposely not implemented diff --git a/Modules/Feature/Corner/include/otbLineSpatialObjectListToRightAnglePointSetFilter.h b/Modules/Feature/Corner/include/otbLineSpatialObjectListToRightAnglePointSetFilter.h index 8726c3009fc10f319d74f4ff38ec9b26eda3570e..68c594ec0bc999a9c3235f065647918258df6f20 100644 --- a/Modules/Feature/Corner/include/otbLineSpatialObjectListToRightAnglePointSetFilter.h +++ b/Modules/Feature/Corner/include/otbLineSpatialObjectListToRightAnglePointSetFilter.h @@ -104,7 +104,7 @@ protected: * */ - void GenerateOutputInformation() ITK_OVERRIDE{} + void GenerateOutputInformation() override{} /** * Constructor. @@ -113,15 +113,15 @@ protected: /** * Destructor. */ - ~LineSpatialObjectListToRightAnglePointSetFilter() ITK_OVERRIDE{} + ~LineSpatialObjectListToRightAnglePointSetFilter() override{} /** * Standard PrintSelf method. */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** * Main computation method. */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** * Angle computation */ diff --git a/Modules/Feature/Corner/include/otbVectorDataToRightAngleVectorDataFilter.h b/Modules/Feature/Corner/include/otbVectorDataToRightAngleVectorDataFilter.h index c034f2315cfbbf09812af79124c8b87fd5558930..a2c985fc206db69e2210741d4d768c26c49dbf04 100644 --- a/Modules/Feature/Corner/include/otbVectorDataToRightAngleVectorDataFilter.h +++ b/Modules/Feature/Corner/include/otbVectorDataToRightAngleVectorDataFilter.h @@ -87,11 +87,11 @@ protected: /** Constructor.*/ VectorDataToRightAngleVectorDataFilter(); /**Destructor.*/ - ~VectorDataToRightAngleVectorDataFilter() ITK_OVERRIDE{} + ~VectorDataToRightAngleVectorDataFilter() override{} /** Standard PrintSelf method.*/ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /**Main computation method.*/ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /**Angle computation.*/ virtual double ComputeAngleFormedBySegments(LineType * lineDst, LineType * lineSrc); /** When we find a right angle, one compute the coordinate of the segments intersection.*/ diff --git a/Modules/Feature/Density/include/otbKeyPointDensityImageFilter.h b/Modules/Feature/Density/include/otbKeyPointDensityImageFilter.h index ad33f74572da285017b20543b65864bfeae28b13..2944414abd82f6ea372edd2ed9f390092d4b9a62 100644 --- a/Modules/Feature/Density/include/otbKeyPointDensityImageFilter.h +++ b/Modules/Feature/Density/include/otbKeyPointDensityImageFilter.h @@ -99,16 +99,16 @@ protected: /** * Destructor. */ - ~KeyPointDensityImageFilter() ITK_OVERRIDE; + ~KeyPointDensityImageFilter() override; /** * Standard PrintSelf method. */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** * Main computation method. */ //virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId ); - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; private: diff --git a/Modules/Feature/Density/include/otbPointSetDensityEpanechnikovFunction.h b/Modules/Feature/Density/include/otbPointSetDensityEpanechnikovFunction.h index ade7a2bacef267c599d74e6de249684ac253425a..6abb4fc1c0b935453be4e88b3e2ad24d525e379b 100644 --- a/Modules/Feature/Density/include/otbPointSetDensityEpanechnikovFunction.h +++ b/Modules/Feature/Density/include/otbPointSetDensityEpanechnikovFunction.h @@ -65,13 +65,13 @@ public: itkGetMacro(Radius, unsigned int); /** Evaluate Method */ - OutputType Evaluate(const InputType& input) const ITK_OVERRIDE; + OutputType Evaluate(const InputType& input) const override; protected: PointSetDensityEpanechnikovFunction() : m_Radius(1) {}; - ~PointSetDensityEpanechnikovFunction() ITK_OVERRIDE {} + ~PointSetDensityEpanechnikovFunction() override {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: PointSetDensityEpanechnikovFunction(const Self &); //purposely not implemented diff --git a/Modules/Feature/Density/include/otbPointSetDensityFunction.h b/Modules/Feature/Density/include/otbPointSetDensityFunction.h index 622e28ff19928e04447c8838c078fcb5d9fc2a94..fc1d0ccff4f151df50a15dd4ecab634782412eb6 100644 --- a/Modules/Feature/Density/include/otbPointSetDensityFunction.h +++ b/Modules/Feature/Density/include/otbPointSetDensityFunction.h @@ -64,13 +64,13 @@ public: itkGetMacro(Radius, unsigned int); /** Evaluate Method */ - OutputType Evaluate(const InputType& input) const ITK_OVERRIDE; + OutputType Evaluate(const InputType& input) const override; protected: PointSetDensityFunction() : m_Radius(1) {}; - ~PointSetDensityFunction() ITK_OVERRIDE {} + ~PointSetDensityFunction() override {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: PointSetDensityFunction(const Self &); //purposely not implemented diff --git a/Modules/Feature/Density/include/otbPointSetDensityGaussianFunction.h b/Modules/Feature/Density/include/otbPointSetDensityGaussianFunction.h index 56955afdf723c2e87e23c2eabdcf89d8fedc4cec..44fadcfc973f9adcc14118ab4b0befecc38ec9f1 100644 --- a/Modules/Feature/Density/include/otbPointSetDensityGaussianFunction.h +++ b/Modules/Feature/Density/include/otbPointSetDensityGaussianFunction.h @@ -65,13 +65,13 @@ public: itkGetMacro(Radius, unsigned int); /** Evaluate Method */ - OutputType Evaluate(const InputType& input) const ITK_OVERRIDE; + OutputType Evaluate(const InputType& input) const override; protected: PointSetDensityGaussianFunction() : m_Radius(1) {}; - ~PointSetDensityGaussianFunction() ITK_OVERRIDE {} + ~PointSetDensityGaussianFunction() override {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: PointSetDensityGaussianFunction(const Self &); //purposely not implemented diff --git a/Modules/Feature/Density/include/otbPointSetToDensityImageFilter.h b/Modules/Feature/Density/include/otbPointSetToDensityImageFilter.h index a68b729dadc3060ed552508fb1a3ce02cabb62d7..47f61fe050f8d2369698111af45a5158f8ec640a 100644 --- a/Modules/Feature/Density/include/otbPointSetToDensityImageFilter.h +++ b/Modules/Feature/Density/include/otbPointSetToDensityImageFilter.h @@ -82,27 +82,27 @@ protected: /** * Destructor. */ - ~PointSetToDensityImageFilter() ITK_OVERRIDE {} + ~PointSetToDensityImageFilter() override {} /** * Standard PrintSelf method. */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** * Call the ImageSource::GenerateData which handle multithreading */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** * Main computation method. */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId) ITK_OVERRIDE; + itk::ThreadIdType threadId) override; /** * Main computation method. */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; private: diff --git a/Modules/Feature/Descriptors/include/otbForwardFourierMellinTransformImageFilter.h b/Modules/Feature/Descriptors/include/otbForwardFourierMellinTransformImageFilter.h index de10e1cf1145dd9a326a5a6e59e1090a6419f849..56fa10d27f938121b05956f38dcedc9c997ae213 100644 --- a/Modules/Feature/Descriptors/include/otbForwardFourierMellinTransformImageFilter.h +++ b/Modules/Feature/Descriptors/include/otbForwardFourierMellinTransformImageFilter.h @@ -129,15 +129,15 @@ public: protected: ForwardFourierMellinTransformImageFilter(); - ~ForwardFourierMellinTransformImageFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~ForwardFourierMellinTransformImageFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; - void GenerateOutputInformation(void) ITK_OVERRIDE; + void GenerateOutputInformation(void) override; - void GenerateInputRequestedRegion(void) ITK_OVERRIDE; + void GenerateInputRequestedRegion(void) override; /** Main Computation Method */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; private: ForwardFourierMellinTransformImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Feature/Descriptors/include/otbFourierMellinDescriptorsImageFunction.h b/Modules/Feature/Descriptors/include/otbFourierMellinDescriptorsImageFunction.h index b2e6864a13ba482599c746b5e3c567689cf6ce2b..9eac6eeebcb383c3dbe4a21794a0e2dbb1ae181a 100644 --- a/Modules/Feature/Descriptors/include/otbFourierMellinDescriptorsImageFunction.h +++ b/Modules/Feature/Descriptors/include/otbFourierMellinDescriptorsImageFunction.h @@ -101,17 +101,17 @@ public: InputImageType::ImageDimension); /** Evalulate the function at specified index */ - OutputType EvaluateAtIndex(const IndexType& index) const ITK_OVERRIDE; + OutputType EvaluateAtIndex(const IndexType& index) const override; /** Evaluate the function at non-integer positions */ - OutputType Evaluate(const PointType& point) const ITK_OVERRIDE + OutputType Evaluate(const PointType& point) const override { IndexType index; this->ConvertPointToNearestIndex(point, index); return this->EvaluateAtIndex(index); } OutputType EvaluateAtContinuousIndex( - const ContinuousIndexType& cindex) const ITK_OVERRIDE + const ContinuousIndexType& cindex) const override { IndexType index; this->ConvertContinuousIndexToNearestIndex(cindex, index); @@ -131,8 +131,8 @@ public: protected: FourierMellinDescriptorsImageFunction(); - ~FourierMellinDescriptorsImageFunction() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~FourierMellinDescriptorsImageFunction() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: FourierMellinDescriptorsImageFunction(const Self &); //purposely not implemented diff --git a/Modules/Feature/Descriptors/include/otbHessianToScalarImageFilter.h b/Modules/Feature/Descriptors/include/otbHessianToScalarImageFilter.h index 04e0d2bdcd0ba9542e04d7469f10080a184dbc66..67a5ca55c6beaababccc30095d45223bf1f12b2d 100644 --- a/Modules/Feature/Descriptors/include/otbHessianToScalarImageFilter.h +++ b/Modules/Feature/Descriptors/include/otbHessianToScalarImageFilter.h @@ -107,7 +107,7 @@ public: } protected: HessianToScalarImageFilter() {} - ~HessianToScalarImageFilter() ITK_OVERRIDE {} + ~HessianToScalarImageFilter() override {} private: HessianToScalarImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Feature/Descriptors/include/otbHistogramOfOrientedGradientCovariantImageFunction.h b/Modules/Feature/Descriptors/include/otbHistogramOfOrientedGradientCovariantImageFunction.h index 6a464dd648e70ef28409dd87514ba34406caccd3..930982a8aba1fafefb234e6f1c34344181c93a8a 100644 --- a/Modules/Feature/Descriptors/include/otbHistogramOfOrientedGradientCovariantImageFunction.h +++ b/Modules/Feature/Descriptors/include/otbHistogramOfOrientedGradientCovariantImageFunction.h @@ -103,17 +103,17 @@ public: InputImageType::ImageDimension); /** Evalulate the function at specified index */ - OutputType EvaluateAtIndex(const IndexType& index) const ITK_OVERRIDE; + OutputType EvaluateAtIndex(const IndexType& index) const override; /** Evaluate the function at non-integer positions */ - OutputType Evaluate(const PointType& point) const ITK_OVERRIDE + OutputType Evaluate(const PointType& point) const override { IndexType index; this->ConvertPointToNearestIndex(point, index); return this->EvaluateAtIndex(index); } OutputType EvaluateAtContinuousIndex( - const ContinuousIndexType& cindex) const ITK_OVERRIDE + const ContinuousIndexType& cindex) const override { IndexType index; this->ConvertContinuousIndexToNearestIndex(cindex, index); @@ -134,8 +134,8 @@ public: protected: HistogramOfOrientedGradientCovariantImageFunction(); - ~HistogramOfOrientedGradientCovariantImageFunction() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~HistogramOfOrientedGradientCovariantImageFunction() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: HistogramOfOrientedGradientCovariantImageFunction(const Self &); //purposely not implemented diff --git a/Modules/Feature/Descriptors/include/otbImageToHessianDeterminantImageFilter.h b/Modules/Feature/Descriptors/include/otbImageToHessianDeterminantImageFilter.h index 7466591cdf5d2328a14397073460dbfd3c602b2b..009f7091946896ad4fcd1895c38820f4a07f20f5 100644 --- a/Modules/Feature/Descriptors/include/otbImageToHessianDeterminantImageFilter.h +++ b/Modules/Feature/Descriptors/include/otbImageToHessianDeterminantImageFilter.h @@ -133,15 +133,15 @@ protected: /** * Destructor. */ - ~ImageToHessianDeterminantImageFilter() ITK_OVERRIDE; + ~ImageToHessianDeterminantImageFilter() override; /** * Standard PrintSelf method. */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** * Main computation method. */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; private: diff --git a/Modules/Feature/Descriptors/include/otbImageToSIFTKeyPointSetFilter.h b/Modules/Feature/Descriptors/include/otbImageToSIFTKeyPointSetFilter.h index deba62193489b6d8bbbc8b50170695834e6c9759..e554389b152746d710397805bdb1928127c8fffd 100644 --- a/Modules/Feature/Descriptors/include/otbImageToSIFTKeyPointSetFilter.h +++ b/Modules/Feature/Descriptors/include/otbImageToSIFTKeyPointSetFilter.h @@ -227,16 +227,16 @@ public: protected: /** Actually process the input */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** Constructor */ ImageToSIFTKeyPointSetFilter(); /** Destructor */ - ~ImageToSIFTKeyPointSetFilter() ITK_OVERRIDE {} + ~ImageToSIFTKeyPointSetFilter() override {} /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Initialize input image */ void InitializeInputImage(); diff --git a/Modules/Feature/Descriptors/include/otbImageToSURFKeyPointSetFilter.h b/Modules/Feature/Descriptors/include/otbImageToSURFKeyPointSetFilter.h index eec0eef16eebc18f9fcb181f44c950368266c436..bb8b1f2e6d132aecd114a39356696d284d05ea82 100644 --- a/Modules/Feature/Descriptors/include/otbImageToSURFKeyPointSetFilter.h +++ b/Modules/Feature/Descriptors/include/otbImageToSURFKeyPointSetFilter.h @@ -134,15 +134,15 @@ protected: /** * Destructor. */ - ~ImageToSURFKeyPointSetFilter() ITK_OVERRIDE; + ~ImageToSURFKeyPointSetFilter() override; /** * Standard PrintSelf method. */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** * Main computation method. */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** Check local extremum for 8 neighbors (current) * diff --git a/Modules/Feature/Descriptors/include/otbKeyPointSetsMatchingFilter.h b/Modules/Feature/Descriptors/include/otbKeyPointSetsMatchingFilter.h index 671c19bc4398bcc6301c7ae8f861984387df5914..bf16d31549d549ff9e1da260092d4ba4009e6ede 100644 --- a/Modules/Feature/Descriptors/include/otbKeyPointSetsMatchingFilter.h +++ b/Modules/Feature/Descriptors/include/otbKeyPointSetsMatchingFilter.h @@ -102,12 +102,12 @@ protected: /// Constructor KeyPointSetsMatchingFilter(); /// Destructor - ~KeyPointSetsMatchingFilter() ITK_OVERRIDE {} + ~KeyPointSetsMatchingFilter() override {} /// PrintSelf method - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /// Generate Data - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** * Find the nearest neighbor of data1 in pointset. diff --git a/Modules/Feature/Descriptors/include/otbLandmark.h b/Modules/Feature/Descriptors/include/otbLandmark.h index 70573df764fee04639f5e8162c5d7ab0e1f6b04b..997e5da5e5929230d240304a531807006cb29ea5 100644 --- a/Modules/Feature/Descriptors/include/otbLandmark.h +++ b/Modules/Feature/Descriptors/include/otbLandmark.h @@ -72,9 +72,9 @@ protected: /// Constructor Landmark() {} /// Destructor - ~Landmark() ITK_OVERRIDE {} + ~Landmark() override {} /// PrintSelf method - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + void PrintSelf(std::ostream& os, itk::Indent indent) const override { Superclass::PrintSelf(os, indent); os << indent << "Landmark: P1= " << m_Point1 << " P2= " << m_Point2 << std::endl; diff --git a/Modules/Feature/Descriptors/include/otbSiftFastImageFilter.h b/Modules/Feature/Descriptors/include/otbSiftFastImageFilter.h index 4cbbce49b6a53d9726102ff3f4ef2bbe5e1f7cb5..ff1e7ef2b51bad6812563f7f75b5664514e8b5d9 100644 --- a/Modules/Feature/Descriptors/include/otbSiftFastImageFilter.h +++ b/Modules/Feature/Descriptors/include/otbSiftFastImageFilter.h @@ -91,16 +91,16 @@ public: protected: /** Actually process the input */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** Constructor */ SiftFastImageFilter(); /** Destructor */ - ~SiftFastImageFilter() ITK_OVERRIDE {} + ~SiftFastImageFilter() override {} /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: /** The number of scales */ diff --git a/Modules/Feature/Descriptors/test/CMakeLists.txt b/Modules/Feature/Descriptors/test/CMakeLists.txt index 587685882e08c5adfec389e8d381de9cab0ea19d..6382e7b260145bece389dcc81ded8032f926bee1 100644 --- a/Modules/Feature/Descriptors/test/CMakeLists.txt +++ b/Modules/Feature/Descriptors/test/CMakeLists.txt @@ -263,9 +263,10 @@ otb_add_test(NAME feTvFourierMellinDescriptors COMMAND otbDescriptorsTestDriver ) otb_add_test(NAME feTvImageToSIFTKeyPointSetFilterDistanceMap COMMAND otbDescriptorsTestDriver - --compare-ascii ${EPSILON_3} + --compare-ascii ${EPSILON_3} ${BASELINE_FILES}/feTvImageToSIFTKeyPointSetFilterDistanceMap.txt ${TEMP}/feTvImageToSIFTKeyPointSetFilterDistanceMap.txt + --ignore-lines-with 2 INFO DEBUG otbImageToSIFTKeyPointSetFilterDistanceMap ${INPUTDATA}/scene.png 6 3 0.08 10.0 diff --git a/Modules/Feature/Edge/include/otbAssociativeSymmetricalSumImageFilter.h b/Modules/Feature/Edge/include/otbAssociativeSymmetricalSumImageFilter.h index 5e8f72c6f5dd419a29e7715d08806f87992dcc6f..b0c011244cb25172076d21727ff369ac0353f16c 100644 --- a/Modules/Feature/Edge/include/otbAssociativeSymmetricalSumImageFilter.h +++ b/Modules/Feature/Edge/include/otbAssociativeSymmetricalSumImageFilter.h @@ -94,7 +94,7 @@ public: protected: AssociativeSymmetricalSumImageFilter() {} - ~AssociativeSymmetricalSumImageFilter() ITK_OVERRIDE {} + ~AssociativeSymmetricalSumImageFilter() override {} private: AssociativeSymmetricalSumImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Feature/Edge/include/otbAsymmetricFusionOfLineDetectorImageFilter.h b/Modules/Feature/Edge/include/otbAsymmetricFusionOfLineDetectorImageFilter.h index 463564db4a4caf5de42746c7ccf9de92719569af..991f9c1b5e1ec3acc8d946fabf830c11a1c26b23 100644 --- a/Modules/Feature/Edge/include/otbAsymmetricFusionOfLineDetectorImageFilter.h +++ b/Modules/Feature/Edge/include/otbAsymmetricFusionOfLineDetectorImageFilter.h @@ -81,7 +81,7 @@ public: protected: AsymmetricFusionOfLineDetectorImageFilter(); - ~AsymmetricFusionOfLineDetectorImageFilter() ITK_OVERRIDE {} + ~AsymmetricFusionOfLineDetectorImageFilter() override {} typedef otb::LineRatioDetectorImageFilter<InputImageType, OutputImageType, OutputImageDirectionType, InterpolatorType> LineRatioType; @@ -90,9 +90,9 @@ protected: typedef otb::AssociativeSymmetricalSumImageFilter<InputImageType1, InputImageType2, OutputImageType> AssSymSumType; - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: AsymmetricFusionOfLineDetectorImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Feature/Edge/include/otbEdgeDensityImageFilter.h b/Modules/Feature/Edge/include/otbEdgeDensityImageFilter.h index 0be9d6a1bce8530c02a335bbe2e4f0142aa5e14d..2b789dfe757405fce5fd0aed4812f3cfdef32c36 100644 --- a/Modules/Feature/Edge/include/otbEdgeDensityImageFilter.h +++ b/Modules/Feature/Edge/include/otbEdgeDensityImageFilter.h @@ -104,15 +104,15 @@ protected: /** * Destructor. */ - ~EdgeDensityImageFilter() ITK_OVERRIDE; + ~EdgeDensityImageFilter() override; /** * Standard PrintSelf method. */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** * Main computation method. */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; private: diff --git a/Modules/Feature/Edge/include/otbEdgeDetectorImageFilter.h b/Modules/Feature/Edge/include/otbEdgeDetectorImageFilter.h index 611459bde93334d0de11e65caf0bad58e98b3673..33fffc7376ac7187f1cf1e3a40c41bed20c817da 100644 --- a/Modules/Feature/Edge/include/otbEdgeDetectorImageFilter.h +++ b/Modules/Feature/Edge/include/otbEdgeDetectorImageFilter.h @@ -110,9 +110,9 @@ public: protected: EdgeDetectorImageFilter(); - ~EdgeDetectorImageFilter() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - void GenerateData() ITK_OVERRIDE; + ~EdgeDetectorImageFilter() override; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; + void GenerateData() override; private: diff --git a/Modules/Feature/Edge/include/otbExtractSegmentsImageFilter.h b/Modules/Feature/Edge/include/otbExtractSegmentsImageFilter.h index e04a582c19184016e54371924935cdaed024859b..76323b278a0712cae62b528677cefce46b8b99ea 100644 --- a/Modules/Feature/Edge/include/otbExtractSegmentsImageFilter.h +++ b/Modules/Feature/Edge/include/otbExtractSegmentsImageFilter.h @@ -129,16 +129,16 @@ public: protected: ExtractSegmentsImageFilter(); - ~ExtractSegmentsImageFilter() ITK_OVERRIDE {} + ~ExtractSegmentsImageFilter() override {} typedef PixelSuppressionByDirectionImageFilter<InputImageType, PSOutputImageType> PixelSuppressionType; typedef LocalHoughFilter<InputImageType> LocalHoughType; typedef FillGapsFilter FillGapsType; typedef DrawLineSpatialObjectListFilter<InputImageType, OutputImageType> DrawLineListType; typedef itk::RescaleIntensityImageFilter<TInputImage, TInputImage> RescaleType; - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: ExtractSegmentsImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Feature/Edge/include/otbFillGapsFilter.h b/Modules/Feature/Edge/include/otbFillGapsFilter.h index 4df477cd1806bb95677aaa4310fee9971291fd83..3364b55fabc190de4278f18289302de71fe66d50 100644 --- a/Modules/Feature/Edge/include/otbFillGapsFilter.h +++ b/Modules/Feature/Edge/include/otbFillGapsFilter.h @@ -71,11 +71,11 @@ public: protected: FillGapsFilter(); - ~FillGapsFilter() ITK_OVERRIDE {} + ~FillGapsFilter() override {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; private: FillGapsFilter(const Self &); //purposely not implemented diff --git a/Modules/Feature/Edge/include/otbHorizontalSobelVectorImageFilter.h b/Modules/Feature/Edge/include/otbHorizontalSobelVectorImageFilter.h index 6bd4edb5bcb4ed7fb0c369dbb1cc3c3b8872e698..e00af221d11321495fdc1c7f538570dc4417c5aa 100644 --- a/Modules/Feature/Edge/include/otbHorizontalSobelVectorImageFilter.h +++ b/Modules/Feature/Edge/include/otbHorizontalSobelVectorImageFilter.h @@ -91,7 +91,7 @@ protected: typename Superclass::RadiusType radius = {{1, 1}}; this->SetRadius( radius ); } - ~HorizontalSobelVectorImageFilter() ITK_OVERRIDE { } + ~HorizontalSobelVectorImageFilter() override { } private: HorizontalSobelVectorImageFilter( const Self & ); // Not implemented diff --git a/Modules/Feature/Edge/include/otbHoughTransform2DLinesImageFilter.h b/Modules/Feature/Edge/include/otbHoughTransform2DLinesImageFilter.h index 532c26d917a3e0a4a905b02128b223d6c33858bb..758e33dd45bf8316627411954f867c869979f688 100644 --- a/Modules/Feature/Edge/include/otbHoughTransform2DLinesImageFilter.h +++ b/Modules/Feature/Edge/include/otbHoughTransform2DLinesImageFilter.h @@ -108,7 +108,7 @@ public: itkNewMacro(Self); /** Method for evaluating the implicit function over the image. */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** Accessors for the threshold above which the filter should consider the point as a valid point */ @@ -184,17 +184,17 @@ public: protected: HoughTransform2DLinesImageFilter(); - ~HoughTransform2DLinesImageFilter() ITK_OVERRIDE {} + ~HoughTransform2DLinesImageFilter() override {} HoughTransform2DLinesImageFilter(const Self &) {} void operator =(const Self&) {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** HoughTransform2DLinesImageFilter needs the entire input. Therefore * it must provide an implementation GenerateInputRequestedRegion(). * \sa ProcessObject::GenerateInputRequestedRegion(). */ - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; /** HoughTransform2DLinesImageFilter's output is the accumulator * array. The size of the output is a function of the size of the @@ -202,10 +202,10 @@ protected: * has a different size than the input, it must provide an implementation * of GenerateOutputInformation. * \sa ProcessObject::GenerateOutputRequestedRegion() */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; /** HoughTransform2DLinesImageFilter must produce the entire output */ - void EnlargeOutputRequestedRegion(itk::DataObject *output) ITK_OVERRIDE; + void EnlargeOutputRequestedRegion(itk::DataObject *output) override; int GetAngleIndex(double); diff --git a/Modules/Feature/Edge/include/otbLineCorrelationDetectorImageFilter.h b/Modules/Feature/Edge/include/otbLineCorrelationDetectorImageFilter.h index ab4d3d3278a748ac1fa5ba320afbd94702a4af80..915054394b3180562af265a5a90c9110db2242f6 100644 --- a/Modules/Feature/Edge/include/otbLineCorrelationDetectorImageFilter.h +++ b/Modules/Feature/Edge/include/otbLineCorrelationDetectorImageFilter.h @@ -85,11 +85,11 @@ public: protected: LineCorrelationDetectorImageFilter(); - ~LineCorrelationDetectorImageFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~LineCorrelationDetectorImageFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Compute the measure */ - double ComputeMeasure(std::vector<double>* m1, std::vector<double>* m2, std::vector<double>* m3) ITK_OVERRIDE; + double ComputeMeasure(std::vector<double>* m1, std::vector<double>* m2, std::vector<double>* m3) override; private: LineCorrelationDetectorImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Feature/Edge/include/otbLineDetectorImageFilterBase.h b/Modules/Feature/Edge/include/otbLineDetectorImageFilterBase.h index 03ef00ec2ea2f691905acbee4abdc885ad681e66..bcc411f56848bf0a616d5784e80f6ddefffa0701 100644 --- a/Modules/Feature/Edge/include/otbLineDetectorImageFilterBase.h +++ b/Modules/Feature/Edge/include/otbLineDetectorImageFilterBase.h @@ -132,14 +132,14 @@ public: itkGetConstReferenceMacro(NumberOfDirections, unsigned int); void GenerateInputRequestedRegion() - throw(itk::InvalidRequestedRegionError) ITK_OVERRIDE; + throw(itk::InvalidRequestedRegionError) override; protected: LineDetectorImageFilterBase(); - ~LineDetectorImageFilterBase() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~LineDetectorImageFilterBase() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; /** LineDetectorImageFilterBase can be implemented for a treatment of filter multithreaded. * Thus, the ThreadedGenerateData() method is called for each thread process. @@ -151,7 +151,7 @@ protected: * \sa ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId) ITK_OVERRIDE; + itk::ThreadIdType threadId) override; virtual double ComputeMeasure(std::vector<double>* m1, std::vector<double>* m2, std::vector<double>* m3); diff --git a/Modules/Feature/Edge/include/otbLineRatioDetectorImageFilter.h b/Modules/Feature/Edge/include/otbLineRatioDetectorImageFilter.h index 1940cbbb2ff9bc21edf62cfe1352d23908b3cf2b..3ed85b87e232e6e381909e33a63f5d1c124ae256 100644 --- a/Modules/Feature/Edge/include/otbLineRatioDetectorImageFilter.h +++ b/Modules/Feature/Edge/include/otbLineRatioDetectorImageFilter.h @@ -114,10 +114,10 @@ public: protected: LineRatioDetectorImageFilter(); - ~LineRatioDetectorImageFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~LineRatioDetectorImageFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; - double ComputeMeasure(std::vector<double>* m1, std::vector<double>* m2, std::vector<double>* m3) ITK_OVERRIDE; + double ComputeMeasure(std::vector<double>* m1, std::vector<double>* m2, std::vector<double>* m3) override; private: LineRatioDetectorImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Feature/Edge/include/otbLineSegmentDetector.h b/Modules/Feature/Edge/include/otbLineSegmentDetector.h index 25c0872bd65fadfd1bc63b1c84f09303b26fe3e6..ef78f8c8f106bada22f21f45d3db465ba3a75290 100644 --- a/Modules/Feature/Edge/include/otbLineSegmentDetector.h +++ b/Modules/Feature/Edge/include/otbLineSegmentDetector.h @@ -192,12 +192,12 @@ public: protected: LineSegmentDetector(); - ~LineSegmentDetector() ITK_OVERRIDE {} + ~LineSegmentDetector() override {} - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; /** Generate Data method*/ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** Sort the image and store the coordinates in a histogram * this method is used to determine the seeds where to begin the search segments @@ -257,7 +257,7 @@ protected: virtual void CopyRectangle(RectangleType& rDst, RectangleType& rSrc) const; /** Printself method*/ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: LineSegmentDetector(const Self &); //purposely not implemented diff --git a/Modules/Feature/Edge/include/otbLineSegmentDetector.txx b/Modules/Feature/Edge/include/otbLineSegmentDetector.txx index c06344e1831c17e0f9c07448a40f7ceb1b154155..8ff969c22c23d5558295af53589c62a5d8168e38 100644 --- a/Modules/Feature/Edge/include/otbLineSegmentDetector.txx +++ b/Modules/Feature/Edge/include/otbLineSegmentDetector.txx @@ -792,8 +792,14 @@ LineSegmentDetector<TInputImage, TPrecision> l = (static_cast<double>((*it)[0]) - x) * dx + (static_cast<double>((*it)[1]) - y) * dy; w = -(static_cast<double>((*it)[0]) - x) * dy + (static_cast<double>((*it)[1]) - y) * dx; - if (l < l_min) l_min = l; if (l > l_max) l_max = l; - if (w < w_min) w_min = w; if (w > w_max) w_max = w; + if (l < l_min) + l_min = l; + if (l > l_max) + l_max = l; + if (w < w_min) + w_min = w; + if (w > w_max) + w_max = w; sum_l[static_cast < int > (vcl_floor(l) + 0.5) + Diagonal] += static_cast<MagnitudePixelType>(weight); sum_w[static_cast < int > (vcl_floor(w) + 0.5) + Diagonal] += static_cast<MagnitudePixelType>(weight); diff --git a/Modules/Feature/Edge/include/otbLocalHoughFilter.h b/Modules/Feature/Edge/include/otbLocalHoughFilter.h index f8d52baace672c208f497b10fded2ebf3367e369..38ff44693bc19afe73abb02d26ed35e319d372a8 100644 --- a/Modules/Feature/Edge/include/otbLocalHoughFilter.h +++ b/Modules/Feature/Edge/include/otbLocalHoughFilter.h @@ -130,13 +130,13 @@ public: protected: LocalHoughFilter(); - ~LocalHoughFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~LocalHoughFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Definition of the Hough Filter. */ typedef itk::HoughTransform2DLinesImageFilter<InputPixelType, AccumulatorPixelType> HoughFilterType; - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; private: LocalHoughFilter(const Self &); //purposely not implemented diff --git a/Modules/Feature/Edge/include/otbLocalHoughFilter.txx b/Modules/Feature/Edge/include/otbLocalHoughFilter.txx index a3b0d6e6be609527145600c5024aa0f8ffec19a3..b6a21b20f2e078f308d1af840690944d5096bc1c 100644 --- a/Modules/Feature/Edge/include/otbLocalHoughFilter.txx +++ b/Modules/Feature/Edge/include/otbLocalHoughFilter.txx @@ -229,7 +229,11 @@ LocalHoughFilter<TInputImage> // Get the list of LineSpatialObject lines // --------------------------------------- + #if !defined(ITK_LEGACY_REMOVE) lines = houghFilter->GetLines(m_NumberOfLines); + #else + lines = houghFilter->GetLines(); + #endif LineIterator itLines = lines.begin(); diff --git a/Modules/Feature/Edge/include/otbPersistentVectorizationImageFilter.h b/Modules/Feature/Edge/include/otbPersistentVectorizationImageFilter.h index f7d883212adddf4de3b506c5aec3279d1746e072..4bcf136cdc9adde818344c39dfea4ec2ace00b71 100644 --- a/Modules/Feature/Edge/include/otbPersistentVectorizationImageFilter.h +++ b/Modules/Feature/Edge/include/otbPersistentVectorizationImageFilter.h @@ -82,16 +82,16 @@ public: typedef otb::ImageToEdgePathFilter<ImageType, PathType> ImageToEdgePathFilterType; typedef typename ImageToEdgePathFilterType::Pointer ImageToEdgePathFilterPointerType; - void Reset(void) ITK_OVERRIDE; - void Synthetize(void) ITK_OVERRIDE; + void Reset(void) override; + void Synthetize(void) override; itkGetObjectMacro(PathList, PathListType); protected: PersistentVectorizationImageFilter(); - ~PersistentVectorizationImageFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - void GenerateData() ITK_OVERRIDE; + ~PersistentVectorizationImageFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; + void GenerateData() override; private: PersistentVectorizationImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Feature/Edge/include/otbPixelSuppressionByDirectionImageFilter.h b/Modules/Feature/Edge/include/otbPixelSuppressionByDirectionImageFilter.h index 647ba25f5f8b2f662baa738fdaa42cd98ec0120d..1213469178203df3a6356854ecd8a1c21c52b279 100644 --- a/Modules/Feature/Edge/include/otbPixelSuppressionByDirectionImageFilter.h +++ b/Modules/Feature/Edge/include/otbPixelSuppressionByDirectionImageFilter.h @@ -103,15 +103,15 @@ public: const InputImageType * GetInputImageDirection(void); void GenerateInputRequestedRegion() - throw(itk::InvalidRequestedRegionError) ITK_OVERRIDE; + throw(itk::InvalidRequestedRegionError) override; protected: PixelSuppressionByDirectionImageFilter(); - ~PixelSuppressionByDirectionImageFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~PixelSuppressionByDirectionImageFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId) ITK_OVERRIDE; + itk::ThreadIdType threadId) override; private: PixelSuppressionByDirectionImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Feature/Edge/include/otbSobelVectorImageFilter.h b/Modules/Feature/Edge/include/otbSobelVectorImageFilter.h index 37f45c5f1461ea777710e0462ff16ebb2f5a7477..cfe3d0d7098fd7c307307c15bada03f8caa5017d 100644 --- a/Modules/Feature/Edge/include/otbSobelVectorImageFilter.h +++ b/Modules/Feature/Edge/include/otbSobelVectorImageFilter.h @@ -100,7 +100,7 @@ protected: typename Superclass::RadiusType radius = {{1, 1}}; this->SetRadius( radius ); } - ~SobelVectorImageFilter() ITK_OVERRIDE { } + ~SobelVectorImageFilter() override { } private: SobelVectorImageFilter( const Self & ); // Not implemented diff --git a/Modules/Feature/Edge/include/otbStreamingLineSegmentDetector.h b/Modules/Feature/Edge/include/otbStreamingLineSegmentDetector.h index 9f1ad77392df57869c768de0407247a5a6d1cbe6..a161d2beeafabbf1d94972f3f5cfe8f242f1a69d 100644 --- a/Modules/Feature/Edge/include/otbStreamingLineSegmentDetector.h +++ b/Modules/Feature/Edge/include/otbStreamingLineSegmentDetector.h @@ -77,15 +77,15 @@ public: protected: PersistentStreamingLineSegmentDetector(); - ~PersistentStreamingLineSegmentDetector() ITK_OVERRIDE; + ~PersistentStreamingLineSegmentDetector() override; - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; private: PersistentStreamingLineSegmentDetector(const Self &); //purposely not implemented void operator =(const Self&); //purposely not implemented - OutputVectorDataPointerType ProcessTile() ITK_OVERRIDE; + OutputVectorDataPointerType ProcessTile() override; }; template <class TImageType> diff --git a/Modules/Feature/Edge/include/otbTouziEdgeDetectorImageFilter.h b/Modules/Feature/Edge/include/otbTouziEdgeDetectorImageFilter.h index ad0c0d37040ae15b823f5baf2d440e4e3cb65482..90b1cc18e9901740bb9bd9b9b30db50d8e8e49a0 100644 --- a/Modules/Feature/Edge/include/otbTouziEdgeDetectorImageFilter.h +++ b/Modules/Feature/Edge/include/otbTouziEdgeDetectorImageFilter.h @@ -101,14 +101,14 @@ public: * * \sa ImageToImageFilter::GenerateInputRequestedRegion() */ void GenerateInputRequestedRegion() - throw(itk::InvalidRequestedRegionError) ITK_OVERRIDE; + throw(itk::InvalidRequestedRegionError) override; protected: TouziEdgeDetectorImageFilter(); - ~TouziEdgeDetectorImageFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~TouziEdgeDetectorImageFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; /** TouziEdgeDetectorImageFilter can be implemented for a multithreaded filter treatment. * Thus, this implementation give the ThreadedGenerateData() method. @@ -119,7 +119,7 @@ protected: * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId) ITK_OVERRIDE; + itk::ThreadIdType threadId) override; private: TouziEdgeDetectorImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Feature/Edge/include/otbVerticalSobelVectorImageFilter.h b/Modules/Feature/Edge/include/otbVerticalSobelVectorImageFilter.h index fd480b5795c9b20e1c8fc6f1bf3b3cd5e6ac406c..b244398da4bed7c02bc68148b4f35fa843f3f88a 100644 --- a/Modules/Feature/Edge/include/otbVerticalSobelVectorImageFilter.h +++ b/Modules/Feature/Edge/include/otbVerticalSobelVectorImageFilter.h @@ -91,7 +91,7 @@ protected: typename Superclass::RadiusType radius = {{1, 1}}; this->SetRadius( radius ); } - ~VerticalSobelVectorImageFilter() ITK_OVERRIDE { } + ~VerticalSobelVectorImageFilter() override { } private: VerticalSobelVectorImageFilter( const Self & ); // Not implemented diff --git a/Modules/Feature/Moments/include/otbComplexMomentPathFunction.h b/Modules/Feature/Moments/include/otbComplexMomentPathFunction.h index c6de473c73543543baf5e603a317cf835033bd26..83d638752ed2cf3f51af5f49b16fe2f9cd7c8b6e 100644 --- a/Modules/Feature/Moments/include/otbComplexMomentPathFunction.h +++ b/Modules/Feature/Moments/include/otbComplexMomentPathFunction.h @@ -92,7 +92,7 @@ public: typedef std::complex<PrecisionType> ComplexPrecisionType; /** Evalulate the function */ - OutputType Evaluate(const PathType& path) const ITK_OVERRIDE; + OutputType Evaluate(const PathType& path) const override; virtual OutputType Evaluate() const; itkSetMacro(P, unsigned int); @@ -102,8 +102,8 @@ public: protected: ComplexMomentPathFunction(); - ~ComplexMomentPathFunction() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~ComplexMomentPathFunction() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: ComplexMomentPathFunction(const Self &); //purposely not implemented diff --git a/Modules/Feature/Moments/include/otbComplexMomentsImageFunction.h b/Modules/Feature/Moments/include/otbComplexMomentsImageFunction.h index ea7ccac8fc4f1dad40240039bb0888255ce66f48..5f8629703250a19d42d83d5aad641ef05b3f98b7 100644 --- a/Modules/Feature/Moments/include/otbComplexMomentsImageFunction.h +++ b/Modules/Feature/Moments/include/otbComplexMomentsImageFunction.h @@ -92,17 +92,17 @@ public: InputImageType::ImageDimension); /** Evalulate the function at specified index */ - OutputType EvaluateAtIndex(const IndexType& index) const ITK_OVERRIDE; + OutputType EvaluateAtIndex(const IndexType& index) const override; /** Evaluate the function at non-integer positions */ - OutputType Evaluate(const PointType& point) const ITK_OVERRIDE + OutputType Evaluate(const PointType& point) const override { IndexType index; this->ConvertPointToNearestIndex(point, index); return this->EvaluateAtIndex(index); } OutputType EvaluateAtContinuousIndex( - const ContinuousIndexType& cindex) const ITK_OVERRIDE + const ContinuousIndexType& cindex) const override { IndexType index; this->ConvertContinuousIndexToNearestIndex(cindex, index); @@ -122,8 +122,8 @@ public: protected: ComplexMomentsImageFunction(); - ~ComplexMomentsImageFunction() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~ComplexMomentsImageFunction() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: ComplexMomentsImageFunction(const Self &); //purposely not implemented diff --git a/Modules/Feature/Moments/include/otbFlusserMomentsImageFunction.h b/Modules/Feature/Moments/include/otbFlusserMomentsImageFunction.h index 38914022defc4c6d873e2453d5e5ebc07952af51..4590e021534d5621ea643093e4faf44ef4f89de4 100644 --- a/Modules/Feature/Moments/include/otbFlusserMomentsImageFunction.h +++ b/Modules/Feature/Moments/include/otbFlusserMomentsImageFunction.h @@ -108,17 +108,17 @@ public: InputImageType::ImageDimension); /** Evalulate the function at specified index */ - OutputType EvaluateAtIndex(const IndexType& index) const ITK_OVERRIDE; + OutputType EvaluateAtIndex(const IndexType& index) const override; /** Evaluate the function at non-integer positions */ - OutputType Evaluate(const PointType& point) const ITK_OVERRIDE + OutputType Evaluate(const PointType& point) const override { IndexType index; this->ConvertPointToNearestIndex(point, index); return this->EvaluateAtIndex(index); } OutputType EvaluateAtContinuousIndex( - const ContinuousIndexType& cindex) const ITK_OVERRIDE + const ContinuousIndexType& cindex) const override { IndexType index; this->ConvertContinuousIndexToNearestIndex(cindex, index); @@ -133,8 +133,8 @@ public: protected: FlusserMomentsImageFunction(); - ~FlusserMomentsImageFunction() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~FlusserMomentsImageFunction() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: FlusserMomentsImageFunction(const Self &); //purposely not implemented diff --git a/Modules/Feature/Moments/include/otbFlusserPathFunction.h b/Modules/Feature/Moments/include/otbFlusserPathFunction.h index 8564016eac747e93d031687396864358d7f4ca83..4f6e4788b88d0302a415c10c1e93630ed5023df5 100644 --- a/Modules/Feature/Moments/include/otbFlusserPathFunction.h +++ b/Modules/Feature/Moments/include/otbFlusserPathFunction.h @@ -93,7 +93,7 @@ public: typedef typename Superclass::PrecisionType PrecisionType; /** Evaluate the function at non-integer positions */ - RealType Evaluate(const PathType& path) const ITK_OVERRIDE; + RealType Evaluate(const PathType& path) const override; virtual RealType Evaluate() const; /** Get/Set the radius of the neighborhood over which the statistics are evaluated */ @@ -102,8 +102,8 @@ public: protected: FlusserPathFunction(); - ~FlusserPathFunction() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~FlusserPathFunction() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: FlusserPathFunction(const Self &); //purposely not implemented diff --git a/Modules/Feature/Moments/include/otbGeometricMomentPathFunction.h b/Modules/Feature/Moments/include/otbGeometricMomentPathFunction.h index 4ebbc49a6dad30b00906359ea301888489837186..c02171118b23a39a0d378c267443c6196d9f03ac 100644 --- a/Modules/Feature/Moments/include/otbGeometricMomentPathFunction.h +++ b/Modules/Feature/Moments/include/otbGeometricMomentPathFunction.h @@ -63,8 +63,8 @@ public: protected: GeometricMomentPathFunction() {}; - ~GeometricMomentPathFunction() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + ~GeometricMomentPathFunction() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override { Superclass::PrintSelf(os, indent); } diff --git a/Modules/Feature/Moments/include/otbHuMomentsImageFunction.h b/Modules/Feature/Moments/include/otbHuMomentsImageFunction.h index e74f8643423471ddb0f08413e1a2a09e75d9ff55..3c319ecfb3253dc1ef63ac8a38c602ec3f29f18a 100644 --- a/Modules/Feature/Moments/include/otbHuMomentsImageFunction.h +++ b/Modules/Feature/Moments/include/otbHuMomentsImageFunction.h @@ -104,17 +104,17 @@ public: InputImageType::ImageDimension); /** Evalulate the function at specified index */ - OutputType EvaluateAtIndex(const IndexType& index) const ITK_OVERRIDE; + OutputType EvaluateAtIndex(const IndexType& index) const override; /** Evaluate the function at non-integer positions */ - OutputType Evaluate(const PointType& point) const ITK_OVERRIDE + OutputType Evaluate(const PointType& point) const override { IndexType index; this->ConvertPointToNearestIndex(point, index); return this->EvaluateAtIndex(index); } OutputType EvaluateAtContinuousIndex( - const ContinuousIndexType& cindex) const ITK_OVERRIDE + const ContinuousIndexType& cindex) const override { IndexType index; this->ConvertContinuousIndexToNearestIndex(cindex, index); @@ -129,8 +129,8 @@ public: protected: HuMomentsImageFunction(); - ~HuMomentsImageFunction() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~HuMomentsImageFunction() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: HuMomentsImageFunction(const Self &); //purposely not implemented diff --git a/Modules/Feature/Moments/include/otbHuPathFunction.h b/Modules/Feature/Moments/include/otbHuPathFunction.h index 6014af005cf7bf55772179dc468ead442eaa3bb9..855460a704892b969c26a940f1c98d451a5b03b6 100644 --- a/Modules/Feature/Moments/include/otbHuPathFunction.h +++ b/Modules/Feature/Moments/include/otbHuPathFunction.h @@ -90,7 +90,7 @@ public: typedef typename Superclass::PrecisionType PrecisionType; /** Evaluate the function at non-integer positions */ - RealType Evaluate(const PathType& path) const ITK_OVERRIDE; + RealType Evaluate(const PathType& path) const override; virtual RealType Evaluate() const; /** Get/Set the radius of the neighborhood over which the statistics are evaluated */ @@ -99,8 +99,8 @@ public: protected: HuPathFunction(); - ~HuPathFunction() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~HuPathFunction() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: HuPathFunction(const Self &); //purposely not implemented diff --git a/Modules/Feature/Moments/include/otbRadiometricMomentsImageFilter.h b/Modules/Feature/Moments/include/otbRadiometricMomentsImageFilter.h index 0324437e3db294c5c245e5f3a1ce1915ffe40a09..6508a9ce8e1dc871b88c1b08958e435d53738f29 100644 --- a/Modules/Feature/Moments/include/otbRadiometricMomentsImageFilter.h +++ b/Modules/Feature/Moments/include/otbRadiometricMomentsImageFilter.h @@ -92,10 +92,10 @@ public: protected: RadiometricMomentsImageFilter(); - ~RadiometricMomentsImageFilter() ITK_OVERRIDE {} - void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; - void GenerateInputRequestedRegion(void) ITK_OVERRIDE; - void GenerateOutputInformation(void) ITK_OVERRIDE; + ~RadiometricMomentsImageFilter() override {} + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) override; + void GenerateInputRequestedRegion(void) override; + void GenerateOutputInformation(void) override; private: RadiometricMomentsImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Feature/Moments/include/otbRadiometricMomentsImageFunction.h b/Modules/Feature/Moments/include/otbRadiometricMomentsImageFunction.h index 1fd7355e7c94e341d8100b646fe92e70d215943f..49563faaaf4079e7021d1c1435682ef37d6e8a36 100644 --- a/Modules/Feature/Moments/include/otbRadiometricMomentsImageFunction.h +++ b/Modules/Feature/Moments/include/otbRadiometricMomentsImageFunction.h @@ -89,17 +89,17 @@ public: InputImageType::ImageDimension); /** Evalulate the function at specified index */ - OutputType EvaluateAtIndex(const IndexType& index) const ITK_OVERRIDE; + OutputType EvaluateAtIndex(const IndexType& index) const override; /** Evaluate the function at non-integer positions */ - OutputType Evaluate(const PointType& point) const ITK_OVERRIDE + OutputType Evaluate(const PointType& point) const override { IndexType index; this->ConvertPointToNearestIndex(point, index); return this->EvaluateAtIndex(index); } OutputType EvaluateAtContinuousIndex( - const ContinuousIndexType& cindex) const ITK_OVERRIDE + const ContinuousIndexType& cindex) const override { IndexType index; this->ConvertContinuousIndexToNearestIndex(cindex, index); @@ -114,8 +114,8 @@ public: protected: RadiometricMomentsImageFunction(); - ~RadiometricMomentsImageFunction() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~RadiometricMomentsImageFunction() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: RadiometricMomentsImageFunction(const Self &); //purposely not implemented diff --git a/Modules/Feature/Moments/include/otbRealMomentPathFunction.h b/Modules/Feature/Moments/include/otbRealMomentPathFunction.h index 70765ce6f7d095d58ad5a166b4702a78a38f2690..fdb123749ac658382aa2a1654190bc9bdf409d3b 100644 --- a/Modules/Feature/Moments/include/otbRealMomentPathFunction.h +++ b/Modules/Feature/Moments/include/otbRealMomentPathFunction.h @@ -67,8 +67,8 @@ public: protected: RealMomentPathFunction() {} - ~RealMomentPathFunction() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + ~RealMomentPathFunction() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override { Superclass::PrintSelf(os, indent); } diff --git a/Modules/Feature/Moments/include/otbRealMomentsImageFunction.h b/Modules/Feature/Moments/include/otbRealMomentsImageFunction.h index 7dcfce0489626a9564c5c3a15e71a2b90174f568..d535d989cb476cc3701c0f569c882bc3c1736a8a 100644 --- a/Modules/Feature/Moments/include/otbRealMomentsImageFunction.h +++ b/Modules/Feature/Moments/include/otbRealMomentsImageFunction.h @@ -79,17 +79,17 @@ public: InputImageType::ImageDimension); /** Evalulate the function at specified index */ - OutputType EvaluateAtIndex(const IndexType& index) const ITK_OVERRIDE; + OutputType EvaluateAtIndex(const IndexType& index) const override; /** Evaluate the function at non-integer positions */ - OutputType Evaluate(const PointType& point) const ITK_OVERRIDE + OutputType Evaluate(const PointType& point) const override { IndexType index; this->ConvertPointToNearestIndex(point, index); return this->EvaluateAtIndex(index); } OutputType EvaluateAtContinuousIndex( - const ContinuousIndexType& cindex) const ITK_OVERRIDE + const ContinuousIndexType& cindex) const override { IndexType index; this->ConvertContinuousIndexToNearestIndex(cindex, index); @@ -109,8 +109,8 @@ public: protected: RealMomentsImageFunction(); - ~RealMomentsImageFunction() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~RealMomentsImageFunction() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: RealMomentsImageFunction(const Self &); //purposely not implemented diff --git a/Modules/Feature/SeamCarving/include/otbAddCarvingPathFilter.h b/Modules/Feature/SeamCarving/include/otbAddCarvingPathFilter.h index 2b0e1a4b9d94544c4e474bbd42a67e5b178efb27..4c8f48760de0dfbe456fd0e1c228b08ae8c835a2 100644 --- a/Modules/Feature/SeamCarving/include/otbAddCarvingPathFilter.h +++ b/Modules/Feature/SeamCarving/include/otbAddCarvingPathFilter.h @@ -114,15 +114,15 @@ public: itkSetMacro(Direction, unsigned int); itkGetConstMacro(Direction, unsigned int); - void GenerateOutputInformation() ITK_OVERRIDE; - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateOutputInformation() override; + void GenerateInputRequestedRegion() override; protected: AddCarvingPathFilter(); - ~AddCarvingPathFilter() ITK_OVERRIDE {} + ~AddCarvingPathFilter() override {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - void GenerateData() ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; + void GenerateData() override; private: AddCarvingPathFilter(const Self &); //purposely not implemented diff --git a/Modules/Feature/SeamCarving/include/otbImageToCarvingPathFilter.h b/Modules/Feature/SeamCarving/include/otbImageToCarvingPathFilter.h index a3cdcc3623b920d8edd4913f83f790241fde0321..d48e79b04c284d025b3b64f8bb20c24341fbd47a 100644 --- a/Modules/Feature/SeamCarving/include/otbImageToCarvingPathFilter.h +++ b/Modules/Feature/SeamCarving/include/otbImageToCarvingPathFilter.h @@ -93,10 +93,10 @@ public: protected: ImageToCarvingPathFilter(); - ~ImageToCarvingPathFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - void GenerateOutputInformation() ITK_OVERRIDE {} //does nothing - void GenerateData() ITK_OVERRIDE; + ~ImageToCarvingPathFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; + void GenerateOutputInformation() override {} //does nothing + void GenerateData() override; private: ImageToCarvingPathFilter(const Self &); // purposely not implemented diff --git a/Modules/Feature/SeamCarving/include/otbRemoveCarvingPathFilter.h b/Modules/Feature/SeamCarving/include/otbRemoveCarvingPathFilter.h index 81cdd304b13064c07c531854c66419226a5e317c..3ad0f99046c11ec827e83bb15561c599ec8a27a0 100644 --- a/Modules/Feature/SeamCarving/include/otbRemoveCarvingPathFilter.h +++ b/Modules/Feature/SeamCarving/include/otbRemoveCarvingPathFilter.h @@ -115,14 +115,14 @@ public: itkSetMacro(Direction, unsigned int); itkGetConstMacro(Direction, unsigned int); - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; protected: RemoveCarvingPathFilter(); - ~RemoveCarvingPathFilter() ITK_OVERRIDE {} + ~RemoveCarvingPathFilter() override {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - void GenerateData() ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; + void GenerateData() override; private: RemoveCarvingPathFilter(const Self &); //purposely not implemented diff --git a/Modules/Feature/Textures/include/otbGreyLevelCooccurrenceIndexedList.h b/Modules/Feature/Textures/include/otbGreyLevelCooccurrenceIndexedList.h index f4c1692d28b2a6a15beea5bb3be74147624eb61e..6e3cd1707af083cb90395e0dac80bd88002c8609 100644 --- a/Modules/Feature/Textures/include/otbGreyLevelCooccurrenceIndexedList.h +++ b/Modules/Feature/Textures/include/otbGreyLevelCooccurrenceIndexedList.h @@ -138,7 +138,7 @@ public: protected: GreyLevelCooccurrenceIndexedList(); - ~GreyLevelCooccurrenceIndexedList() ITK_OVERRIDE { } + ~GreyLevelCooccurrenceIndexedList() override { } /** create a cooccurrence pair with given index and frequency = 1 * value. Next occurrence of same index is checked via m_LookupArray and the @@ -155,7 +155,7 @@ protected: /** Get index of the pixelPair combination and save the result in index **/ bool GetIndex(const PixelPairType & pixelPair, IndexType & index) const; - void PrintSelf(std::ostream & os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream & os, itk::Indent indent) const override; private: diff --git a/Modules/Feature/Textures/include/otbHaralickTexturesImageFunction.h b/Modules/Feature/Textures/include/otbHaralickTexturesImageFunction.h index 167fd367705ad3e96a80b9ca47cb2b0598e480c5..bc717f3838397bacf54d6bf469a09343d4d032b8 100644 --- a/Modules/Feature/Textures/include/otbHaralickTexturesImageFunction.h +++ b/Modules/Feature/Textures/include/otbHaralickTexturesImageFunction.h @@ -149,17 +149,17 @@ public: InputImageType::ImageDimension); /** Evalulate the function at specified index */ - OutputType EvaluateAtIndex(const IndexType& index) const ITK_OVERRIDE; + OutputType EvaluateAtIndex(const IndexType& index) const override; /** Evaluate the function at non-integer positions */ - OutputType Evaluate(const PointType& point) const ITK_OVERRIDE + OutputType Evaluate(const PointType& point) const override { IndexType index; this->ConvertPointToNearestIndex(point, index); return this->EvaluateAtIndex(index); } OutputType EvaluateAtContinuousIndex( - const ContinuousIndexType& cindex) const ITK_OVERRIDE + const ContinuousIndexType& cindex) const override { IndexType index; this->ConvertContinuousIndexToNearestIndex(cindex, index); @@ -203,8 +203,8 @@ public: protected: HaralickTexturesImageFunction(); - ~HaralickTexturesImageFunction() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~HaralickTexturesImageFunction() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: HaralickTexturesImageFunction(const Self &); //purposely not implemented diff --git a/Modules/Feature/Textures/include/otbSFSTexturesImageFilter.h b/Modules/Feature/Textures/include/otbSFSTexturesImageFilter.h index 2ac676e4aef479ac58926e51342b723fda38b19b..a4155279005efac5b58d3c5d538c8d7345a203b0 100644 --- a/Modules/Feature/Textures/include/otbSFSTexturesImageFilter.h +++ b/Modules/Feature/Textures/include/otbSFSTexturesImageFilter.h @@ -213,18 +213,18 @@ public: const OutputImageType * GetSDOutput() const; OutputImageType * GetSDOutput(); - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; std::vector<FunctorType> m_FunctorList; protected: SFSTexturesImageFilter(); - ~SFSTexturesImageFilter() ITK_OVERRIDE{} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~SFSTexturesImageFilter() override{} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; - void BeforeThreadedGenerateData() ITK_OVERRIDE; - void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) override; /** Pad the input requested region by radius */ - void GenerateInputRequestedRegion(void) ITK_OVERRIDE; + void GenerateInputRequestedRegion(void) override; private: SFSTexturesImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Feature/Textures/include/otbScalarImageToAdvancedTexturesFilter.h b/Modules/Feature/Textures/include/otbScalarImageToAdvancedTexturesFilter.h index 8ed418c5f0855e05d6627b10623efdcbe3ff1f47..22d3fe478e3803b53205285154f0e29cb120781a 100644 --- a/Modules/Feature/Textures/include/otbScalarImageToAdvancedTexturesFilter.h +++ b/Modules/Feature/Textures/include/otbScalarImageToAdvancedTexturesFilter.h @@ -213,15 +213,15 @@ protected: /** Constructor */ ScalarImageToAdvancedTexturesFilter(); /** Destructor */ - ~ScalarImageToAdvancedTexturesFilter() ITK_OVERRIDE; + ~ScalarImageToAdvancedTexturesFilter() override; /** Generate the output information */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; /** Generate the input requested region */ - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; /** Before Parallel textures extraction */ - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; /** Parallel textures extraction */ - void ThreadedGenerateData(const OutputRegionType& outputRegion, itk::ThreadIdType threadId) ITK_OVERRIDE; + void ThreadedGenerateData(const OutputRegionType& outputRegion, itk::ThreadIdType threadId) override; private: ScalarImageToAdvancedTexturesFilter(const Self&); //purposely not implemented diff --git a/Modules/Feature/Textures/include/otbScalarImageToHigherOrderTexturesFilter.h b/Modules/Feature/Textures/include/otbScalarImageToHigherOrderTexturesFilter.h index f252b673cad9c7a27dc789c49bf39736be0642ec..72b6517ffff1596786aa02a84177495861b67ad3 100644 --- a/Modules/Feature/Textures/include/otbScalarImageToHigherOrderTexturesFilter.h +++ b/Modules/Feature/Textures/include/otbScalarImageToHigherOrderTexturesFilter.h @@ -200,13 +200,13 @@ protected: /** Constructor */ ScalarImageToHigherOrderTexturesFilter(); /** Destructor */ - ~ScalarImageToHigherOrderTexturesFilter() ITK_OVERRIDE; + ~ScalarImageToHigherOrderTexturesFilter() override; /** Generate the output information */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; /** Generate the input requested region */ - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; /** Parallel textures extraction */ - void ThreadedGenerateData(const OutputRegionType& outputRegion, itk::ThreadIdType threadId) ITK_OVERRIDE; + void ThreadedGenerateData(const OutputRegionType& outputRegion, itk::ThreadIdType threadId) override; private: ScalarImageToHigherOrderTexturesFilter(const Self&); //purposely not implemented diff --git a/Modules/Feature/Textures/include/otbScalarImageToPanTexTextureFilter.h b/Modules/Feature/Textures/include/otbScalarImageToPanTexTextureFilter.h index 74e040025efb28412a37fc47b64af433e08ba122..3c5d65006976b929cac996d7db96b3c2bc2e4c0e 100644 --- a/Modules/Feature/Textures/include/otbScalarImageToPanTexTextureFilter.h +++ b/Modules/Feature/Textures/include/otbScalarImageToPanTexTextureFilter.h @@ -114,11 +114,11 @@ protected: /** Constructor */ ScalarImageToPanTexTextureFilter(); /** Destructor */ - ~ScalarImageToPanTexTextureFilter() ITK_OVERRIDE; + ~ScalarImageToPanTexTextureFilter() override; /** Generate the input requested region */ - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; /** Parallel textures extraction */ - void ThreadedGenerateData(const OutputRegionType& outputRegion, itk::ThreadIdType threadId) ITK_OVERRIDE; + void ThreadedGenerateData(const OutputRegionType& outputRegion, itk::ThreadIdType threadId) override; private: ScalarImageToPanTexTextureFilter(const Self&); //purposely not implemented diff --git a/Modules/Feature/Textures/include/otbScalarImageToTexturesFilter.h b/Modules/Feature/Textures/include/otbScalarImageToTexturesFilter.h index 3b9b8dfaf2e1153d4c6fe4c3ca5a6386d03e6779..b3732a164a41f35ac6b5c1cfcef8194b78e73b66 100644 --- a/Modules/Feature/Textures/include/otbScalarImageToTexturesFilter.h +++ b/Modules/Feature/Textures/include/otbScalarImageToTexturesFilter.h @@ -209,15 +209,15 @@ protected: /** Constructor */ ScalarImageToTexturesFilter(); /** Destructor */ - ~ScalarImageToTexturesFilter() ITK_OVERRIDE; + ~ScalarImageToTexturesFilter() override; /** Generate the output information */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; /** Generate the input requested region */ - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; /** Before Parallel textures extraction */ - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; /** Parallel textures extraction */ - void ThreadedGenerateData(const OutputRegionType& outputRegion, itk::ThreadIdType threadId) ITK_OVERRIDE; + void ThreadedGenerateData(const OutputRegionType& outputRegion, itk::ThreadIdType threadId) override; private: ScalarImageToTexturesFilter(const Self&); //purposely not implemented diff --git a/Modules/Feature/Textures/include/otbTextureImageFunction.h b/Modules/Feature/Textures/include/otbTextureImageFunction.h index 316a39c0ff1032b2d40cc979958613ac83e10ac9..02040fe05fa5a5d978844cb7c0cdcc5f5338e431 100644 --- a/Modules/Feature/Textures/include/otbTextureImageFunction.h +++ b/Modules/Feature/Textures/include/otbTextureImageFunction.h @@ -77,17 +77,17 @@ public: itkStaticConstMacro(ImageDimension, unsigned int, InputImageType::ImageDimension); /** Evalulate the function at specified index */ - RealType EvaluateAtIndex(const IndexType& index) const ITK_OVERRIDE; + RealType EvaluateAtIndex(const IndexType& index) const override; /** Evaluate the function at non-integer positions */ - RealType Evaluate(const PointType& point) const ITK_OVERRIDE + RealType Evaluate(const PointType& point) const override { IndexType index; this->ConvertPointToNearestIndex(point, index); return this->EvaluateAtIndex(index); } RealType EvaluateAtContinuousIndex( - const ContinuousIndexType& cindex) const ITK_OVERRIDE + const ContinuousIndexType& cindex) const override { IndexType index; this->ConvertContinuousIndexToNearestIndex(cindex, index); @@ -120,8 +120,8 @@ public: protected: TextureImageFunction(); - ~TextureImageFunction() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~TextureImageFunction() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: TextureImageFunction(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ChangeDetection/include/otbBinaryFunctorNeighborhoodJoinHistogramImageFilter.h b/Modules/Filtering/ChangeDetection/include/otbBinaryFunctorNeighborhoodJoinHistogramImageFilter.h index e9822f5cb7385773c3ad04b83940790863634fe4..3b82bad169d805f1f9fc272b856c6dae783d0ec4 100644 --- a/Modules/Filtering/ChangeDetection/include/otbBinaryFunctorNeighborhoodJoinHistogramImageFilter.h +++ b/Modules/Filtering/ChangeDetection/include/otbBinaryFunctorNeighborhoodJoinHistogramImageFilter.h @@ -148,9 +148,9 @@ public: protected: BinaryFunctorNeighborhoodJoinHistogramImageFilter(); - ~BinaryFunctorNeighborhoodJoinHistogramImageFilter() ITK_OVERRIDE {} + ~BinaryFunctorNeighborhoodJoinHistogramImageFilter() override {} - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; /** BinaryFunctorNeighborhoodJoinHistogramImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine @@ -163,12 +163,12 @@ protected: * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId) ITK_OVERRIDE; + itk::ThreadIdType threadId) override; /** * Pad the inputs requested regions by radius */ - void GenerateInputRequestedRegion(void) ITK_OVERRIDE; + void GenerateInputRequestedRegion(void) override; RadiusSizeType m_Radius; diff --git a/Modules/Filtering/ChangeDetection/include/otbCBAMIChangeDetector.h b/Modules/Filtering/ChangeDetection/include/otbCBAMIChangeDetector.h index 31f47e259f2e631217580895d4ad1b23a3baf639..e6650ce67609ba2c93db7e0307a938117fa4ef64 100644 --- a/Modules/Filtering/ChangeDetection/include/otbCBAMIChangeDetector.h +++ b/Modules/Filtering/ChangeDetection/include/otbCBAMIChangeDetector.h @@ -84,7 +84,7 @@ public: protected: CBAMIChangeDetector() {} - ~CBAMIChangeDetector() ITK_OVERRIDE {} + ~CBAMIChangeDetector() override {} private: CBAMIChangeDetector(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ChangeDetection/include/otbCorrelationChangeDetector.h b/Modules/Filtering/ChangeDetection/include/otbCorrelationChangeDetector.h index e6831bceba8ae27eff322201644ec62d6bf25094..4b710c4bba5179fccaf9536afb57ccffb8a8ae7a 100644 --- a/Modules/Filtering/ChangeDetection/include/otbCorrelationChangeDetector.h +++ b/Modules/Filtering/ChangeDetection/include/otbCorrelationChangeDetector.h @@ -83,7 +83,7 @@ public: protected: CorrelationChangeDetector() {} - ~CorrelationChangeDetector() ITK_OVERRIDE {} + ~CorrelationChangeDetector() override {} private: CorrelationChangeDetector(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ChangeDetection/include/otbJoinHistogramMIImageFilter.h b/Modules/Filtering/ChangeDetection/include/otbJoinHistogramMIImageFilter.h index 56b3f5ae70c77482b1dbe5698fa13019affd77ae..98f736f84accd02622dcef389c99eb679935a572 100644 --- a/Modules/Filtering/ChangeDetection/include/otbJoinHistogramMIImageFilter.h +++ b/Modules/Filtering/ChangeDetection/include/otbJoinHistogramMIImageFilter.h @@ -84,7 +84,7 @@ public: protected: JoinHistogramMIImageFilter() {} - ~JoinHistogramMIImageFilter() ITK_OVERRIDE {} + ~JoinHistogramMIImageFilter() override {} private: JoinHistogramMIImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerDistanceImageFilter.h b/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerDistanceImageFilter.h index b28e9d8b10064b0e85e677c97d72ba933fcc5b2b..ad9c088b641d9f1811fdcddeffb42d391c318fbe 100644 --- a/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerDistanceImageFilter.h +++ b/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerDistanceImageFilter.h @@ -170,7 +170,7 @@ public: protected: KullbackLeiblerDistanceImageFilter() {} - ~KullbackLeiblerDistanceImageFilter() ITK_OVERRIDE {} + ~KullbackLeiblerDistanceImageFilter() override {} private: KullbackLeiblerDistanceImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerProfileImageFilter.h b/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerProfileImageFilter.h index 2a04a140b7bc5e56113f55c79b3ece22ca5b53a0..bced45b78bbafda5d05d67e676a4c8191fbff8a3 100644 --- a/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerProfileImageFilter.h +++ b/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerProfileImageFilter.h @@ -187,7 +187,7 @@ public: protected: KullbackLeiblerProfileImageFilter() {} - ~KullbackLeiblerProfileImageFilter() ITK_OVERRIDE {} + ~KullbackLeiblerProfileImageFilter() override {} private: KullbackLeiblerProfileImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerSupervizedDistanceImageFilter.h b/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerSupervizedDistanceImageFilter.h index e74d68c904afa4d19bf0126e9ac9e542eb22cf12..b26619d8e226afe0ff57f5a0b2867b59be1e4607 100644 --- a/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerSupervizedDistanceImageFilter.h +++ b/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerSupervizedDistanceImageFilter.h @@ -146,13 +146,13 @@ public: void SetTrainingArea(const TInputROIImage * trainingImage); protected: - void BeforeThreadedGenerateData(void) ITK_OVERRIDE; + void BeforeThreadedGenerateData(void) override; KullbackLeiblerSupervizedDistanceImageFilter() { this->SetNumberOfRequiredInputs(3); } - ~KullbackLeiblerSupervizedDistanceImageFilter() ITK_OVERRIDE {} + ~KullbackLeiblerSupervizedDistanceImageFilter() override {} private: KullbackLeiblerSupervizedDistanceImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ChangeDetection/include/otbLHMIChangeDetector.h b/Modules/Filtering/ChangeDetection/include/otbLHMIChangeDetector.h index 391d622411054d719065f4a028976a75a99deaa0..bb54a51f6662fd94d7e4d64f8fefaa8468bd1946 100644 --- a/Modules/Filtering/ChangeDetection/include/otbLHMIChangeDetector.h +++ b/Modules/Filtering/ChangeDetection/include/otbLHMIChangeDetector.h @@ -84,7 +84,7 @@ public: protected: LHMIChangeDetector() {} - ~LHMIChangeDetector() ITK_OVERRIDE {} + ~LHMIChangeDetector() override {} private: LHMIChangeDetector(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ChangeDetection/include/otbMeanDifferenceImageFilter.h b/Modules/Filtering/ChangeDetection/include/otbMeanDifferenceImageFilter.h index 7d0a70ed2cb7035f419d77c657494d93bf397536..a93d1b6bc9607a713bb139712ace0e405a549714 100644 --- a/Modules/Filtering/ChangeDetection/include/otbMeanDifferenceImageFilter.h +++ b/Modules/Filtering/ChangeDetection/include/otbMeanDifferenceImageFilter.h @@ -82,7 +82,7 @@ public: protected: MeanDifferenceImageFilter() {} - ~MeanDifferenceImageFilter() ITK_OVERRIDE {} + ~MeanDifferenceImageFilter() override {} private: MeanDifferenceImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ChangeDetection/include/otbMeanRatioImageFilter.h b/Modules/Filtering/ChangeDetection/include/otbMeanRatioImageFilter.h index 6de8f8cf3d90ec2babe62d5cb73a91e1f43a5f29..48aa6ae096473ecacc8ebd5b68805c213c3a71e3 100644 --- a/Modules/Filtering/ChangeDetection/include/otbMeanRatioImageFilter.h +++ b/Modules/Filtering/ChangeDetection/include/otbMeanRatioImageFilter.h @@ -80,7 +80,7 @@ public: protected: MeanRatioImageFilter() {} - ~MeanRatioImageFilter() ITK_OVERRIDE {} + ~MeanRatioImageFilter() override {} private: MeanRatioImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ChangeDetection/include/otbMultivariateAlterationDetectorImageFilter.h b/Modules/Filtering/ChangeDetection/include/otbMultivariateAlterationDetectorImageFilter.h index 9e608d3c1bef429e9fb5554e3d98d98a11e49e3e..51bc83c9b8c1a871c528e03964b7be962c647dc1 100644 --- a/Modules/Filtering/ChangeDetection/include/otbMultivariateAlterationDetectorImageFilter.h +++ b/Modules/Filtering/ChangeDetection/include/otbMultivariateAlterationDetectorImageFilter.h @@ -155,11 +155,11 @@ public: protected: MultivariateAlterationDetectorImageFilter(); - ~MultivariateAlterationDetectorImageFilter() ITK_OVERRIDE {} + ~MultivariateAlterationDetectorImageFilter() override {} - void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) override; - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; private: MultivariateAlterationDetectorImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ColorMap/include/otbReliefColormapFunctor.h b/Modules/Filtering/ColorMap/include/otbReliefColormapFunctor.h index 26a6265414e0bdb507eaf6fbab4b55cd9bd71f71..5ea56326988ecf7ef7bdb3d761ed365b7dd03df0 100644 --- a/Modules/Filtering/ColorMap/include/otbReliefColormapFunctor.h +++ b/Modules/Filtering/ColorMap/include/otbReliefColormapFunctor.h @@ -58,11 +58,11 @@ public: typedef typename Superclass::ScalarType ScalarType; typedef typename Superclass::RealType RealType; - RGBPixelType operator ()(const TScalar&) const ITK_OVERRIDE; + RGBPixelType operator ()(const TScalar&) const override; protected: ReliefColormapFunctor(){}; - ~ReliefColormapFunctor() ITK_OVERRIDE {} + ~ReliefColormapFunctor() override {} private: ReliefColormapFunctor(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ColorMap/include/otbScalarToRainbowRGBPixelFunctor.h b/Modules/Filtering/ColorMap/include/otbScalarToRainbowRGBPixelFunctor.h index ba1e0cb6e9f2d3c7423ba45b40a7413873f80ebb..c5b8a54923220ceed8568f0b955a440c901acc79 100644 --- a/Modules/Filtering/ColorMap/include/otbScalarToRainbowRGBPixelFunctor.h +++ b/Modules/Filtering/ColorMap/include/otbScalarToRainbowRGBPixelFunctor.h @@ -139,7 +139,7 @@ class ITK_EXPORT ScalarToRainbowRGBPixelFunctor { public: ScalarToRainbowRGBPixelFunctor(); - ~ScalarToRainbowRGBPixelFunctor() ITK_OVERRIDE {} + ~ScalarToRainbowRGBPixelFunctor() override {} typedef ScalarToRainbowRGBPixelFunctor Self; typedef itk::Function::ColormapFunction<TScalar, TRGBPixel> Superclass; @@ -154,7 +154,7 @@ public: typedef TScalar ScalarType; typedef HSVToRGBFunctor<RGBPixelType> HSVToRGBFunctorType; - RGBPixelType operator ()(const TScalar&) const ITK_OVERRIDE; + RGBPixelType operator ()(const TScalar&) const override; protected: RGBPixelType HSVToRGB(double h, double s, double v) const; diff --git a/Modules/Filtering/Convolution/include/otbConvolutionImageFilter.h b/Modules/Filtering/Convolution/include/otbConvolutionImageFilter.h index 9517e1ecd011ce1954234c70e068f11cb615c5f4..1eabaf7c1a7320783bdda09afe998c2beda2742f 100644 --- a/Modules/Filtering/Convolution/include/otbConvolutionImageFilter.h +++ b/Modules/Filtering/Convolution/include/otbConvolutionImageFilter.h @@ -157,8 +157,8 @@ public: protected: ConvolutionImageFilter(); - ~ConvolutionImageFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~ConvolutionImageFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** ConvolutionImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() @@ -171,7 +171,7 @@ protected: * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId) ITK_OVERRIDE; + itk::ThreadIdType threadId) override; /** ConvolutionImageFilter needs a larger input requested region than * the output requested region. As such, ConvolutionImageFilter needs @@ -180,7 +180,7 @@ protected: * * \sa ImageToImageFilter::GenerateInputRequestedRegion() */ void GenerateInputRequestedRegion() - throw(itk::InvalidRequestedRegionError) ITK_OVERRIDE; + throw(itk::InvalidRequestedRegionError) override; private: ConvolutionImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Convolution/include/otbGaborFilterGenerator.h b/Modules/Filtering/Convolution/include/otbGaborFilterGenerator.h index b4b42f067f96adf22adfe93e22f8837a6ec5732a..9f26a1c94d01be6f699c2c8700408559db44796e 100644 --- a/Modules/Filtering/Convolution/include/otbGaborFilterGenerator.h +++ b/Modules/Filtering/Convolution/include/otbGaborFilterGenerator.h @@ -112,17 +112,17 @@ protected: /** constructor */ GaborFilterGenerator(); /** destructor */ - ~GaborFilterGenerator() ITK_OVERRIDE {} + ~GaborFilterGenerator() override {} /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Generate the filter coefficients */ void GenerateFilter(); /** Reimplement the Modified() method *to set the NeedToGenerateFilter to true */ - void Modified() const ITK_OVERRIDE; + void Modified() const override; private: GaborFilterGenerator(const Self&); //purposely not implemented diff --git a/Modules/Filtering/Convolution/include/otbOverlapSaveConvolutionImageFilter.h b/Modules/Filtering/Convolution/include/otbOverlapSaveConvolutionImageFilter.h index 6ecf591280e24f7499ffe909bc8cabb3b8c8eed6..a72ed2dfa9ce3061f276ff12e283e30f0c03c892 100644 --- a/Modules/Filtering/Convolution/include/otbOverlapSaveConvolutionImageFilter.h +++ b/Modules/Filtering/Convolution/include/otbOverlapSaveConvolutionImageFilter.h @@ -142,7 +142,7 @@ public: * region than the output region. */ void GenerateInputRequestedRegion() - throw(itk::InvalidRequestedRegionError) ITK_OVERRIDE; + throw(itk::InvalidRequestedRegionError) override; #ifdef ITK_USE_CONCEPT_CHECKING /** Begin concept checking */ @@ -154,13 +154,13 @@ protected: /** Constructor */ OverlapSaveConvolutionImageFilter(); /** destructor */ - ~OverlapSaveConvolutionImageFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~OverlapSaveConvolutionImageFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /* TODO For the moment this class provide only a GenerateData(), * due to limited thread-safety of FFTW plan creation. */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; // void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId); private: diff --git a/Modules/Filtering/DEM/include/otbDEMCaracteristicsExtractor.h b/Modules/Filtering/DEM/include/otbDEMCaracteristicsExtractor.h index cfa03e7a8dcd27646d5c32a43dd9f8cd1a075d33..110850719e3582fb0deee6134410290cb7789be0 100644 --- a/Modules/Filtering/DEM/include/otbDEMCaracteristicsExtractor.h +++ b/Modules/Filtering/DEM/include/otbDEMCaracteristicsExtractor.h @@ -144,11 +144,11 @@ public: protected: DEMCaracteristicsExtractor(); - ~DEMCaracteristicsExtractor() ITK_OVERRIDE; + ~DEMCaracteristicsExtractor() override; /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; private: /** Angle parameters*/ diff --git a/Modules/Filtering/DEM/include/otbDEMToImageGenerator.h b/Modules/Filtering/DEM/include/otbDEMToImageGenerator.h index 26464e39fc79babb9f8dfdf92412ca42886550d7..cc1e5d4de7164d37ba6645fa033ff8edbcd5f5a6 100644 --- a/Modules/Filtering/DEM/include/otbDEMToImageGenerator.h +++ b/Modules/Filtering/DEM/include/otbDEMToImageGenerator.h @@ -176,13 +176,13 @@ public: protected: DEMToImageGenerator(); - ~DEMToImageGenerator() ITK_OVERRIDE{} + ~DEMToImageGenerator() override{} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; + void BeforeThreadedGenerateData() override; void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId) ITK_OVERRIDE; - void GenerateOutputInformation() ITK_OVERRIDE; + itk::ThreadIdType threadId) override; + void GenerateOutputInformation() override; DEMHandlerType::Pointer m_DEMHandler; PointType m_OutputOrigin; diff --git a/Modules/Filtering/DimensionalityReduction/include/otbAngularProjectionBinaryImageFilter.h b/Modules/Filtering/DimensionalityReduction/include/otbAngularProjectionBinaryImageFilter.h index 2497d6b0eeba705c5b08e95146cd6110ff27232c..5dd2c46622753be63784a0922939aaf453399503 100644 --- a/Modules/Filtering/DimensionalityReduction/include/otbAngularProjectionBinaryImageFilter.h +++ b/Modules/Filtering/DimensionalityReduction/include/otbAngularProjectionBinaryImageFilter.h @@ -89,10 +89,10 @@ public: protected: AngularProjectionBinaryImageFilter(); - ~AngularProjectionBinaryImageFilter() ITK_OVERRIDE { } + ~AngularProjectionBinaryImageFilter() override { } - void GenerateOutputInformation() ITK_OVERRIDE; - void ThreadedGenerateData( const OutputImageRegionType & outputRegionForThread, itk::ThreadIdType threadID ) ITK_OVERRIDE; + void GenerateOutputInformation() override; + void ThreadedGenerateData( const OutputImageRegionType & outputRegionForThread, itk::ThreadIdType threadID ) override; private: AngularProjectionBinaryImageFilter(const Self&); // not implemented diff --git a/Modules/Filtering/DimensionalityReduction/include/otbAngularProjectionImageFilter.h b/Modules/Filtering/DimensionalityReduction/include/otbAngularProjectionImageFilter.h index f7976fe05f3a414222c2b404f159057113fa351e..4a8a4f906cf1b462e15f2079ce6b74f974a76165 100644 --- a/Modules/Filtering/DimensionalityReduction/include/otbAngularProjectionImageFilter.h +++ b/Modules/Filtering/DimensionalityReduction/include/otbAngularProjectionImageFilter.h @@ -84,7 +84,7 @@ public: itkGetMacro(AngleArray, AngleArrayType); itkSetMacro(AngleArray, AngleArrayType); - void SetInput ( unsigned int i, const InputImageType * ) ITK_OVERRIDE; + void SetInput ( unsigned int i, const InputImageType * ) override; using Superclass::SetInput; const InputImageType * GetInput( unsigned int i ) const; @@ -92,9 +92,9 @@ public: protected: AngularProjectionImageFilter(); - ~AngularProjectionImageFilter() ITK_OVERRIDE { } + ~AngularProjectionImageFilter() override { } - void ThreadedGenerateData( const OutputImageRegionType & outputRegionForThread, itk::ThreadIdType threadID ) ITK_OVERRIDE; + void ThreadedGenerateData( const OutputImageRegionType & outputRegionForThread, itk::ThreadIdType threadID ) override; virtual OutputImagePixelType InternalGenerateData ( const ImageRegionConstIteratorVectorType & ) const; private: diff --git a/Modules/Filtering/DimensionalityReduction/include/otbAngularProjectionSetImageFilter.h b/Modules/Filtering/DimensionalityReduction/include/otbAngularProjectionSetImageFilter.h index 3b1e8e2b1275e1ae1b02f9ec810872c2f6350647..9a8bdd9e4f2cfb3a9a4b5ec8147717e67d4ae34b 100644 --- a/Modules/Filtering/DimensionalityReduction/include/otbAngularProjectionSetImageFilter.h +++ b/Modules/Filtering/DimensionalityReduction/include/otbAngularProjectionSetImageFilter.h @@ -126,9 +126,9 @@ public: protected: AngularProjectionSetImageFilter(); - ~AngularProjectionSetImageFilter() ITK_OVERRIDE { } + ~AngularProjectionSetImageFilter() override { } - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; private: AngularProjectionSetImageFilter(const Self&); // not implemented diff --git a/Modules/Filtering/DimensionalityReduction/include/otbEstimateInnerProductPCAImageFilter.h b/Modules/Filtering/DimensionalityReduction/include/otbEstimateInnerProductPCAImageFilter.h index 870d196f1bb5113f502a55a53654f6dfcd67c0db..1864a7e5f94cc4ebf4909afce8ee97ac38012c36 100644 --- a/Modules/Filtering/DimensionalityReduction/include/otbEstimateInnerProductPCAImageFilter.h +++ b/Modules/Filtering/DimensionalityReduction/include/otbEstimateInnerProductPCAImageFilter.h @@ -78,21 +78,21 @@ public: protected: EstimateInnerProductPCAImageFilter(); - ~EstimateInnerProductPCAImageFilter() ITK_OVERRIDE {} + ~EstimateInnerProductPCAImageFilter() override {} /** GenerateOutputInformation * Set the number of bands of the output. * Copy information from the first image of the list if existing. **/ - void GenerateOutputInformation(void) ITK_OVERRIDE; + void GenerateOutputInformation(void) override; /** * BeforeThreadedGenerateData **/ - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; - void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) override; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: EstimateInnerProductPCAImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/DimensionalityReduction/include/otbFastICAImageFilter.h b/Modules/Filtering/DimensionalityReduction/include/otbFastICAImageFilter.h index aab7b1a5cd562ba7e1340edd04b4bcfb6e6bbb04..5e9d614342be8cf79eb605963c1709d2e0a0255f 100644 --- a/Modules/Filtering/DimensionalityReduction/include/otbFastICAImageFilter.h +++ b/Modules/Filtering/DimensionalityReduction/include/otbFastICAImageFilter.h @@ -149,7 +149,7 @@ public: protected: FastICAImageFilter (); - ~FastICAImageFilter() ITK_OVERRIDE { } + ~FastICAImageFilter() override { } /** GenerateOutputInformation * Propagate vector length info and modify if needed @@ -159,12 +159,12 @@ protected: * (which may not be square) has to be given, * otherwize, GenerateOutputInformation throws an itk::ExceptionObject */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; /** GenerateData * Through a filter of filter structure */ - void GenerateData () ITK_OVERRIDE; + void GenerateData () override; /** Internal methods */ void ForwardGenerateOutputInformation(); diff --git a/Modules/Filtering/DimensionalityReduction/include/otbFastICAInternalOptimizerVectorImageFilter.h b/Modules/Filtering/DimensionalityReduction/include/otbFastICAInternalOptimizerVectorImageFilter.h index ed81ac736e988f3ce6bcac67ac77328dcee53770..30be138c35fafc88a7ad0b1ca80d54856d376946 100644 --- a/Modules/Filtering/DimensionalityReduction/include/otbFastICAInternalOptimizerVectorImageFilter.h +++ b/Modules/Filtering/DimensionalityReduction/include/otbFastICAInternalOptimizerVectorImageFilter.h @@ -96,12 +96,12 @@ public: protected: FastICAInternalOptimizerVectorImageFilter(); - ~FastICAInternalOptimizerVectorImageFilter() ITK_OVERRIDE { } + ~FastICAInternalOptimizerVectorImageFilter() override { } - void GenerateOutputInformation() ITK_OVERRIDE; - void BeforeThreadedGenerateData () ITK_OVERRIDE; - void ThreadedGenerateData ( const OutputRegionType &, itk::ThreadIdType ) ITK_OVERRIDE; - void AfterThreadedGenerateData() ITK_OVERRIDE; + void GenerateOutputInformation() override; + void BeforeThreadedGenerateData () override; + void ThreadedGenerateData ( const OutputRegionType &, itk::ThreadIdType ) override; + void AfterThreadedGenerateData() override; unsigned int m_CurrentBandForLoop; diff --git a/Modules/Filtering/DimensionalityReduction/include/otbInnerProductPCAImageFilter.h b/Modules/Filtering/DimensionalityReduction/include/otbInnerProductPCAImageFilter.h index b92d7f619f2a43c1e66b2642ab50cd92beeb8520..d63ad8da0fd472189b697385cc07cd7b3da70be5 100644 --- a/Modules/Filtering/DimensionalityReduction/include/otbInnerProductPCAImageFilter.h +++ b/Modules/Filtering/DimensionalityReduction/include/otbInnerProductPCAImageFilter.h @@ -121,13 +121,13 @@ public: protected: /** GenerateData */ - void GenerateData(void) ITK_OVERRIDE; + void GenerateData(void) override; /** Constructor */ InnerProductPCAImageFilter(); /** Destructor */ - ~InnerProductPCAImageFilter() ITK_OVERRIDE {} + ~InnerProductPCAImageFilter() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** NormalizeInnerProductPCAImageFilter can produce an image which is a different * resolution than its input image. As such, NormalizeInnerProductPCAImageFilter @@ -137,7 +137,7 @@ protected: * below. * * \sa ProcessObject::GenerateOutputInformaton() */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; private: InnerProductPCAImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/DimensionalityReduction/include/otbLocalActivityVectorImageFilter.h b/Modules/Filtering/DimensionalityReduction/include/otbLocalActivityVectorImageFilter.h index 5f9816285fb4c6aa2db57770bf8e97ee2ef5aa42..cb48b1188677e723c9ea40f4f0880aa002a8a3da 100644 --- a/Modules/Filtering/DimensionalityReduction/include/otbLocalActivityVectorImageFilter.h +++ b/Modules/Filtering/DimensionalityReduction/include/otbLocalActivityVectorImageFilter.h @@ -109,7 +109,7 @@ public: protected: LocalActivityVectorImageFilter() { } - ~LocalActivityVectorImageFilter() ITK_OVERRIDE { } + ~LocalActivityVectorImageFilter() override { } private: LocalActivityVectorImageFilter( const Self & ); // Not implemented diff --git a/Modules/Filtering/DimensionalityReduction/include/otbMNFImageFilter.h b/Modules/Filtering/DimensionalityReduction/include/otbMNFImageFilter.h index 50557f1fe21dc0e0dce3e50de39b21f3a9049739..5fb0c7812ae5a8b0673adf525e1ddb37371cfa50 100644 --- a/Modules/Filtering/DimensionalityReduction/include/otbMNFImageFilter.h +++ b/Modules/Filtering/DimensionalityReduction/include/otbMNFImageFilter.h @@ -149,7 +149,7 @@ public: protected: MNFImageFilter(); - ~MNFImageFilter() ITK_OVERRIDE { } + ~MNFImageFilter() override { } /** GenerateOutputInformation * Propagate vector length info and modify if needed @@ -159,14 +159,14 @@ protected: * (which may not be square) has to be given, * otherwize, GenerateOutputInformation throws an itk::ExceptionObject */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; /** GenerateData * Through a filter of filter structure */ - void GenerateData () ITK_OVERRIDE; + void GenerateData () override; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Internal methods */ void ForwardGenerateOutputInformation(); diff --git a/Modules/Filtering/DimensionalityReduction/include/otbMaximumAutocorrelationFactorImageFilter.h b/Modules/Filtering/DimensionalityReduction/include/otbMaximumAutocorrelationFactorImageFilter.h index 6acb4c466f126e337b64e8b787e3a3115967cf71..d32b18d0a9125a43f2b19735871950b75aa6ab11 100644 --- a/Modules/Filtering/DimensionalityReduction/include/otbMaximumAutocorrelationFactorImageFilter.h +++ b/Modules/Filtering/DimensionalityReduction/include/otbMaximumAutocorrelationFactorImageFilter.h @@ -134,11 +134,11 @@ public: protected: MaximumAutocorrelationFactorImageFilter(); - ~MaximumAutocorrelationFactorImageFilter() ITK_OVERRIDE {} + ~MaximumAutocorrelationFactorImageFilter() override {} - void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) override; - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; private: MaximumAutocorrelationFactorImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/DimensionalityReduction/include/otbNAPCAImageFilter.h b/Modules/Filtering/DimensionalityReduction/include/otbNAPCAImageFilter.h index c7847771c3a259d12b7895492210531d67652ee9..791d9cc993a9b09c941ae74f11b9d33a1130e6dd 100644 --- a/Modules/Filtering/DimensionalityReduction/include/otbNAPCAImageFilter.h +++ b/Modules/Filtering/DimensionalityReduction/include/otbNAPCAImageFilter.h @@ -89,10 +89,10 @@ public: protected: NAPCAImageFilter() { } - ~NAPCAImageFilter () ITK_OVERRIDE { } + ~NAPCAImageFilter () override { } /** Specific functionality of NAPCA */ - void GenerateTransformationMatrix() ITK_OVERRIDE; + void GenerateTransformationMatrix() override; }; // end of class } // end of namespace otb diff --git a/Modules/Filtering/DimensionalityReduction/include/otbNormalizeInnerProductPCAImageFilter.h b/Modules/Filtering/DimensionalityReduction/include/otbNormalizeInnerProductPCAImageFilter.h index d58f83aaeccc31c4ae2d614499228a251db8cbfd..ed2e9055c980ad5b1b2a7f233faf15da68f2a5cf 100644 --- a/Modules/Filtering/DimensionalityReduction/include/otbNormalizeInnerProductPCAImageFilter.h +++ b/Modules/Filtering/DimensionalityReduction/include/otbNormalizeInnerProductPCAImageFilter.h @@ -82,7 +82,7 @@ public: protected: NormalizeInnerProductPCAImageFilter(); - ~NormalizeInnerProductPCAImageFilter() ITK_OVERRIDE {} + ~NormalizeInnerProductPCAImageFilter() override {} /** NormalizeInnerProductPCAImageFilter can produce an image which is a different * resolution than its input image. As such, NormalizeInnerProductPCAImageFilter @@ -92,7 +92,7 @@ protected: * below. * * \sa ProcessObject::GenerateOutputInformaton() */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; /** NormalizeInnerProductPCAImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine @@ -104,12 +104,12 @@ protected: * * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ - void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) override; /** BeforeThreadedGenerateData method */ - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: diff --git a/Modules/Filtering/DimensionalityReduction/include/otbPCAImageFilter.h b/Modules/Filtering/DimensionalityReduction/include/otbPCAImageFilter.h index 63f69b86c1842f3f41ef88bf31898552f7ccbee8..4b64ed6c909d5d37def509122907339d981df6b2 100644 --- a/Modules/Filtering/DimensionalityReduction/include/otbPCAImageFilter.h +++ b/Modules/Filtering/DimensionalityReduction/include/otbPCAImageFilter.h @@ -161,7 +161,7 @@ public: protected: PCAImageFilter(); - ~PCAImageFilter() ITK_OVERRIDE { } + ~PCAImageFilter() override { } /** GenerateOutputInformation * Propagate vector length info and modify if needed @@ -171,14 +171,14 @@ protected: * (which may not be square) has to be given, * otherwize, GenerateOutputInformation throws an itk::ExceptionObject */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; /** GenerateData * Through a filter of filter structure */ - void GenerateData () ITK_OVERRIDE; + void GenerateData () override; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Internal methods */ virtual void ForwardGenerateOutputInformation(); diff --git a/Modules/Filtering/DimensionalityReduction/include/otbSparseWvltToAngleMapperListFilter.h b/Modules/Filtering/DimensionalityReduction/include/otbSparseWvltToAngleMapperListFilter.h index cae9cbb747e7e8a6455cb6e11f4627582adc62a2..c419eb0937c25c411039c53aac426d1dff49a05c 100644 --- a/Modules/Filtering/DimensionalityReduction/include/otbSparseWvltToAngleMapperListFilter.h +++ b/Modules/Filtering/DimensionalityReduction/include/otbSparseWvltToAngleMapperListFilter.h @@ -108,16 +108,16 @@ public: protected: SparseWvltToAngleMapperListFilter(); - ~SparseWvltToAngleMapperListFilter() ITK_OVERRIDE { } + ~SparseWvltToAngleMapperListFilter() override { } /** Standard itk::ProcessObject subclass method. */ - DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override; using Superclass::MakeOutput; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** This method causes the filter to generate its output. */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /* Internal functions */ virtual bool IsToGenerate ( const ImageConstIteratorVectorType & ) const; diff --git a/Modules/Filtering/ImageManipulation/include/otbAmplitudeFunctor.h b/Modules/Filtering/ImageManipulation/include/otbAmplitudeFunctor.h index da27e0389d400c810a7c74cf707c8f60e0b67437..a543b2ae58832756c51810dff8851407d97d722c 100644 --- a/Modules/Filtering/ImageManipulation/include/otbAmplitudeFunctor.h +++ b/Modules/Filtering/ImageManipulation/include/otbAmplitudeFunctor.h @@ -70,17 +70,17 @@ public: } /** Destructor */ - ~AmplitudeFunctor() ITK_OVERRIDE {} + ~AmplitudeFunctor() override {} const char *GetDescription() const {return "Amplitude"; } - unsigned int GetOutputSize() const ITK_OVERRIDE + unsigned int GetOutputSize() const override { return 1; } - OutputPixelType operator ()(const VectorPixelType& inPixel) const ITK_OVERRIDE + OutputPixelType operator ()(const VectorPixelType& inPixel) const override { OutputPixelType outPixel; outPixel.SetSize(1); @@ -91,13 +91,13 @@ public: return outPixel; } - OutputPixelType operator ()(ScalarType) const ITK_OVERRIDE + OutputPixelType operator ()(ScalarType) const override { //FIXME we don't handle the std::complex<> yet itkExceptionMacro(<< "Can't compute amplitude from a scalar value"); } - OutputPixelType operator ()(const RGBPixelType& inPixel) const ITK_OVERRIDE + OutputPixelType operator ()(const RGBPixelType& inPixel) const override { OutputPixelType outPixel; outPixel.SetSize(1); @@ -110,7 +110,7 @@ public: return outPixel; } - OutputPixelType operator ()(const RGBAPixelType& inPixel) const ITK_OVERRIDE + OutputPixelType operator ()(const RGBAPixelType& inPixel) const override { OutputPixelType outPixel; outPixel.SetSize(1); diff --git a/Modules/Filtering/ImageManipulation/include/otbBinaryFunctorImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbBinaryFunctorImageFilter.h index e0e246aee5f7e787c0d4b994874bd42f75c01d06..ec60c693df08dac36a278b39203f0e9d6520698c 100644 --- a/Modules/Filtering/ImageManipulation/include/otbBinaryFunctorImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbBinaryFunctorImageFilter.h @@ -55,7 +55,7 @@ public: protected: BinaryFunctorImageFilter() {}; - ~BinaryFunctorImageFilter() ITK_OVERRIDE {} + ~BinaryFunctorImageFilter() override {} /** BinaryFunctorImageFilter can produce an image which has a different number of bands * than its input image. As such, BinaryFunctorImageFilter @@ -65,7 +65,7 @@ protected: * below. * * \sa ProcessObject::GenerateOutputInformaton() */ - void GenerateOutputInformation() ITK_OVERRIDE + void GenerateOutputInformation() override { Superclass::GenerateOutputInformation(); typename Superclass::OutputImagePointer outputPtr = this->GetOutput(); diff --git a/Modules/Filtering/ImageManipulation/include/otbBinaryFunctorNeighborhoodImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbBinaryFunctorNeighborhoodImageFilter.h index 2b0cc52d1317f58c9fcc379a31a9a0925427f17a..a8f69d607e158ca54125371338fc83a6c9550fe3 100644 --- a/Modules/Filtering/ImageManipulation/include/otbBinaryFunctorNeighborhoodImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbBinaryFunctorNeighborhoodImageFilter.h @@ -130,7 +130,7 @@ public: protected: BinaryFunctorNeighborhoodImageFilter(); - ~BinaryFunctorNeighborhoodImageFilter() ITK_OVERRIDE {} + ~BinaryFunctorNeighborhoodImageFilter() override {} /** BinaryFunctorNeighborhoodImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine @@ -143,12 +143,12 @@ protected: * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId) ITK_OVERRIDE; + itk::ThreadIdType threadId) override; /** * Pad the inputs requested regions by radius */ - void GenerateInputRequestedRegion(void) ITK_OVERRIDE; + void GenerateInputRequestedRegion(void) override; RadiusSizeType m_Radius; diff --git a/Modules/Filtering/ImageManipulation/include/otbBinaryFunctorNeighborhoodVectorImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbBinaryFunctorNeighborhoodVectorImageFilter.h index d282ec933bdf2b82dfaa9247bdefcf545f680fad..dfc99b5f0bcf7d322381b6039a645a57bdf869da 100644 --- a/Modules/Filtering/ImageManipulation/include/otbBinaryFunctorNeighborhoodVectorImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbBinaryFunctorNeighborhoodVectorImageFilter.h @@ -119,7 +119,7 @@ public: protected: BinaryFunctorNeighborhoodVectorImageFilter(); - ~BinaryFunctorNeighborhoodVectorImageFilter() ITK_OVERRIDE {} + ~BinaryFunctorNeighborhoodVectorImageFilter() override {} /** BinaryFunctorNeighborhoodVectorImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine @@ -132,13 +132,13 @@ protected: * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId) ITK_OVERRIDE; + itk::ThreadIdType threadId) override; /** * Since the number of components per pixel depends on the radius range, one must reimplement * this method to set the proper number of component on the filter output. */ - void GenerateOutputInformation(void) ITK_OVERRIDE; + void GenerateOutputInformation(void) override; RadiusSizeType m_Radius; diff --git a/Modules/Filtering/ImageManipulation/include/otbBinaryImageDensityFunction.h b/Modules/Filtering/ImageManipulation/include/otbBinaryImageDensityFunction.h index a751322a72ef17c665279959bd0ca66e2138ff19..8ab7e0c989df265c70bd52996be47bb7c5214f09 100644 --- a/Modules/Filtering/ImageManipulation/include/otbBinaryImageDensityFunction.h +++ b/Modules/Filtering/ImageManipulation/include/otbBinaryImageDensityFunction.h @@ -78,17 +78,17 @@ public: RealType; /** Evalulate the function at specified index */ - RealType EvaluateAtIndex(const IndexType& index) const ITK_OVERRIDE; + RealType EvaluateAtIndex(const IndexType& index) const override; /** Evaluate the function at non-integer positions */ - RealType Evaluate(const PointType& point) const ITK_OVERRIDE + RealType Evaluate(const PointType& point) const override { IndexType index; this->ConvertPointToNearestIndex(point, index); return this->EvaluateAtIndex(index); } RealType EvaluateAtContinuousIndex( - const ContinuousIndexType& cindex) const ITK_OVERRIDE + const ContinuousIndexType& cindex) const override { IndexType index; this->ConvertContinuousIndexToNearestIndex(cindex, index); @@ -107,8 +107,8 @@ public: protected: BinaryImageDensityFunction(); - ~BinaryImageDensityFunction() ITK_OVERRIDE{} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~BinaryImageDensityFunction() override{} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: BinaryImageDensityFunction(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbBinaryImageMinimalBoundingRegionCalculator.h b/Modules/Filtering/ImageManipulation/include/otbBinaryImageMinimalBoundingRegionCalculator.h index 2a420761d197c00046751b899e11ae4ea95922b0..fea7f9a8e84ac20f90f3ed459962116c08dc62c2 100644 --- a/Modules/Filtering/ImageManipulation/include/otbBinaryImageMinimalBoundingRegionCalculator.h +++ b/Modules/Filtering/ImageManipulation/include/otbBinaryImageMinimalBoundingRegionCalculator.h @@ -70,11 +70,11 @@ protected: /** Constructor */ BinaryImageMinimalBoundingRegionCalculator(); /** Destructor */ - ~BinaryImageMinimalBoundingRegionCalculator() ITK_OVERRIDE {} + ~BinaryImageMinimalBoundingRegionCalculator() override {} /** Main computation method */ - void GenerateData(void) ITK_OVERRIDE; + void GenerateData(void) override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: BinaryImageMinimalBoundingRegionCalculator(const Self &); // purposely not implemented void operator =(const Self&); // purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbBinaryImageToDensityImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbBinaryImageToDensityImageFilter.h index 7f0e16a0e977e0a5bd742523789e33a73579cc2c..029b9344b3f805ddc89ed35a31f5d6a78b1eba61 100644 --- a/Modules/Filtering/ImageManipulation/include/otbBinaryImageToDensityImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbBinaryImageToDensityImageFilter.h @@ -77,17 +77,17 @@ public: } /** Main computation method */ - void ThreadedGenerateData(const InputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; - void BeforeThreadedGenerateData() ITK_OVERRIDE; - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void ThreadedGenerateData(const InputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) override; + void BeforeThreadedGenerateData() override; + void GenerateInputRequestedRegion() override; protected: /** Constructor */ BinaryImageToDensityImageFilter(); /** Destructor */ - ~BinaryImageToDensityImageFilter() ITK_OVERRIDE; + ~BinaryImageToDensityImageFilter() override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: BinaryImageToDensityImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbBoxAndWhiskerImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbBoxAndWhiskerImageFilter.h index 67203519bed9f2cc93851aea97e027f744d4198c..1bd82ea6ddbf899a3c94e17e3da7d281ee9f18c0 100644 --- a/Modules/Filtering/ImageManipulation/include/otbBoxAndWhiskerImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbBoxAndWhiskerImageFilter.h @@ -94,12 +94,12 @@ public: protected: BoxAndWhiskerImageFilter (); - ~BoxAndWhiskerImageFilter () ITK_OVERRIDE {} + ~BoxAndWhiskerImageFilter () override {} /** Main computation method implemented as a multithreaded filter */ - void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; - void GenerateOutputInformation() ITK_OVERRIDE; - void AllocateOutputs() ITK_OVERRIDE; + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) override; + void GenerateOutputInformation() override; + void AllocateOutputs() override; /** Perform the outlier detection */ PixelType PerformBoxAndWhiskerDetection(const PixelType& pixel); diff --git a/Modules/Filtering/ImageManipulation/include/otbChangeInformationImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbChangeInformationImageFilter.h index 7ae72a4706b5b5c90a1dc6cbf3b78e4895e23f5a..3bbce052eedb2473e0a1c1c6aa1471a6854de180 100644 --- a/Modules/Filtering/ImageManipulation/include/otbChangeInformationImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbChangeInformationImageFilter.h @@ -69,10 +69,10 @@ public: protected: ChangeInformationImageFilter() {} - ~ChangeInformationImageFilter() ITK_OVERRIDE {} + ~ChangeInformationImageFilter() override {} /** Apply changes to the output image metadata. */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; private: ChangeInformationImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbChangeLabelImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbChangeLabelImageFilter.h index 9c32e30611ce591d24263d10c3ae106d94017ebb..b367f140c80ea8a8d200d7ffe075334891efe011 100644 --- a/Modules/Filtering/ImageManipulation/include/otbChangeLabelImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbChangeLabelImageFilter.h @@ -165,11 +165,11 @@ public: protected: ChangeLabelImageFilter(); - ~ChangeLabelImageFilter() ITK_OVERRIDE {} + ~ChangeLabelImageFilter() override {} /** Generate the output information missing */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: ChangeLabelImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbChangeNoDataValueFilter.h b/Modules/Filtering/ImageManipulation/include/otbChangeNoDataValueFilter.h index 5ab3cf24353e3c84377d4188cf9318988701cea3..d19f2184a37551610df37d07b0cabbe1ef789ebf 100644 --- a/Modules/Filtering/ImageManipulation/include/otbChangeNoDataValueFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbChangeNoDataValueFilter.h @@ -137,10 +137,10 @@ protected: ChangeNoDataValueFilter() {} - ~ChangeNoDataValueFilter() ITK_OVERRIDE + ~ChangeNoDataValueFilter() override {} - void GenerateOutputInformation() ITK_OVERRIDE + void GenerateOutputInformation() override { Superclass::GenerateOutputInformation(); diff --git a/Modules/Filtering/ImageManipulation/include/otbClampImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbClampImageFilter.h index 6fdd16e955a3b7a754779b6d1acd76de60e711d8..478eb952220a8cf08eed6b8550114d2053ba2ccd 100644 --- a/Modules/Filtering/ImageManipulation/include/otbClampImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbClampImageFilter.h @@ -21,121 +21,104 @@ #ifndef otbClampImageFilter_h #define otbClampImageFilter_h -#include "itkImageToImageFilter.h" +#include "otbConvertTypeFunctor.h" +#include "itkUnaryFunctorImageFilter.h" namespace otb { /** \class ClampImageFilter - * \brief Set image values to a user-specified value if they are below, - * above, or between simple threshold values. + * \brief Clamp image values to be below, over, or between threhold values. * * ClampImageFilter clamp image values to be between an upper * and lower value. Values lower than m_Lower values are set to lower, * and values greater than upper threshold are set to upper threshold * value. + * This filter can also be used to cast any type of image into any other type + * as long as those types are arithmetics or complex. * * By default lower and upper thresholds are set to the maximum and - * minimum bounds of the image pixel type. - * - * The pixels must support the operators >= and <=. + * minimum bounds of the image internal pixel value. * * \ingroup IntensityImageFilters Multithreaded * * \ingroup OTBImageManipulation */ template <class TInputImage, class TOutputImage=TInputImage> - class ITK_EXPORT ClampImageFilter : public itk::ImageToImageFilter<TInputImage, TOutputImage> + class ITK_EXPORT ClampImageFilter + : public itk::UnaryFunctorImageFilter< TInputImage , TOutputImage , + Functor::ConvertTypeFunctor <typename TInputImage::PixelType , + typename TOutputImage::PixelType> > { public: /** Standard class typedefs. */ - typedef ClampImageFilter Self; - typedef itk::ImageToImageFilter<TInputImage, TOutputImage> Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; + typedef ClampImageFilter Self; + typedef itk::UnaryFunctorImageFilter< TInputImage , TOutputImage , + Functor::ConvertTypeFunctor <typename TInputImage::PixelType , + typename TOutputImage::PixelType> > Superclass; + typedef itk::SmartPointer<Self> Pointer; + 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(ClampImageFilter, itk::ImageToImageFilter); + itkTypeMacro( ClampImageFilter , itk::UnaryFunctorImageFilter ); /** Some additional typedefs. */ typedef TInputImage InputImageType; - typedef typename InputImageType::ConstPointer InputImagePointer; typedef typename InputImageType::RegionType InputImageRegionType; typedef typename InputImageType::PixelType InputImagePixelType; /** Some additional typedefs. */ - typedef TOutputImage OutputImageType; - typedef typename OutputImageType::Pointer OutputImagePointer; - typedef typename OutputImageType::RegionType OutputImageRegionType; - typedef typename OutputImageType::PixelType OutputImagePixelType; + typedef TOutputImage OutputImageType; + typedef typename OutputImageType::RegionType OutputImageRegionType; + typedef typename OutputImageType::PixelType OutputImagePixelType; + typedef typename OutputImageType::InternalPixelType OutputInternalPixelType; + typedef typename itk::NumericTraits< OutputInternalPixelType >::ValueType OutputPixelValueType; - /** The values greater than or equal to the value are set to OutsideValue. */ - void ClampAbove(const OutputImagePixelType &thresh); + /** The values greater than or equal to the value are set to \p thresh. */ + void ClampAbove(const OutputPixelValueType &thresh); - /** The values less than or equal to the value are set to OutsideValue. */ - void ClampBelow(const OutputImagePixelType &thresh); + /** The values less than or equal to the value are set to \p thresh. */ + void ClampBelow(const OutputPixelValueType &thresh); - /** The values outside the range are set to OutsideValue. */ - void ClampOutside(const OutputImagePixelType &lower, const OutputImagePixelType &upper); + /** The values outside the range are set to \p lower or \p upper. */ + void ClampOutside(const OutputPixelValueType &lower, const OutputPixelValueType &upper); /** Set/Get methods to set the lower threshold */ - void SetLower(OutputImagePixelType val) - { - m_Lower = val; - m_DLower = static_cast<double>(val); - this->Modified(); - } - itkGetConstMacro(Lower, OutputImagePixelType); + void SetLower(OutputPixelValueType val); + + itkGetConstMacro(Lower, OutputPixelValueType); /** Set/Get methods to set the upper threshold */ - void SetUpper(OutputImagePixelType val) - { - m_Upper = val; - m_DUpper = static_cast<double>(val); - this->Modified(); - } - itkGetConstMacro(Upper, OutputImagePixelType); + void SetUpper(OutputPixelValueType val); + + itkGetConstMacro(Upper, OutputPixelValueType); protected: ClampImageFilter(); - ~ClampImageFilter() ITK_OVERRIDE {}; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - - /** ClampImageFilter can be implemented as a multithreaded filter. - * Therefore, this implementation provides a ThreadedGenerateData() routine - * which is called for each processing thread. The output image data is - * allocated automatically by the superclass prior to calling - * ThreadedGenerateData(). ThreadedGenerateData can only write to the - * portion of the output image specified by the parameter - * "outputRegionForThread" - * - * \sa ImageToImageFilter::ThreadedGenerateData(), - * ImageToImageFilter::GenerateData() */ - void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId ) ITK_OVERRIDE; - - void GenerateOutputInformation(void) ITK_OVERRIDE - { - Superclass::GenerateOutputInformation(); + ~ClampImageFilter() override {}; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; - this->GetOutput()->SetNumberOfComponentsPerPixel( this->GetInput()->GetNumberOfComponentsPerPixel() ); - } + void GenerateOutputInformation(void) override + { + Superclass::GenerateOutputInformation(); + unsigned int sizeIn = this->GetInput()->GetNumberOfComponentsPerPixel(); + this->GetFunctor().SetInputComponents( sizeIn ); + this->GetOutput()->SetNumberOfComponentsPerPixel( + this->GetFunctor().GetOutputSize () ); + } private: - ClampImageFilter(const Self&); //purposely not implemented - void operator=(const Self&); //purposely not implemented - - double m_DLower; - double m_DUpper; + ClampImageFilter(const Self&) = delete ; + void operator=(const Self&) = delete ; - OutputImagePixelType m_Lower; - OutputImagePixelType m_Upper; + OutputPixelValueType m_Lower; + OutputPixelValueType m_Upper; }; diff --git a/Modules/Filtering/ImageManipulation/include/otbClampImageFilter.txx b/Modules/Filtering/ImageManipulation/include/otbClampImageFilter.txx index fd1ed1320ec1cbe7768eb8ccb44f7b9ba317d8f9..b1ac37e2e3df315e4b2e402f9034a73ef25a4665 100644 --- a/Modules/Filtering/ImageManipulation/include/otbClampImageFilter.txx +++ b/Modules/Filtering/ImageManipulation/include/otbClampImageFilter.txx @@ -25,6 +25,7 @@ #include "otbClampImageFilter.h" #include "itkImageRegionIterator.h" #include "itkNumericTraits.h" +#include <limits> #include "itkObjectFactory.h" #include "itkProgressReporter.h" @@ -38,13 +39,35 @@ template <class TInputImage, class TOutputImage> ClampImageFilter<TInputImage, TOutputImage> ::ClampImageFilter() { - m_Lower = itk::NumericTraits<OutputImagePixelType>::NonpositiveMin(); - m_Upper = itk::NumericTraits<OutputImagePixelType>::max(); + m_Lower = std::numeric_limits < OutputPixelValueType >::lowest(); + m_Upper = std::numeric_limits < OutputPixelValueType >::max(); +} - m_DLower = static_cast<double>(m_Lower); - m_DUpper = static_cast<double>(m_Upper); +template <class TInputImage, class TOutputImage> +void +ClampImageFilter<TInputImage, TOutputImage> +::SetLower(OutputPixelValueType val) +{ + if ( m_Lower != val ) + { + m_Lower = val; + this->GetFunctor().SetLowest( m_Lower ); + this->Modified(); + } } +template <class TInputImage, class TOutputImage> +void +ClampImageFilter<TInputImage, TOutputImage> +::SetUpper(OutputPixelValueType val) +{ + if ( m_Upper != val ) + { + m_Upper = val; + this->GetFunctor().SetHighest( m_Upper ); + this->Modified(); + } +} /** * @@ -70,14 +93,15 @@ ClampImageFilter<TInputImage, TOutputImage> template <class TInputImage, class TOutputImage> void ClampImageFilter<TInputImage, TOutputImage> -::ClampAbove(const OutputImagePixelType &thresh) +::ClampAbove(const OutputPixelValueType &thresh) { if (m_Upper != thresh - || m_Lower > itk::NumericTraits<OutputImagePixelType>::NonpositiveMin()) + || m_Lower > std::numeric_limits < OutputPixelValueType >::lowest()) { - m_Lower = itk::NumericTraits<OutputImagePixelType>::NonpositiveMin(); + m_Lower = std::numeric_limits < OutputPixelValueType >::lowest(); m_Upper = thresh; - m_DUpper = static_cast<double>(m_Upper); + this->GetFunctor().SetLowest( m_Lower ); + this->GetFunctor().SetHighest( m_Upper ); this->Modified(); } } @@ -88,13 +112,14 @@ ClampImageFilter<TInputImage, TOutputImage> template <class TInputImage, class TOutputImage> void ClampImageFilter<TInputImage, TOutputImage> -::ClampBelow(const OutputImagePixelType &thresh) +::ClampBelow(const OutputPixelValueType &thresh) { - if (m_Lower != thresh || m_Upper < itk::NumericTraits<OutputImagePixelType>::max()) + if (m_Lower != thresh || m_Upper < std::numeric_limits < OutputPixelValueType >::max()) { + m_Upper = std::numeric_limits < OutputPixelValueType >::max(); m_Lower = thresh; - m_DLower = m_Lower; - m_Upper = itk::NumericTraits<InputImagePixelType>::max(); + this->GetFunctor().SetLowest( m_Lower ); + this->GetFunctor().SetHighest( m_Upper ); this->Modified(); } } @@ -106,7 +131,7 @@ ClampImageFilter<TInputImage, TOutputImage> template <class TInputImage, class TOutputImage> void ClampImageFilter<TInputImage, TOutputImage> -::ClampOutside(const OutputImagePixelType &lower, const OutputImagePixelType &upper) +::ClampOutside(const OutputPixelValueType &lower, const OutputPixelValueType &upper) { if (lower > upper) { @@ -118,73 +143,12 @@ ClampImageFilter<TInputImage, TOutputImage> { m_Lower = lower; m_Upper = upper; - m_DLower = m_Lower; - m_DUpper = m_Upper; + this->GetFunctor().SetLowest( m_Lower ); + this->GetFunctor().SetHighest( m_Upper ); this->Modified(); } } - -/** - * - */ -template <class TInputImage, class TOutputImage> -void -ClampImageFilter<TInputImage, TOutputImage> -::ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId) -{ - itkDebugMacro(<<"Actually executing"); - - // Get the input and output pointers - InputImagePointer inputPtr = this->GetInput(); - OutputImagePointer outputPtr = this->GetOutput(0); - - // Define/declare an iterator that will walk the output region for this - // thread. - typedef itk::ImageRegionConstIterator<TInputImage> InputIterator; - typedef itk::ImageRegionIterator<TOutputImage> OutputIterator; - - InputIterator inIt(inputPtr, outputRegionForThread); - OutputIterator outIt(outputPtr, outputRegionForThread); - - // support progress methods/callbacks - itk::ProgressReporter progress(this, threadId, outputRegionForThread.GetNumberOfPixels()); - - // walk the regions, threshold each pixel - while( !outIt.IsAtEnd() && !inIt.IsAtEnd() ) - { - // Cast the value of the pixel to double in order to compare - // with the double version of the upper and the lower bounds of - // output image - const double value = static_cast<double>(inIt.Get()); - OutputImagePixelType outPix = m_Lower; - - if ( m_DLower <= value && value <= m_DUpper) - { - // pixel passes to output unchanged - outPix = static_cast<OutputImagePixelType>(value); - } - /* Already outPix is initialized with m_Lower even for preventing Warning. - * - else if ( value < m_DLower ) - { - outPix = m_Lower; - } - */ - else if ( value > m_DUpper) - { - outPix = m_Upper; - } - - outIt.Set( outPix ); - - ++inIt; - ++outIt; - progress.CompletedPixel(); - } -} - } // end namespace itk #endif diff --git a/Modules/Filtering/ImageManipulation/include/otbClampVectorImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbClampVectorImageFilter.h index 053c3060001c7bc0961d1f4aac7d16ead7cd1fa2..84ff84cb59e0d577c14df85f1dcf11ef417edfb1 100644 --- a/Modules/Filtering/ImageManipulation/include/otbClampVectorImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbClampVectorImageFilter.h @@ -21,6 +21,7 @@ #ifndef otbClampVectorImageFilter_h #define otbClampVectorImageFilter_h +#include <vcl_deprecated_header.h> #include "itkImageToImageFilter.h" namespace otb @@ -106,8 +107,8 @@ public: protected: ClampVectorImageFilter(); - ~ClampVectorImageFilter() ITK_OVERRIDE {}; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~ClampVectorImageFilter() override {}; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** ClampVectorImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine @@ -120,9 +121,9 @@ protected: * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId ) ITK_OVERRIDE; + itk::ThreadIdType threadId ) override; - void GenerateOutputInformation(void) ITK_OVERRIDE + void GenerateOutputInformation(void) override { Superclass::GenerateOutputInformation(); diff --git a/Modules/Filtering/ImageManipulation/include/otbConcatenateScalarValueImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbConcatenateScalarValueImageFilter.h index dcb79a8f257b3ac798caa5b37980fde508125704..7f9cf3f068f801e7e10cc54e21519d2fb0a99e54 100644 --- a/Modules/Filtering/ImageManipulation/include/otbConcatenateScalarValueImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbConcatenateScalarValueImageFilter.h @@ -141,11 +141,11 @@ public: protected: ConcatenateScalarValueImageFilter(); - ~ConcatenateScalarValueImageFilter() ITK_OVERRIDE {} + ~ConcatenateScalarValueImageFilter() override {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; private: ConcatenateScalarValueImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbConcatenateVectorImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbConcatenateVectorImageFilter.h index 06bfad6d0d18a470f87b29be698d97a05f136d06..30fad1ad60efdf1e935c12527030cd7175e1eed4 100644 --- a/Modules/Filtering/ImageManipulation/include/otbConcatenateVectorImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbConcatenateVectorImageFilter.h @@ -95,13 +95,13 @@ protected: /** Constructor. */ ConcatenateVectorImageFilter(); /** Destructor. */ - ~ConcatenateVectorImageFilter() ITK_OVERRIDE; - void GenerateOutputInformation() ITK_OVERRIDE; - void BeforeThreadedGenerateData() ITK_OVERRIDE; + ~ConcatenateVectorImageFilter() override; + void GenerateOutputInformation() override; + void BeforeThreadedGenerateData() override; /** Main computation method. */ - void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: ConcatenateVectorImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbConvertTypeFunctor.h b/Modules/Filtering/ImageManipulation/include/otbConvertTypeFunctor.h new file mode 100644 index 0000000000000000000000000000000000000000..c5a73b5cb1591868f4f67a1ddf65df3b5544a6ff --- /dev/null +++ b/Modules/Filtering/ImageManipulation/include/otbConvertTypeFunctor.h @@ -0,0 +1,243 @@ +/* + * 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 otbConvertTypeFunctor_h +#define otbConvertTypeFunctor_h + +#include <limits> +#include <type_traits> +#include <boost/type_traits/is_complex.hpp> +#include <boost/type_traits/is_scalar.hpp> + +#include "itkNumericTraits.h" +#include "otbDefaultConvertPixelTraits.h" + +namespace otb +{ +namespace Functor +{ + +template < class TInputPixelType , class TOutputPixelType > +class ConvertTypeFunctor +{ +public: + typedef TInputPixelType InputPixelType; + typedef TOutputPixelType OutputPixelType; + typedef ConvertTypeFunctor Self; + + typedef typename itk::NumericTraits < InputPixelType > :: ValueType InputInternalPixelType; + typedef typename itk::NumericTraits < OutputPixelType > :: ValueType OutputInternalPixelType; + + typedef typename itk::NumericTraits < InputInternalPixelType > :: ValueType InputPixelValueType; + typedef typename itk::NumericTraits < OutputInternalPixelType > :: ValueType OutputPixelValueType; + + static constexpr bool m_cInPix = boost::is_complex < InputPixelType > :: value ; + static constexpr bool m_cOutPix = boost::is_complex < OutputPixelType > :: value ; + static constexpr bool m_cInInternalPix = boost::is_complex < InputInternalPixelType > :: value ; + static constexpr bool m_cOutInternalPix = boost::is_complex < OutputInternalPixelType > :: value ; + + ConvertTypeFunctor() + // m_cInPix ( boost::is_complex < InputPixelType > :: value ) , + // m_cOutPix ( boost::is_complex < OutputPixelType > :: value ) , + // m_cInInternalPix ( boost::is_complex < InputInternalPixelType > :: value ) , + // m_cOutInternalPix ( boost::is_complex < OutputInternalPixelType > :: value ) + { + m_LowestB = std::numeric_limits < OutputPixelValueType >::lowest(); + m_HighestB = std::numeric_limits < OutputPixelValueType >::max(); + + m_LowestBD = static_cast < double > ( m_LowestB ); + m_HighestBD = static_cast < double > ( m_HighestB ); + + // m_cInPix = boost::is_complex < InputPixelType > :: value ; + // m_cOutPix = boost::is_complex < OutputPixelType > :: value ; + // m_cInInternalPix = boost::is_complex < InputInternalPixelType > :: value ; + // m_cOutInternalPix = boost::is_complex < OutputInternalPixelType > :: value ; + } + + // template < class InternalPixelType > + void SetInputComponents( unsigned int sizeIn ) + { + m_CompIn = sizeIn ; + if ( m_cInPix ) + { + // needed as ITK thinks that one complex component is actually + // two components... + m_CompIn /= 2 ; + } + } + + unsigned int GetOutputSize() + { + if ( m_cInInternalPix || m_cInPix ) + m_Scal = 2 * m_CompIn; + else + m_Scal = m_CompIn; + + OutputPixelType out; + unsigned int size = + itk::NumericTraits < OutputPixelType > :: GetLength( out ); + if ( size == 0 ) // That means it is a variable size container + { + if ( m_cOutInternalPix ) + m_CompOut = ( m_Scal + 1 ) / 2 ; + else + m_CompOut = m_Scal ; + } + // It is a fixed size container, m_CompOut should be equal to its size + else if ( m_cOutPix ) // one complex is one component + m_CompOut = 1 ; + else // fized size container or scalar + m_CompOut = size; + + + return m_CompOut ; + } + + void SetLowest( OutputPixelValueType & lowest ) + { + m_LowestB = lowest; + m_LowestBD = static_cast < double > ( m_LowestB ); + } + + void SetHighest( OutputPixelValueType & highest ) + { + m_HighestB = highest; + m_HighestBD = static_cast < double > ( m_HighestB ); + } + + OutputPixelType operator() ( InputPixelType const & in ) const + { + std::vector < double > vPixel; + for ( unsigned int i = 0 ; i < m_CompIn ; i ++) + FillIn < InputPixelType > ( i , in , vPixel ); + assert( m_Scal == vPixel.size() ); + if ( ( m_cOutPix || m_cOutInternalPix ) && vPixel.size()%2 ) + { + vPixel.push_back(0); // last component has no imaginary part + } + Clamp( vPixel ); + OutputPixelType out; + + int hack = 1; + if ( m_cOutPix ) + hack += 1; // needed in case we have OutputPixelType == complex<t> as + // itk::NumericTraits::SetLength() will ask a length of 2! + itk::NumericTraits < OutputPixelType > :: SetLength( out , + hack * m_CompOut ); + + for ( unsigned int i = 0 ; i < m_CompOut ; i ++) + FillOut < OutputPixelType > ( i , out , vPixel ); + return out; + } + + ~ConvertTypeFunctor() {}; + +protected: + + template <class PixelType , + std::enable_if_t < std::is_arithmetic < PixelType > ::value , int > = 0 > + void FillIn( unsigned int i , + InputPixelType const & pix , + std::vector < double > & vPix ) const + { + vPix.push_back( DefaultConvertPixelTraits < InputPixelType > :: + GetNthComponent( i , pix ) ); + } + + template <class PixelType , + std::enable_if_t < boost::is_complex < PixelType > :: value , int > = 0 > + void FillIn( unsigned int i , + InputPixelType const & pix , + std::vector < double > & vPix ) const + { + PixelType comp = DefaultConvertPixelTraits < InputPixelType > :: + GetNthComponent( i , pix ); + vPix.push_back( static_cast < double > ( real( comp ) ) ); + vPix.push_back( static_cast < double > ( imag( comp ) ) ); + } + + template <class PixelType , + std::enable_if_t < !( boost::is_complex < PixelType > :: value + || std::is_arithmetic < PixelType > ::value ) , int > = 0 > + void FillIn( unsigned int i , + InputPixelType const & pix , + std::vector < double > & vPix ) const + { + FillIn < InputInternalPixelType > ( i , pix , vPix ); + } + + void Clamp( std::vector < double > & vPixel ) const + { + for ( double & comp : vPixel ) + { + if ( comp >= m_HighestBD ) + comp = m_HighestBD; + else if ( comp <= m_LowestBD ) + comp = m_LowestBD; + } + } + + template <class PixelType , + std::enable_if_t < std::is_arithmetic < PixelType > ::value , int > = 0 > + void FillOut( unsigned int i , + OutputPixelType & pix , + std::vector < double > & vPix ) const + { + DefaultConvertPixelTraits < OutputPixelType > :: + SetNthComponent( i , pix , vPix[i] ); + } + + template <class PixelType , + std::enable_if_t < boost::is_complex < PixelType > :: value , int > = 0 > + void FillOut( unsigned int i , + OutputPixelType & pix , + std::vector < double > & vPix ) const + { + DefaultConvertPixelTraits < OutputPixelType > :: + SetNthComponent( i , pix , + PixelType ( vPix[ 2 * i] , vPix[ 2 * i + 1] ) ); + } + + template <class PixelType , + std::enable_if_t < !( boost::is_complex < PixelType > :: value + || std::is_arithmetic < PixelType > ::value ) , int > = 0 > + void FillOut( unsigned int i , + OutputPixelType & pix , + std::vector < double > & vPix ) const + { + FillOut < OutputInternalPixelType > ( i , pix , vPix ); + } + +private: + ConvertTypeFunctor(const Self &) = delete; + void operator =(const Self&) = delete; + + double m_LowestBD , m_HighestBD ; + OutputPixelValueType m_LowestB , m_HighestB ; + unsigned int m_CompIn , m_CompOut , m_Scal ; + // const bool m_cInPix , m_cOutPix , m_cInInternalPix , m_cOutInternalPix ; + +}; + +} //end namespace Functor + +} //end namespace otb + +#endif diff --git a/Modules/Filtering/ImageManipulation/include/otbEuclideanDistanceMetricWithMissingValue.h b/Modules/Filtering/ImageManipulation/include/otbEuclideanDistanceMetricWithMissingValue.h index 4d802c46ea7bb2ed7816a2f622b97fc902bec935..37e08144ba0ad7ff5d1bb4ce74554f380712c3e5 100644 --- a/Modules/Filtering/ImageManipulation/include/otbEuclideanDistanceMetricWithMissingValue.h +++ b/Modules/Filtering/ImageManipulation/include/otbEuclideanDistanceMetricWithMissingValue.h @@ -70,13 +70,13 @@ public: typedef typename TVector::ValueType ValueType; /** Gets the distance between the origin and x */ - double Evaluate(const TVector& x) const ITK_OVERRIDE + double Evaluate(const TVector& x) const override { return ::vcl_sqrt(Superclass::Evaluate(x)); } /** Gets the distance between x1 and x2 */ - double Evaluate(const TVector& x1, const TVector& x2) const ITK_OVERRIDE + double Evaluate(const TVector& x1, const TVector& x2) const override { return ::vcl_sqrt(Superclass::Evaluate(x1, x2)); } @@ -97,7 +97,7 @@ public: protected: EuclideanDistanceMetricWithMissingValue() {} - ~EuclideanDistanceMetricWithMissingValue() ITK_OVERRIDE {} + ~EuclideanDistanceMetricWithMissingValue() override {} }; // end of class } // end namespace statistics diff --git a/Modules/Filtering/ImageManipulation/include/otbEuclideanDistanceMetricWithMissingValuePow2.h b/Modules/Filtering/ImageManipulation/include/otbEuclideanDistanceMetricWithMissingValuePow2.h index 49b8885bbe5a36c1a429a852188e174fd3b3cd79..3fe2d4f77a78dbb1a9c3500f82ec9838a6fe98cb 100644 --- a/Modules/Filtering/ImageManipulation/include/otbEuclideanDistanceMetricWithMissingValuePow2.h +++ b/Modules/Filtering/ImageManipulation/include/otbEuclideanDistanceMetricWithMissingValuePow2.h @@ -69,10 +69,10 @@ public: typedef typename TVector::ValueType ValueType; /** Gets the distance between the origin and x */ - double Evaluate(const TVector& x) const ITK_OVERRIDE; + double Evaluate(const TVector& x) const override; /** Gets the distance between x1 and x2 */ - double Evaluate(const TVector& x1, const TVector& x2) const ITK_OVERRIDE; + double Evaluate(const TVector& x1, const TVector& x2) const override; /** Gets the cooridnate distance between a and b. NOTE: a and b * should be type of component */ @@ -93,7 +93,7 @@ public: protected: EuclideanDistanceMetricWithMissingValuePow2() {} - ~EuclideanDistanceMetricWithMissingValuePow2() ITK_OVERRIDE {} + ~EuclideanDistanceMetricWithMissingValuePow2() override {} }; // end of class } // end namespace statistics diff --git a/Modules/Filtering/ImageManipulation/include/otbFlexibleDistanceWithMissingValue.h b/Modules/Filtering/ImageManipulation/include/otbFlexibleDistanceWithMissingValue.h index 05298aa14db069c519052f4fed0cde184c49cf96..3a703c921a1a0878431e3e99c68dac43938e564a 100644 --- a/Modules/Filtering/ImageManipulation/include/otbFlexibleDistanceWithMissingValue.h +++ b/Modules/Filtering/ImageManipulation/include/otbFlexibleDistanceWithMissingValue.h @@ -73,10 +73,10 @@ public: typedef typename TVector::ValueType ValueType; /** Gets the distance between the origin and x */ - double Evaluate(const TVector& x) const ITK_OVERRIDE; + double Evaluate(const TVector& x) const override; /** Gets the distance between x1 and x2 */ - double Evaluate(const TVector& x1, const TVector& x2) const ITK_OVERRIDE; + double Evaluate(const TVector& x1, const TVector& x2) const override; /** Gets the cooridnate distance between a and b. NOTE: a and b * should be type of component */ @@ -101,7 +101,7 @@ public: protected: FlexibleDistanceWithMissingValue() {} - ~FlexibleDistanceWithMissingValue() ITK_OVERRIDE {} + ~FlexibleDistanceWithMissingValue() override {} }; // end of class /** Static variable instantiation */ diff --git a/Modules/Filtering/ImageManipulation/include/otbFunctionWithNeighborhoodToImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbFunctionWithNeighborhoodToImageFilter.h index 2febd16f5f7191f841d6beae8ce5160c7a5cb2d7..61168d59d1dd437eadf0fa6cfcee2d48fd33776e 100644 --- a/Modules/Filtering/ImageManipulation/include/otbFunctionWithNeighborhoodToImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbFunctionWithNeighborhoodToImageFilter.h @@ -122,11 +122,11 @@ public: protected: FunctionWithNeighborhoodToImageFilter(); - ~FunctionWithNeighborhoodToImageFilter() ITK_OVERRIDE{} + ~FunctionWithNeighborhoodToImageFilter() override{} - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; /** SpatialFunctionImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine @@ -139,7 +139,7 @@ protected: * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId) ITK_OVERRIDE; + itk::ThreadIdType threadId) override; private: FunctionWithNeighborhoodToImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbGridResampleImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbGridResampleImageFilter.h index b67760965c8287644c570c70f518fa2d06b6280b..23655ef667d30f0ff8f9e87b0d9d28c7d362a273 100644 --- a/Modules/Filtering/ImageManipulation/include/otbGridResampleImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbGridResampleImageFilter.h @@ -137,23 +137,23 @@ public: void SetOutputParametersFromImage(const ImageBaseType * image); /** Method Compute the Modified Time based on changed to the components. */ - itk::ModifiedTimeType GetMTime(void) const ITK_OVERRIDE; + itk::ModifiedTimeType GetMTime(void) const override; protected: GridResampleImageFilter(); /** Destructor */ - ~GridResampleImageFilter() ITK_OVERRIDE {}; + ~GridResampleImageFilter() override {}; - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; - void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) override; - void AfterThreadedGenerateData() ITK_OVERRIDE; + void AfterThreadedGenerateData() override; inline void CastPixelWithBoundsChecking( const InterpolatorOutputType& value, const InterpolatorComponentType& minComponent, @@ -186,7 +186,7 @@ protected: } - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: GridResampleImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbHillShadingFilter.h b/Modules/Filtering/ImageManipulation/include/otbHillShadingFilter.h index 8463f1821adb4dca6b0c3ac0577d6e340a3bee4d..9779f1de6fe27345e7e642118bbeda98356da493 100644 --- a/Modules/Filtering/ImageManipulation/include/otbHillShadingFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbHillShadingFilter.h @@ -82,7 +82,7 @@ public: protected: HillShadingFilter() {} - ~HillShadingFilter() ITK_OVERRIDE {} + ~HillShadingFilter() override {} private: HillShadingFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbImageToNoDataMaskFilter.h b/Modules/Filtering/ImageManipulation/include/otbImageToNoDataMaskFilter.h index 5f96a9652e3839f054adab558b623176a887a2b0..8ec6c7850aa54a6574a01519cac24735ac246a0c 100644 --- a/Modules/Filtering/ImageManipulation/include/otbImageToNoDataMaskFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbImageToNoDataMaskFilter.h @@ -133,10 +133,10 @@ protected: ImageToNoDataMaskFilter() {} - ~ImageToNoDataMaskFilter() ITK_OVERRIDE + ~ImageToNoDataMaskFilter() override {} - void BeforeThreadedGenerateData() ITK_OVERRIDE + void BeforeThreadedGenerateData() override { std::vector<bool> noDataValueAvailable; std::vector<double> noDataValues; diff --git a/Modules/Filtering/ImageManipulation/include/otbImageToVectorImageCastFilter.h b/Modules/Filtering/ImageManipulation/include/otbImageToVectorImageCastFilter.h index 49d44f57c2bd55043f304998ef9089b68e36f510..3425e90a5e4892d3bb256778b50f017796f3a62d 100644 --- a/Modules/Filtering/ImageManipulation/include/otbImageToVectorImageCastFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbImageToVectorImageCastFilter.h @@ -96,15 +96,15 @@ protected: /// Constructor ImageToVectorImageCastFilter() {} /// Detructor - ~ImageToVectorImageCastFilter() ITK_OVERRIDE {} + ~ImageToVectorImageCastFilter() override {} /// Additional output information for allocation - void GenerateOutputInformation(void) ITK_OVERRIDE + void GenerateOutputInformation(void) override { Superclass::GenerateOutputInformation(); this->GetOutput()->SetNumberOfComponentsPerPixel(1); } /// Copy output requested region to input requested region - void GenerateInputRequestedRegion(void) ITK_OVERRIDE + void GenerateInputRequestedRegion(void) override { if (this->GetInput()) { diff --git a/Modules/Filtering/ImageManipulation/include/otbLocalGradientVectorImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbLocalGradientVectorImageFilter.h index b7e90fae49742da9ebcb7775e0afdb1c9550b498..f2bf9db5f4e923fda38cefd826111940e01fa55d 100644 --- a/Modules/Filtering/ImageManipulation/include/otbLocalGradientVectorImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbLocalGradientVectorImageFilter.h @@ -96,7 +96,7 @@ protected: typename Superclass::RadiusType radius = {{1, 1}}; this->SetRadius( radius ); } - ~LocalGradientVectorImageFilter() ITK_OVERRIDE { } + ~LocalGradientVectorImageFilter() override { } private: LocalGradientVectorImageFilter( const Self & ); // Not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbLog10ThresholdedImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbLog10ThresholdedImageFilter.h index bd5882214c928769e15014f43b3df28afced11ce..36c7fb14bb241b088d92cb3129044642c0c0ed97 100644 --- a/Modules/Filtering/ImageManipulation/include/otbLog10ThresholdedImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbLog10ThresholdedImageFilter.h @@ -104,7 +104,7 @@ public: } protected: Log10ThresholdedImageFilter() {} - ~Log10ThresholdedImageFilter() ITK_OVERRIDE {} + ~Log10ThresholdedImageFilter() override {} private: Log10ThresholdedImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbMatrixImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbMatrixImageFilter.h index 4199951dfa0e0107f6c16fe3f93385de08ec4a10..611dc22ef39e57efec1ddd977a2baaa3955ba0e4 100644 --- a/Modules/Filtering/ImageManipulation/include/otbMatrixImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbMatrixImageFilter.h @@ -111,13 +111,13 @@ public: protected: MatrixImageFilter(); - ~MatrixImageFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~MatrixImageFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** * Before threaded generate data method. */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; /** MatrixImageFilter can be implemented for a multithreaded filter treatment. * Thus, this implementation give the ThreadedGenerateData() method. @@ -128,7 +128,7 @@ protected: * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId) ITK_OVERRIDE; + itk::ThreadIdType threadId) override; private: MatrixImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbMultiplyByScalarImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbMultiplyByScalarImageFilter.h index 3f0f6c678bace77779bd725b990c0bc8499818d8..8cc130a72832bc9f204462480898ad335752b6ee 100644 --- a/Modules/Filtering/ImageManipulation/include/otbMultiplyByScalarImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbMultiplyByScalarImageFilter.h @@ -101,7 +101,7 @@ public: } protected: MultiplyByScalarImageFilter() {} - ~MultiplyByScalarImageFilter() ITK_OVERRIDE {} + ~MultiplyByScalarImageFilter() override {} private: MultiplyByScalarImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbNRIBandImagesToOneNComplexBandsImage.h b/Modules/Filtering/ImageManipulation/include/otbNRIBandImagesToOneNComplexBandsImage.h index 205da84a196af0e579c542c9466ac4fe5744e098..9d482cd70dfcf3af286c880688e07be9c1eab8a3 100644 --- a/Modules/Filtering/ImageManipulation/include/otbNRIBandImagesToOneNComplexBandsImage.h +++ b/Modules/Filtering/ImageManipulation/include/otbNRIBandImagesToOneNComplexBandsImage.h @@ -72,13 +72,13 @@ public: protected: NRIBandImagesToOneNComplexBandsImage(); - ~NRIBandImagesToOneNComplexBandsImage() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~NRIBandImagesToOneNComplexBandsImage() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; - void GenerateOutputInformation(void) ITK_OVERRIDE; - void BeforeThreadedGenerateData(void) ITK_OVERRIDE; + void GenerateOutputInformation(void) override; + void BeforeThreadedGenerateData(void) override; void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId) ITK_OVERRIDE; + itk::ThreadIdType threadId) override; private: NRIBandImagesToOneNComplexBandsImage(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbOneRIBandImageToOneComplexBandImage.h b/Modules/Filtering/ImageManipulation/include/otbOneRIBandImageToOneComplexBandImage.h index 8582158d36343dd3449f79e27e7135fb04a435b7..faf49f1b0982a4be5870d222229480cfa892deb1 100644 --- a/Modules/Filtering/ImageManipulation/include/otbOneRIBandImageToOneComplexBandImage.h +++ b/Modules/Filtering/ImageManipulation/include/otbOneRIBandImageToOneComplexBandImage.h @@ -21,6 +21,7 @@ #ifndef otbOneRIBandImageToOneComplexBandImage_h #define otbOneRIBandImageToOneComplexBandImage_h +#include <vcl_deprecated_header.h> #include "itkImageToImageFilter.h" #include "itkImage.h" #include "itkNumericTraits.h" @@ -72,12 +73,12 @@ public: protected: OneRIBandImageToOneComplexBandImage(); - ~OneRIBandImageToOneComplexBandImage() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~OneRIBandImageToOneComplexBandImage() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; - void BeforeThreadedGenerateData(void) ITK_OVERRIDE; + void BeforeThreadedGenerateData(void) override; void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId) ITK_OVERRIDE; + itk::ThreadIdType threadId) override; private: OneRIBandImageToOneComplexBandImage(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbPerBandVectorImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbPerBandVectorImageFilter.h index 82f601942568887897ef27b2a141eb80ddf9ce69..9654ccebf4e8e736fccc7fca18736384a2ebca3c 100644 --- a/Modules/Filtering/ImageManipulation/include/otbPerBandVectorImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbPerBandVectorImageFilter.h @@ -94,18 +94,18 @@ public: itkSetMacro(OutputIndex, unsigned int); itkGetMacro(OutputIndex, unsigned int); - void GenerateInputRequestedRegion(void) ITK_OVERRIDE; - void GenerateOutputInformation(void) ITK_OVERRIDE; + void GenerateInputRequestedRegion(void) override; + void GenerateOutputInformation(void) override; protected: /** Main computation method */ - void GenerateData(void) ITK_OVERRIDE; + void GenerateData(void) override; /** Constructor */ PerBandVectorImageFilter(); /** Destructor */ - ~PerBandVectorImageFilter() ITK_OVERRIDE {} + ~PerBandVectorImageFilter() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: PerBandVectorImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbPhaseFunctor.h b/Modules/Filtering/ImageManipulation/include/otbPhaseFunctor.h index 99646f8823f426883bdbcfd8853087b0004a7b2a..b289c7f4c79db961740391334889745b47128e19 100644 --- a/Modules/Filtering/ImageManipulation/include/otbPhaseFunctor.h +++ b/Modules/Filtering/ImageManipulation/include/otbPhaseFunctor.h @@ -70,17 +70,17 @@ public: } /** Destructor */ - ~PhaseFunctor() ITK_OVERRIDE {} + ~PhaseFunctor() override {} const char *GetDescription() const {return "Phase"; } - unsigned int GetOutputSize() const ITK_OVERRIDE + unsigned int GetOutputSize() const override { return 1; } - OutputPixelType operator ()(const VectorPixelType& inPixel) const ITK_OVERRIDE + OutputPixelType operator ()(const VectorPixelType& inPixel) const override { OutputPixelType outPixel; outPixel.SetSize(1); @@ -91,13 +91,13 @@ public: return outPixel; } - OutputPixelType operator ()(ScalarType /*inPixel*/) const ITK_OVERRIDE + OutputPixelType operator ()(ScalarType /*inPixel*/) const override { //FIXME we don't handle the std::complex<> yet itkExceptionMacro(<< "Can't compute amplitude from a scalar value"); } - OutputPixelType operator ()(const RGBPixelType& inPixel) const ITK_OVERRIDE + OutputPixelType operator ()(const RGBPixelType& inPixel) const override { OutputPixelType outPixel; outPixel.SetSize(1); @@ -109,7 +109,7 @@ public: return outPixel; } - OutputPixelType operator ()(const RGBAPixelType& inPixel) const ITK_OVERRIDE + OutputPixelType operator ()(const RGBAPixelType& inPixel) const override { OutputPixelType outPixel; outPixel.SetSize(1); diff --git a/Modules/Filtering/ImageManipulation/include/otbPrintableImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbPrintableImageFilter.h index ee35f261fc2fe4111977aecfe38a9dd256242752..346a34f2ffb09ce39ed05f1a3ca4fd0cdda4a3d1 100644 --- a/Modules/Filtering/ImageManipulation/include/otbPrintableImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbPrintableImageFilter.h @@ -161,7 +161,7 @@ public: itk::ImageToImageFilter); /** Display */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; void SetChannel(unsigned int channel); const ChannelsType GetChannels(void) const; @@ -232,14 +232,14 @@ public: * below. * * \sa ProcessObject::GenerateOutputInformaton() */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; protected: PrintableImageFilter(); void BeforeGenerateData(); - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; private: diff --git a/Modules/Filtering/ImageManipulation/include/otbRealAndImaginaryImageToComplexImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbRealAndImaginaryImageToComplexImageFilter.h index 23d924f8041e0e98ec55ddac12471e22813fc7f8..e473277d1c07d10df0e3d6a16c0b77a9f1191780 100644 --- a/Modules/Filtering/ImageManipulation/include/otbRealAndImaginaryImageToComplexImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbRealAndImaginaryImageToComplexImageFilter.h @@ -116,7 +116,7 @@ public: protected: RealAndImaginaryImageToComplexImageFilter() {} - ~RealAndImaginaryImageToComplexImageFilter() ITK_OVERRIDE {} + ~RealAndImaginaryImageToComplexImageFilter() override {} private: RealAndImaginaryImageToComplexImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbRealImageToComplexImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbRealImageToComplexImageFilter.h index c426b5a2f9e5a2225d842b51cb92640841bcefbd..0c4168b247a96c4a3c67926a8d83d892c87abb98 100644 --- a/Modules/Filtering/ImageManipulation/include/otbRealImageToComplexImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbRealImageToComplexImageFilter.h @@ -21,6 +21,7 @@ #ifndef otbRealImageToComplexImageFilter_h #define otbRealImageToComplexImageFilter_h +#include <vcl_deprecated_header.h> #include "itkUnaryFunctorImageFilter.h" #include "vnl/vnl_math.h" @@ -92,7 +93,7 @@ public: protected: RealImageToComplexImageFilter() {} - ~RealImageToComplexImageFilter() ITK_OVERRIDE {} + ~RealImageToComplexImageFilter() override {} private: RealImageToComplexImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbShiftScaleImageAdaptor.h b/Modules/Filtering/ImageManipulation/include/otbShiftScaleImageAdaptor.h index b22dcd8e6944694171b2e4af5f1d3fc6edec2367..68f986535201d5a5bdd32d0bb98a46081647003a 100644 --- a/Modules/Filtering/ImageManipulation/include/otbShiftScaleImageAdaptor.h +++ b/Modules/Filtering/ImageManipulation/include/otbShiftScaleImageAdaptor.h @@ -166,7 +166,7 @@ public: protected: ShiftScaleImageAdaptor() {} - ~ShiftScaleImageAdaptor() ITK_OVERRIDE {} + ~ShiftScaleImageAdaptor() override {} private: ShiftScaleImageAdaptor(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbShiftScaleVectorImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbShiftScaleVectorImageFilter.h index 0d5868b6f922916ba29d50c43bee046322f2c1b0..9b90aee8cd3ee82a5d5d5297c9bd47cee50db47b 100644 --- a/Modules/Filtering/ImageManipulation/include/otbShiftScaleVectorImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbShiftScaleVectorImageFilter.h @@ -197,16 +197,16 @@ public: protected: ShiftScaleVectorImageFilter() {} - ~ShiftScaleVectorImageFilter() ITK_OVERRIDE {} + ~ShiftScaleVectorImageFilter() override {} /** Process to execute before entering the multithreaded section */ - void BeforeThreadedGenerateData(void) ITK_OVERRIDE; + void BeforeThreadedGenerateData(void) override; /** Generate output information */ - void GenerateOutputInformation(void) ITK_OVERRIDE; + void GenerateOutputInformation(void) override; /** Generate input requested region */ - void GenerateInputRequestedRegion(void) ITK_OVERRIDE; + void GenerateInputRequestedRegion(void) override; private: ShiftScaleVectorImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbSpectralAngleDistanceImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbSpectralAngleDistanceImageFilter.h index b071637c6febabba9d9fd85b87296a9da7db4e91..7cf4f3c44284de83854b9aed87c7a516daa941f4 100644 --- a/Modules/Filtering/ImageManipulation/include/otbSpectralAngleDistanceImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbSpectralAngleDistanceImageFilter.h @@ -84,9 +84,9 @@ protected: /** Constructor */ SpectralAngleDistanceImageFilter(); /** Destructor */ - ~SpectralAngleDistanceImageFilter() ITK_OVERRIDE {} + ~SpectralAngleDistanceImageFilter() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** SpectralAngleDistanceImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine * which is called for each processing thread. The output image data is @@ -98,9 +98,9 @@ protected: * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId) ITK_OVERRIDE; + itk::ThreadIdType threadId) override; - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; private: SpectralAngleDistanceImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbSqrtSpectralAngleFunctor.h b/Modules/Filtering/ImageManipulation/include/otbSqrtSpectralAngleFunctor.h index 7f06d1c3deacf8b99a25658a28d030239fb88b7e..48226356e25f6d56e879a6c2efadb0b51735d6db 100644 --- a/Modules/Filtering/ImageManipulation/include/otbSqrtSpectralAngleFunctor.h +++ b/Modules/Filtering/ImageManipulation/include/otbSqrtSpectralAngleFunctor.h @@ -43,10 +43,10 @@ public: typedef SpectralAngleFunctor<TInputVectorPixel, TOutputPixel> Superclass; SqrtSpectralAngleFunctor() {} - ~SqrtSpectralAngleFunctor() ITK_OVERRIDE {} + ~SqrtSpectralAngleFunctor() override {} protected: - TOutputPixel Evaluate(const TInputVectorPixel& inPix) const ITK_OVERRIDE + TOutputPixel Evaluate(const TInputVectorPixel& inPix) const override { return static_cast<TOutputPixel>(vcl_sqrt(Superclass::Evaluate(inPix))); } diff --git a/Modules/Filtering/ImageManipulation/include/otbStreamingInnerProductVectorImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbStreamingInnerProductVectorImageFilter.h index da666dbb2ab59c24d514dd23478529db26b29141..423cbab31342a2bc1a59105b5f8aa75eee9d0289 100644 --- a/Modules/Filtering/ImageManipulation/include/otbStreamingInnerProductVectorImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbStreamingInnerProductVectorImageFilter.h @@ -102,16 +102,16 @@ public: /** Make a DataObject of the correct type to be used as the specified * output. */ - DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override; using Superclass::MakeOutput; /** Pass the input through unmodified. Do this by Grafting in the * AllocateOutputs method. */ - void AllocateOutputs() ITK_OVERRIDE; - void GenerateOutputInformation() ITK_OVERRIDE; - void Synthetize(void) ITK_OVERRIDE; - void Reset(void) ITK_OVERRIDE; + void AllocateOutputs() override; + void GenerateOutputInformation() override; + void Synthetize(void) override; + void Reset(void) override; /** Enable/Disable center data */ itkSetMacro(CenterData, bool); @@ -120,10 +120,10 @@ public: protected: PersistentInnerProductVectorImageFilter(); - ~PersistentInnerProductVectorImageFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~PersistentInnerProductVectorImageFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Multi-thread version GenerateData. */ - void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId) override; private: PersistentInnerProductVectorImageFilter(const Self &); //purposely not implemented @@ -217,7 +217,7 @@ protected: /** Constructor */ StreamingInnerProductVectorImageFilter() {}; /** Destructor */ - ~StreamingInnerProductVectorImageFilter() ITK_OVERRIDE {} + ~StreamingInnerProductVectorImageFilter() override {} private: StreamingInnerProductVectorImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbStreamingMatrixTransposeMatrixImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbStreamingMatrixTransposeMatrixImageFilter.h index 3cb5ddb1a5a1641846c7738c56e55f1799104e42..f79ead12bb00a5c8e1c0ed0f27451ae5757b16dc 100644 --- a/Modules/Filtering/ImageManipulation/include/otbStreamingMatrixTransposeMatrixImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbStreamingMatrixTransposeMatrixImageFilter.h @@ -122,18 +122,18 @@ public: /** Make a DataObject of the correct type to be used as the specified * output. */ - DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override; using Superclass::MakeOutput; /** Pass the input through unmodified. Do this by Grafting in the * AllocateOutputs method. */ - void AllocateOutputs() ITK_OVERRIDE; - void GenerateOutputInformation() ITK_OVERRIDE; + void AllocateOutputs() override; + void GenerateOutputInformation() override; // Override since the filter needs all the data for the algorithm - void GenerateInputRequestedRegion() ITK_OVERRIDE; - void Reset(void) ITK_OVERRIDE; - void Synthetize(void) ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; + void Reset(void) override; + void Synthetize(void) override; /** Input wrapper */ void SetFirstInput(const TInputImage *input1) @@ -165,10 +165,10 @@ public: protected: PersistentMatrixTransposeMatrixImageFilter(); - ~PersistentMatrixTransposeMatrixImageFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~PersistentMatrixTransposeMatrixImageFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Multi-thread version GenerateData. */ - void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId) override; private: PersistentMatrixTransposeMatrixImageFilter(const Self &); //purposely not implemented @@ -274,7 +274,7 @@ protected: /** Constructor */ StreamingMatrixTransposeMatrixImageFilter() {}; /** Destructor */ - ~StreamingMatrixTransposeMatrixImageFilter() ITK_OVERRIDE {} + ~StreamingMatrixTransposeMatrixImageFilter() override {} private: StreamingMatrixTransposeMatrixImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbStreamingResampleImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbStreamingResampleImageFilter.h index d42cea94c96426b7843395bba5a5726afa8eced8..164d9d19e2511cca27069099c2f9ca9ba285b9cc 100644 --- a/Modules/Filtering/ImageManipulation/include/otbStreamingResampleImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbStreamingResampleImageFilter.h @@ -172,19 +172,19 @@ public: } /** Override itk::ProcessObject method to let the internal filter do the propagation */ - void PropagateRequestedRegion(itk::DataObject *output) ITK_OVERRIDE; + void PropagateRequestedRegion(itk::DataObject *output) override; protected: StreamingResampleImageFilter(); /** Destructor */ - ~StreamingResampleImageFilter() ITK_OVERRIDE {}; + ~StreamingResampleImageFilter() override {}; - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: StreamingResampleImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbStreamingShrinkImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbStreamingShrinkImageFilter.h index c00878892f2d0c7aa0950e835dc3f39264ae12b1..c48e2d2e2eca4c2ac1fb836e57df88cdf528bb7e 100644 --- a/Modules/Filtering/ImageManipulation/include/otbStreamingShrinkImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbStreamingShrinkImageFilter.h @@ -72,13 +72,13 @@ public: * a certain dimensions, then some splits will not be possible. */ unsigned int GetNumberOfSplits(const RegionType& region, - unsigned int requestedNumber) ITK_OVERRIDE; + unsigned int requestedNumber) override; /** Get a region definition that represents the ith piece a specified region. * The "numberOfPieces" specified should be less than or equal to what * GetNumberOfSplits() returns. */ RegionType GetSplit(unsigned int i, unsigned int numberOfPieces, - const RegionType& region) ITK_OVERRIDE; + const RegionType& region) override; itkGetMacro(TileSizeAlignment, unsigned int); @@ -89,8 +89,8 @@ public: protected: StreamingShrinkImageRegionSplitter() : m_SplitsPerDimension(0U), m_TileDimension(0), m_TileSizeAlignment(0), m_ShrinkFactor(10) {} - ~StreamingShrinkImageRegionSplitter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~StreamingShrinkImageRegionSplitter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: StreamingShrinkImageRegionSplitter(const StreamingShrinkImageRegionSplitter &); //purposely not implemented @@ -130,7 +130,7 @@ public: /** Actually computes the stream divisions, according to the specified streaming mode, * eventually using the input parameter to estimate memory consumption */ - void PrepareStreaming(itk::DataObject * input, const RegionType ®ion) ITK_OVERRIDE; + void PrepareStreaming(itk::DataObject * input, const RegionType ®ion) override; void SetShrinkFactor(unsigned int val) { @@ -144,7 +144,7 @@ public: protected: StreamingShrinkStreamingManager(); - ~StreamingShrinkStreamingManager() ITK_OVERRIDE; + ~StreamingShrinkStreamingManager() override; private: StreamingShrinkStreamingManager(const StreamingShrinkStreamingManager &); //purposely not implemented @@ -203,9 +203,9 @@ public: return m_ShrunkOutput; } - void Synthetize(void) ITK_OVERRIDE; + void Synthetize(void) override; - void Reset(void) ITK_OVERRIDE; + void Reset(void) override; itkSetMacro(ShrinkFactor, unsigned int); itkGetMacro(ShrinkFactor, unsigned int); @@ -213,23 +213,23 @@ public: protected: PersistentShrinkImageFilter(); - ~PersistentShrinkImageFilter() ITK_OVERRIDE; + ~PersistentShrinkImageFilter() override; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; /** Multi-thread version GenerateData. */ - void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId) override; - void AfterThreadedGenerateData() ITK_OVERRIDE; + void AfterThreadedGenerateData() override; /** Pass the input through unmodified. Do this by Grafting in the * AllocateOutputs method. */ - void AllocateOutputs() ITK_OVERRIDE; + void AllocateOutputs() override; - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; private: @@ -305,7 +305,7 @@ public: otbSetObjectMemberMacro(Filter, ShrinkFactor, unsigned int); otbGetObjectMemberMacro(Filter, ShrinkFactor, unsigned int); - void Update(void) ITK_OVERRIDE + void Update(void) override { m_StreamingManager->SetShrinkFactor( this->GetFilter()->GetShrinkFactor() ); Superclass::Update(); @@ -321,7 +321,7 @@ protected: } /** Destructor */ - ~StreamingShrinkImageFilter() ITK_OVERRIDE {} + ~StreamingShrinkImageFilter() override {} private: StreamingShrinkImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbTernaryFunctorImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbTernaryFunctorImageFilter.h index 3e6d3f540505708893faa290c511633e55d4b462..483f2e3275ce047cfb8b1647226cce075f90f151 100644 --- a/Modules/Filtering/ImageManipulation/include/otbTernaryFunctorImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbTernaryFunctorImageFilter.h @@ -55,7 +55,7 @@ public: protected: TernaryFunctorImageFilter() {}; - ~TernaryFunctorImageFilter() ITK_OVERRIDE {} + ~TernaryFunctorImageFilter() override {} /** TernaryFunctorImageFilter can produce an image which has a different number of bands * than its input image. As such, TernaryFunctorImageFilter @@ -65,7 +65,7 @@ protected: * below. * * \sa ProcessObject::GenerateOutputInformaton() */ - void GenerateOutputInformation() ITK_OVERRIDE + void GenerateOutputInformation() override { Superclass::GenerateOutputInformation(); typename Superclass::OutputImagePointer outputPtr = this->GetOutput(); diff --git a/Modules/Filtering/ImageManipulation/include/otbThresholdVectorImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbThresholdVectorImageFilter.h index ef2a903cd471d659bc4df45291106dabf016e260..cf87797e75b5ab9135b8e6620a3ea31ca980e708 100644 --- a/Modules/Filtering/ImageManipulation/include/otbThresholdVectorImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbThresholdVectorImageFilter.h @@ -98,8 +98,8 @@ public: protected: ThresholdVectorImageFilter(); - ~ThresholdVectorImageFilter() ITK_OVERRIDE {}; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~ThresholdVectorImageFilter() override {}; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** ThresholdVectorImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine @@ -112,9 +112,9 @@ protected: * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType ThrethreadId ) ITK_OVERRIDE; + itk::ThreadIdType ThrethreadId ) override; - void GenerateOutputInformation(void) ITK_OVERRIDE + void GenerateOutputInformation(void) override { Superclass::GenerateOutputInformation(); diff --git a/Modules/Filtering/ImageManipulation/include/otbTileImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbTileImageFilter.h index 34c1c5aa488afe3d0acaa82d051404bb1da718f0..7eb50db4f4b0ea8b9c0407076a501bc757500f6d 100644 --- a/Modules/Filtering/ImageManipulation/include/otbTileImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbTileImageFilter.h @@ -80,26 +80,26 @@ protected: TileImageFilter(); /** Destructor */ - ~TileImageFilter() ITK_OVERRIDE; + ~TileImageFilter() override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Threaded generate data */ - void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId) override; /** Generate input requested region method */ - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; /** Generate input requested region method */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; /** Override VerifyInputInformation() since this filter's inputs do * not need to occupy the same physical space. * * \sa ProcessObject::VerifyInputInformation */ - void VerifyInputInformation() ITK_OVERRIDE {} + void VerifyInputInformation() override {} private: diff --git a/Modules/Filtering/ImageManipulation/include/otbTwoNRIBandsImageToNComplexBandsImage.h b/Modules/Filtering/ImageManipulation/include/otbTwoNRIBandsImageToNComplexBandsImage.h index 538b07214964f53fb86a9238d9417b968ae13630..64020282a392e6267b5d854658997d76bc224892 100644 --- a/Modules/Filtering/ImageManipulation/include/otbTwoNRIBandsImageToNComplexBandsImage.h +++ b/Modules/Filtering/ImageManipulation/include/otbTwoNRIBandsImageToNComplexBandsImage.h @@ -21,6 +21,7 @@ #ifndef otbTwoNRIBandsImageToNComplexBandsImage_h #define otbTwoNRIBandsImageToNComplexBandsImage_h +#include <vcl_deprecated_header.h> #include "itkImageToImageFilter.h" #include "itkImage.h" #include "itkNumericTraits.h" @@ -72,13 +73,13 @@ public: protected: TwoNRIBandsImageToNComplexBandsImage(); - ~TwoNRIBandsImageToNComplexBandsImage() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~TwoNRIBandsImageToNComplexBandsImage() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; - void GenerateOutputInformation(void) ITK_OVERRIDE; - void BeforeThreadedGenerateData(void) ITK_OVERRIDE; + void GenerateOutputInformation(void) override; + void BeforeThreadedGenerateData(void) override; void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId) ITK_OVERRIDE; + itk::ThreadIdType threadId) override; private: TwoNRIBandsImageToNComplexBandsImage(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorNeighborhoodImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorNeighborhoodImageFilter.h index de00941439bf0f44b1cba57331a9deaae1a96cc2..b925c64959685b567abc4ba5e70e3dbfa68fac02 100644 --- a/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorNeighborhoodImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorNeighborhoodImageFilter.h @@ -123,7 +123,7 @@ protected: /** * Destructor */ - ~UnaryFunctorNeighborhoodImageFilter() ITK_OVERRIDE {} + ~UnaryFunctorNeighborhoodImageFilter() override {} /** UnaryFunctorNeighborhoodImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine @@ -135,12 +135,12 @@ protected: * * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ - void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) override; /** * Pad the input requested region by radius */ - void GenerateInputRequestedRegion(void) ITK_OVERRIDE; + void GenerateInputRequestedRegion(void) override; private: UnaryFunctorNeighborhoodImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorNeighborhoodWithOffsetImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorNeighborhoodWithOffsetImageFilter.h index 05f86d0857b35d727eec4be0ae654c0a2ee0826c..d562ea081050bc9cc27ed32fe468a41c4aac803b 100644 --- a/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorNeighborhoodWithOffsetImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorNeighborhoodWithOffsetImageFilter.h @@ -133,9 +133,9 @@ protected: /** * Destructor */ - ~UnaryFunctorNeighborhoodWithOffsetImageFilter() ITK_OVERRIDE {} + ~UnaryFunctorNeighborhoodWithOffsetImageFilter() override {} - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; /** UnaryFunctorNeighborhoodWithOffsetImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine @@ -147,12 +147,12 @@ protected: * * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ - void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) override; /** * Pad the input requested region by radius */ - void GenerateInputRequestedRegion(void) ITK_OVERRIDE; + void GenerateInputRequestedRegion(void) override; std::vector<FunctorType> m_FunctorList; private: diff --git a/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorWithIndexImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorWithIndexImageFilter.h index 6a241dd5a2ea9efb2b18384fe2f507d448a2ad23..34e42c34bcddc15a37a475bab04b087f9e30e7de 100644 --- a/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorWithIndexImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbUnaryFunctorWithIndexImageFilter.h @@ -111,7 +111,7 @@ protected: /** * Destructor */ - ~UnaryFunctorWithIndexImageFilter() ITK_OVERRIDE {} + ~UnaryFunctorWithIndexImageFilter() override {} /** UnaryFunctorWithIndexImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine @@ -123,12 +123,12 @@ protected: * * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ - void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) override; /** * Pad the input requested region by radius */ - void GenerateInputRequestedRegion(void) ITK_OVERRIDE; + void GenerateInputRequestedRegion(void) override; private: UnaryFunctorWithIndexImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbUnaryImageFunctorWithVectorImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbUnaryImageFunctorWithVectorImageFilter.h index fe37b979057c32c0bbc79d34ffd2e88b76d93515..f2519e2a59e64f256cbebcd4e33971b7c20e39f3 100644 --- a/Modules/Filtering/ImageManipulation/include/otbUnaryImageFunctorWithVectorImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbUnaryImageFunctorWithVectorImageFilter.h @@ -89,7 +89,7 @@ public: protected: UnaryImageFunctorWithVectorImageFilter(); - ~UnaryImageFunctorWithVectorImageFilter() ITK_OVERRIDE {} + ~UnaryImageFunctorWithVectorImageFilter() override {} /** UnaryImageFunctorWithVectorImageFilter can produce an image which is a different * resolution than its input image. As such, UnaryImageFunctorWithVectorImageFilter @@ -99,7 +99,7 @@ protected: * below. * * \sa ProcessObject::GenerateOutputInformaton() */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; /** UnaryImageFunctorWithVectorImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine @@ -111,9 +111,9 @@ protected: * * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ - void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) override; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: /** Ponderation declaration*/ diff --git a/Modules/Filtering/ImageManipulation/include/otbVectorImageTo3DScalarImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbVectorImageTo3DScalarImageFilter.h index 368f04969172e5599a94e4639885ef99541a4b22..ba02992064eb8408d98ee223f7c468473a24e3f1 100644 --- a/Modules/Filtering/ImageManipulation/include/otbVectorImageTo3DScalarImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbVectorImageTo3DScalarImageFilter.h @@ -74,21 +74,21 @@ public: protected: /** Generate output information */ - void GenerateOutputInformation(void) ITK_OVERRIDE; + void GenerateOutputInformation(void) override; /** Generate input requested region */ - void GenerateInputRequestedRegion(void) ITK_OVERRIDE; + void GenerateInputRequestedRegion(void) override; /** Threaded Generate data */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId) ITK_OVERRIDE; + itk::ThreadIdType threadId) override; /** Constructor */ VectorImageTo3DScalarImageFilter(); /** Destructor */ - ~VectorImageTo3DScalarImageFilter() ITK_OVERRIDE {} + ~VectorImageTo3DScalarImageFilter() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: VectorImageTo3DScalarImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/include/otbVectorImageToAmplitudeImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbVectorImageToAmplitudeImageFilter.h index 7a8875e488014459725cf47d17ff35426378b6e5..09602f7650692e212a364d79ff7e5ac2ee6eed54 100644 --- a/Modules/Filtering/ImageManipulation/include/otbVectorImageToAmplitudeImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbVectorImageToAmplitudeImageFilter.h @@ -84,9 +84,9 @@ protected: /** Constructor */ VectorImageToAmplitudeImageFilter() {}; /** Destructor */ - ~VectorImageToAmplitudeImageFilter() ITK_OVERRIDE {} + ~VectorImageToAmplitudeImageFilter() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + void PrintSelf(std::ostream& os, itk::Indent indent) const override { Superclass::PrintSelf(os, indent); } diff --git a/Modules/Filtering/ImageManipulation/include/otbVectorRescaleIntensityImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbVectorRescaleIntensityImageFilter.h index 8b5633863c1097a95560600945f7d704f113c066..e2227f0b70816694fba3f09c37deeb05b8653ce3 100644 --- a/Modules/Filtering/ImageManipulation/include/otbVectorRescaleIntensityImageFilter.h +++ b/Modules/Filtering/ImageManipulation/include/otbVectorRescaleIntensityImageFilter.h @@ -260,20 +260,20 @@ public: itkGetConstReferenceMacro(Gamma,double); /** Process to execute before entering the multithreaded section */ - void BeforeThreadedGenerateData(void) ITK_OVERRIDE; + void BeforeThreadedGenerateData(void) override; /** Generate output information */ - void GenerateOutputInformation(void) ITK_OVERRIDE; + void GenerateOutputInformation(void) override; /** Generate input requested region */ - void GenerateInputRequestedRegion(void) ITK_OVERRIDE; + void GenerateInputRequestedRegion(void) override; /** Print internal ivars */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; protected: VectorRescaleIntensityImageFilter(); - ~VectorRescaleIntensityImageFilter() ITK_OVERRIDE {} + ~VectorRescaleIntensityImageFilter() override {} private: VectorRescaleIntensityImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageManipulation/test/CMakeLists.txt b/Modules/Filtering/ImageManipulation/test/CMakeLists.txt index 386b4294793890480773aa72640551525dfaedcf..834a6d3da072adf5c4dbc385d46db7931132de97 100644 --- a/Modules/Filtering/ImageManipulation/test/CMakeLists.txt +++ b/Modules/Filtering/ImageManipulation/test/CMakeLists.txt @@ -58,7 +58,6 @@ otbStreamingInnerProductVectorImageFilter.cxx otbPhaseFunctorTest.cxx otbShiftScaleVectorImageFilterNew.cxx otbChangeLabelImageFilter.cxx -otbClampVectorImageFilter.cxx otbPrintableImageFilterNew.cxx otbShiftScaleImageAdaptorNew.cxx otbStreamingInnerProductVectorImageFilterNew.cxx @@ -442,20 +441,6 @@ otb_add_test(NAME bfTvChangeLabelImageFilter COMMAND otbImageManipulationTestDri 255 # upper threshold ) - -otb_add_test(NAME bfTvClampVectorImageFilterTest COMMAND otbImageManipulationTestDriver - --compare-image 0.0001 - ${BASELINE}/bfTvClampVectorImageFilterTest_Output.tif - ${TEMP}/bfTvClampVectorImageFilterTest_Output.tif - otbClampVectorImageFilterTest - ${INPUTDATA}/QB_TOULOUSE_MUL_Extract_500_500.tif - ${TEMP}/bfTvClampVectorImageFilterTest_Output.tif - ) - -otb_add_test(NAME bfTuClampVectorImageFilterNew COMMAND otbImageManipulationTestDriver - otbClampVectorImageFilterNew - ) - otb_add_test(NAME bfTuPrintableImageFilterNew COMMAND otbImageManipulationTestDriver otbPrintableImageFilterNew) @@ -638,6 +623,11 @@ otb_add_test(NAME bfTvClampImageFilterTest COMMAND otbImageManipulationTestDrive ${TEMP}/bfTvClampImageFilterTest_Output.tif ) +otb_add_test(NAME bfTvClampImageFilterConversionTest COMMAND otbImageManipulationTestDriver + otbClampImageFilterConversionTest + ${INPUTDATA}/veryverySmallFSATSW.tif + ) + otb_add_test(NAME coTvConcatenateVectorImageFilter COMMAND otbImageManipulationTestDriver --compare-image ${NOTOL} ${BASELINE}/coConcatenateVectorImageFilterOutput1.hdr diff --git a/Modules/Filtering/ImageManipulation/test/otbClampImageFilter.cxx b/Modules/Filtering/ImageManipulation/test/otbClampImageFilter.cxx index 82deca5f4fc74917e5e3bc5d78bf1acf5e0a41c6..29ac5602eacbc38ffda2b5914822024b2a20d0df 100644 --- a/Modules/Filtering/ImageManipulation/test/otbClampImageFilter.cxx +++ b/Modules/Filtering/ImageManipulation/test/otbClampImageFilter.cxx @@ -21,10 +21,14 @@ #include "otbClampImageFilter.h" #include "otbImage.h" +#include "otbVectorImage.h" +#include <limits> #include "otbImageFileReader.h" #include "otbImageFileWriter.h" +#include "itkImageRegionConstIterator.h" + /** Pixel typedefs */ typedef double InputPixelType; typedef unsigned int OutputPixelType; @@ -65,3 +69,423 @@ int otbClampImageFilterTest(int itkNotUsed(argc), char* argv[]) return EXIT_SUCCESS; } + +template < class InImageType , class OutImageType > +typename OutImageType::Pointer +Cross ( std::string const & inputFileName ) +{ + typedef otb::ImageFileReader< InImageType > ReaderType; + typedef otb::ClampImageFilter< InImageType , OutImageType > ClampFilter; + typename ReaderType::Pointer reader ( ReaderType::New() ); + reader->SetFileName( inputFileName ); + typename ClampFilter::Pointer clamp ( ClampFilter::New() ); + clamp->SetInput( reader->GetOutput() ); + clamp->Update(); + return clamp->GetOutput(); +} + +template < class OutImageType > +typename OutImageType::Pointer +Cross ( otb::VectorImage< std::complex<float> >::Pointer input ) +{ + typedef otb::ClampImageFilter< otb::VectorImage< std::complex<float> > , + OutImageType > ClampFilter; + typename ClampFilter::Pointer clamp ( ClampFilter::New() ); + clamp->SetInput( input ); + clamp->Update(); + return clamp->GetOutput(); +} + +template < class OutImageType > +typename OutImageType::Pointer +Cross ( otb::Image< itk::FixedArray< std::complex<float> , 2 > >::Pointer input ) +{ + typedef otb::ClampImageFilter< otb::Image< itk::FixedArray< std::complex<float> , 2 > > , + OutImageType > ClampFilter; + typename ClampFilter::Pointer clamp ( ClampFilter::New() ); + clamp->SetInput( input ); + clamp->Update(); + return clamp->GetOutput(); +} + +typedef otb::VectorImage<double> ImageRefType; + +template <class ImageType > +bool +CompareImageReal( const ImageRefType::Pointer imRef , + const ImageType * im ) +{ + typedef typename ImageType::PixelType RealPixelType; + + RealPixelType min = std::numeric_limits< RealPixelType >::lowest(); + RealPixelType max = std::numeric_limits< RealPixelType >::max(); + auto itRef = itk::ImageRegionConstIterator< ImageRefType >( imRef , + imRef->GetLargestPossibleRegion() ); + auto it = itk::ImageRegionConstIterator< ImageType >( im , + im->GetLargestPossibleRegion() ); + itRef.GoToBegin(); + it.GoToBegin(); + RealPixelType val; + double ref; + while ( !it.IsAtEnd() ) + { + val = it.Get(); + ref = itRef.Get()[0]; + if ( ref > static_cast<double>( max ) && val != max ) + { + return false; + } + else if ( ref < static_cast<double>( min ) && val != min ) + { + return false; + } + else if ( static_cast<RealPixelType>( ref ) != val ) + { + return false; + } + ++it; + ++itRef; + } + return true; +} + +template <class ImageType > +bool +CompareVectorReal( const ImageRefType::Pointer imRef , + const ImageType * im ) +{ + typedef typename ImageType::InternalPixelType RealPixelType; + RealPixelType min = std::numeric_limits< RealPixelType >::lowest(); + RealPixelType max = std::numeric_limits< RealPixelType >::max(); + auto itRef = itk::ImageRegionConstIterator< ImageRefType >( imRef , + imRef->GetLargestPossibleRegion() ); + auto it = itk::ImageRegionConstIterator< ImageType >( im , + im->GetLargestPossibleRegion() ); + itRef.GoToBegin(); + it.GoToBegin(); + unsigned int nbChanel = im->GetNumberOfComponentsPerPixel (); + // unsigned int nbChanelRef = imRef->GetNumberOfComponentsPerPixel (); + RealPixelType val; + double ref; + while ( !it.IsAtEnd() ) + { + // std::cout<<it.Get()<<std::endl; + // std::cout<<itRef.Get()<<std::endl; + for ( unsigned int i = 0 ; i < nbChanel ; i++ ) + { + val = it.Get()[i]; + ref = itRef.Get()[i]; + + if ( ref > static_cast<double>( max ) && val != max ) + { + std::cout<<"ref : "<<static_cast<RealPixelType>(ref)<<std::endl; + std::cout<<"val : "<<val<<std::endl; + return false; + } + else if ( ref < static_cast<double>( min ) && val != min ) + { + std::cout<<"ref : "<<static_cast<RealPixelType>(ref)<<std::endl; + std::cout<<"val : "<<val<<std::endl; + return false; + } + else if ( static_cast<RealPixelType>(ref) != val ) + { + std::cout<<"ref : "<<static_cast<RealPixelType>(ref)<<std::endl; + std::cout<<"val : "<<val<<std::endl; + return false; + } + } + ++it; + ++itRef; + } + return true; +} + +template <class ImageType > +bool +CompareImageComplex( const ImageRefType::Pointer imageRef , + const ImageType * im ) +{ + typedef typename ImageType::PixelType ComplexType; + typedef typename ComplexType::value_type RealType; + + RealType min = std::numeric_limits< RealType >::lowest(); + RealType max = std::numeric_limits< RealType >::max(); + auto itRef = itk::ImageRegionConstIterator< ImageRefType >( imageRef , + imageRef->GetLargestPossibleRegion() ); + auto it = itk::ImageRegionConstIterator< ImageType >( im , + im->GetLargestPossibleRegion() ); + itRef.GoToBegin(); + it.GoToBegin(); + ComplexType val; + double reRef , imRef; + while ( !it.IsAtEnd() ) + { + val = it.Get(); + reRef = itRef.Get()[0]; + imRef = itRef.Get()[1]; + if ( ( reRef > static_cast<double>( max ) && val.real() != max ) + || ( imRef > static_cast<double>( max ) && val.imag() != max ) ) + { + return false; + } + else if ( ( reRef < static_cast<double>( min ) && val.real() != min ) + || ( imRef < static_cast<double>( min ) && val.imag() != min ) ) + { + return false; + } + else if ( static_cast<RealType>( reRef ) != val.real() + || static_cast<RealType>( imRef ) != val.imag() ) + { + return false; + } + ++it; + ++itRef; + } + return true; +} + +template <class ImageType > +bool +CompareVectorComplex( const ImageRefType::Pointer imageRef , + const ImageType * im ) +{ + typedef typename ImageType::InternalPixelType ComplexType; + typedef typename ComplexType::value_type RealType; + + RealType min = std::numeric_limits< RealType >::lowest(); + RealType max = std::numeric_limits< RealType >::max(); + auto itRef = itk::ImageRegionConstIterator< ImageRefType >( imageRef , + imageRef->GetLargestPossibleRegion() ); + auto it = itk::ImageRegionConstIterator< ImageType >( im , + im->GetLargestPossibleRegion() ); + itRef.GoToBegin(); + it.GoToBegin(); + unsigned int nbChanel = im->GetNumberOfComponentsPerPixel (); + ComplexType val; + float reRef , imRef; + while ( !it.IsAtEnd() ) + { + for (unsigned int i = 0 ; i < nbChanel ; i++ ) + { + val = it.Get()[i]; + reRef = itRef.Get()[ 2 * i ]; + imRef = itRef.Get()[ 2 * i + 1 ]; + if ( ( reRef > static_cast<double>( max ) && val.real() != max ) + || ( imRef > static_cast<double>( max ) && val.imag() != max ) ) + { + return false; + } + else if ( ( reRef < static_cast<double>( min ) && val.real() != min ) + || ( imRef < static_cast<double>( min ) && val.imag() != min ) ) + { + return false; + } + else if ( static_cast<RealType>( reRef ) != val.real() + || static_cast<RealType>( imRef ) != val.imag() ) + { + return false; + } + } + ++it; + ++itRef; + } + return true; +} + +template <class ImageType > +bool +CompareArrayComplex( const ImageRefType::Pointer imageRef , + const ImageType * im ) +{ + typedef typename ImageType::PixelType ArrayType; + typedef typename ArrayType::ValueType ComplexType; + typedef typename ComplexType::value_type RealType; + + RealType min = std::numeric_limits< RealType >::lowest(); + RealType max = std::numeric_limits< RealType >::max(); + auto itRef = itk::ImageRegionConstIterator< ImageRefType >( imageRef , + imageRef->GetLargestPossibleRegion() ); + auto it = itk::ImageRegionConstIterator< ImageType >( im , + im->GetLargestPossibleRegion() ); + itRef.GoToBegin(); + it.GoToBegin(); + unsigned int nbChanel = im->GetNumberOfComponentsPerPixel (); + ComplexType val; + float reRef , imRef; + while ( !it.IsAtEnd() ) + { + for (unsigned int i = 0 ; i < nbChanel ; i++ ) + { + val = it.Get()[i]; + reRef = itRef.Get()[ 2 * i ]; + imRef = itRef.Get()[ 2 * i + 1 ]; + if ( ( reRef > static_cast<double>( max ) && val.real() != max ) + || ( imRef > static_cast<double>( max ) && val.imag() != max ) ) + { + return false; + } + else if ( ( reRef < static_cast<double>( min ) && val.real() != min ) + || ( imRef < static_cast<double>( min ) && val.imag() != min ) ) + { + return false; + } + else if ( static_cast<RealType>( reRef ) != val.real() + || static_cast<RealType>( imRef ) != val.imag() ) + { + return false; + } + } + ++it; + ++itRef; + } + return true; +} + +int otbClampImageFilterConversionTest(int itkNotUsed(argc), char* argv[]) +{ + typedef otb::ImageFileReader< ImageRefType > ReaderType; + ReaderType::Pointer reader ( ReaderType::New() ); + reader->SetFileName( argv[1] ); + reader->Update(); + ImageRefType::Pointer imageRef = reader->GetOutput(); + + // vect<real> --> vect<real> + otb::VectorImage< short >::Pointer image0 = + Cross < otb::VectorImage< double > , otb::VectorImage< short > > ( argv[1] ); + bool test0 = CompareVectorReal < otb::VectorImage< short > >( imageRef , image0 ); + std::cout<< "Test 0 : "<<test0<<std::endl; + image0 =nullptr; + + // vect<real> --> vect<complex> + otb::VectorImage< std::complex<unsigned short>>::Pointer image1 = + Cross < otb::VectorImage< float > , otb::VectorImage<std::complex<unsigned short>> > ( argv[1] ); + bool test1 = CompareVectorComplex < otb::VectorImage<std::complex<unsigned short>> >( imageRef , image1 ); + std::cout<< "Test 1 : "<<test1<<std::endl; + image1 = nullptr; + + // vect<real> --> image<real> + otb::Image<int>::Pointer image2 = + Cross < otb::VectorImage< float > , otb::Image<int> > ( argv[1] ); + bool test2 = CompareImageReal < otb::Image<int> >( imageRef , image2 ); + std::cout<< "Test 2 : "<<test2<<std::endl; + image2 = nullptr; + + // vect<real> --> image<complex> + otb::Image< std::complex<float>>::Pointer image3 = + Cross < otb::VectorImage< float > , otb::Image<std::complex<float>> > ( argv[1] ); + bool test3 = CompareImageComplex < otb::Image<std::complex<float>> >( imageRef , image3 ); + std::cout<< "Test 3 : "<<test3<<std::endl; + image3 = nullptr; + + // image<real> --> image<real> + otb::Image< unsigned short >::Pointer image4 = + Cross < otb::Image< itk::FixedArray < double , 4 > > , otb::Image< unsigned short > > ( argv[1] ); + bool test4 = CompareImageReal < otb::Image< unsigned short > >( imageRef , image4 ); + std::cout<< "Test 4 : "<<test4<<std::endl; + image4 = nullptr; + + // image<real> --> image<complex> + otb::Image< std::complex<int> >::Pointer image5 = + Cross < otb::Image< itk::FixedArray < double , 4 > > , otb::Image< std::complex<int> > > ( argv[1] ); + bool test5 = CompareImageComplex < otb::Image< std::complex<int> > >( imageRef , image5 ); + std::cout<< "Test 5 : "<<test5<<std::endl; + image5 = nullptr; + + // image<real> --> vector<real> + otb::VectorImage< float >::Pointer image6 = + Cross < otb::Image< itk::FixedArray < double , 4 > > , otb::VectorImage< float > > ( argv[1] ); + bool test6 = CompareVectorReal < otb::VectorImage< float > >( imageRef , image6 ); + std::cout<< "Test 6 : "<<test6<<std::endl; + image6 = nullptr; + + // image<real> --> vector<complex> + otb::VectorImage< std::complex<float> >::Pointer image7 = + Cross < otb::Image< itk::FixedArray < double , 4 > > , otb::VectorImage< std::complex<float> > > ( argv[1] ); + bool test7 = CompareVectorComplex < otb::VectorImage< std::complex<float> > >( imageRef , image7 ); + std::cout<< "Test 7 : "<<test7<<std::endl; + + // vector<complex> --> vector<real> + otb::VectorImage< int >::Pointer image8 = + Cross < otb::VectorImage< int > > ( image7 ); + bool test8 = CompareVectorReal < otb::VectorImage< int > >( imageRef , image8 ); + std::cout<< "Test 8 : "<<test8<<std::endl; + image8=nullptr; + + // vector<complex> --> vector<complex> + otb::VectorImage< std::complex<int> >::Pointer image9 = + Cross < otb::VectorImage< std::complex<int> > > ( image7 ); + bool test9 = CompareVectorComplex < otb::VectorImage< std::complex<int> > >( imageRef , image9 ); + std::cout<< "Test 9 : "<<test9<<std::endl; + image9=nullptr; + + // vector<complex> --> image<real> + otb::Image< int >::Pointer image10 = + Cross < otb::Image< int > > ( image7 ); + bool test10 = CompareImageReal < otb::Image< int > >( imageRef , image10 ); + std::cout<< "Test 10 : "<<test10<<std::endl; + image10=nullptr; + + // vector<complex> --> image<complex> + otb::Image< std::complex<unsigned short> >::Pointer image11 = + Cross < otb::Image< std::complex<unsigned short> > > ( image7 ); + bool test11 = CompareImageComplex < otb::Image< std::complex<unsigned short> > >( imageRef , image11 ); + std::cout<< "Test 11 : "<<test11<<std::endl; + image11=nullptr; + + // image<complex> --> vector<complex> + otb::VectorImage<std::complex<float>>::Pointer image12 = + Cross < otb::Image< std::complex<float> > , otb::VectorImage< std::complex<float>> > ( argv[1] ); + bool test12 = CompareVectorComplex < otb::VectorImage<std::complex<float>> >( imageRef , image12 ); + std::cout<< "Test 12 : "<<test12<<std::endl; + image12 = nullptr; + + // image<complex> --> image<complex> + otb::Image< std::complex< short >>::Pointer image13 = + Cross < otb::Image< std::complex<float> > , otb::Image< std::complex< short >> > ( argv[1] ); + bool test13 = CompareImageComplex < otb::Image< std::complex< short >> >( imageRef , image13 ); + std::cout<< "Test 13 : "<<test13<<std::endl; + image13 = nullptr; + + // image<complex> --> image<real> + otb::Image< int >::Pointer image14 = + Cross < otb::Image< std::complex<float> > , otb::Image< int > > ( argv[1] ); + bool test14 = CompareImageReal < otb::Image< int > >( imageRef , image14 ); + std::cout<< "Test 14 : "<<test14<<std::endl; + image14 = nullptr; + + // image<complex> --> vector<real> + otb::VectorImage< unsigned short >::Pointer image15 = + Cross < otb::Image< std::complex<float> > , otb::VectorImage< unsigned short > > ( argv[1] ); + bool test15 = CompareVectorReal < otb::VectorImage< unsigned short > >( imageRef , image15 ); + std::cout<< "Test 15 : "<<test15<<std::endl; + image15 = nullptr; + + // image<fixedarray<real>> --> image<fixedarray<complex>> + otb::Image< itk::FixedArray < std::complex<float> , 2 > >::Pointer image16 = + Cross < otb::Image< itk::FixedArray < double , 4 > > , + otb::Image< itk::FixedArray < std::complex<float> , 2 > > > ( argv[1] ); + bool test16 = CompareArrayComplex < otb::Image< itk::FixedArray < std::complex<float> , 2 > > >( imageRef , image16 ); + std::cout<< "Test 16 : "<<test16<<std::endl; + + // image<fixedarray<complex>> --> vectorimage<real> + otb::VectorImage< int >::Pointer image17 = + Cross < otb::VectorImage< int > >( image16 ); + bool test17 = CompareVectorReal < otb::VectorImage< int > >( imageRef , image17 ); + std::cout<< "Test 17 : "<<test17<<std::endl; + image17 = nullptr; + + // vector<real> --> image<fixedarray<complex>> + otb::Image< itk::FixedArray < std::complex<float> , 2 > >::Pointer image18 = + Cross < otb::VectorImage< int > , + otb::Image< itk::FixedArray < std::complex<float> , 2 > > > ( argv[1] ); + bool test18 = CompareArrayComplex < otb::Image< itk::FixedArray < std::complex<float> , 2 > > >( imageRef , image18 ); + image18 = nullptr; + std::cout<< "Test 18 : "<<test18<<std::endl; + + if (test1 && test2 && test3 && test4 && test5 &&test6 && test7 && test8 + && test9 && test10 && test11 && test12 && test13 && test14 && test15 + && test16 && test17 && test18 ) + return EXIT_SUCCESS; + return EXIT_FAILURE; +} diff --git a/Modules/Filtering/ImageManipulation/test/otbImageManipulationTestDriver.cxx b/Modules/Filtering/ImageManipulation/test/otbImageManipulationTestDriver.cxx index b5176d976154edad57bcd2f470a2cff6eb76085c..c5b59f8ef2d62eb790adf085e5c9121db5f28d4a 100644 --- a/Modules/Filtering/ImageManipulation/test/otbImageManipulationTestDriver.cxx +++ b/Modules/Filtering/ImageManipulation/test/otbImageManipulationTestDriver.cxx @@ -61,8 +61,6 @@ void RegisterTests() REGISTER_TEST(otbPhaseFunctorTest); REGISTER_TEST(otbShiftScaleVectorImageFilterNew); REGISTER_TEST(otbChangeLabelImageFilter); - REGISTER_TEST(otbClampVectorImageFilterNew); - REGISTER_TEST(otbClampVectorImageFilterTest); REGISTER_TEST(otbPrintableImageFilterNew); REGISTER_TEST(otbShiftScaleImageAdaptorNew); REGISTER_TEST(otbStreamingInnerProductVectorImageFilterNew); @@ -87,6 +85,7 @@ void RegisterTests() REGISTER_TEST(otbMultiplyByScalarImageFilterTest); REGISTER_TEST(otbClampImageFilterNew); REGISTER_TEST(otbClampImageFilterTest); + REGISTER_TEST(otbClampImageFilterConversionTest); REGISTER_TEST(otbConcatenateVectorImageFilter); REGISTER_TEST(otbBinaryImageMinimalBoundingRegionCalculatorNew); REGISTER_TEST(otbVectorRescaleIntensityImageFilterNew); diff --git a/Modules/Filtering/ImageManipulation/test/otbOneRIBandImageToOneComplexBandImage.cxx b/Modules/Filtering/ImageManipulation/test/otbOneRIBandImageToOneComplexBandImage.cxx index b7d8de1665289709964b8938b56ab693ee62b93b..41a18d0bb3b611e3eee571932648c0803e92c3aa 100644 --- a/Modules/Filtering/ImageManipulation/test/otbOneRIBandImageToOneComplexBandImage.cxx +++ b/Modules/Filtering/ImageManipulation/test/otbOneRIBandImageToOneComplexBandImage.cxx @@ -20,7 +20,8 @@ #include "itkMacro.h" -#include "otbOneRIBandImageToOneComplexBandImage.h" +// #include "otbOneRIBandImageToOneComplexBandImage.h" +#include "otbClampImageFilter.h" #include "otbImage.h" #include "otbVectorImage.h" @@ -37,7 +38,7 @@ int otbOneRIBandImageToOneComplexBandImage(int itkNotUsed(argc), char * argv[]) typedef otb::Image<OutputPixelType, 2> OutputImageType; - typedef otb::OneRIBandImageToOneComplexBandImage<InputImageType, OutputImageType> FilterType; + typedef otb::ClampImageFilter<InputImageType, OutputImageType> FilterType; typedef otb::ImageFileReader<InputImageType> ReaderType; typedef otb::ImageFileWriter<OutputImageType> WriterType; diff --git a/Modules/Filtering/ImageNoise/include/otbFrostImageFilter.h b/Modules/Filtering/ImageNoise/include/otbFrostImageFilter.h index b7bed10f9b13ee513247014926ea96a103fce589..deaa62aed91a320bff164ee7e84c5bc20a0fd0de 100644 --- a/Modules/Filtering/ImageNoise/include/otbFrostImageFilter.h +++ b/Modules/Filtering/ImageNoise/include/otbFrostImageFilter.h @@ -99,12 +99,12 @@ public: * an input processing area larger than the output one. * \sa ImageToImageFilter::GenerateInputRequestedRegion() */ void GenerateInputRequestedRegion() - throw(itk::InvalidRequestedRegionError) ITK_OVERRIDE; + throw(itk::InvalidRequestedRegionError) override; protected: FrostImageFilter(); - ~FrostImageFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~FrostImageFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** FrostImageFilter can be implemented for a multithreaded filter treatment. * Thus, this implementation give the ThreadedGenerateData() method. @@ -115,7 +115,7 @@ protected: * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId) ITK_OVERRIDE; + itk::ThreadIdType threadId) override; private: FrostImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageNoise/include/otbGammaMAPImageFilter.h b/Modules/Filtering/ImageNoise/include/otbGammaMAPImageFilter.h index aacd79527f1f1cc80d39465819ebd52d72c31bf7..7aae5b4199702a1cc6a6d695402592ae4356fc12 100644 --- a/Modules/Filtering/ImageNoise/include/otbGammaMAPImageFilter.h +++ b/Modules/Filtering/ImageNoise/include/otbGammaMAPImageFilter.h @@ -91,18 +91,18 @@ public: * * \sa ImageToImageFilter::GenerateInputRequestedRegion() */ void GenerateInputRequestedRegion() - throw(itk::InvalidRequestedRegionError) ITK_OVERRIDE; + throw(itk::InvalidRequestedRegionError) override; protected: GammaMAPImageFilter(); - ~GammaMAPImageFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~GammaMAPImageFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** GammaMAPImageFilter can be multithreaded. */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId) ITK_OVERRIDE; + itk::ThreadIdType threadId) override; private: GammaMAPImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageNoise/include/otbKuanImageFilter.h b/Modules/Filtering/ImageNoise/include/otbKuanImageFilter.h index 4233766bd5276710269ed820d339ca34db7f0c79..b2701daf370c575c1bacccec0f76427798dbfc48 100644 --- a/Modules/Filtering/ImageNoise/include/otbKuanImageFilter.h +++ b/Modules/Filtering/ImageNoise/include/otbKuanImageFilter.h @@ -91,18 +91,18 @@ public: * * \sa ImageToImageFilter::GenerateInputRequestedRegion() */ void GenerateInputRequestedRegion() - throw(itk::InvalidRequestedRegionError) ITK_OVERRIDE; + throw(itk::InvalidRequestedRegionError) override; protected: KuanImageFilter(); - ~KuanImageFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~KuanImageFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** KuanImageFilter can be multithreaded. */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId) ITK_OVERRIDE; + itk::ThreadIdType threadId) override; private: KuanImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/ImageNoise/include/otbLeeImageFilter.h b/Modules/Filtering/ImageNoise/include/otbLeeImageFilter.h index 6479cc5e2d8c6c62079916b76dc5913cda576b43..a502acb05a8dc99d45d902764c92eb1c529c6709 100644 --- a/Modules/Filtering/ImageNoise/include/otbLeeImageFilter.h +++ b/Modules/Filtering/ImageNoise/include/otbLeeImageFilter.h @@ -98,12 +98,12 @@ public: * * \sa ImageToImageFilter::GenerateInputRequestedRegion() */ void GenerateInputRequestedRegion() - throw(itk::InvalidRequestedRegionError) ITK_OVERRIDE; + throw(itk::InvalidRequestedRegionError) override; protected: LeeImageFilter(); - ~LeeImageFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~LeeImageFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** LeeImageFilter can be multithreaded. * As such, it provides a definition of ThreadedGenerateData() @@ -116,7 +116,7 @@ protected: * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId) ITK_OVERRIDE; + itk::ThreadIdType threadId) override; private: LeeImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/MathParser/include/otbBandMathImageFilter.h b/Modules/Filtering/MathParser/include/otbBandMathImageFilter.h index 6f79f68ca6f4a7b048f6c8e9c18f83de8f7b979a..2ae2485e7264005530824491df9aabf5c5d15e62 100644 --- a/Modules/Filtering/MathParser/include/otbBandMathImageFilter.h +++ b/Modules/Filtering/MathParser/include/otbBandMathImageFilter.h @@ -128,12 +128,12 @@ public: protected : BandMathImageFilter(); - ~BandMathImageFilter() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~BandMathImageFilter() override; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; - void BeforeThreadedGenerateData() ITK_OVERRIDE; - void ThreadedGenerateData(const ImageRegionType& outputRegionForThread, itk::ThreadIdType threadId ) ITK_OVERRIDE; - void AfterThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; + void ThreadedGenerateData(const ImageRegionType& outputRegionForThread, itk::ThreadIdType threadId ) override; + void AfterThreadedGenerateData() override; private : BandMathImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/MathParser/include/otbMaskMuParserFilter.h b/Modules/Filtering/MathParser/include/otbMaskMuParserFilter.h index 7fef900379631204d8481b4491a175aced0e6150..a6cd78452f689301763979e00bb9ca40cd6145db 100644 --- a/Modules/Filtering/MathParser/include/otbMaskMuParserFilter.h +++ b/Modules/Filtering/MathParser/include/otbMaskMuParserFilter.h @@ -120,12 +120,12 @@ public: protected: MaskMuParserFilter(); - ~MaskMuParserFilter() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~MaskMuParserFilter() override; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; - void BeforeThreadedGenerateData() ITK_OVERRIDE; - void ThreadedGenerateData(const OutputImageRegionType &outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; - void AfterThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; + void ThreadedGenerateData(const OutputImageRegionType &outputRegionForThread, itk::ThreadIdType threadId) override; + void AfterThreadedGenerateData() override; private: MaskMuParserFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/MathParser/include/otbMaskMuParserFunctor.h b/Modules/Filtering/MathParser/include/otbMaskMuParserFunctor.h index d88e533e4f258769cfb77eaae5731b5af6424b93..e9ddd48734c30b1cb16d7461a867b6783258ce1f 100644 --- a/Modules/Filtering/MathParser/include/otbMaskMuParserFunctor.h +++ b/Modules/Filtering/MathParser/include/otbMaskMuParserFunctor.h @@ -98,7 +98,7 @@ public: protected: MaskMuParserFunctor(); - ~MaskMuParserFunctor() ITK_OVERRIDE; + ~MaskMuParserFunctor() override; private: diff --git a/Modules/Filtering/MathParser/include/otbParser.h b/Modules/Filtering/MathParser/include/otbParser.h index 4dd914b9f734db75c8f100b3c0f30b766b4c65c4..053c1b4566d4f9174c87efdd67a752dd403c42de 100644 --- a/Modules/Filtering/MathParser/include/otbParser.h +++ b/Modules/Filtering/MathParser/include/otbParser.h @@ -89,8 +89,8 @@ public: protected: Parser(); - ~Parser() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~Parser() override; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: diff --git a/Modules/Filtering/MathParser/include/otbParserConditionDataNodeFeatureFunction.h b/Modules/Filtering/MathParser/include/otbParserConditionDataNodeFeatureFunction.h index d0d036a7df6116084cd5ff55a69fcc10b582c192..5212da806d7753a1ff93b42c8a7325527c097b1f 100644 --- a/Modules/Filtering/MathParser/include/otbParserConditionDataNodeFeatureFunction.h +++ b/Modules/Filtering/MathParser/include/otbParserConditionDataNodeFeatureFunction.h @@ -87,7 +87,7 @@ public: typedef std::vector<PrecisionType> OutputType; - OutputType Evaluate( const DataNodeType& node ) const ITK_OVERRIDE; + OutputType Evaluate( const DataNodeType& node ) const override; std::string GetExpression() const { @@ -106,8 +106,8 @@ public: protected: ParserConditionDataNodeFeatureFunction(); - ~ParserConditionDataNodeFeatureFunction() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~ParserConditionDataNodeFeatureFunction() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: ParserConditionDataNodeFeatureFunction(const Self&); //purposely not implemented diff --git a/Modules/Filtering/MathParser/src/otbParser.cxx b/Modules/Filtering/MathParser/src/otbParser.cxx index 4280d3ac9c85b508453b5c23685bf0dc52f89255..ac57dd9a85f054b0fc6dd9ddc248043dbdd4877b 100644 --- a/Modules/Filtering/MathParser/src/otbParser.cxx +++ b/Modules/Filtering/MathParser/src/otbParser.cxx @@ -184,11 +184,11 @@ protected: InitConst(); } - ~ParserImpl() ITK_OVERRIDE + ~ParserImpl() override { } - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + void PrintSelf(std::ostream& os, itk::Indent indent) const override { Superclass::PrintSelf(os, indent); } diff --git a/Modules/Filtering/MathParserX/include/otbBandMathXImageFilter.h b/Modules/Filtering/MathParserX/include/otbBandMathXImageFilter.h index 5dd1085c054d77b067e11ba5b52f48641d137f7a..b491cef10f2b56bea1eee72f555174390d879b2d 100644 --- a/Modules/Filtering/MathParserX/include/otbBandMathXImageFilter.h +++ b/Modules/Filtering/MathParserX/include/otbBandMathXImageFilter.h @@ -132,15 +132,15 @@ public: protected : BandMathXImageFilter(); - ~BandMathXImageFilter() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~BandMathXImageFilter() override; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; - void GenerateOutputInformation() ITK_OVERRIDE; - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateOutputInformation() override; + void GenerateInputRequestedRegion() override; - void BeforeThreadedGenerateData() ITK_OVERRIDE; - void ThreadedGenerateData(const ImageRegionType& outputRegionForThread, itk::ThreadIdType threadId ) ITK_OVERRIDE; - void AfterThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; + void ThreadedGenerateData(const ImageRegionType& outputRegionForThread, itk::ThreadIdType threadId ) override; + void AfterThreadedGenerateData() override; private : diff --git a/Modules/Filtering/MathParserX/include/otbParserX.h b/Modules/Filtering/MathParserX/include/otbParserX.h index ef75a31eaf29ef5912be88d26045a938824671a5..d0eab3a05e09a48dbc0006710c90abfc85680de5 100644 --- a/Modules/Filtering/MathParserX/include/otbParserX.h +++ b/Modules/Filtering/MathParserX/include/otbParserX.h @@ -107,8 +107,8 @@ public: protected: ParserX(); - ~ParserX() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~ParserX() override; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: diff --git a/Modules/Filtering/MathParserX/include/otbParserXPlugins.h b/Modules/Filtering/MathParserX/include/otbParserXPlugins.h index e9da00fd05e01352e2f04ca9b1807d38170df5f8..195a7e955ba25e0c0076c015c309cc3fe121e002 100644 --- a/Modules/Filtering/MathParserX/include/otbParserXPlugins.h +++ b/Modules/Filtering/MathParserX/include/otbParserXPlugins.h @@ -36,14 +36,14 @@ public: bands():ICallback(mup::cmFUNC, "bands", 2) {} - void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iArgc) ITK_OVERRIDE; + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iArgc) override; - const mup::char_type* GetDesc() const ITK_OVERRIDE + const mup::char_type* GetDesc() const override { return "bands - A bands selector"; } - mup::IToken* Clone() const ITK_OVERRIDE + mup::IToken* Clone() const override { return new bands(*this); } @@ -56,14 +56,14 @@ public: dotpr():ICallback(mup::cmFUNC, "dotpr", -1) {} - void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iArgc) ITK_OVERRIDE; + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iArgc) override; - const mup::char_type* GetDesc() const ITK_OVERRIDE + const mup::char_type* GetDesc() const override { return "dotpr(m1,m2) - A vector/matrix dot product"; } - mup::IToken* Clone() const ITK_OVERRIDE + mup::IToken* Clone() const override { return new dotpr(*this); } @@ -75,14 +75,14 @@ class ElementWiseDivision : public mup::IOprtBin ElementWiseDivision():IOprtBin(_T("div"), (int)(mup::prMUL_DIV), mup::oaLEFT) {} - void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int) ITK_OVERRIDE; + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int) override; - const mup::char_type* GetDesc() const ITK_OVERRIDE + const mup::char_type* GetDesc() const override { return _T("x div y - Element-wise division (vectors / matrices)"); } - mup::IToken* Clone() const ITK_OVERRIDE + mup::IToken* Clone() const override { return new ElementWiseDivision(*this); } @@ -95,14 +95,14 @@ class DivisionByScalar : public mup::IOprtBin DivisionByScalar():IOprtBin(_T("dv"), (int)(mup::prMUL_DIV), mup::oaLEFT) {} - void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int) ITK_OVERRIDE; + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int) override; - const mup::char_type* GetDesc() const ITK_OVERRIDE + const mup::char_type* GetDesc() const override { return _T("x dv y - division of vectors / matrices by a scalar"); } - mup::IToken* Clone() const ITK_OVERRIDE + mup::IToken* Clone() const override { return new DivisionByScalar(*this); } @@ -115,14 +115,14 @@ class ElementWiseMultiplication : public mup::IOprtBin ElementWiseMultiplication():IOprtBin(_T("mult"), (int)(mup::prMUL_DIV), mup::oaLEFT) {} - void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int) ITK_OVERRIDE; + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int) override; - const mup::char_type* GetDesc() const ITK_OVERRIDE + const mup::char_type* GetDesc() const override { return _T("x mult y - Element wise multiplication (vectors / matrices)"); } - mup::IToken* Clone() const ITK_OVERRIDE + mup::IToken* Clone() const override { return new ElementWiseMultiplication(*this); } @@ -135,14 +135,14 @@ class MultiplicationByScalar : public mup::IOprtBin MultiplicationByScalar():IOprtBin(_T("mlt"), (int)(mup::prMUL_DIV), mup::oaLEFT) {} - void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int) ITK_OVERRIDE; + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int) override; - const mup::char_type* GetDesc() const ITK_OVERRIDE + const mup::char_type* GetDesc() const override { return _T("x mlt y - multiplication of vectors / matrices by a scalar"); } - mup::IToken* Clone() const ITK_OVERRIDE + mup::IToken* Clone() const override { return new MultiplicationByScalar(*this); } @@ -155,14 +155,14 @@ public: ElementWisePower():IOprtBin(_T("pow"), (int) mup::prPOW, mup::oaRIGHT) {} - void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) ITK_OVERRIDE; + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) override; - const mup::char_type* GetDesc() const ITK_OVERRIDE + const mup::char_type* GetDesc() const override { return _T("pow - Power for noncomplex vectors & matrices"); } - mup::IToken* Clone() const ITK_OVERRIDE + mup::IToken* Clone() const override { return new ElementWisePower(*this); } @@ -175,14 +175,14 @@ class PowerByScalar : public mup::IOprtBin PowerByScalar():IOprtBin(_T("pw"), (int)(mup::prMUL_DIV), mup::oaLEFT) {} - void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int) ITK_OVERRIDE; + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int) override; - const mup::char_type* GetDesc() const ITK_OVERRIDE + const mup::char_type* GetDesc() const override { return _T("x pw y - power of vectors / matrices by a scalar"); } - mup::IToken* Clone() const ITK_OVERRIDE + mup::IToken* Clone() const override { return new PowerByScalar(*this); } @@ -195,14 +195,14 @@ public: ndvi():ICallback(mup::cmFUNC, "ndvi", 2) {} - void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iArgc) ITK_OVERRIDE; + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iArgc) override; - const mup::char_type* GetDesc() const ITK_OVERRIDE + const mup::char_type* GetDesc() const override { return "NDVI - Normalized Difference Vegetation Index"; } - mup::IToken* Clone() const ITK_OVERRIDE + mup::IToken* Clone() const override { return new ndvi(*this); } @@ -215,14 +215,14 @@ public: cat():ICallback(mup::cmFUNC, "cat", -1) {} - void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iArgc) ITK_OVERRIDE; + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iArgc) override; - const mup::char_type* GetDesc() const ITK_OVERRIDE + const mup::char_type* GetDesc() const override { return "cat(m1,m2) - Values concatenation"; } - mup::IToken* Clone() const ITK_OVERRIDE + mup::IToken* Clone() const override { return new cat(*this); } @@ -235,14 +235,14 @@ public: mean():ICallback(mup::cmFUNC, "mean", -1) {} - void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iArgc) ITK_OVERRIDE; + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iArgc) override; - const mup::char_type* GetDesc() const ITK_OVERRIDE + const mup::char_type* GetDesc() const override { return "mean(m1,m2,..) - mean of each neighborhood"; } - mup::IToken* Clone() const ITK_OVERRIDE + mup::IToken* Clone() const override { return new mean(*this); } @@ -255,14 +255,14 @@ public: var():ICallback(mup::cmFUNC, "var", -1) {} - void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) ITK_OVERRIDE; + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) override; - const mup::char_type* GetDesc() const ITK_OVERRIDE + const mup::char_type* GetDesc() const override { return "var(m1,m2,..) - variance of each neighborhood"; } - mup::IToken* Clone() const ITK_OVERRIDE + mup::IToken* Clone() const override { return new var(*this); } @@ -275,14 +275,14 @@ public: corr():ICallback(mup::cmFUNC, "corr", 2) {} - void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) ITK_OVERRIDE; + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) override; - const mup::char_type* GetDesc() const ITK_OVERRIDE + const mup::char_type* GetDesc() const override { return "corr(m1,m2) - variance of two variables m1 and m2"; } - mup::IToken* Clone() const ITK_OVERRIDE + mup::IToken* Clone() const override { return new corr(*this); } @@ -295,14 +295,14 @@ public: median():ICallback(mup::cmFUNC, "median", -1) {} - void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iArgc) ITK_OVERRIDE; + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iArgc) override; - const mup::char_type* GetDesc() const ITK_OVERRIDE + const mup::char_type* GetDesc() const override { return "median(m1,m2,..) - median value of each neighborhood"; } - mup::IToken* Clone() const ITK_OVERRIDE + mup::IToken* Clone() const override { return new median(*this); } @@ -315,14 +315,14 @@ public: maj():ICallback(mup::cmFUNC, "maj", -1) {} - void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iArgc) ITK_OVERRIDE; + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iArgc) override; - const mup::char_type* GetDesc() const ITK_OVERRIDE + const mup::char_type* GetDesc() const override { return "maj(m1,m2,..) - majority value of each neighborhood"; } - mup::IToken* Clone() const ITK_OVERRIDE + mup::IToken* Clone() const override { return new maj(*this); } @@ -335,14 +335,14 @@ public: vnorm():ICallback(mup::cmFUNC, "vnorm", 1) {} - void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iArgc) ITK_OVERRIDE; + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iArgc) override; - const mup::char_type* GetDesc() const ITK_OVERRIDE + const mup::char_type* GetDesc() const override { return "vnorm(v1) - Norm for a vector : sqrt(sum of squared elements); works also with matrices"; } - mup::IToken* Clone() const ITK_OVERRIDE + mup::IToken* Clone() const override { return new vnorm(*this); } @@ -354,14 +354,14 @@ public: vmin():ICallback(mup::cmFUNC, "vmin", 1) {} - void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) ITK_OVERRIDE; + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) override; - const mup::char_type* GetDesc() const ITK_OVERRIDE + const mup::char_type* GetDesc() const override { return "vmin(m1) - overall minimum"; } - mup::IToken* Clone() const ITK_OVERRIDE + mup::IToken* Clone() const override { return new vmin(*this); } @@ -374,14 +374,14 @@ public: vmax():ICallback(mup::cmFUNC, "vmax", 1) {} - void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) ITK_OVERRIDE; + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) override; - const mup::char_type* GetDesc() const ITK_OVERRIDE + const mup::char_type* GetDesc() const override { return "vmax(m1) - overall maximun"; } - mup::IToken* Clone() const ITK_OVERRIDE + mup::IToken* Clone() const override { return new vmax(*this); } @@ -394,14 +394,14 @@ public: vect2scal():ICallback(mup::cmFUNC, "vect2scal", 1) {} - void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) ITK_OVERRIDE; + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) override; - const mup::char_type* GetDesc() const ITK_OVERRIDE + const mup::char_type* GetDesc() const override { return "vect2scal - Convert one dimensional vector to scalar"; } - mup::IToken* Clone() const ITK_OVERRIDE + mup::IToken* Clone() const override { return new vect2scal(*this); } @@ -415,14 +415,14 @@ public: vcos():ICallback(mup::cmFUNC, "vcos", 1) {} - void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) ITK_OVERRIDE; + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) override; - const mup::char_type* GetDesc() const ITK_OVERRIDE + const mup::char_type* GetDesc() const override { return "vcos - Cosinus for noncomplex vectors & matrices"; } - mup::IToken* Clone() const ITK_OVERRIDE + mup::IToken* Clone() const override { return new vcos(*this); } @@ -435,14 +435,14 @@ public: vacos():ICallback(mup::cmFUNC, "vacos", 1) {} - void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) ITK_OVERRIDE; + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) override; - const mup::char_type* GetDesc() const ITK_OVERRIDE + const mup::char_type* GetDesc() const override { return "vacos - Arccosinus for noncomplex vectors & matrices"; } - mup::IToken* Clone() const ITK_OVERRIDE + mup::IToken* Clone() const override { return new vacos(*this); } @@ -454,14 +454,14 @@ public: vsin():ICallback(mup::cmFUNC, "vsin", 1) {} - void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) ITK_OVERRIDE; + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) override; - const mup::char_type* GetDesc() const ITK_OVERRIDE + const mup::char_type* GetDesc() const override { return "vsin - Sinus for noncomplex vectors & matrices"; } - mup::IToken* Clone() const ITK_OVERRIDE + mup::IToken* Clone() const override { return new vsin(*this); } @@ -473,14 +473,14 @@ public: vasin():ICallback(mup::cmFUNC, "vasin", 1) {} - void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) ITK_OVERRIDE; + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) override; - const mup::char_type* GetDesc() const ITK_OVERRIDE + const mup::char_type* GetDesc() const override { return "vasin - Arcsinus for noncomplex vectors & matrices"; } - mup::IToken* Clone() const ITK_OVERRIDE + mup::IToken* Clone() const override { return new vasin(*this); } @@ -493,14 +493,14 @@ public: vtan():ICallback(mup::cmFUNC, "vtan", 1) {} - void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) ITK_OVERRIDE; + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) override; - const mup::char_type* GetDesc() const ITK_OVERRIDE + const mup::char_type* GetDesc() const override { return "vtan - Tangent for noncomplex vectors & matrices"; } - mup::IToken* Clone() const ITK_OVERRIDE + mup::IToken* Clone() const override { return new vtan(*this); } @@ -513,14 +513,14 @@ public: vatan():ICallback(mup::cmFUNC, "vatan", 1) {} - void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) ITK_OVERRIDE; + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) override; - const mup::char_type* GetDesc() const ITK_OVERRIDE + const mup::char_type* GetDesc() const override { return "vatan - Arctangent for noncomplex vectors & matrices"; } - mup::IToken* Clone() const ITK_OVERRIDE + mup::IToken* Clone() const override { return new vatan(*this); } @@ -533,14 +533,14 @@ public: vtanh():ICallback(mup::cmFUNC, "vtanh", 1) {} - void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) ITK_OVERRIDE; + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) override; - const mup::char_type* GetDesc() const ITK_OVERRIDE + const mup::char_type* GetDesc() const override { return "vtanh - Hyperbolic tangent for noncomplex vectors & matrices"; } - mup::IToken* Clone() const ITK_OVERRIDE + mup::IToken* Clone() const override { return new vtanh(*this); } @@ -553,14 +553,14 @@ public: vsinh():ICallback(mup::cmFUNC, "vsinh", 1) {} - void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) ITK_OVERRIDE; + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) override; - const mup::char_type* GetDesc() const ITK_OVERRIDE + const mup::char_type* GetDesc() const override { return "vsinh - Hyperbolic sinus for noncomplex vectors & matrices"; } - mup::IToken* Clone() const ITK_OVERRIDE + mup::IToken* Clone() const override { return new vsinh(*this); } @@ -573,14 +573,14 @@ public: vcosh():ICallback(mup::cmFUNC, "vcosh", 1) {} - void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) ITK_OVERRIDE; + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) override; - const mup::char_type* GetDesc() const ITK_OVERRIDE + const mup::char_type* GetDesc() const override { return "vcosh - Hyperbolic cosinus for noncomplex vectors & matrices"; } - mup::IToken* Clone() const ITK_OVERRIDE + mup::IToken* Clone() const override { return new vcosh(*this); } @@ -593,14 +593,14 @@ public: vlog():ICallback(mup::cmFUNC, "vlog", 1) {} - void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) ITK_OVERRIDE; + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) override; - const mup::char_type* GetDesc() const ITK_OVERRIDE + const mup::char_type* GetDesc() const override { return "vlog - Log for noncomplex vectors & matrices"; } - mup::IToken* Clone() const ITK_OVERRIDE + mup::IToken* Clone() const override { return new vlog(*this); } @@ -613,14 +613,14 @@ public: vlog10():ICallback(mup::cmFUNC, "vlog10", 1) {} - void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) ITK_OVERRIDE; + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) override; - const mup::char_type* GetDesc() const ITK_OVERRIDE + const mup::char_type* GetDesc() const override { return "vlog10 - Log10 for noncomplex vectors & matrices"; } - mup::IToken* Clone() const ITK_OVERRIDE + mup::IToken* Clone() const override { return new vlog10(*this); } @@ -633,14 +633,14 @@ public: vabs():ICallback(mup::cmFUNC, "vabs", 1) {} - void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) ITK_OVERRIDE; + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) override; - const mup::char_type* GetDesc() const ITK_OVERRIDE + const mup::char_type* GetDesc() const override { return "vabs - Absolute value for noncomplex vectors & matrices"; } - mup::IToken* Clone() const ITK_OVERRIDE + mup::IToken* Clone() const override { return new vabs(*this); } @@ -653,14 +653,14 @@ public: vexp():ICallback(mup::cmFUNC, "vexp", 1) {} - void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) ITK_OVERRIDE; + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) override; - const mup::char_type* GetDesc() const ITK_OVERRIDE + const mup::char_type* GetDesc() const override { return "vexp - Exponential for noncomplex vectors & matrices"; } - mup::IToken* Clone() const ITK_OVERRIDE + mup::IToken* Clone() const override { return new vexp(*this); } @@ -673,14 +673,14 @@ public: vsqrt():ICallback(mup::cmFUNC, "vsqrt", 1) {} - void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) ITK_OVERRIDE; + void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc)) override; - const mup::char_type* GetDesc() const ITK_OVERRIDE + const mup::char_type* GetDesc() const override { return "vsqrt - Sqrt for noncomplex vectors & matrices"; } - mup::IToken* Clone() const ITK_OVERRIDE + mup::IToken* Clone() const override { return new vsqrt(*this); } diff --git a/Modules/Filtering/MathParserX/src/otbParserX.cxx b/Modules/Filtering/MathParserX/src/otbParserX.cxx index b57ac98fec1c7ece27bdc42958b768f4537ce222..c7b0be5625b95beb2799632fc3058d3d6447b906 100644 --- a/Modules/Filtering/MathParserX/src/otbParserX.cxx +++ b/Modules/Filtering/MathParserX/src/otbParserX.cxx @@ -250,11 +250,11 @@ protected: InitConst(); } - ~ParserXImpl() ITK_OVERRIDE + ~ParserXImpl() override { } - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + void PrintSelf(std::ostream& os, itk::Indent indent) const override { Superclass::PrintSelf(os, indent); } diff --git a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidAnalysisFilter.h b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidAnalysisFilter.h index da70e60c4824f095c5ef05ae20be837bb8fc05db..5a72c260d4a3533165f6fdb9ec08c0dab811b8fc 100644 --- a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidAnalysisFilter.h +++ b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidAnalysisFilter.h @@ -93,7 +93,7 @@ public: * Get The Analyse image at each level of the pyramid. * \return The analysed image at each level of the pyramid. */ - OutputImageListType* GetOutput(void) ITK_OVERRIDE; + OutputImageListType* GetOutput(void) override; /** * Get The SupFilter details * \return The brighter details extracted from the filtering operation. @@ -119,12 +119,12 @@ protected: /** Constructor */ MorphologicalPyramidAnalysisFilter(); /** Destructor */ - ~MorphologicalPyramidAnalysisFilter() ITK_OVERRIDE; - void GenerateOutputInformation() ITK_OVERRIDE {} // does nothing + ~MorphologicalPyramidAnalysisFilter() override; + void GenerateOutputInformation() override {} // does nothing /** Main computation method */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** Printself method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: /** Number of levels of the algorithm */ diff --git a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidMRToMSConverter.h b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidMRToMSConverter.h index 6ca0f65408f95153c5fb2fca6e135b0356edc04e..7b49a7fd3ea7a49736d01ac897b081e4c9280d83 100644 --- a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidMRToMSConverter.h +++ b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidMRToMSConverter.h @@ -71,7 +71,7 @@ public: * \param imageList The analysed image at each level of the pyramid. */ using Superclass::SetInput; - void SetInput(const InputImageListType * imageList) ITK_OVERRIDE; + void SetInput(const InputImageListType * imageList) override; /** * Set The SupFilter details * \param imageList The brighter details extracted from the filtering operation. @@ -96,7 +96,7 @@ public: * Get the input list. * \return The list of the analysed image at each pyramid level. */ - InputImageListType* GetInput(void) ITK_OVERRIDE; + InputImageListType* GetInput(void) override; /** * Get The SupFilter details * \return The brighter details extracted from the filtering operation. @@ -122,7 +122,7 @@ public: * \return The analysed image at each pyramid level * resampled at full resolution. */ - OutputImageListType* GetOutput(void) ITK_OVERRIDE; + OutputImageListType* GetOutput(void) override; /** * Get The SupFilter details at full resolution. * \return The brighter details extracted from the filtering operation @@ -152,12 +152,12 @@ protected: /** Constructor */ MRToMSConverter(); /** Destructor */ - ~MRToMSConverter() ITK_OVERRIDE {} + ~MRToMSConverter() override {} /** Main computation method */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: MRToMSConverter(const Self &); // purposely not implemented diff --git a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidResampler.h b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidResampler.h index 3de2246b07d248b7b0a65e76bd18d7603b97b26b..732149b2114c116d5aa993851a00fda5ea7b66db 100644 --- a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidResampler.h +++ b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidResampler.h @@ -77,17 +77,17 @@ protected: /** Constructor */ Resampler(); /** Destructor */ - ~Resampler() ITK_OVERRIDE {} + ~Resampler() override {} /** Generate output information */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; /** Configure input requested region to be the largest possible region */ - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; /** Configure output requested region to be the largest possible region */ - void EnlargeOutputRequestedRegion(itk::DataObject * itkNotUsed(output)) ITK_OVERRIDE; + void EnlargeOutputRequestedRegion(itk::DataObject * itkNotUsed(output)) override; /** Main computation method */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: Resampler(const Self &); // purposely not implemented void operator =(const Self&); // purposely not implemented diff --git a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidSegmentationFilter.h b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidSegmentationFilter.h index a000cf5dfcea9d58b3cfe5fb04734048f0c3cdb2..5312f55b0a29fc1ca49818f67e9d83247b9a1ed5 100644 --- a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidSegmentationFilter.h +++ b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidSegmentationFilter.h @@ -141,12 +141,12 @@ protected: /** Constructor */ MorphologicalPyramidSegmentationFilter(); /** Destructor */ - ~MorphologicalPyramidSegmentationFilter() ITK_OVERRIDE; - void GenerateOutputInformation() ITK_OVERRIDE {} // does nothing + ~MorphologicalPyramidSegmentationFilter() override; + void GenerateOutputInformation() override {} // does nothing /** Main computation method */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** Printself method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: unsigned long m_MinimumObjectSize; /** Quantile for seeds determination */ diff --git a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidSegmenter.h b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidSegmenter.h index 09969ede26b58d970785f8e242c9a27ea769bb96..47a9929ff75c63c9914e795bd0bdace7b1a87210 100644 --- a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidSegmenter.h +++ b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidSegmenter.h @@ -120,15 +120,15 @@ protected: /** Constructor */ Segmenter(); /** Destructor */ - ~Segmenter() ITK_OVERRIDE {} + ~Segmenter() override {} /** Main computation method */ - void GenerateData(void) ITK_OVERRIDE; + void GenerateData(void) override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** * Configure the input datas. */ - void GenerateInputRequestedRegion(void) ITK_OVERRIDE; + void GenerateInputRequestedRegion(void) override; /** * Configure the output data. */ diff --git a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidSynthesisFilter.h b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidSynthesisFilter.h index 3cd4c2653dbe0730236c300ea6021e0ce10962b5..3b83773a44d2a2b649528c9cff7c396f85723436 100644 --- a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidSynthesisFilter.h +++ b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidSynthesisFilter.h @@ -128,12 +128,12 @@ protected: /** Constructor */ MorphologicalPyramidSynthesisFilter(); /** Destructor */ - ~MorphologicalPyramidSynthesisFilter() ITK_OVERRIDE; - void GenerateOutputInformation() ITK_OVERRIDE {} // does nothing + ~MorphologicalPyramidSynthesisFilter() override; + void GenerateOutputInformation() override {} // does nothing /** Main computation method */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** Printself method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; }; } // End namespace otb diff --git a/Modules/Filtering/Path/include/otbClosePathFunctor.h b/Modules/Filtering/Path/include/otbClosePathFunctor.h index 90924a2b427f09eedc3289678f17115078c5cd1f..d880196c9f4b9d4992fd538fc8c988f74369fcdc 100644 --- a/Modules/Filtering/Path/include/otbClosePathFunctor.h +++ b/Modules/Filtering/Path/include/otbClosePathFunctor.h @@ -59,6 +59,9 @@ public: if(input->GetVertexList()->Size()>0) { + //Initialization of lastVertex to GetVertexList + lastVertex = input->GetVertexList()->Begin().Value(); + for (VertexListConstIteratorType vertexIt = input->GetVertexList()->Begin(); vertexIt != input->GetVertexList()->End(); ++vertexIt) diff --git a/Modules/Filtering/Path/include/otbCompacityPathFunction.h b/Modules/Filtering/Path/include/otbCompacityPathFunction.h index 6341a81fd3c5480745b306ac29f43a8be7bb6311..b668d970e33eaafe0bbeddda5594bdaf8279507f 100644 --- a/Modules/Filtering/Path/include/otbCompacityPathFunction.h +++ b/Modules/Filtering/Path/include/otbCompacityPathFunction.h @@ -70,13 +70,13 @@ public: typedef double RealType; /** Evaluate the function at non-integer positions */ - OutputType Evaluate(const PathType& path) const ITK_OVERRIDE; + OutputType Evaluate(const PathType& path) const override; virtual OutputType Evaluate() const; protected: CompacityPathFunction() {}; - ~CompacityPathFunction() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~CompacityPathFunction() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: CompacityPathFunction(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Path/include/otbDrawPathFilter.h b/Modules/Filtering/Path/include/otbDrawPathFilter.h index c0f24975e7e479098d39274aa6aeb4b515378630..1fda8044e13889fb8b5478da351785dca8ac3074 100644 --- a/Modules/Filtering/Path/include/otbDrawPathFilter.h +++ b/Modules/Filtering/Path/include/otbDrawPathFilter.h @@ -90,10 +90,10 @@ public: protected: DrawPathFilter(); - ~DrawPathFilter() ITK_OVERRIDE {} + ~DrawPathFilter() override {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - void GenerateData() ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; + void GenerateData() override; private: DrawPathFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Path/include/otbDrawPathListFilter.h b/Modules/Filtering/Path/include/otbDrawPathListFilter.h index efa0645b5a37107dd6adf59e96d313f4a1e8506a..9c9de8abee430d1cc72fadd66bd528da679e486f 100644 --- a/Modules/Filtering/Path/include/otbDrawPathListFilter.h +++ b/Modules/Filtering/Path/include/otbDrawPathListFilter.h @@ -111,11 +111,11 @@ protected: /** Constructor */ DrawPathListFilter(); /** Desctructor */ - ~DrawPathListFilter() ITK_OVERRIDE {} + ~DrawPathListFilter() override {} /** Printself method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Main computation method */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; private: DrawPathListFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Path/include/otbImageFittingPolygonListFilter.h b/Modules/Filtering/Path/include/otbImageFittingPolygonListFilter.h index c33c6afc7e9ba0bd955938100bb7ed41289ffb81..ac5d3b89b33cdba40f4894e7d57a7d45e6c570d5 100644 --- a/Modules/Filtering/Path/include/otbImageFittingPolygonListFilter.h +++ b/Modules/Filtering/Path/include/otbImageFittingPolygonListFilter.h @@ -94,11 +94,11 @@ protected: /** Constructor */ ImageFittingPolygonListFilter(); /** Destructor */ - ~ImageFittingPolygonListFilter() ITK_OVERRIDE {} + ~ImageFittingPolygonListFilter() override {} /** GenerateData method */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; virtual double computeValue(ImageConstPointerType image, VertexType middlePoint, diff --git a/Modules/Filtering/Path/include/otbImageToEdgePathFilter.h b/Modules/Filtering/Path/include/otbImageToEdgePathFilter.h index 2bf48180fc579d524375a342833a1377ae9a236c..f976eb805f16a59c6d103869a1732de140f9074b 100644 --- a/Modules/Filtering/Path/include/otbImageToEdgePathFilter.h +++ b/Modules/Filtering/Path/include/otbImageToEdgePathFilter.h @@ -86,10 +86,10 @@ public: protected: ImageToEdgePathFilter(); - ~ImageToEdgePathFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - void GenerateOutputInformation() ITK_OVERRIDE {} //does nothing - void GenerateData() ITK_OVERRIDE; + ~ImageToEdgePathFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; + void GenerateOutputInformation() override {} //does nothing + void GenerateData() override; private: ImageToEdgePathFilter(const Self &); // purposely not implemented diff --git a/Modules/Filtering/Path/include/otbImageToPathFilter.h b/Modules/Filtering/Path/include/otbImageToPathFilter.h index 9011677b0adb4714e02050b8eb4b7c6abb378bd4..8e09616793253a73ee262c8f5ea63d2e672f1f5d 100644 --- a/Modules/Filtering/Path/include/otbImageToPathFilter.h +++ b/Modules/Filtering/Path/include/otbImageToPathFilter.h @@ -61,8 +61,8 @@ public: protected: ImageToPathFilter(); - ~ImageToPathFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~ImageToPathFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: ImageToPathFilter(const Self &); diff --git a/Modules/Filtering/Path/include/otbImageToPathListFilter.h b/Modules/Filtering/Path/include/otbImageToPathListFilter.h index d43671930b2fe869fb03e6c8922a37e60dd16d12..146d7d4d6dae5f0516533c62d57e82bba4af0ba8 100644 --- a/Modules/Filtering/Path/include/otbImageToPathListFilter.h +++ b/Modules/Filtering/Path/include/otbImageToPathListFilter.h @@ -76,9 +76,9 @@ public: protected: ImageToPathListFilter(); - ~ImageToPathListFilter() ITK_OVERRIDE {} + ~ImageToPathListFilter() override {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: ImageToPathListFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Path/include/otbOrientationPathFunction.h b/Modules/Filtering/Path/include/otbOrientationPathFunction.h index d3bdd5a27fe36c52953bec6ffd7578a9345331b7..ca1b010e231da5b5d5dbde804cc0953714608f36 100644 --- a/Modules/Filtering/Path/include/otbOrientationPathFunction.h +++ b/Modules/Filtering/Path/include/otbOrientationPathFunction.h @@ -66,13 +66,13 @@ public: typedef double RealType; /** Evaluate the function at non-integer positions */ - OutputType Evaluate(const PathType& path) const ITK_OVERRIDE; + OutputType Evaluate(const PathType& path) const override; virtual OutputType Evaluate() const; protected: OrientationPathFunction() {}; - ~OrientationPathFunction() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~OrientationPathFunction() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: OrientationPathFunction(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Path/include/otbPathFunction.h b/Modules/Filtering/Path/include/otbPathFunction.h index 065a7d5f369a1db5008ef01f32a1b7870c7866e3..e260d86b3221dd4ab234fd8265aea7f3642f404c 100644 --- a/Modules/Filtering/Path/include/otbPathFunction.h +++ b/Modules/Filtering/Path/include/otbPathFunction.h @@ -80,8 +80,8 @@ public: protected: PathFunction(); - ~PathFunction() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~PathFunction() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; InputPathConstPointer m_Path; diff --git a/Modules/Filtering/Path/include/otbPathListSource.h b/Modules/Filtering/Path/include/otbPathListSource.h index 31eaebc2b7fdb7b375e4da73e669a6795a4516bb..0181cc72763be8cab65790dd489a384bff15d3d6 100644 --- a/Modules/Filtering/Path/include/otbPathListSource.h +++ b/Modules/Filtering/Path/include/otbPathListSource.h @@ -172,7 +172,7 @@ public: protected: PathListSource() {}; - ~PathListSource() ITK_OVERRIDE {} + ~PathListSource() override {} // void PrintSelf(std::ostream& os, itk::Indent indent) const; private: diff --git a/Modules/Filtering/Path/include/otbPathListToHistogramGenerator.h b/Modules/Filtering/Path/include/otbPathListToHistogramGenerator.h index 17569744ed8f3d7f31e1cc1cc2bf44ac38c83496..e5f99af968f345d7687ab52f7f41b8601472cc8a 100644 --- a/Modules/Filtering/Path/include/otbPathListToHistogramGenerator.h +++ b/Modules/Filtering/Path/include/otbPathListToHistogramGenerator.h @@ -117,12 +117,12 @@ public: protected: PathListToHistogramGenerator(); - ~PathListToHistogramGenerator() ITK_OVERRIDE {} - void GenerateData() ITK_OVERRIDE; - DataObjectPointer MakeOutput(DataObjectPointerArraySizeType) ITK_OVERRIDE; + ~PathListToHistogramGenerator() override {} + void GenerateData() override; + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType) override; using Superclass::MakeOutput; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: diff --git a/Modules/Filtering/Path/include/otbPathListToPathListFilter.h b/Modules/Filtering/Path/include/otbPathListToPathListFilter.h index a7baf6f52efad5bec77960bc58356a4e87c25739..88fcb21c6316e1b406b63d565322959226dbfd4b 100644 --- a/Modules/Filtering/Path/include/otbPathListToPathListFilter.h +++ b/Modules/Filtering/Path/include/otbPathListToPathListFilter.h @@ -63,7 +63,7 @@ protected: /** Constructor */ PathListToPathListFilter() {}; /** Destructor */ - ~PathListToPathListFilter() ITK_OVERRIDE {} + ~PathListToPathListFilter() override {} private: PathListToPathListFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Path/include/otbPolyLineImageIterator.h b/Modules/Filtering/Path/include/otbPolyLineImageIterator.h index 2b1eebd04ba7e3e9ca3c608bbadc504ae519b9ce..e56e3e2ac8a11662219b69e081380fdb4c2994be 100644 --- a/Modules/Filtering/Path/include/otbPolyLineImageIterator.h +++ b/Modules/Filtering/Path/include/otbPolyLineImageIterator.h @@ -95,7 +95,7 @@ public: PolyLineImageIterator(ImageType * imagePtr, PathType * pathPtr) : Superclass(imagePtr, pathPtr) {}; /** Default Destructor. */ - ~PolyLineImageIterator() ITK_OVERRIDE {} + ~PolyLineImageIterator() override {} }; } // End namespace otb diff --git a/Modules/Filtering/Path/include/otbRegionImageToRectangularPathListFilter.h b/Modules/Filtering/Path/include/otbRegionImageToRectangularPathListFilter.h index fd3e1c0c50e3b5efaddd3912d273bef8b383b92c..21176cb50ea37dc304a0d099994dd242ef029bf5 100644 --- a/Modules/Filtering/Path/include/otbRegionImageToRectangularPathListFilter.h +++ b/Modules/Filtering/Path/include/otbRegionImageToRectangularPathListFilter.h @@ -102,16 +102,16 @@ public: protected: RegionImageToRectangularPathListFilter(); - ~RegionImageToRectangularPathListFilter() ITK_OVERRIDE; + ~RegionImageToRectangularPathListFilter() override; - void GenerateOutputInformation() ITK_OVERRIDE{} // do nothing - void GenerateData() ITK_OVERRIDE; + void GenerateOutputInformation() override{} // do nothing + void GenerateData() override; double m_MinimumFit; double m_MinimumSize; int m_CrossTermFormula; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; //jgc typedef Image<unsigned char, itkGetStaticConstMacro(NDimensions)> MarkerImageType; diff --git a/Modules/Filtering/Path/include/otbVectorizationPathListFilter.h b/Modules/Filtering/Path/include/otbVectorizationPathListFilter.h index 7d6f3f13fb92e731af7ad552789d92d66c80c0d4..3e0b32a71b3e28c22d41334400f4ce42b562f916 100644 --- a/Modules/Filtering/Path/include/otbVectorizationPathListFilter.h +++ b/Modules/Filtering/Path/include/otbVectorizationPathListFilter.h @@ -117,11 +117,11 @@ protected: /** Constructor */ VectorizationPathListFilter(); /** Destructor */ - ~VectorizationPathListFilter() ITK_OVERRIDE {} + ~VectorizationPathListFilter() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Main computation method */ - void GenerateData(void) ITK_OVERRIDE; + void GenerateData(void) override; /** * Compute a vector of the 8 neighbors to explore from the direction and the type of search (forward or backward). * \param direction The direction diff --git a/Modules/Filtering/Polarimetry/include/otbMuellerToPolarisationDegreeAndPowerImageFilter.h b/Modules/Filtering/Polarimetry/include/otbMuellerToPolarisationDegreeAndPowerImageFilter.h index 6d0ce02fc5b8fc20d51c50cd46373e350ef9b224..fcec423adc6bc8256034e978c95a8a8cf7384224 100644 --- a/Modules/Filtering/Polarimetry/include/otbMuellerToPolarisationDegreeAndPowerImageFilter.h +++ b/Modules/Filtering/Polarimetry/include/otbMuellerToPolarisationDegreeAndPowerImageFilter.h @@ -230,7 +230,7 @@ public: protected: MuellerToPolarisationDegreeAndPowerImageFilter() {} - ~MuellerToPolarisationDegreeAndPowerImageFilter() ITK_OVERRIDE {} + ~MuellerToPolarisationDegreeAndPowerImageFilter() override {} private: MuellerToPolarisationDegreeAndPowerImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/Polarimetry/include/otbMuellerToReciprocalCovarianceImageFilter.h b/Modules/Filtering/Polarimetry/include/otbMuellerToReciprocalCovarianceImageFilter.h index f867aa7ede24b5b7393621acc118e52b9f416e1f..77a13cbb0472a75272edea8a37bd5ccc04773935 100644 --- a/Modules/Filtering/Polarimetry/include/otbMuellerToReciprocalCovarianceImageFilter.h +++ b/Modules/Filtering/Polarimetry/include/otbMuellerToReciprocalCovarianceImageFilter.h @@ -158,7 +158,7 @@ public: protected: MuellerToReciprocalCovarianceImageFilter() {} - ~MuellerToReciprocalCovarianceImageFilter() ITK_OVERRIDE {} + ~MuellerToReciprocalCovarianceImageFilter() override {} private: MuellerToReciprocalCovarianceImageFilter(const Self&); // purposely not implemented diff --git a/Modules/Filtering/Polarimetry/include/otbMultiChannelsPolarimetricSynthesisFilter.h b/Modules/Filtering/Polarimetry/include/otbMultiChannelsPolarimetricSynthesisFilter.h index bb08aa2ffef686d56e6c0fdf3b6f86ab2ddadb20..7c3ab103d00deefcfdb9f904eb4707547740c379 100644 --- a/Modules/Filtering/Polarimetry/include/otbMultiChannelsPolarimetricSynthesisFilter.h +++ b/Modules/Filtering/Polarimetry/include/otbMultiChannelsPolarimetricSynthesisFilter.h @@ -155,7 +155,7 @@ protected: /** Constructor */ MultiChannelsPolarimetricSynthesisFilter(); /** Destructor */ - ~MultiChannelsPolarimetricSynthesisFilter() ITK_OVERRIDE {} + ~MultiChannelsPolarimetricSynthesisFilter() override {} /** MultiChannelsPolarimetricSynthesisFilter can produce an image * which is a synthesis of channels HH, HV, VH and VV. @@ -167,9 +167,9 @@ protected: * below. * * \sa ProcessObject::GenerateOutputInformaton() */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; /** MultiChannelsPolarimetricSynthesisFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine @@ -182,7 +182,7 @@ protected: * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId) ITK_OVERRIDE; + itk::ThreadIdType threadId) override; /** Computation of the electromagnetic fields Ei Er */ void ComputeElectromagneticFields(); @@ -190,7 +190,7 @@ protected: /** Verify and force the inputs, if only 2 or 3 channels are present */ void VerifyAndForceInputs(); - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: MultiChannelsPolarimetricSynthesisFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Polarimetry/include/otbPolarimetricData.h b/Modules/Filtering/Polarimetry/include/otbPolarimetricData.h index 2207165b5c0f81c4d20d27dfe944ad8f1d6eac46..78a3d1c1cc4212ef4be994a36fddd4bc0fdab6fa 100644 --- a/Modules/Filtering/Polarimetry/include/otbPolarimetricData.h +++ b/Modules/Filtering/Polarimetry/include/otbPolarimetricData.h @@ -79,9 +79,9 @@ protected: /** Constructor */ PolarimetricData(); /** Destructor */ - ~PolarimetricData() ITK_OVERRIDE {} + ~PolarimetricData() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: PolarimetricData(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Polarimetry/include/otbReciprocalBarnesDecompImageFilter.h b/Modules/Filtering/Polarimetry/include/otbReciprocalBarnesDecompImageFilter.h index d6fd45092aadd268880be5be324a4cf7e93d1efa..54dd975da48a2594728d643a67019323ab3c91a9 100644 --- a/Modules/Filtering/Polarimetry/include/otbReciprocalBarnesDecompImageFilter.h +++ b/Modules/Filtering/Polarimetry/include/otbReciprocalBarnesDecompImageFilter.h @@ -151,7 +151,7 @@ public: protected: ReciprocalBarnesDecompImageFilter() {} - ~ReciprocalBarnesDecompImageFilter() ITK_OVERRIDE {} + ~ReciprocalBarnesDecompImageFilter() override {} private: ReciprocalBarnesDecompImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/Polarimetry/include/otbReciprocalCoherencyToReciprocalMuellerImageFilter.h b/Modules/Filtering/Polarimetry/include/otbReciprocalCoherencyToReciprocalMuellerImageFilter.h index 438d27a10b3793a931bf92630fdcfe16497253fa..71e7d6917df3a010042a4c56c0a17fd6127cd1cb 100644 --- a/Modules/Filtering/Polarimetry/include/otbReciprocalCoherencyToReciprocalMuellerImageFilter.h +++ b/Modules/Filtering/Polarimetry/include/otbReciprocalCoherencyToReciprocalMuellerImageFilter.h @@ -163,7 +163,7 @@ public: protected: ReciprocalCoherencyToReciprocalMuellerImageFilter() {} - ~ReciprocalCoherencyToReciprocalMuellerImageFilter() ITK_OVERRIDE {} + ~ReciprocalCoherencyToReciprocalMuellerImageFilter() override {} private: diff --git a/Modules/Filtering/Polarimetry/include/otbReciprocalCovarianceToCoherencyDegreeImageFilter.h b/Modules/Filtering/Polarimetry/include/otbReciprocalCovarianceToCoherencyDegreeImageFilter.h index 64412304a94ef6b679d86ca0c4781eba64874e56..8d346c71493679d1f72c830cc4b056a0806b4299 100644 --- a/Modules/Filtering/Polarimetry/include/otbReciprocalCovarianceToCoherencyDegreeImageFilter.h +++ b/Modules/Filtering/Polarimetry/include/otbReciprocalCovarianceToCoherencyDegreeImageFilter.h @@ -147,7 +147,7 @@ public: protected: ReciprocalCovarianceToCoherencyDegreeImageFilter() {} - ~ReciprocalCovarianceToCoherencyDegreeImageFilter() ITK_OVERRIDE {} + ~ReciprocalCovarianceToCoherencyDegreeImageFilter() override {} private: ReciprocalCovarianceToCoherencyDegreeImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/Polarimetry/include/otbReciprocalCovarianceToReciprocalCoherencyImageFilter.h b/Modules/Filtering/Polarimetry/include/otbReciprocalCovarianceToReciprocalCoherencyImageFilter.h index 4c92f4d88fea6f600b11f0802d9bf857ee66558f..761f4a0f74cf952494e7be810c0413a632bab796 100644 --- a/Modules/Filtering/Polarimetry/include/otbReciprocalCovarianceToReciprocalCoherencyImageFilter.h +++ b/Modules/Filtering/Polarimetry/include/otbReciprocalCovarianceToReciprocalCoherencyImageFilter.h @@ -138,7 +138,7 @@ public: protected: ReciprocalCovarianceToReciprocalCoherencyImageFilter() {} - ~ReciprocalCovarianceToReciprocalCoherencyImageFilter() ITK_OVERRIDE {} + ~ReciprocalCovarianceToReciprocalCoherencyImageFilter() override {} private: ReciprocalCovarianceToReciprocalCoherencyImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/Polarimetry/include/otbReciprocalHAlphaImageFilter.h b/Modules/Filtering/Polarimetry/include/otbReciprocalHAlphaImageFilter.h index ad2404e657581b2baa5f5574fd2fe65a9d06c884..2e95fff07cf72bcc303d1079e114a1057257db71 100644 --- a/Modules/Filtering/Polarimetry/include/otbReciprocalHAlphaImageFilter.h +++ b/Modules/Filtering/Polarimetry/include/otbReciprocalHAlphaImageFilter.h @@ -220,7 +220,7 @@ public: protected: ReciprocalHAlphaImageFilter() {} - ~ReciprocalHAlphaImageFilter() ITK_OVERRIDE {} + ~ReciprocalHAlphaImageFilter() override {} private: ReciprocalHAlphaImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/Polarimetry/include/otbReciprocalHuynenDecompImageFilter.h b/Modules/Filtering/Polarimetry/include/otbReciprocalHuynenDecompImageFilter.h index fc9973dc287fdd8e6e00597ebdef8d52e6a7a0aa..2da4369697705d86a9629fda19ce3a86540a21c6 100644 --- a/Modules/Filtering/Polarimetry/include/otbReciprocalHuynenDecompImageFilter.h +++ b/Modules/Filtering/Polarimetry/include/otbReciprocalHuynenDecompImageFilter.h @@ -122,7 +122,7 @@ public: protected: ReciprocalHuynenDecompImageFilter() {} - ~ReciprocalHuynenDecompImageFilter() ITK_OVERRIDE {} + ~ReciprocalHuynenDecompImageFilter() override {} private: ReciprocalHuynenDecompImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/Polarimetry/include/otbReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter.h b/Modules/Filtering/Polarimetry/include/otbReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter.h index d762a266bd9009e9da0dac3278599961454473c2..900eeb4947675fb23e29920e0f1764e368560dff 100644 --- a/Modules/Filtering/Polarimetry/include/otbReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter.h +++ b/Modules/Filtering/Polarimetry/include/otbReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter.h @@ -143,7 +143,7 @@ public: protected: ReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter() {} - ~ReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter() ITK_OVERRIDE {} + ~ReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter() override {} private: ReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/Polarimetry/include/otbReciprocalPauliDecompImageFilter.h b/Modules/Filtering/Polarimetry/include/otbReciprocalPauliDecompImageFilter.h index d24da9a307630f9e2aaf8c71e717495abb9a37e8..319c19be77046ede4ec0242abd74563b994d7a45 100644 --- a/Modules/Filtering/Polarimetry/include/otbReciprocalPauliDecompImageFilter.h +++ b/Modules/Filtering/Polarimetry/include/otbReciprocalPauliDecompImageFilter.h @@ -113,7 +113,7 @@ public: protected: ReciprocalPauliDecompImageFilter() {this->SetNumberOfThreads(1);} - ~ReciprocalPauliDecompImageFilter() ITK_OVERRIDE {} + ~ReciprocalPauliDecompImageFilter() override {} private: ReciprocalPauliDecompImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/Polarimetry/include/otbSinclairImageFilter.h b/Modules/Filtering/Polarimetry/include/otbSinclairImageFilter.h index 1bbd3f1213b9bf6930613206dde437d0934ac74e..bb9c04c06f37df3da0b96a0f88fb1aa738b18350 100644 --- a/Modules/Filtering/Polarimetry/include/otbSinclairImageFilter.h +++ b/Modules/Filtering/Polarimetry/include/otbSinclairImageFilter.h @@ -109,11 +109,11 @@ protected: /** Constructor */ SinclairImageFilter() {} /** Destructor */ - ~SinclairImageFilter() ITK_OVERRIDE {} + ~SinclairImageFilter() override {} - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: diff --git a/Modules/Filtering/Polarimetry/include/otbSinclairReciprocalImageFilter.h b/Modules/Filtering/Polarimetry/include/otbSinclairReciprocalImageFilter.h index 4dea852f426b96d423c0e43b2465ab20cd7886c4..2b9d4dc32103d3786b560bbba2659af5b6092b9b 100644 --- a/Modules/Filtering/Polarimetry/include/otbSinclairReciprocalImageFilter.h +++ b/Modules/Filtering/Polarimetry/include/otbSinclairReciprocalImageFilter.h @@ -108,11 +108,11 @@ protected: /** Constructor */ SinclairReciprocalImageFilter() {} /** Destructor */ - ~SinclairReciprocalImageFilter() ITK_OVERRIDE {} + ~SinclairReciprocalImageFilter() override {} - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: diff --git a/Modules/Filtering/Projection/include/otbEckert4MapProjection.h b/Modules/Filtering/Projection/include/otbEckert4MapProjection.h index cddb18af871e825b8090be72a2a0a48c531297ae..d02d5a6888e538881914f764de7be90981bc6de9 100644 --- a/Modules/Filtering/Projection/include/otbEckert4MapProjection.h +++ b/Modules/Filtering/Projection/include/otbEckert4MapProjection.h @@ -61,7 +61,7 @@ public: protected: Eckert4MapProjection(); - ~Eckert4MapProjection() ITK_OVERRIDE; + ~Eckert4MapProjection() override; private: Eckert4MapProjection(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Projection/include/otbGCPsToRPCSensorModelImageFilter.h b/Modules/Filtering/Projection/include/otbGCPsToRPCSensorModelImageFilter.h index e2f6aac47023d400f2cca31f4a8d362a5816ce01..06436338f0cc550b3c5561fa8ed9b5cec2b52cc5 100644 --- a/Modules/Filtering/Projection/include/otbGCPsToRPCSensorModelImageFilter.h +++ b/Modules/Filtering/Projection/include/otbGCPsToRPCSensorModelImageFilter.h @@ -170,17 +170,17 @@ protected: /** Constructor */ GCPsToRPCSensorModelImageFilter(); /** Destructor */ - ~GCPsToRPCSensorModelImageFilter() ITK_OVERRIDE; + ~GCPsToRPCSensorModelImageFilter() override; /** The PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Actual estimation of the sensor model takes place in the * GenerateOutputInformation() method */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; /** Drive the model up-to-date flag */ - void Modified() const ITK_OVERRIDE; + void Modified() const override; private: GCPsToRPCSensorModelImageFilter (const Self &); // purposely not implemented diff --git a/Modules/Filtering/Projection/include/otbGenericRSResampleImageFilter.h b/Modules/Filtering/Projection/include/otbGenericRSResampleImageFilter.h index 233d736e857747b497917d664f997ad0e6e7983a..0f93d53e91d85dc3f8877bf88803331a3d77237b 100644 --- a/Modules/Filtering/Projection/include/otbGenericRSResampleImageFilter.h +++ b/Modules/Filtering/Projection/include/otbGenericRSResampleImageFilter.h @@ -268,20 +268,20 @@ public: } /** Override itk::ProcessObject method to let the internal filter do the propagation */ - void PropagateRequestedRegion(itk::DataObject *output) ITK_OVERRIDE; + void PropagateRequestedRegion(itk::DataObject *output) override; protected: GenericRSResampleImageFilter(); /** Destructor */ - ~GenericRSResampleImageFilter() ITK_OVERRIDE {}; + ~GenericRSResampleImageFilter() override {}; - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; virtual void UpdateTransform(); - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: GenericRSResampleImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Projection/include/otbGenericRSResampleImageFilter.txx b/Modules/Filtering/Projection/include/otbGenericRSResampleImageFilter.txx index 7635cdcea7c215848a90ae60efb5a119bc58d1a4..ee70f41a7261b9f83c3ac0bfc2c3e5de3027b317 100644 --- a/Modules/Filtering/Projection/include/otbGenericRSResampleImageFilter.txx +++ b/Modules/Filtering/Projection/include/otbGenericRSResampleImageFilter.txx @@ -203,7 +203,7 @@ GenericRSResampleImageFilter<TInputImage, TOutputImage> m_InputRpcEstimator->SetInput(tempPtr); m_InputRpcEstimator->UpdateOutputInformation(); - // No need to ITK_OVERRIDE the input kwl, just setup the + // No need to override the input kwl, just setup the // transform with the kwl estimated if(m_InputRpcEstimator->GetInput()->GetImageKeywordlist().GetSize() > 0) m_Transform->SetOutputKeywordList(m_InputRpcEstimator->GetOutput()->GetImageKeywordlist()); diff --git a/Modules/Filtering/Projection/include/otbGeographicalDistance.h b/Modules/Filtering/Projection/include/otbGeographicalDistance.h index 11b7dacd6f29b385879e6bbeb1b713687e8bb85c..225aa44e4a43217afe89fd1522ea7d22bda4dd79 100644 --- a/Modules/Filtering/Projection/include/otbGeographicalDistance.h +++ b/Modules/Filtering/Projection/include/otbGeographicalDistance.h @@ -68,10 +68,10 @@ public: /** Gets the distance between the origin point and x. This function * work with SetOrigin() function */ - double Evaluate(const VectorType & x) const ITK_OVERRIDE; + double Evaluate(const VectorType & x) const override; /* Gets the distance between x and y points */ - double Evaluate(const VectorType & x, const VectorType & y) const ITK_OVERRIDE; + double Evaluate(const VectorType & x, const VectorType & y) const override; /** Set the earth radius */ itkSetMacro(EarthRadius, double); @@ -84,10 +84,10 @@ protected: GeographicalDistance(); /** Destructor */ - ~GeographicalDistance() ITK_OVERRIDE{} + ~GeographicalDistance() override{} /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: GeographicalDistance(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Projection/include/otbGeometriesProjectionFilter.h b/Modules/Filtering/Projection/include/otbGeometriesProjectionFilter.h index 50e7ea5b2ff20c75e2bbfc5abf2e136767994921..4229ae3771694a5f39b236a509db92a2ef12a5e9 100644 --- a/Modules/Filtering/Projection/include/otbGeometriesProjectionFilter.h +++ b/Modules/Filtering/Projection/include/otbGeometriesProjectionFilter.h @@ -195,7 +195,7 @@ private: * of the filter. It's up to the caller to take responsibility of the returned * object. */ - OGRSpatialReference* DoDefineNewLayerSpatialReference(ogr::Layer const& source) const ITK_OVERRIDE; + OGRSpatialReference* DoDefineNewLayerSpatialReference(ogr::Layer const& source) const override; /** * Hook that actually filters an OGR \c Layer. * \param[in] source Input layer @@ -207,13 +207,13 @@ private: * inner-filter working on \c ogr::DataSource cannot be globally configured * once and for all. */ - void DoProcessLayer(ogr::Layer const& source, ogr::Layer & destination) const ITK_OVERRIDE; + void DoProcessLayer(ogr::Layer const& source, ogr::Layer & destination) const override; /** Hook used to conclude the initialization phase. * Global \c ogr::DataSource settings for the \c m_Transform functor are * forwarded to the functor. \c ogr::Layer specific settings will be set at * the last moment from \c DoProcessLayer(). */ - void DoFinalizeInitialization() ITK_OVERRIDE; + void DoFinalizeInitialization() override; /** * Hook used to define the fields of the new layer. @@ -223,18 +223,18 @@ private: * Just forwards the fields definition to the \c FieldTransformationPolicy * encapsuled in the \c TransformationFunctorDispatcherType. */ - void DoDefineNewLayerFields(ogr::Layer const& source, ogr::Layer & dest) const ITK_OVERRIDE; + void DoDefineNewLayerFields(ogr::Layer const& source, ogr::Layer & dest) const override; protected: /** Default constructor. */ GeometriesProjectionFilter(); /** Destructor. */ - ~GeometriesProjectionFilter() ITK_OVERRIDE; + ~GeometriesProjectionFilter() override; /** Computes output information. * \post \c m_OutputProjectionRef contains all its related meta-data */ - void GenerateOutputInformation(void) ITK_OVERRIDE; + void GenerateOutputInformation(void) override; public: /**\name Image Reference (origin, spacing) */ diff --git a/Modules/Filtering/Projection/include/otbGroundSpacingImageFunction.h b/Modules/Filtering/Projection/include/otbGroundSpacingImageFunction.h index 6f60e7b74a69362e160af07243c9dd51ab638d90..925069f259888098ade27701a754e4627493e348 100644 --- a/Modules/Filtering/Projection/include/otbGroundSpacingImageFunction.h +++ b/Modules/Filtering/Projection/include/otbGroundSpacingImageFunction.h @@ -81,10 +81,10 @@ public: itkStaticConstMacro(ImageDimension, unsigned int, InputImageType::ImageDimension); /** Evalulate the function at specified index */ - FloatType EvaluateAtIndex(const IndexType& index) const ITK_OVERRIDE; + FloatType EvaluateAtIndex(const IndexType& index) const override; /** Evaluate the function at non-integer positions */ - FloatType Evaluate(const PointType& point) const ITK_OVERRIDE + FloatType Evaluate(const PointType& point) const override { IndexType index; this->ConvertPointToNearestIndex(point, index); @@ -92,7 +92,7 @@ public: } FloatType EvaluateAtContinuousIndex( - const ContinuousIndexType& cindex) const ITK_OVERRIDE + const ContinuousIndexType& cindex) const override { IndexType index; this->ConvertContinuousIndexToNearestIndex(cindex, index); @@ -103,8 +103,8 @@ public: protected: GroundSpacingImageFunction(); - ~GroundSpacingImageFunction() ITK_OVERRIDE{} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~GroundSpacingImageFunction() override{} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: GroundSpacingImageFunction(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Projection/include/otbImageToEnvelopeVectorDataFilter.h b/Modules/Filtering/Projection/include/otbImageToEnvelopeVectorDataFilter.h index 2c4bd9779b8a1bbe4f80f6b1c9f2f06ddcb6e1a5..827b852e8f487b0c131c0c6074d5119c0eb98ce9 100644 --- a/Modules/Filtering/Projection/include/otbImageToEnvelopeVectorDataFilter.h +++ b/Modules/Filtering/Projection/include/otbImageToEnvelopeVectorDataFilter.h @@ -96,13 +96,13 @@ public: protected: ImageToEnvelopeVectorDataFilter(); - ~ImageToEnvelopeVectorDataFilter() ITK_OVERRIDE {} + ~ImageToEnvelopeVectorDataFilter() override {} - void GenerateOutputInformation(void) ITK_OVERRIDE; + void GenerateOutputInformation(void) override; - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; - void GenerateData(void) ITK_OVERRIDE; + void GenerateData(void) override; void InstantiateTransform(); diff --git a/Modules/Filtering/Projection/include/otbImportGeoInformationImageFilter.h b/Modules/Filtering/Projection/include/otbImportGeoInformationImageFilter.h index 6245f9b0a13468872d029849ebe6f29c50901e85..f22b21de3b262040e5a757793125e516ef859a44 100644 --- a/Modules/Filtering/Projection/include/otbImportGeoInformationImageFilter.h +++ b/Modules/Filtering/Projection/include/otbImportGeoInformationImageFilter.h @@ -81,20 +81,20 @@ protected: /** Constructor */ ImportGeoInformationImageFilter(); /** Destructor */ - ~ImportGeoInformationImageFilter() ITK_OVERRIDE {} + ~ImportGeoInformationImageFilter() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Generate input requested region */ - void GenerateInputRequestedRegion(void) ITK_OVERRIDE; + void GenerateInputRequestedRegion(void) override; /** Generate output information */ - void GenerateOutputInformation(void) ITK_OVERRIDE; + void GenerateOutputInformation(void) override; /** Override VerifyInputInformation() since this filter's inputs do * not need to occupy the same physical space. * * \sa ProcessObject::VerifyInputInformation */ - void VerifyInputInformation() ITK_OVERRIDE {} + void VerifyInputInformation() override {} private: ImportGeoInformationImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Projection/include/otbLambert2EtenduProjection.h b/Modules/Filtering/Projection/include/otbLambert2EtenduProjection.h index d66432cfcfa903d8a9fcb84f3d353eb11cd2ad34..76dfc2c415cd18e0ff52916ca220d0539403cab8 100644 --- a/Modules/Filtering/Projection/include/otbLambert2EtenduProjection.h +++ b/Modules/Filtering/Projection/include/otbLambert2EtenduProjection.h @@ -60,7 +60,7 @@ protected: this->SetParameter("StandardParallel2", "47.69601389"); } - ~Lambert2EtenduProjection() ITK_OVERRIDE {} + ~Lambert2EtenduProjection() override {} private: Lambert2EtenduProjection(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Projection/include/otbLambert93Projection.h b/Modules/Filtering/Projection/include/otbLambert93Projection.h index 6949cbb9eabdf535b03b87e7c83214c5da78c2ec..377d61acc6b4e636696ba922d7daaf314e6e6ead 100644 --- a/Modules/Filtering/Projection/include/otbLambert93Projection.h +++ b/Modules/Filtering/Projection/include/otbLambert93Projection.h @@ -60,7 +60,7 @@ protected: this->SetParameter("StandardParallel2", "49"); } - ~Lambert93Projection() ITK_OVERRIDE {} + ~Lambert93Projection() override {} private: Lambert93Projection(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Projection/include/otbLambertConformalConicMapProjection.h b/Modules/Filtering/Projection/include/otbLambertConformalConicMapProjection.h index d0031487d611c8c50cdeb613afe7dc2cf45ebe6e..53bf34e8ec8395c25dadee34e76979ccc1674f97 100644 --- a/Modules/Filtering/Projection/include/otbLambertConformalConicMapProjection.h +++ b/Modules/Filtering/Projection/include/otbLambertConformalConicMapProjection.h @@ -64,7 +64,7 @@ public: protected: LambertConformalConicMapProjection(); - ~LambertConformalConicMapProjection() ITK_OVERRIDE {}; + ~LambertConformalConicMapProjection() override {}; private: LambertConformalConicMapProjection(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Projection/include/otbLeastSquareAffineTransformEstimator.h b/Modules/Filtering/Projection/include/otbLeastSquareAffineTransformEstimator.h index f85ec672636f0dbf0130e99cc78243f50a10ac32..a3d1f273c4eb593a2da5af4b4ee790d2af296a9d 100644 --- a/Modules/Filtering/Projection/include/otbLeastSquareAffineTransformEstimator.h +++ b/Modules/Filtering/Projection/include/otbLeastSquareAffineTransformEstimator.h @@ -138,10 +138,10 @@ protected: /** Constructor */ LeastSquareAffineTransformEstimator(); /** Destructor */ - ~LeastSquareAffineTransformEstimator() ITK_OVERRIDE; + ~LeastSquareAffineTransformEstimator() override; /** The PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: LeastSquareAffineTransformEstimator (const Self &); // purposely not implemented diff --git a/Modules/Filtering/Projection/include/otbMollweidMapProjection.h b/Modules/Filtering/Projection/include/otbMollweidMapProjection.h index 807239a0fa219a65983a2fb4c3fbbdda053ee798..27c7f714171cfdf0f9f4b6b39af42c63779e3143 100644 --- a/Modules/Filtering/Projection/include/otbMollweidMapProjection.h +++ b/Modules/Filtering/Projection/include/otbMollweidMapProjection.h @@ -59,7 +59,7 @@ public: protected: MollweidMapProjection(); - ~MollweidMapProjection() ITK_OVERRIDE; + ~MollweidMapProjection() override; private: MollweidMapProjection(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Projection/include/otbOrthoRectificationFilter.h b/Modules/Filtering/Projection/include/otbOrthoRectificationFilter.h index 72b4aeb38c82216e794c52d72a581a2909ade42a..17c6ef257be2c664ebaaa4287ce48dfa8ccdb112 100644 --- a/Modules/Filtering/Projection/include/otbOrthoRectificationFilter.h +++ b/Modules/Filtering/Projection/include/otbOrthoRectificationFilter.h @@ -93,11 +93,11 @@ public: protected: OrthoRectificationFilter(); - ~OrthoRectificationFilter() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~OrthoRectificationFilter() override; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; - void GenerateInputRequestedRegion() ITK_OVERRIDE; - void GenerateOutputInformation(void) ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; + void GenerateOutputInformation(void) override; private: OrthoRectificationFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Projection/include/otbPhysicalToRPCSensorModelImageFilter.h b/Modules/Filtering/Projection/include/otbPhysicalToRPCSensorModelImageFilter.h index 877bc433ca96e251520461b7270d49858d313ca8..0fb3a72973b94aacf6bd72d0209a886f009983a4 100644 --- a/Modules/Filtering/Projection/include/otbPhysicalToRPCSensorModelImageFilter.h +++ b/Modules/Filtering/Projection/include/otbPhysicalToRPCSensorModelImageFilter.h @@ -110,19 +110,19 @@ public: } /** Reimplement the method Modified() */ - void Modified() const ITK_OVERRIDE; + void Modified() const override; protected: /** Constructor */ PhysicalToRPCSensorModelImageFilter(); /** Destructor */ - ~PhysicalToRPCSensorModelImageFilter() ITK_OVERRIDE; + ~PhysicalToRPCSensorModelImageFilter() override; /** The PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Generate the Output image information*/ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; private: PhysicalToRPCSensorModelImageFilter(const Self &); // purposely not implemented diff --git a/Modules/Filtering/Projection/include/otbProjectiveProjectionImageFilter.h b/Modules/Filtering/Projection/include/otbProjectiveProjectionImageFilter.h index 29fea2c18dd3487f560438cf7a4bdffc1c976427..22b92e4a05dce7d732d72bc5c43de1542fc9a269 100644 --- a/Modules/Filtering/Projection/include/otbProjectiveProjectionImageFilter.h +++ b/Modules/Filtering/Projection/include/otbProjectiveProjectionImageFilter.h @@ -154,11 +154,11 @@ public: protected: ProjectiveProjectionImageFilter(); - ~ProjectiveProjectionImageFilter() ITK_OVERRIDE {} + ~ProjectiveProjectionImageFilter() override {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; - void GenerateOutputInformation() ITK_OVERRIDE + void GenerateOutputInformation() override { Superclass::GenerateOutputInformation(); typename Superclass::OutputImagePointer outputPtr = this->GetOutput(); diff --git a/Modules/Filtering/Projection/include/otbROIdataConversion.h b/Modules/Filtering/Projection/include/otbROIdataConversion.h index ed7f9469f23d7bad30d4cbd8b8610bd491c3a2f4..1c74b75a40d1dc9bb6a331d2046827018a549c4e 100644 --- a/Modules/Filtering/Projection/include/otbROIdataConversion.h +++ b/Modules/Filtering/Projection/include/otbROIdataConversion.h @@ -82,16 +82,16 @@ public: protected: ROIdataConversion(); - ~ROIdataConversion() ITK_OVERRIDE {} - void GenerateOutputInformation() ITK_OVERRIDE; - void GenerateInputRequestedRegion() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + ~ROIdataConversion() override {} + void GenerateOutputInformation() override; + void GenerateInputRequestedRegion() override; + void PrintSelf(std::ostream& os, itk::Indent indent) const override { Superclass::PrintSelf(os, indent); } /** Performs its job! */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** Count the number for sample in the training area */ SizeValueType GetNumberOfSample(); diff --git a/Modules/Filtering/Projection/include/otbRationalTransform.h b/Modules/Filtering/Projection/include/otbRationalTransform.h index 9ce1720ac69778c7252fce688c6322b218f8dc89..5cc26f3bb61402cdba9d8cc6ca0cf18cb0bf81aa 100644 --- a/Modules/Filtering/Projection/include/otbRationalTransform.h +++ b/Modules/Filtering/Projection/include/otbRationalTransform.h @@ -101,7 +101,7 @@ public: itkGetConstMacro(DenominatorDegree, unsigned int); /** The transform point method */ - OutputPointType TransformPoint(const InputPointType& point) const ITK_OVERRIDE + OutputPointType TransformPoint(const InputPointType& point) const override { // Check for consistency if(this->GetNumberOfParameters() != this->m_Parameters.size()) @@ -148,13 +148,13 @@ public: } /** Get the number of parameters */ - NumberOfParametersType GetNumberOfParameters() const ITK_OVERRIDE + NumberOfParametersType GetNumberOfParameters() const override { return (static_cast <NumberOfParametersType> ( (m_NumeratorDegree +1 + m_DenominatorDegree+1)*SpaceDimension )); } // Set parameter method - void SetParameters(const typename Superclass::ParametersType & params) ITK_OVERRIDE + void SetParameters(const typename Superclass::ParametersType & params) override { // Check for the appropriate size if(params.Size() != this->GetNumberOfParameters()) @@ -187,9 +187,9 @@ protected: } - ~RationalTransform() ITK_OVERRIDE {} + ~RationalTransform() override {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + void PrintSelf(std::ostream& os, itk::Indent indent) const override { Superclass::PrintSelf(os, indent); os << indent << "Numerator Degree : " << m_NumeratorDegree << std::endl; diff --git a/Modules/Filtering/Projection/include/otbSVY21MapProjection.h b/Modules/Filtering/Projection/include/otbSVY21MapProjection.h index a2a82cf17455b2db9ed0aa437f6bf529862fcb86..415f9f9e4f1259eb64e9b06d163dfb47019260f1 100644 --- a/Modules/Filtering/Projection/include/otbSVY21MapProjection.h +++ b/Modules/Filtering/Projection/include/otbSVY21MapProjection.h @@ -62,7 +62,7 @@ protected: this->SetParameter("FalseEasting", "28001.642"); this->SetParameter("ScaleFactor", "1.00"); } - ~SVY21MapProjection() ITK_OVERRIDE {} + ~SVY21MapProjection() override {} private: SVY21MapProjection(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Projection/include/otbSinusoidalMapProjection.h b/Modules/Filtering/Projection/include/otbSinusoidalMapProjection.h index 2a2d7ca276f490a8e19c16f3ab48c4a846b310fd..e8b7a190d3219464cbbf12e98722a3bae46c0d43 100644 --- a/Modules/Filtering/Projection/include/otbSinusoidalMapProjection.h +++ b/Modules/Filtering/Projection/include/otbSinusoidalMapProjection.h @@ -62,7 +62,7 @@ public: protected: SinusoidalMapProjection(); - ~SinusoidalMapProjection() ITK_OVERRIDE; + ~SinusoidalMapProjection() override; private: SinusoidalMapProjection(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Projection/include/otbTileMapTransform.h b/Modules/Filtering/Projection/include/otbTileMapTransform.h index f02bbb7438eb2f95df594b856d96e4ef22dacac1..c6d2125ba13d755a6330062087c2fba196a8f2b7 100644 --- a/Modules/Filtering/Projection/include/otbTileMapTransform.h +++ b/Modules/Filtering/Projection/include/otbTileMapTransform.h @@ -73,7 +73,7 @@ public: void SetLevel(unsigned int level); unsigned int GetLevel() const; - OutputPointType TransformPoint(const InputPointType& point) const ITK_OVERRIDE; + OutputPointType TransformPoint(const InputPointType& point) const override; virtual void PrintMap() const; @@ -85,7 +85,7 @@ public: protected: TileMapTransform(); - ~TileMapTransform() ITK_OVERRIDE; + ~TileMapTransform() override; private: TileMapTransform(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Projection/include/otbTransMercatorMapProjection.h b/Modules/Filtering/Projection/include/otbTransMercatorMapProjection.h index b89d16333ea76b32b0bdcbc363c0afb56e890367..35a384373a36e7f4ee50147d59abedffa45b2cbd 100644 --- a/Modules/Filtering/Projection/include/otbTransMercatorMapProjection.h +++ b/Modules/Filtering/Projection/include/otbTransMercatorMapProjection.h @@ -64,7 +64,7 @@ public: protected: TransMercatorMapProjection(); - ~TransMercatorMapProjection() ITK_OVERRIDE; + ~TransMercatorMapProjection() override; private: TransMercatorMapProjection(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Projection/include/otbUtmMapProjection.h b/Modules/Filtering/Projection/include/otbUtmMapProjection.h index 5310eeb42aca93f1b5dba00c87bbd319c24d4762..60992d15b3d19bda06802627ca7a3dbbea121b18 100644 --- a/Modules/Filtering/Projection/include/otbUtmMapProjection.h +++ b/Modules/Filtering/Projection/include/otbUtmMapProjection.h @@ -63,7 +63,7 @@ public: protected: UtmMapProjection(); - ~UtmMapProjection() ITK_OVERRIDE {}; + ~UtmMapProjection() override {}; private: UtmMapProjection(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Projection/include/otbVectorDataIntoImageProjectionFilter.h b/Modules/Filtering/Projection/include/otbVectorDataIntoImageProjectionFilter.h index b86c9c78acaf19896ba659b549bde48962987a9d..34743bb569815223e38bdd996477a8cba0b80c3c 100644 --- a/Modules/Filtering/Projection/include/otbVectorDataIntoImageProjectionFilter.h +++ b/Modules/Filtering/Projection/include/otbVectorDataIntoImageProjectionFilter.h @@ -105,9 +105,9 @@ public: protected: VectorDataIntoImageProjectionFilter(); - ~VectorDataIntoImageProjectionFilter() ITK_OVERRIDE {} + ~VectorDataIntoImageProjectionFilter() override {} - void GenerateData(void) ITK_OVERRIDE; + void GenerateData(void) override; // Projection filter typedef VectorDataProjectionFilter<InputVectorDataType, InputVectorDataType> diff --git a/Modules/Filtering/Projection/include/otbVectorDataProjectionFilter.h b/Modules/Filtering/Projection/include/otbVectorDataProjectionFilter.h index 3178d4c71af131efc3ac3e171984fad42abb1a39..d455ec83d7e7710c8639fdbceac7c1382c2f32f3 100644 --- a/Modules/Filtering/Projection/include/otbVectorDataProjectionFilter.h +++ b/Modules/Filtering/Projection/include/otbVectorDataProjectionFilter.h @@ -175,17 +175,17 @@ public: protected: VectorDataProjectionFilter(); - ~VectorDataProjectionFilter() ITK_OVERRIDE {} + ~VectorDataProjectionFilter() override {} - OutputPointType ProcessPoint(InputPointType point) const ITK_OVERRIDE; - OutputLinePointerType ProcessLine(InputLinePointerType line) const ITK_OVERRIDE; - OutputPolygonPointerType ProcessPolygon(InputPolygonPointerType polygon) const ITK_OVERRIDE; - OutputPolygonListPointerType ProcessPolygonList(InputPolygonListPointerType polygonList) const ITK_OVERRIDE; + OutputPointType ProcessPoint(InputPointType point) const override; + OutputLinePointerType ProcessLine(InputLinePointerType line) const override; + OutputPolygonPointerType ProcessPolygon(InputPolygonPointerType polygon) const override; + OutputPolygonListPointerType ProcessPolygonList(InputPolygonListPointerType polygonList) const override; virtual void InstantiateTransform(void); - void GenerateOutputInformation(void) ITK_OVERRIDE; - void GenerateData(void) ITK_OVERRIDE; + void GenerateOutputInformation(void) override; + void GenerateData(void) override; private: VectorDataProjectionFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Projection/include/otbVectorDataTransformFilter.h b/Modules/Filtering/Projection/include/otbVectorDataTransformFilter.h index df815dd7d7dff0cb64d6d8f9bc6fe0b169dfc033..0ba5ce9031106d863aa433e2af8bd682d9694b78 100644 --- a/Modules/Filtering/Projection/include/otbVectorDataTransformFilter.h +++ b/Modules/Filtering/Projection/include/otbVectorDataTransformFilter.h @@ -102,14 +102,14 @@ public: protected: VectorDataTransformFilter(); - ~VectorDataTransformFilter() ITK_OVERRIDE {}; + ~VectorDataTransformFilter() override {}; - PointType ProcessPoint(PointType point) const ITK_OVERRIDE; - LinePointerType ProcessLine(LinePointerType line) const ITK_OVERRIDE; - PolygonPointerType ProcessPolygon(PolygonPointerType polygon) const ITK_OVERRIDE; - PolygonListPointerType ProcessPolygonList(PolygonListPointerType polygonList) const ITK_OVERRIDE; + PointType ProcessPoint(PointType point) const override; + LinePointerType ProcessLine(LinePointerType line) const override; + PolygonPointerType ProcessPolygon(PolygonPointerType polygon) const override; + PolygonListPointerType ProcessPolygonList(PolygonListPointerType polygonList) const override; - void GenerateData(void) ITK_OVERRIDE; + void GenerateData(void) override; private: VectorDataTransformFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/Smoothing/include/otbMeanShiftSmoothingImageFilter.h b/Modules/Filtering/Smoothing/include/otbMeanShiftSmoothingImageFilter.h index b91668884bbe6adc17f02a79501924e430019edd..845f7dc00db625ff19e527558ae179b5d1d7aff3 100644 --- a/Modules/Filtering/Smoothing/include/otbMeanShiftSmoothingImageFilter.h +++ b/Modules/Filtering/Smoothing/include/otbMeanShiftSmoothingImageFilter.h @@ -576,11 +576,11 @@ protected: * Define output pixel size * **/ - void GenerateOutputInformation(void) ITK_OVERRIDE; + void GenerateOutputInformation(void) override; - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; /** MeanShiftFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() @@ -592,21 +592,21 @@ protected: * * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ - void ThreadedGenerateData(const OutputRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void ThreadedGenerateData(const OutputRegionType& outputRegionForThread, itk::ThreadIdType threadId) override; - void AfterThreadedGenerateData() ITK_OVERRIDE; + void AfterThreadedGenerateData() override; /** Allocates the outputs (need to be reimplemented since outputs have different type) */ - void AllocateOutputs() ITK_OVERRIDE; + void AllocateOutputs() override; /** Constructor */ MeanShiftSmoothingImageFilter(); /** Destructor */ - ~MeanShiftSmoothingImageFilter() ITK_OVERRIDE; + ~MeanShiftSmoothingImageFilter() override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; virtual void CalculateMeanShiftVector(const typename RealVectorImageType::Pointer inputImagePtr, const RealVector& jointPixel, const OutputRegionType& outputRegion, diff --git a/Modules/Filtering/Statistics/include/otbConcatenateSampleListFilter.h b/Modules/Filtering/Statistics/include/otbConcatenateSampleListFilter.h index 7208ac16f537622b1fe9364ddc37b0500ed01fa4..4fa8981e15fa036004aa4256b7aa65199df9b0de 100644 --- a/Modules/Filtering/Statistics/include/otbConcatenateSampleListFilter.h +++ b/Modules/Filtering/Statistics/include/otbConcatenateSampleListFilter.h @@ -67,11 +67,11 @@ public: protected: /** This method causes the filter to generate its output. */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; ConcatenateSampleListFilter(); - ~ConcatenateSampleListFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~ConcatenateSampleListFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: ConcatenateSampleListFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/Statistics/include/otbContinuousMinimumMaximumImageCalculator.h b/Modules/Filtering/Statistics/include/otbContinuousMinimumMaximumImageCalculator.h index d10a702d4e9f142ce275c6cbde658b0ce4373b35..d22fcaba4570bec5ac7a8cf23746a163812aa00f 100644 --- a/Modules/Filtering/Statistics/include/otbContinuousMinimumMaximumImageCalculator.h +++ b/Modules/Filtering/Statistics/include/otbContinuousMinimumMaximumImageCalculator.h @@ -137,8 +137,8 @@ public: protected: ContinuousMinimumMaximumImageCalculator(); - ~ContinuousMinimumMaximumImageCalculator() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~ContinuousMinimumMaximumImageCalculator() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; PixelType m_Minimum; PixelType m_Maximum; diff --git a/Modules/Filtering/Statistics/include/otbGaussianAdditiveNoiseSampleListFilter.h b/Modules/Filtering/Statistics/include/otbGaussianAdditiveNoiseSampleListFilter.h index dd104feb2c3c699eee853b4b87edf4eb5e152dfd..9bc1a1e55567e01ce14352d136cd324d7e0ffae5 100644 --- a/Modules/Filtering/Statistics/include/otbGaussianAdditiveNoiseSampleListFilter.h +++ b/Modules/Filtering/Statistics/include/otbGaussianAdditiveNoiseSampleListFilter.h @@ -88,7 +88,7 @@ public: protected: /** This method causes the filter to generate its output. */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** Generate a white gaussian noise with mean m_Mean and variance * m_Variance @@ -96,8 +96,8 @@ protected: void GenerateRandomSequence(); GaussianAdditiveNoiseSampleListFilter(); - ~GaussianAdditiveNoiseSampleListFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~GaussianAdditiveNoiseSampleListFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: GaussianAdditiveNoiseSampleListFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/Statistics/include/otbHistogramStatisticsFunction.h b/Modules/Filtering/Statistics/include/otbHistogramStatisticsFunction.h index c1cd905fcd79b9bb0d36aed1a688d8d0928a90ba..c2c04c9ea556bb1b1ffacde2ef7cd753a1f17f82 100644 --- a/Modules/Filtering/Statistics/include/otbHistogramStatisticsFunction.h +++ b/Modules/Filtering/Statistics/include/otbHistogramStatisticsFunction.h @@ -83,7 +83,7 @@ public: } /** Calculates the thresholds and save them */ - void Compute() ITK_OVERRIDE + void Compute() override { this->GenerateData(); } @@ -91,8 +91,8 @@ public: protected: HistogramStatisticsFunction(); - ~HistogramStatisticsFunction() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~HistogramStatisticsFunction() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Calculates the thresholds and save them */ void GenerateData(); diff --git a/Modules/Filtering/Statistics/include/otbListSampleGenerator.h b/Modules/Filtering/Statistics/include/otbListSampleGenerator.h index 58ece65e87aa722362084998f36a68ba7b76eb7f..2a074d874822919bbb08406051c822242a1307fe 100644 --- a/Modules/Filtering/Statistics/include/otbListSampleGenerator.h +++ b/Modules/Filtering/Statistics/include/otbListSampleGenerator.h @@ -98,7 +98,7 @@ public: // Build the outputs typedef itk::DataObject::Pointer DataObjectPointer; - DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override; using Superclass::MakeOutput; //virtual void Update(); @@ -152,13 +152,13 @@ public: protected: ListSampleGenerator(); - ~ListSampleGenerator() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~ListSampleGenerator() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Triggers the Computation of the sample list */ - void GenerateData(void) ITK_OVERRIDE; + void GenerateData(void) override; - void GenerateInputRequestedRegion(void) ITK_OVERRIDE; + void GenerateInputRequestedRegion(void) override; /** Compute the calss statistics*/ void GenerateClassStatistics(); diff --git a/Modules/Filtering/Statistics/include/otbListSampleSource.h b/Modules/Filtering/Statistics/include/otbListSampleSource.h index 68efdd1c38de6fd2e2558a72d7355163f052f525..88bf53f9c2687df430c4dcc8ac5f46f75d216de6 100644 --- a/Modules/Filtering/Statistics/include/otbListSampleSource.h +++ b/Modules/Filtering/Statistics/include/otbListSampleSource.h @@ -73,12 +73,12 @@ public: protected: /** Standard itk::ProcessObject subclass method. */ - DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override; using Superclass::MakeOutput; ListSampleSource(); - ~ListSampleSource() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~ListSampleSource() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: ListSampleSource(const Self&); //purposely not implemented diff --git a/Modules/Filtering/Statistics/include/otbListSampleToBalancedListSampleFilter.h b/Modules/Filtering/Statistics/include/otbListSampleToBalancedListSampleFilter.h index f01199660166fdc405d5160b6cfdc6242fbb918a..d904e39073bd54e20f2fa4035f38a1d4e4141baf 100644 --- a/Modules/Filtering/Statistics/include/otbListSampleToBalancedListSampleFilter.h +++ b/Modules/Filtering/Statistics/include/otbListSampleToBalancedListSampleFilter.h @@ -120,7 +120,7 @@ public: protected: /** This method causes the filter to generate its output. */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** In order to respect the fair data principle, the number of samples for * each label must be the same. This method computes the label that @@ -129,12 +129,12 @@ protected: void ComputeMaxSampleFrequency(); /** Make Output */ - DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override; using Superclass::MakeOutput; ListSampleToBalancedListSampleFilter(); - ~ListSampleToBalancedListSampleFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~ListSampleToBalancedListSampleFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: ListSampleToBalancedListSampleFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/Statistics/include/otbListSampleToHistogramListGenerator.h b/Modules/Filtering/Statistics/include/otbListSampleToHistogramListGenerator.h index 3e462206421a0b4706f8cdf1b7e52c12b7cf7e9a..f524aee70502587ddd237782e1a6d2ed706e78a4 100644 --- a/Modules/Filtering/Statistics/include/otbListSampleToHistogramListGenerator.h +++ b/Modules/Filtering/Statistics/include/otbListSampleToHistogramListGenerator.h @@ -147,14 +147,14 @@ public: protected: ListSampleToHistogramListGenerator(); - ~ListSampleToHistogramListGenerator() ITK_OVERRIDE {} + ~ListSampleToHistogramListGenerator() override {} - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; - DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override; using Superclass::MakeOutput; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: //ListSampleConstPointerType m_List; diff --git a/Modules/Filtering/Statistics/include/otbListSampleToListSampleFilter.h b/Modules/Filtering/Statistics/include/otbListSampleToListSampleFilter.h index 9e5f34cbc0735210e27f3138b1bcd1ca1aabde24..152788ef816fbab51a3c3cc013a90a49eed0e7b8 100644 --- a/Modules/Filtering/Statistics/include/otbListSampleToListSampleFilter.h +++ b/Modules/Filtering/Statistics/include/otbListSampleToListSampleFilter.h @@ -88,8 +88,8 @@ public: protected: ListSampleToListSampleFilter(); - ~ListSampleToListSampleFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~ListSampleToListSampleFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: ListSampleToListSampleFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/Statistics/include/otbListSampleToVariableDimensionHistogramGenerator.h b/Modules/Filtering/Statistics/include/otbListSampleToVariableDimensionHistogramGenerator.h index 58e434094273578a813c610d1814ab55c96cfbca..01bdb8506067f25ee6eae8f4f5762e7a680471e3 100644 --- a/Modules/Filtering/Statistics/include/otbListSampleToVariableDimensionHistogramGenerator.h +++ b/Modules/Filtering/Statistics/include/otbListSampleToVariableDimensionHistogramGenerator.h @@ -111,10 +111,10 @@ public: protected: ListSampleToVariableDimensionHistogramGenerator(); - ~ListSampleToVariableDimensionHistogramGenerator() ITK_OVERRIDE {} - void GenerateData() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; + ~ListSampleToVariableDimensionHistogramGenerator() override {} + void GenerateData() override; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override; using Superclass::MakeOutput; private: diff --git a/Modules/Filtering/Statistics/include/otbLocalHistogramImageFunction.h b/Modules/Filtering/Statistics/include/otbLocalHistogramImageFunction.h index b92dfab9815309702a5b6163fff3183d5ad87036..38eec749bc5bd3c5b3832bb1730780a8f71fbcf1 100644 --- a/Modules/Filtering/Statistics/include/otbLocalHistogramImageFunction.h +++ b/Modules/Filtering/Statistics/include/otbLocalHistogramImageFunction.h @@ -89,17 +89,17 @@ public: InputImageType::ImageDimension); /** Evalulate the function at specified index */ - OutputType EvaluateAtIndex(const IndexType& index) const ITK_OVERRIDE; + OutputType EvaluateAtIndex(const IndexType& index) const override; /** Evaluate the function at non-integer positions */ - OutputType Evaluate(const PointType& point) const ITK_OVERRIDE + OutputType Evaluate(const PointType& point) const override { IndexType index; this->ConvertPointToNearestIndex(point, index); return this->EvaluateAtIndex(index); } OutputType EvaluateAtContinuousIndex( - const ContinuousIndexType& cindex) const ITK_OVERRIDE + const ContinuousIndexType& cindex) const override { IndexType index; this->ConvertContinuousIndexToNearestIndex(cindex, index); @@ -128,8 +128,8 @@ public: protected: LocalHistogramImageFunction(); - ~LocalHistogramImageFunction() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~LocalHistogramImageFunction() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: LocalHistogramImageFunction(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Statistics/include/otbNormalizeVectorImageFilter.h b/Modules/Filtering/Statistics/include/otbNormalizeVectorImageFilter.h index 56edd913844e0519af9c64174b82e0b3719e6c6b..f75d244c6114b71f55518a1e68e3e4d76db3ddce 100644 --- a/Modules/Filtering/Statistics/include/otbNormalizeVectorImageFilter.h +++ b/Modules/Filtering/Statistics/include/otbNormalizeVectorImageFilter.h @@ -196,9 +196,9 @@ public: protected: NormalizeVectorImageFilter (); - ~NormalizeVectorImageFilter() ITK_OVERRIDE { } + ~NormalizeVectorImageFilter() override { } - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; private: diff --git a/Modules/Filtering/Statistics/include/otbPatternSampler.h b/Modules/Filtering/Statistics/include/otbPatternSampler.h index cc9dd9465dfe5be082025a960d0707f64f56c31a..90432a595bf11b2912f0a2dbb99afbb473c15e10 100644 --- a/Modules/Filtering/Statistics/include/otbPatternSampler.h +++ b/Modules/Filtering/Statistics/include/otbPatternSampler.h @@ -89,7 +89,7 @@ public: /** * Method that resets the internal state of the sampler */ - void Reset(void) ITK_OVERRIDE; + void Reset(void) override; /** * Method to call during iteration, returns true if the sample is selected, @@ -118,7 +118,7 @@ protected: PatternSampler(); /** Destructor */ - ~PatternSampler() ITK_OVERRIDE {} + ~PatternSampler() override {} private: // Not implemented diff --git a/Modules/Filtering/Statistics/include/otbPeriodicSampler.h b/Modules/Filtering/Statistics/include/otbPeriodicSampler.h index dde341a6cd01a5941d1461f3544298ac167434aa..c5b8185f77c0d628e19ea927106f96e9a4f3d881 100644 --- a/Modules/Filtering/Statistics/include/otbPeriodicSampler.h +++ b/Modules/Filtering/Statistics/include/otbPeriodicSampler.h @@ -86,7 +86,7 @@ public: /** * Method that resets the internal state of the sampler */ - void Reset(void) ITK_OVERRIDE; + void Reset(void) override; /** * Method to call during iteration, returns true if the sample is selected, @@ -99,7 +99,7 @@ protected: PeriodicSampler(); /** Destructor */ - ~PeriodicSampler() ITK_OVERRIDE {} + ~PeriodicSampler() override {} private: // Not implemented diff --git a/Modules/Filtering/Statistics/include/otbRandomSampler.h b/Modules/Filtering/Statistics/include/otbRandomSampler.h index 0ea7eb23d736b8f14661e6f5ded6f220f92bc194..035b9d54ecc7906e7583090dd3ce4c6f2150ee33 100644 --- a/Modules/Filtering/Statistics/include/otbRandomSampler.h +++ b/Modules/Filtering/Statistics/include/otbRandomSampler.h @@ -80,7 +80,7 @@ public: /** * Reset internal counter (to be called before starting iteration) */ - void Reset(void) ITK_OVERRIDE; + void Reset(void) override; /** * Method to call during iteration, returns true if the sample is selected, @@ -93,7 +93,7 @@ protected: RandomSampler(); /** Destructor */ - ~RandomSampler() ITK_OVERRIDE {} + ~RandomSampler() override {} private: // Not implemented diff --git a/Modules/Filtering/Statistics/include/otbSamplerBase.h b/Modules/Filtering/Statistics/include/otbSamplerBase.h index b32f2e46e2c116235e2b86554c2b81e28d64a9d7..be5602873ac1354eb62b1bb1dcdc2e55af5318be 100644 --- a/Modules/Filtering/Statistics/include/otbSamplerBase.h +++ b/Modules/Filtering/Statistics/include/otbSamplerBase.h @@ -78,7 +78,7 @@ protected: SamplerBase(); /** Destructor */ - ~SamplerBase() ITK_OVERRIDE {} + ~SamplerBase() override {} /** Current count of selected elements */ unsigned long m_ChosenElements; diff --git a/Modules/Filtering/Statistics/include/otbShiftScaleSampleListFilter.h b/Modules/Filtering/Statistics/include/otbShiftScaleSampleListFilter.h index b25d2782cc76459ee2068377ff46f631432f284c..00ed571aa8216ddcc03e3c194f11f4a71845cd33 100644 --- a/Modules/Filtering/Statistics/include/otbShiftScaleSampleListFilter.h +++ b/Modules/Filtering/Statistics/include/otbShiftScaleSampleListFilter.h @@ -87,11 +87,11 @@ public: protected: /** This method causes the filter to generate its output. */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; ShiftScaleSampleListFilter(); - ~ShiftScaleSampleListFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~ShiftScaleSampleListFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: ShiftScaleSampleListFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/Statistics/include/otbStreamingCompareImageFilter.h b/Modules/Filtering/Statistics/include/otbStreamingCompareImageFilter.h index c911b3b699a4a43652fa9eb8ecce4f52910f4984..aefd0fc2e10c774aa80a97526764ef0eccbb3161 100644 --- a/Modules/Filtering/Statistics/include/otbStreamingCompareImageFilter.h +++ b/Modules/Filtering/Statistics/include/otbStreamingCompareImageFilter.h @@ -138,31 +138,31 @@ public: /** Make a DataObject of the correct type to be used as the specified * output. */ - DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override; using Superclass::MakeOutput; /** Pass the input through unmodified. Do this by Grafting in the * AllocateOutputs method. */ - void AllocateOutputs() ITK_OVERRIDE; - void GenerateOutputInformation() ITK_OVERRIDE; - void Synthetize(void) ITK_OVERRIDE; - void Reset(void) ITK_OVERRIDE; + void AllocateOutputs() override; + void GenerateOutputInformation() override; + void Synthetize(void) override; + void Reset(void) override; protected: PersistentCompareImageFilter(); - ~PersistentCompareImageFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~PersistentCompareImageFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Multi-thread version GenerateData. */ void ThreadedGenerateData(const RegionType& outputRegionForThread, - itk::ThreadIdType threadId) ITK_OVERRIDE; + itk::ThreadIdType threadId) override; /** Allows skipping the verification of physical space between * the two input images (see flag m_PhysicalSpaceCheck) */ - void VerifyInputInformation() ITK_OVERRIDE; + void VerifyInputInformation() override; private: PersistentCompareImageFilter(const Self &); //purposely not implemented @@ -319,7 +319,7 @@ protected: /** Constructor */ StreamingCompareImageFilter() {}; /** Destructor */ - ~StreamingCompareImageFilter() ITK_OVERRIDE {} + ~StreamingCompareImageFilter() override {} private: StreamingCompareImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Statistics/include/otbStreamingHistogramVectorImageFilter.h b/Modules/Filtering/Statistics/include/otbStreamingHistogramVectorImageFilter.h index 0972e3790b7062f4fc879f6664fa0c0bb83471dc..e3700768792b696bd5869f7b4b1022c897589752 100644 --- a/Modules/Filtering/Statistics/include/otbStreamingHistogramVectorImageFilter.h +++ b/Modules/Filtering/Statistics/include/otbStreamingHistogramVectorImageFilter.h @@ -169,23 +169,23 @@ public: /** Make a DataObject of the correct type to be used as the specified * output. */ - DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override; using Superclass::MakeOutput; /** Pass the input through unmodified. Do this by Grafting in the * AllocateOutputs method. */ - void AllocateOutputs() ITK_OVERRIDE; - void GenerateOutputInformation() ITK_OVERRIDE; - void Synthetize(void) ITK_OVERRIDE; - void Reset(void) ITK_OVERRIDE; + void AllocateOutputs() override; + void GenerateOutputInformation() override; + void Synthetize(void) override; + void Reset(void) override; protected: PersistentHistogramVectorImageFilter(); - ~PersistentHistogramVectorImageFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~PersistentHistogramVectorImageFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Multi-thread version GenerateData. */ - void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId) override; private: PersistentHistogramVectorImageFilter(const Self &); //purposely not implemented @@ -271,7 +271,7 @@ protected: /** Constructor */ StreamingHistogramVectorImageFilter() {}; /** Destructor */ - ~StreamingHistogramVectorImageFilter() ITK_OVERRIDE {} + ~StreamingHistogramVectorImageFilter() override {} private: StreamingHistogramVectorImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Statistics/include/otbStreamingMinMaxImageFilter.h b/Modules/Filtering/Statistics/include/otbStreamingMinMaxImageFilter.h index 567ba1029544052419a7ebf09f79a414ed7f75a2..a10a93cfc8de1c07949a04e19ee6d18ba2465a0f 100644 --- a/Modules/Filtering/Statistics/include/otbStreamingMinMaxImageFilter.h +++ b/Modules/Filtering/Statistics/include/otbStreamingMinMaxImageFilter.h @@ -124,26 +124,26 @@ public: /** Make a DataObject of the correct type to be used as the specified * output. */ - DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override; using Superclass::MakeOutput; /** Pass the input through unmodified. Do this by Grafting in the * AllocateOutputs method. */ - void AllocateOutputs() ITK_OVERRIDE; - void GenerateOutputInformation() ITK_OVERRIDE; - void Synthetize(void) ITK_OVERRIDE; - void Reset(void) ITK_OVERRIDE; + void AllocateOutputs() override; + void GenerateOutputInformation() override; + void Synthetize(void) override; + void Reset(void) override; protected: PersistentMinMaxImageFilter(); - ~PersistentMinMaxImageFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~PersistentMinMaxImageFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Multi-thread version GenerateData. */ void ThreadedGenerateData(const RegionType& outputRegionForThread, - itk::ThreadIdType threadId) ITK_OVERRIDE; + itk::ThreadIdType threadId) override; private: PersistentMinMaxImageFilter(const Self &); //purposely not implemented @@ -280,7 +280,7 @@ protected: /** Constructor */ StreamingMinMaxImageFilter() {} /** Destructor */ - ~StreamingMinMaxImageFilter() ITK_OVERRIDE {} + ~StreamingMinMaxImageFilter() override {} private: StreamingMinMaxImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Statistics/include/otbStreamingMinMaxVectorImageFilter.h b/Modules/Filtering/Statistics/include/otbStreamingMinMaxVectorImageFilter.h index 90de7efb4ea56b0c3b66655b4ba774734d3ec452..9b8c7b3a9dc2e07311a52e3e8772210b2decfb52 100644 --- a/Modules/Filtering/Statistics/include/otbStreamingMinMaxVectorImageFilter.h +++ b/Modules/Filtering/Statistics/include/otbStreamingMinMaxVectorImageFilter.h @@ -144,23 +144,23 @@ public: /** Make a DataObject of the correct type to be used as the specified * output. */ - DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override; using Superclass::MakeOutput; /** Pass the input through unmodified. Do this by Grafting in the * AllocateOutputs method. */ - void AllocateOutputs() ITK_OVERRIDE; - void GenerateOutputInformation() ITK_OVERRIDE; - void Synthetize(void) ITK_OVERRIDE; - void Reset(void) ITK_OVERRIDE; + void AllocateOutputs() override; + void GenerateOutputInformation() override; + void Synthetize(void) override; + void Reset(void) override; protected: PersistentMinMaxVectorImageFilter(); - ~PersistentMinMaxVectorImageFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~PersistentMinMaxVectorImageFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Multi-thread version GenerateData. */ - void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId) override; private: PersistentMinMaxVectorImageFilter(const Self &); //purposely not implemented @@ -271,7 +271,7 @@ protected: /** Constructor */ StreamingMinMaxVectorImageFilter() {}; /** Destructor */ - ~StreamingMinMaxVectorImageFilter() ITK_OVERRIDE {} + ~StreamingMinMaxVectorImageFilter() override {} private: StreamingMinMaxVectorImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Statistics/include/otbStreamingStatisticsImageFilter.h b/Modules/Filtering/Statistics/include/otbStreamingStatisticsImageFilter.h index 04ad8dfc8fec0562843c1b9c030af0cac6993203..2cc0a9e543eb3e0a36f548aba7b9dd114b836ddd 100644 --- a/Modules/Filtering/Statistics/include/otbStreamingStatisticsImageFilter.h +++ b/Modules/Filtering/Statistics/include/otbStreamingStatisticsImageFilter.h @@ -142,16 +142,16 @@ public: /** Make a DataObject of the correct type to be used as the specified * output. */ - DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override; using Superclass::MakeOutput; /** Pass the input through unmodified. Do this by Grafting in the * AllocateOutputs method. */ - void AllocateOutputs() ITK_OVERRIDE; - void GenerateOutputInformation() ITK_OVERRIDE; - void Synthetize(void) ITK_OVERRIDE; - void Reset(void) ITK_OVERRIDE; + void AllocateOutputs() override; + void GenerateOutputInformation() override; + void Synthetize(void) override; + void Reset(void) override; itkSetMacro(IgnoreInfiniteValues, bool); itkGetMacro(IgnoreInfiniteValues, bool); @@ -164,13 +164,13 @@ public: protected: PersistentStatisticsImageFilter(); - ~PersistentStatisticsImageFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~PersistentStatisticsImageFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Multi-thread version GenerateData. */ void ThreadedGenerateData(const RegionType& outputRegionForThread, - itk::ThreadIdType threadId) ITK_OVERRIDE; + itk::ThreadIdType threadId) override; private: PersistentStatisticsImageFilter(const Self &); //purposely not implemented @@ -358,7 +358,7 @@ protected: /** Constructor */ StreamingStatisticsImageFilter() {}; /** Destructor */ - ~StreamingStatisticsImageFilter() ITK_OVERRIDE {} + ~StreamingStatisticsImageFilter() override {} private: StreamingStatisticsImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Statistics/include/otbStreamingStatisticsMapFromLabelImageFilter.h b/Modules/Filtering/Statistics/include/otbStreamingStatisticsMapFromLabelImageFilter.h index 1223832496231928c16e49a020a8cd563ba12931..d91745263866382c7a9879695e3b4bbb3f97beb1 100644 --- a/Modules/Filtering/Statistics/include/otbStreamingStatisticsMapFromLabelImageFilter.h +++ b/Modules/Filtering/Statistics/include/otbStreamingStatisticsMapFromLabelImageFilter.h @@ -110,31 +110,31 @@ public: /** Make a DataObject of the correct type to be used as the specified * output. */ - DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override; using Superclass::MakeOutput; /** Pass the input through unmodified. Do this by Grafting in the * AllocateOutputs method. */ - void AllocateOutputs() ITK_OVERRIDE; + void AllocateOutputs() override; - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; - void Synthetize(void) ITK_OVERRIDE; + void Synthetize(void) override; - void Reset(void) ITK_OVERRIDE; + void Reset(void) override; /** Due to heterogeneous input template GenerateInputRequestedRegion must be reimplemented using explicit cast **/ /** This new implementation is inspired by the one of itk::ImageToImageFilter **/ - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; protected: PersistentStreamingStatisticsMapFromLabelImageFilter(); - ~PersistentStreamingStatisticsMapFromLabelImageFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~PersistentStreamingStatisticsMapFromLabelImageFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** GenerateData. */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; private: PersistentStreamingStatisticsMapFromLabelImageFilter(const Self &); //purposely not implemented @@ -258,7 +258,7 @@ protected: /** Constructor */ StreamingStatisticsMapFromLabelImageFilter() {} /** Destructor */ - ~StreamingStatisticsMapFromLabelImageFilter() ITK_OVERRIDE {} + ~StreamingStatisticsMapFromLabelImageFilter() override {} private: StreamingStatisticsMapFromLabelImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Statistics/include/otbStreamingStatisticsVectorImageFilter.h b/Modules/Filtering/Statistics/include/otbStreamingStatisticsVectorImageFilter.h index bedfb4c832e11f80e2011bc101243e36a97a65ab..83fcb6014ae0d5f36ef0e3e0766e5b3cf6517073 100644 --- a/Modules/Filtering/Statistics/include/otbStreamingStatisticsVectorImageFilter.h +++ b/Modules/Filtering/Statistics/include/otbStreamingStatisticsVectorImageFilter.h @@ -185,12 +185,12 @@ public: /** Make a DataObject of the correct type to be used as the specified * output. */ - DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override; using Superclass::MakeOutput; - void Reset(void) ITK_OVERRIDE; + void Reset(void) override; - void Synthetize(void) ITK_OVERRIDE; + void Synthetize(void) override; itkSetMacro(EnableMinMax, bool); itkGetMacro(EnableMinMax, bool); @@ -216,19 +216,19 @@ public: protected: PersistentStreamingStatisticsVectorImageFilter(); - ~PersistentStreamingStatisticsVectorImageFilter() ITK_OVERRIDE {} + ~PersistentStreamingStatisticsVectorImageFilter() override {} /** Pass the input through unmodified. Do this by Grafting in the * AllocateOutputs method. */ - void AllocateOutputs() ITK_OVERRIDE; + void AllocateOutputs() override; - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Multi-thread version GenerateData. */ - void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId) override; private: PersistentStreamingStatisticsVectorImageFilter(const Self &); //purposely not implemented @@ -493,7 +493,7 @@ protected: StreamingStatisticsVectorImageFilter() {} /** Destructor */ - ~StreamingStatisticsVectorImageFilter() ITK_OVERRIDE {} + ~StreamingStatisticsVectorImageFilter() override {} private: StreamingStatisticsVectorImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Statistics/include/otbStreamingStatisticsVectorImageFilter.txx b/Modules/Filtering/Statistics/include/otbStreamingStatisticsVectorImageFilter.txx index af68ad38efab6be1f3465a7b5d2c9626fbc481d7..c721aa0a9b032bc563aff963c7c37f5dc8eedd4e 100644 --- a/Modules/Filtering/Statistics/include/otbStreamingStatisticsVectorImageFilter.txx +++ b/Modules/Filtering/Statistics/include/otbStreamingStatisticsVectorImageFilter.txx @@ -591,7 +591,7 @@ PersistentStreamingStatisticsVectorImageFilter<TInputImage, TPrecision> { for (unsigned int c = 0; c < threadSecondOrder.Cols(); ++c) { - threadSecondOrder(r, c) += vectorValue[r] * vectorValue[c]; + threadSecondOrder(r, c) += static_cast<PrecisionType>(vectorValue[r]) * static_cast<PrecisionType>(vectorValue[c]); } } threadSecondOrderComponent += vectorValue.GetSquaredNorm(); diff --git a/Modules/Filtering/Statistics/include/otbVarianceImageFilter.h b/Modules/Filtering/Statistics/include/otbVarianceImageFilter.h index e89a8539676f6d66adb6442060719d9dc62becce..1b0839c7b79673ee1002ca866272c4a3f16fe625 100644 --- a/Modules/Filtering/Statistics/include/otbVarianceImageFilter.h +++ b/Modules/Filtering/Statistics/include/otbVarianceImageFilter.h @@ -93,7 +93,7 @@ public: * * \sa ImageToImageFilter::GenerateInputRequestedRegion() */ void GenerateInputRequestedRegion() - throw(itk::InvalidRequestedRegionError) ITK_OVERRIDE; + throw(itk::InvalidRequestedRegionError) override; #ifdef ITK_USE_CONCEPT_CHECKING /** Begin concept checking */ @@ -104,8 +104,8 @@ public: protected: VarianceImageFilter(); - ~VarianceImageFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~VarianceImageFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** VarianceImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() @@ -118,7 +118,7 @@ protected: * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId) ITK_OVERRIDE; + itk::ThreadIdType threadId) override; private: VarianceImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Statistics/include/otbVectorImageToIntensityImageFilter.h b/Modules/Filtering/Statistics/include/otbVectorImageToIntensityImageFilter.h index 82d481aa36713ab46d43acdb801e49236017c0a8..17d9155e3f57e7094f13111d98e583afdfcbafed 100644 --- a/Modules/Filtering/Statistics/include/otbVectorImageToIntensityImageFilter.h +++ b/Modules/Filtering/Statistics/include/otbVectorImageToIntensityImageFilter.h @@ -79,9 +79,9 @@ protected: /** Constructor */ VectorImageToIntensityImageFilter(); /** Destructor */ - ~VectorImageToIntensityImageFilter() ITK_OVERRIDE {} + ~VectorImageToIntensityImageFilter() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** VectorImageToIntensityImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine * which is called for each processing thread. The output image data is @@ -93,7 +93,7 @@ protected: * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId) ITK_OVERRIDE; + itk::ThreadIdType threadId) override; private: VectorImageToIntensityImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Statistics/include/otbVectorImageToMatrixImageFilter.h b/Modules/Filtering/Statistics/include/otbVectorImageToMatrixImageFilter.h index e14ab4bd5131760a31c7ae8097c810c36afc86c4..3bd7150ec537041c5b8c8508bc83eae2d94a58d4 100644 --- a/Modules/Filtering/Statistics/include/otbVectorImageToMatrixImageFilter.h +++ b/Modules/Filtering/Statistics/include/otbVectorImageToMatrixImageFilter.h @@ -101,22 +101,22 @@ public: /** Make a DataObject of the correct type to be used as the specified * output. */ - DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override; using Superclass::MakeOutput; /** Pass the input through unmodified. Do this by Grafting in the * AllocateOutputs method. */ - void AllocateOutputs() ITK_OVERRIDE; - void GenerateOutputInformation() ITK_OVERRIDE; - void Synthetize(void) ITK_OVERRIDE; - void Reset(void) ITK_OVERRIDE; + void AllocateOutputs() override; + void GenerateOutputInformation() override; + void Synthetize(void) override; + void Reset(void) override; protected: PersistentVectorImageToMatrixFilter(); - ~PersistentVectorImageToMatrixFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + ~PersistentVectorImageToMatrixFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; + void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId) override; private: PersistentVectorImageToMatrixFilter(const Self &); //purposely not implemented @@ -197,7 +197,7 @@ protected: /** Constructor */ VectorImageToMatrixImageFilter() {}; /** Destructor */ - ~VectorImageToMatrixImageFilter() ITK_OVERRIDE {} + ~VectorImageToMatrixImageFilter() override {} private: VectorImageToMatrixImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/VectorDataManipulation/include/otbConcatenateVectorDataFilter.h b/Modules/Filtering/VectorDataManipulation/include/otbConcatenateVectorDataFilter.h index 2d384b57349fc42a4674d1fc19e81d7ee821a071..bd18a932c85e15e6864b2d74bc487ec61c6dbf0f 100644 --- a/Modules/Filtering/VectorDataManipulation/include/otbConcatenateVectorDataFilter.h +++ b/Modules/Filtering/VectorDataManipulation/include/otbConcatenateVectorDataFilter.h @@ -82,11 +82,11 @@ public: protected: ConcatenateVectorDataFilter(); - ~ConcatenateVectorDataFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~ConcatenateVectorDataFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Triggers the Computation of the sample list */ - void GenerateData(void) ITK_OVERRIDE; + void GenerateData(void) override; /** Recursive method to visit efficiently the vectordata*/ void ProcessNode(TreeNodeType * source, DataNodeType * outputDocument); diff --git a/Modules/Filtering/VectorDataManipulation/include/otbDBOverlapDataNodeFeatureFunction.h b/Modules/Filtering/VectorDataManipulation/include/otbDBOverlapDataNodeFeatureFunction.h index a3f103ebf725e6d711eb3d2870cb1c7b69529298..6b5359005756e0be97fc702efa4c39a654c3e43d 100644 --- a/Modules/Filtering/VectorDataManipulation/include/otbDBOverlapDataNodeFeatureFunction.h +++ b/Modules/Filtering/VectorDataManipulation/include/otbDBOverlapDataNodeFeatureFunction.h @@ -76,7 +76,7 @@ public: typedef std::vector<PrecisionType> OutputType; - OutputType Evaluate( const DataNodeType& node ) const ITK_OVERRIDE; + OutputType Evaluate( const DataNodeType& node ) const override; /** Set/Get methods */ itkGetConstMacro(DistanceThreshold, PrecisionType); @@ -87,8 +87,8 @@ public: protected: DBOverlapDataNodeFeatureFunction(); - ~DBOverlapDataNodeFeatureFunction() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~DBOverlapDataNodeFeatureFunction() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: DBOverlapDataNodeFeatureFunction(const Self&); //purposely not implemented diff --git a/Modules/Filtering/VectorDataManipulation/include/otbRadiometryHomogenousWithNeighborhoodDataNodeFeatureFunction.h b/Modules/Filtering/VectorDataManipulation/include/otbRadiometryHomogenousWithNeighborhoodDataNodeFeatureFunction.h index a602566f10ac4d9d7e8fe7d128cf8d26ca22be36..3f7fdb9977c6bca3832aea71179dbd4bf22db565 100644 --- a/Modules/Filtering/VectorDataManipulation/include/otbRadiometryHomogenousWithNeighborhoodDataNodeFeatureFunction.h +++ b/Modules/Filtering/VectorDataManipulation/include/otbRadiometryHomogenousWithNeighborhoodDataNodeFeatureFunction.h @@ -108,7 +108,7 @@ public: typedef std::vector<PrecisionType> OutputType; /* Compute the descriptor value along this DataNode */ - OutputType Evaluate( const DataNodeType& node ) const ITK_OVERRIDE; + OutputType Evaluate( const DataNodeType& node ) const override; /* Get the radius used to define the area around a line segment. * A radius of 0 means that the area is reduced to a line joining @@ -138,8 +138,8 @@ public: protected: RadiometryHomogenousWithNeighborhoodDataNodeFeatureFunction(); - ~RadiometryHomogenousWithNeighborhoodDataNodeFeatureFunction() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~RadiometryHomogenousWithNeighborhoodDataNodeFeatureFunction() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: RadiometryHomogenousWithNeighborhoodDataNodeFeatureFunction(const Self&); //purposely not implemented diff --git a/Modules/Filtering/VectorDataManipulation/include/otbSpectralAngleDataNodeFeatureFunction.h b/Modules/Filtering/VectorDataManipulation/include/otbSpectralAngleDataNodeFeatureFunction.h index 4d4c8792bdca6a48480ea8477ba70d3902d6d29b..919c6ff50cd760871db14250e985af60c1fda545 100644 --- a/Modules/Filtering/VectorDataManipulation/include/otbSpectralAngleDataNodeFeatureFunction.h +++ b/Modules/Filtering/VectorDataManipulation/include/otbSpectralAngleDataNodeFeatureFunction.h @@ -101,7 +101,7 @@ public: typedef std::pair<IndexType, IndexType> IndexPairType; typedef std::vector<PrecisionType> OutputType; - OutputType Evaluate( const DataNodeType& node ) const ITK_OVERRIDE; + OutputType Evaluate( const DataNodeType& node ) const override; /** Set/Get methods */ itkGetConstMacro(RefPixel, PixelType); @@ -112,8 +112,8 @@ public: protected: SpectralAngleDataNodeFeatureFunction(); - ~SpectralAngleDataNodeFeatureFunction() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~SpectralAngleDataNodeFeatureFunction() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: SpectralAngleDataNodeFeatureFunction(const Self&); //purposely not implemented diff --git a/Modules/Filtering/VectorDataManipulation/include/otbVectorDataAdapter.h b/Modules/Filtering/VectorDataManipulation/include/otbVectorDataAdapter.h index 7eb8a105653f235c9320512a7e4f6dfa850f4267..b3b43bfeee807b1cc4ae7daea070a8d81c68ed29 100644 --- a/Modules/Filtering/VectorDataManipulation/include/otbVectorDataAdapter.h +++ b/Modules/Filtering/VectorDataManipulation/include/otbVectorDataAdapter.h @@ -78,12 +78,12 @@ public: protected: VectorDataAdapter() {}; - ~VectorDataAdapter() ITK_OVERRIDE {} + ~VectorDataAdapter() override {} - OutputPointType ProcessPoint(InputPointType point) const ITK_OVERRIDE; - OutputLinePointerType ProcessLine(InputLinePointerType line) const ITK_OVERRIDE; - OutputPolygonPointerType ProcessPolygon(InputPolygonPointerType polygon) const ITK_OVERRIDE; - OutputPolygonListPointerType ProcessPolygonList(InputPolygonListPointerType polygonList) const ITK_OVERRIDE; + OutputPointType ProcessPoint(InputPointType point) const override; + OutputLinePointerType ProcessLine(InputLinePointerType line) const override; + OutputPolygonPointerType ProcessPolygon(InputPolygonPointerType polygon) const override; + OutputPolygonListPointerType ProcessPolygonList(InputPolygonListPointerType polygonList) const override; private: VectorDataAdapter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/VectorDataManipulation/include/otbVectorDataExtractROI.h b/Modules/Filtering/VectorDataManipulation/include/otbVectorDataExtractROI.h index 002536578edd0a3d4642bb8d710b8a4061f2875b..87ed0a2f9c08f7a3ef381bec5f12bbf488a852ff 100644 --- a/Modules/Filtering/VectorDataManipulation/include/otbVectorDataExtractROI.h +++ b/Modules/Filtering/VectorDataManipulation/include/otbVectorDataExtractROI.h @@ -106,8 +106,8 @@ public: protected: VectorDataExtractROI(); - ~VectorDataExtractROI() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~VectorDataExtractROI() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Method to compare the projection embedded in the cartoRegion And the the InputVectorData*/ virtual void CompareInputAndRegionProjection(); @@ -122,7 +122,7 @@ protected: virtual VertexType PointToContinuousIndex(ProjPointType point); /** Prototype of the generate data method*/ - void GenerateData(void) ITK_OVERRIDE; + void GenerateData(void) override; /** Method to check if the polygon Bounding Box ha ve a non-null intersection with the ROI*/ virtual bool IsPolygonIntersectionNotNull(PolygonPointerType polygon); diff --git a/Modules/Filtering/VectorDataManipulation/include/otbVectorDataToRandomLineGenerator.h b/Modules/Filtering/VectorDataManipulation/include/otbVectorDataToRandomLineGenerator.h index ab38d43e826a00a1624b67d7fea684551b43b33d..2db1bee395b77f26129d07e294806edbfc0cc4cd 100644 --- a/Modules/Filtering/VectorDataManipulation/include/otbVectorDataToRandomLineGenerator.h +++ b/Modules/Filtering/VectorDataManipulation/include/otbVectorDataToRandomLineGenerator.h @@ -97,11 +97,11 @@ public: protected: VectorDataToRandomLineGenerator(); - ~VectorDataToRandomLineGenerator() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~VectorDataToRandomLineGenerator() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Triggers the Computation of the sample list */ - void GenerateData(void) ITK_OVERRIDE; + void GenerateData(void) override; PointVectorType RandomPointsGenerator(DataNodeType * node); diff --git a/Modules/Filtering/VectorDataManipulation/include/otbVectorDataToSpecificDescriptionFilterBase.h b/Modules/Filtering/VectorDataManipulation/include/otbVectorDataToSpecificDescriptionFilterBase.h index 4285db786953aafee483a45581f7d283bb01b142..2dca72eaf41e1a99eac0255adbbd0628a0f0197e 100644 --- a/Modules/Filtering/VectorDataManipulation/include/otbVectorDataToSpecificDescriptionFilterBase.h +++ b/Modules/Filtering/VectorDataManipulation/include/otbVectorDataToSpecificDescriptionFilterBase.h @@ -76,9 +76,9 @@ protected: /** Constructor */ VectorDataToSpecificDescriptionFilterBase(); /** Destructor */ - ~VectorDataToSpecificDescriptionFilterBase() ITK_OVERRIDE {} + ~VectorDataToSpecificDescriptionFilterBase() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: VectorDataToSpecificDescriptionFilterBase(const Self &); //purposely not implemented diff --git a/Modules/Filtering/VectorDataManipulation/include/otbVectorDataToVectorDataFilter.h b/Modules/Filtering/VectorDataManipulation/include/otbVectorDataToVectorDataFilter.h index 05859c811e914f7f56e8fd4d6cfaed57b3794a75..a3ba98b7196940e32b065d876ac983c4858bdee6 100644 --- a/Modules/Filtering/VectorDataManipulation/include/otbVectorDataToVectorDataFilter.h +++ b/Modules/Filtering/VectorDataManipulation/include/otbVectorDataToVectorDataFilter.h @@ -94,7 +94,7 @@ protected: /** Constructor */ VectorDataToVectorDataFilter(); /** Destructor */ - ~VectorDataToVectorDataFilter() ITK_OVERRIDE {} + ~VectorDataToVectorDataFilter() override {} virtual OutputPointType ProcessPoint(InputPointType itkNotUsed(point)) const { @@ -113,14 +113,14 @@ protected: itkExceptionMacro( << "Subclass should reimplement this method"); } - void GenerateOutputInformation(void) ITK_OVERRIDE; - void GenerateData(void) ITK_OVERRIDE; + void GenerateOutputInformation(void) override; + void GenerateData(void) override; /** Go through the vector data tree and process the nodes */ virtual void ProcessNode(InputInternalTreeNodeType * source, OutputInternalTreeNodeType * destination) const; /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: VectorDataToVectorDataFilter(const Self &); //purposely not implemented diff --git a/Modules/Filtering/Wavelet/include/otbSubsampleImageFilter.h b/Modules/Filtering/Wavelet/include/otbSubsampleImageFilter.h index 56371e3bea3514c01a3e14a67ee1994f338503f4..b39a267f718901ef884d508e5f957b0b1c620743 100644 --- a/Modules/Filtering/Wavelet/include/otbSubsampleImageFilter.h +++ b/Modules/Filtering/Wavelet/include/otbSubsampleImageFilter.h @@ -105,7 +105,7 @@ protected: { m_SubsampleFactor.Fill(1); } - ~SubsampleImageFilter() ITK_OVERRIDE {} + ~SubsampleImageFilter() override {} /** Internal test function to check if there is any direction to subsample */ bool IsSubsampleFactorOne() const; @@ -114,23 +114,23 @@ protected: * Region estimation functions has to be reimplemented */ void CallCopyOutputRegionToInputRegion - (InputImageRegionType& destRegion, const OutputImageRegionType& srcRegion) ITK_OVERRIDE; + (InputImageRegionType& destRegion, const OutputImageRegionType& srcRegion) override; void CallCopyInputRegionToOutputRegion - (OutputImageRegionType& destRegion, const InputImageRegionType& srcRegion) ITK_OVERRIDE; + (OutputImageRegionType& destRegion, const InputImageRegionType& srcRegion) override; /** Output image region size is not of the same dimension as the input. * That is why GenerateOutputInformation has to be redefined. */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; /** Set output image to 0 before processing */ - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; /** Allows multithreading */ void ThreadedGenerateData - (const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + (const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) override; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: SubsampleImageFilter (const Self &); // purposely not implemented diff --git a/Modules/Filtering/Wavelet/include/otbWaveletFilterBank.h b/Modules/Filtering/Wavelet/include/otbWaveletFilterBank.h index 04d897c7eff46c650ba2f1a9afd88f6588890917..cb0d78d25a7b7551d702b1adc9f2e861377203df 100644 --- a/Modules/Filtering/Wavelet/include/otbWaveletFilterBank.h +++ b/Modules/Filtering/Wavelet/include/otbWaveletFilterBank.h @@ -214,13 +214,13 @@ public: protected: WaveletFilterBank(); - ~WaveletFilterBank() ITK_OVERRIDE {} + ~WaveletFilterBank() override {} /** GenerateOutputInformation * Set the size of the output image depending on the decimation factor * Copy information from the input image if existing. **/ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; /** The forward transformation needs a larger input requested * region than the output requested region (larger by subsampling @@ -232,12 +232,12 @@ protected: * * \sa ImageToImageFilter::GenerateInputRequestedRegion() */ void GenerateInputRequestedRegion() - throw (itk::InvalidRequestedRegionError) ITK_OVERRIDE; + throw (itk::InvalidRequestedRegionError) override; /** BeforeThreadedGenerateData. * It allocates also internal images */ - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; /** Internal Data Allocation * If m_SubsampleImageFactor != 1, internal data with progressive region size @@ -248,7 +248,7 @@ protected: /** AfterThreadedGenerateData. * It enforce memory destruction of internal images */ - void AfterThreadedGenerateData() ITK_OVERRIDE; + void AfterThreadedGenerateData() override; /** CallCopyOutputRegionToInputRegion * Since input and output image may be of different size when a @@ -256,9 +256,9 @@ protected: * functions has to be reimplemented */ void CallCopyOutputRegionToInputRegion - (InputImageRegionType& destRegion, const OutputImageRegionType& srcRegion) ITK_OVERRIDE; + (InputImageRegionType& destRegion, const OutputImageRegionType& srcRegion) override; void CallCopyInputRegionToOutputRegion - (OutputImageRegionType& destRegion, const InputImageRegionType& srcRegion) ITK_OVERRIDE; + (OutputImageRegionType& destRegion, const InputImageRegionType& srcRegion) override; /** CallCopyOutputRegionToInputRegion * This function is also redefined in order to adapt the shape of the regions with @@ -272,7 +272,7 @@ protected: const InputImageRegionType& srcRegion); /** Generate data redefinition */ - void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) override; /** Iterative call to the forward filter bank at each dimension. */ virtual void ThreadedGenerateDataAtDimensionN(unsigned int idx, unsigned int direction, @@ -399,9 +399,9 @@ public: protected: WaveletFilterBank(); - ~WaveletFilterBank() ITK_OVERRIDE {} + ~WaveletFilterBank() override {} - void VerifyInputInformation() ITK_OVERRIDE + void VerifyInputInformation() override { } @@ -410,7 +410,7 @@ protected: * Set the size of the output image depending on the decimation factor * Copy information from the input image if existing. **/ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; /** The inverse transformation needs larger inputs requested * region than the output requested region (larger by subsampling @@ -422,12 +422,12 @@ protected: * * \sa ImageToImageFilter::GenerateInputRequestedRegion() */ void GenerateInputRequestedRegion() - throw (itk::InvalidRequestedRegionError) ITK_OVERRIDE; + throw (itk::InvalidRequestedRegionError) override; /** BeforeThreadedGenerateData * If SubsampleImageFactor neq 1, it is necessary to up sample input images in the Wavelet::INVERSE mode */ - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; /** Internal Data Allocation * If m_SubsampleImageFactor != 1, internal data with progressive region size @@ -438,7 +438,7 @@ protected: /** AfterThreadedGenerateData. * It enforce memory destruction of internal images */ - void AfterThreadedGenerateData() ITK_OVERRIDE; + void AfterThreadedGenerateData() override; /** CallCopyOutputRegionToInputRegion * Since input and output image may be of different size when a @@ -446,9 +446,9 @@ protected: * functions has to be reimplemented */ void CallCopyOutputRegionToInputRegion - (InputImageRegionType& destRegion, const OutputImageRegionType& srcRegion) ITK_OVERRIDE; + (InputImageRegionType& destRegion, const OutputImageRegionType& srcRegion) override; void CallCopyInputRegionToOutputRegion - (OutputImageRegionType& destRegion, const InputImageRegionType& srcRegion) ITK_OVERRIDE; + (OutputImageRegionType& destRegion, const InputImageRegionType& srcRegion) override; /** CallCopyOutputRegionToInputRegion * This function is also redefined in order to adapt the shape of the regions with @@ -462,7 +462,7 @@ protected: const InputImageRegionType& srcRegion); /** Generate data redefinition */ - void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) override; /** * Iterative call to the forward filter bank at each dimension. diff --git a/Modules/Filtering/Wavelet/include/otbWaveletGenerator.h b/Modules/Filtering/Wavelet/include/otbWaveletGenerator.h index e52d6e7d66dc6cb2e57dd81f0e43f4d2fd49a558..ba5a8a0b83d1c3a00b4b0ce905d2f68a8d649ed3 100644 --- a/Modules/Filtering/Wavelet/include/otbWaveletGenerator.h +++ b/Modules/Filtering/Wavelet/include/otbWaveletGenerator.h @@ -100,7 +100,7 @@ public: protected: WaveletGenerator() {} - ~WaveletGenerator() ITK_OVERRIDE {} + ~WaveletGenerator() override {} private: WaveletGenerator(const Self &); // not implemented diff --git a/Modules/Filtering/Wavelet/include/otbWaveletHighPassOperator.h b/Modules/Filtering/Wavelet/include/otbWaveletHighPassOperator.h index 632bf1d79b01d4cb3d33f1d165822723ddf73f88..1310f178bf66f56fdb7c3fe03997fe6443bc9b15 100644 --- a/Modules/Filtering/Wavelet/include/otbWaveletHighPassOperator.h +++ b/Modules/Filtering/Wavelet/include/otbWaveletHighPassOperator.h @@ -60,7 +60,7 @@ public: protected: - void PrintSelf(std::ostream& os, itk::Indent i) const ITK_OVERRIDE + void PrintSelf(std::ostream& os, itk::Indent i) const override { os << i << "WaveletHighPassOperator {this=" << this << "}" << std::endl; Superclass::PrintSelf(os, i.GetNextIndent()); @@ -76,7 +76,7 @@ protected: /** * Set operator coefficients. */ - CoefficientVector GenerateCoefficients() ITK_OVERRIDE + CoefficientVector GenerateCoefficients() override { CoefficientVector coeff; if (DirectionOfTransformation == Wavelet::FORWARD) diff --git a/Modules/Filtering/Wavelet/include/otbWaveletImageFilter.h b/Modules/Filtering/Wavelet/include/otbWaveletImageFilter.h index d1022824dd0e256cc1563d390a1cd4aa225266e4..68d914c7af6307ec49c4a9168fdca51cf4cddfc6 100644 --- a/Modules/Filtering/Wavelet/include/otbWaveletImageFilter.h +++ b/Modules/Filtering/Wavelet/include/otbWaveletImageFilter.h @@ -92,11 +92,11 @@ protected: WaveletImageFilter(); virtual ~WaveletImageFilter(); - virtual void GenerateInputRequestedRegion(); + virtual void GenerateInputRequestedRegion() override; - virtual void GenerateData(); + virtual void GenerateData() override; - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + virtual void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: WaveletImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/Wavelet/include/otbWaveletInverseImageFilter.h b/Modules/Filtering/Wavelet/include/otbWaveletInverseImageFilter.h index 52030d844481d53f103a928a62d887878332009c..e064511df57c3591dd761a7ef17f5d7da1c72e5e 100644 --- a/Modules/Filtering/Wavelet/include/otbWaveletInverseImageFilter.h +++ b/Modules/Filtering/Wavelet/include/otbWaveletInverseImageFilter.h @@ -87,17 +87,17 @@ public: itkSetMacro(NumberOfDecompositions,unsigned int); /** If the filter is modified, the internal filters need to be modified too */ - virtual void Modified() const; + virtual void Modified() const override; protected: WaveletInverseImageFilter(); virtual ~WaveletInverseImageFilter(); - virtual void GenerateInputRequestedRegion(); + virtual void GenerateInputRequestedRegion() override; - virtual void GenerateData(); + virtual void GenerateData() override; - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + virtual void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: WaveletInverseImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/Wavelet/include/otbWaveletLowPassOperator.h b/Modules/Filtering/Wavelet/include/otbWaveletLowPassOperator.h index 11691589492da66a76a2a001d312b371b172779b..7eaeaed296f9dae520dff44d0c98f9ce2bd948c9 100644 --- a/Modules/Filtering/Wavelet/include/otbWaveletLowPassOperator.h +++ b/Modules/Filtering/Wavelet/include/otbWaveletLowPassOperator.h @@ -59,7 +59,7 @@ public: protected: - void PrintSelf(std::ostream& os, itk::Indent i) const ITK_OVERRIDE + void PrintSelf(std::ostream& os, itk::Indent i) const override { os << i << "WaveletLowPassOperator {this=" << this << "}" << std::endl; Superclass::PrintSelf(os, i.GetNextIndent()); @@ -75,7 +75,7 @@ protected: /** * Set operator coefficients. */ - CoefficientVector GenerateCoefficients() ITK_OVERRIDE + CoefficientVector GenerateCoefficients() override { CoefficientVector coeff; if (DirectionOfTransformation == Wavelet::FORWARD) diff --git a/Modules/Filtering/Wavelet/include/otbWaveletOperatorBase.h b/Modules/Filtering/Wavelet/include/otbWaveletOperatorBase.h index f3f4c6c464d0e1ff26c041708d761885968faff2..c8e1d21edee65068d71180e96bd806c68209e2c7 100644 --- a/Modules/Filtering/Wavelet/include/otbWaveletOperatorBase.h +++ b/Modules/Filtering/Wavelet/include/otbWaveletOperatorBase.h @@ -100,7 +100,7 @@ public: m_WaveletGenerator = WaveletGeneratorType::New(); } - ~WaveletOperatorBase() ITK_OVERRIDE {} + ~WaveletOperatorBase() override {} /** Assignment operator */ Self & operator =(const Self& other) @@ -138,7 +138,7 @@ protected: /** * Prints some debugging information */ - void PrintSelf(std::ostream& os, itk::Indent i) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent i) const override; typedef WaveletGenerator<TMotherWaveletOperator> WaveletGeneratorType; typedef typename WaveletGeneratorType::Pointer WaveletGeneratorPointerType; @@ -187,7 +187,7 @@ protected: void ReduceFilterLength(CoefficientVector& coeff); /** Arranges coefficients spatially in the memory buffer. */ - void Fill(const CoefficientVector& coeff) ITK_OVERRIDE + void Fill(const CoefficientVector& coeff) override { this->FillCenteredDirectional(coeff); } diff --git a/Modules/Filtering/Wavelet/include/otbWaveletPacketDecompositionCosts.h b/Modules/Filtering/Wavelet/include/otbWaveletPacketDecompositionCosts.h index e11648fe244fa2ae98cd01cd55a3ff976f6321de..36a49994866503b12b16944d85e25e489f64441f 100644 --- a/Modules/Filtering/Wavelet/include/otbWaveletPacketDecompositionCosts.h +++ b/Modules/Filtering/Wavelet/include/otbWaveletPacketDecompositionCosts.h @@ -69,7 +69,7 @@ public: protected: FullyDecomposedWaveletPacketCost () {} - ~FullyDecomposedWaveletPacketCost() ITK_OVERRIDE {} + ~FullyDecomposedWaveletPacketCost() override {} private: FullyDecomposedWaveletPacketCost (const Self &); // not implemented diff --git a/Modules/Filtering/Wavelet/include/otbWaveletPacketTransform.h b/Modules/Filtering/Wavelet/include/otbWaveletPacketTransform.h index c0ea33c8c1e5db63f61e167cf7926ac363d9cb62..4efc0a1286e1c4543b40a1e1c2aff54256b06b55 100644 --- a/Modules/Filtering/Wavelet/include/otbWaveletPacketTransform.h +++ b/Modules/Filtering/Wavelet/include/otbWaveletPacketTransform.h @@ -185,13 +185,13 @@ public: protected: WaveletPacketTransform(); - ~WaveletPacketTransform() ITK_OVERRIDE {} + ~WaveletPacketTransform() override {} /** Generate data redefinition. * This class does not performs multi-threading directly. But it uses step by step the * GenerateData() of TFilter. If This one can thread, the transformation is threaded * (e.g. WaveletFilterBank) */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** Performs (if any) the local decomposition (called recursively) */ virtual void GenerateData(unsigned int depth, OutputImageType * outputPtr, @@ -323,19 +323,19 @@ public: protected: WaveletPacketTransform(); - ~WaveletPacketTransform() ITK_OVERRIDE {} + ~WaveletPacketTransform() override {} /** GenerateOutputInformation * Set the size of the output image depending on the decimation factor * Copy information from the input image if existing. **/ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; /** Generate data redefinition. * This class does not performs multi-threading directly. But it uses step by step the * GenerateData() of TFilter. If This one can thread, the transformation is threaded * (e.g. WaveletFilterBank) */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** Performs (if any) the local decomposition (called recursively) */ virtual unsigned int SetInputFilters(unsigned int& ruleID, InputImageIterator& inputIter, diff --git a/Modules/Filtering/Wavelet/include/otbWaveletTransform.h b/Modules/Filtering/Wavelet/include/otbWaveletTransform.h index d4aa6d4fdfb9a0e3073b659374f1b7d8c2987ceb..4a0a43f8d50a88bfcc6247c6ef747e2194482907 100644 --- a/Modules/Filtering/Wavelet/include/otbWaveletTransform.h +++ b/Modules/Filtering/Wavelet/include/otbWaveletTransform.h @@ -175,10 +175,10 @@ public: protected: WaveletTransform(); - ~WaveletTransform() ITK_OVERRIDE {} + ~WaveletTransform() override {} /** Generate data redefinition */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; private: WaveletTransform (const Self &); @@ -306,16 +306,16 @@ public: protected: WaveletTransform(); - ~WaveletTransform() ITK_OVERRIDE {} + ~WaveletTransform() override {} /** GenerateOutputInformation * Set the size of the output image depending on the decimation factor * Copy information from the input image if existing. **/ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; /** Generate data redefinition */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; private: WaveletTransform (const Self &); diff --git a/Modules/Filtering/Wavelet/include/otbWaveletsBandsListToWaveletsSynopsisImageFilter.h b/Modules/Filtering/Wavelet/include/otbWaveletsBandsListToWaveletsSynopsisImageFilter.h index 2c3225cf242c539ce0fb70fa0ebab2fa40875841..064a79856b2ab4e0d35b2cd10a025d49eb59eee5 100644 --- a/Modules/Filtering/Wavelet/include/otbWaveletsBandsListToWaveletsSynopsisImageFilter.h +++ b/Modules/Filtering/Wavelet/include/otbWaveletsBandsListToWaveletsSynopsisImageFilter.h @@ -68,19 +68,19 @@ public: protected: /** Main computation method */ - virtual void ThreadedGenerateData(const RegionType & outputRegionForThread, itk::ThreadIdType threadId); + virtual void ThreadedGenerateData(const RegionType & outputRegionForThread, itk::ThreadIdType threadId) override; /** GenerateOutputInformation * Set the number of bands of the output. * Copy information from the first image of the list if existing. **/ - virtual void GenerateOutputInformation(void); + virtual void GenerateOutputInformation(void) override; /** * GenerateInputRequestedRegion * Set the requested region of each image in the list. */ - virtual void GenerateInputRequestedRegion(void); + virtual void GenerateInputRequestedRegion(void) override; /** Constructor */ WaveletsBandsListToWaveletsSynopsisImageFilter(); @@ -89,7 +89,7 @@ protected: virtual ~WaveletsBandsListToWaveletsSynopsisImageFilter(); /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + virtual void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: WaveletsBandsListToWaveletsSynopsisImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Filtering/Wavelet/include/otbWaveletsSynopsisImageToWaveletsBandsListFilter.h b/Modules/Filtering/Wavelet/include/otbWaveletsSynopsisImageToWaveletsBandsListFilter.h index 5714fc1cab95a78fa1ed7a6ce00a84790e27cd00..2c547f8b51b9d8c905a1c6f5312fd5247ce24d27 100644 --- a/Modules/Filtering/Wavelet/include/otbWaveletsSynopsisImageToWaveletsBandsListFilter.h +++ b/Modules/Filtering/Wavelet/include/otbWaveletsSynopsisImageToWaveletsBandsListFilter.h @@ -80,7 +80,7 @@ public: itkGetMacro(DecimationRatio,unsigned int); /** If the filter is modified, the extract list need to be regenerated */ - virtual void Modified() const; + virtual void Modified() const override; protected: /** Constructor */ @@ -90,16 +90,16 @@ protected: virtual ~WaveletsSynopsisImageToWaveletsBandsListFilter(); /**PrintSelf method */ - virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; + virtual void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Generate the input requested region from the first element in the list. */ - virtual void GenerateInputRequestedRegion(void); + virtual void GenerateInputRequestedRegion(void) override; /** Generate the output information by building the output list. */ - virtual void GenerateOutputInformation(void); + virtual void GenerateOutputInformation(void) override; /** Main computation method */ - virtual void GenerateData(void); + virtual void GenerateData(void) override; private: WaveletsSynopsisImageToWaveletsBandsListFilter(const Self&); //purposely not implemented diff --git a/Modules/Fusion/Fuzzy/include/otbFuzzyVariable.h b/Modules/Fusion/Fuzzy/include/otbFuzzyVariable.h index 4781b8e4e328a9b9b8f261f114040c9c3369ae6c..8ff9ae486c402023c9bfb73ffe0468f12a59c87d 100644 --- a/Modules/Fusion/Fuzzy/include/otbFuzzyVariable.h +++ b/Modules/Fusion/Fuzzy/include/otbFuzzyVariable.h @@ -107,9 +107,9 @@ protected: /** Constructor */ FuzzyVariable(); /** Destructor */ - ~FuzzyVariable() ITK_OVERRIDE {} + ~FuzzyVariable() override {} /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: /** Map containing the membership functions */ diff --git a/Modules/Fusion/MajorityVoting/include/otbNeighborhoodMajorityVotingImageFilter.h b/Modules/Fusion/MajorityVoting/include/otbNeighborhoodMajorityVotingImageFilter.h index bc4bc866b73e66a8b95de4fb42ae477117b3abe6..042106701cc9ca9af44b52fc976e45f35f848eed 100644 --- a/Modules/Fusion/MajorityVoting/include/otbNeighborhoodMajorityVotingImageFilter.h +++ b/Modules/Fusion/MajorityVoting/include/otbNeighborhoodMajorityVotingImageFilter.h @@ -159,7 +159,7 @@ public: protected: NeighborhoodMajorityVotingImageFilter(); - ~NeighborhoodMajorityVotingImageFilter() ITK_OVERRIDE {}; + ~NeighborhoodMajorityVotingImageFilter() override {}; /** Evaluate image neighborhood with kernel to find the new value * for the center pixel value @@ -169,9 +169,9 @@ protected: * Evaluate is used for non-boundary pixels. */ PixelType Evaluate(const NeighborhoodIteratorType &nit, const KernelIteratorType kernelBegin, - const KernelIteratorType kernelEnd) ITK_OVERRIDE; + const KernelIteratorType kernelEnd) override; - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; //Type to store the useful information from the label histogram diff --git a/Modules/Fusion/PanSharpening/include/otbBayesianFusionFilter.h b/Modules/Fusion/PanSharpening/include/otbBayesianFusionFilter.h index 80290995ac7b29e3190ce459291c0a0598096d92..c57b46d5680383dcd1cbd365cf585b30d5dbbf36 100644 --- a/Modules/Fusion/PanSharpening/include/otbBayesianFusionFilter.h +++ b/Modules/Fusion/PanSharpening/include/otbBayesianFusionFilter.h @@ -298,14 +298,14 @@ public: protected: BayesianFusionFilter(); - ~BayesianFusionFilter() ITK_OVERRIDE; + ~BayesianFusionFilter() override; /** Check if internal statistics need to be computed, and do so */ - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; /** Compute internal statistics required for fusion */ void ComputeInternalStatistics(void); /** Call the superclass implementation and set the StatisticsHaveBeenGenerated * flag to false */ - void Modified(void) const ITK_OVERRIDE; + void Modified(void) const override; private: /** Ponderation declaration*/ diff --git a/Modules/Fusion/PanSharpening/include/otbLmvmPanSharpeningFusionImageFilter.h b/Modules/Fusion/PanSharpening/include/otbLmvmPanSharpeningFusionImageFilter.h index 4a87bd3f0f28968acf8a0139804a8e9910d3f276..df34eeadeb8c45236c82b2111c29008b4125666b 100644 --- a/Modules/Fusion/PanSharpening/include/otbLmvmPanSharpeningFusionImageFilter.h +++ b/Modules/Fusion/PanSharpening/include/otbLmvmPanSharpeningFusionImageFilter.h @@ -110,13 +110,13 @@ protected: LmvmPanSharpeningFusionImageFilter(); /** Destructor */ - ~LmvmPanSharpeningFusionImageFilter() ITK_OVERRIDE {}; + ~LmvmPanSharpeningFusionImageFilter() override {}; /** Call to generate data, wiring composite internal minipipeline */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: LmvmPanSharpeningFusionImageFilter(Self &); // intentionally not implemented diff --git a/Modules/Fusion/PanSharpening/include/otbSimpleRcsPanSharpeningFusionImageFilter.h b/Modules/Fusion/PanSharpening/include/otbSimpleRcsPanSharpeningFusionImageFilter.h index 75cb290f5e33e8f3d2571c825dcc3efb793028cb..2808c721eb9f6eec7484a447891e16f80667904d 100644 --- a/Modules/Fusion/PanSharpening/include/otbSimpleRcsPanSharpeningFusionImageFilter.h +++ b/Modules/Fusion/PanSharpening/include/otbSimpleRcsPanSharpeningFusionImageFilter.h @@ -95,13 +95,13 @@ protected: SimpleRcsPanSharpeningFusionImageFilter(); /** Destructor */ - ~SimpleRcsPanSharpeningFusionImageFilter() ITK_OVERRIDE {}; + ~SimpleRcsPanSharpeningFusionImageFilter() override {}; /** Call to generate data, wiring composite internal minipipeline */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: SimpleRcsPanSharpeningFusionImageFilter(Self &); // intentionally not implemented diff --git a/Modules/Hyperspectral/AnomalyDetection/include/otbLocalRxDetectorFilter.h b/Modules/Hyperspectral/AnomalyDetection/include/otbLocalRxDetectorFilter.h index 0876c7427d2394080caf4980b516ab65876d395d..0207220ff0fd3c99cc64ba289dd0e4d6a0051d37 100644 --- a/Modules/Hyperspectral/AnomalyDetection/include/otbLocalRxDetectorFilter.h +++ b/Modules/Hyperspectral/AnomalyDetection/include/otbLocalRxDetectorFilter.h @@ -94,16 +94,16 @@ public: itkGetMacro(ExternalRadius, int); /** Main computation method */ - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; // virtual void GenerateData(); - void BeforeThreadedGenerateData() ITK_OVERRIDE; - void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) override; protected: LocalRxDetectorFilter(); - ~LocalRxDetectorFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~LocalRxDetectorFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: LocalRxDetectorFilter(const Self&); //purposely not implemented diff --git a/Modules/Hyperspectral/AnomalyDetection/include/otbLocalRxDetectorNonThreadFilter.h b/Modules/Hyperspectral/AnomalyDetection/include/otbLocalRxDetectorNonThreadFilter.h index e369bc5eb668cb59c0299c6b75c4d340878bf486..257efd5c6c6dc0c683652be4105d6ea94c464b14 100644 --- a/Modules/Hyperspectral/AnomalyDetection/include/otbLocalRxDetectorNonThreadFilter.h +++ b/Modules/Hyperspectral/AnomalyDetection/include/otbLocalRxDetectorNonThreadFilter.h @@ -93,16 +93,16 @@ public: itkGetMacro(ExternalRadius, int); /** Main computation method */ - void GenerateInputRequestedRegion() ITK_OVERRIDE; - void GenerateData() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; + void GenerateData() override; // virtual void BeforeThreadedGenerateData(); // virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId); protected: LocalRxDetectorNonThreadFilter(); - ~LocalRxDetectorNonThreadFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~LocalRxDetectorNonThreadFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: LocalRxDetectorNonThreadFilter(const Self&); //purposely not implemented diff --git a/Modules/Hyperspectral/EndmembersExtraction/include/otbEigenvalueLikelihoodMaximisation.h b/Modules/Hyperspectral/EndmembersExtraction/include/otbEigenvalueLikelihoodMaximisation.h index 548d493a4a5e8b82a2a76dfa259f820aa417b424..68bc950a422f55789b3cffa2c1bef21170593d35 100644 --- a/Modules/Hyperspectral/EndmembersExtraction/include/otbEigenvalueLikelihoodMaximisation.h +++ b/Modules/Hyperspectral/EndmembersExtraction/include/otbEigenvalueLikelihoodMaximisation.h @@ -105,8 +105,8 @@ public: protected: EigenvalueLikelihoodMaximisation(); - ~EigenvalueLikelihoodMaximisation() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~EigenvalueLikelihoodMaximisation() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: EigenvalueLikelihoodMaximisation(const Self &); //purposely not implemented diff --git a/Modules/Hyperspectral/EndmembersExtraction/include/otbVcaImageFilter.h b/Modules/Hyperspectral/EndmembersExtraction/include/otbVcaImageFilter.h index c921d60ab808a989b318502cebf82a3f123e9ecd..e91d2346dc602892af7fdd6aeb0613ee06c098a0 100644 --- a/Modules/Hyperspectral/EndmembersExtraction/include/otbVcaImageFilter.h +++ b/Modules/Hyperspectral/EndmembersExtraction/include/otbVcaImageFilter.h @@ -104,12 +104,12 @@ public: itkGetMacro( NumberOfEndmembers, unsigned int ); itkSetMacro( NumberOfEndmembers, unsigned int ); - void Update() ITK_OVERRIDE + void Update() override { this->GenerateData(); } - void EnlargeOutputRequestedRegion(itk::DataObject *itkNotUsed(output)) ITK_OVERRIDE + void EnlargeOutputRequestedRegion(itk::DataObject *itkNotUsed(output)) override { this->GetOutput() ->SetRequestedRegion( this->GetOutput()->GetLargestPossibleRegion() ); @@ -118,13 +118,13 @@ public: protected: VCAImageFilter(); - ~VCAImageFilter() ITK_OVERRIDE; + ~VCAImageFilter() override; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; private: VCAImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Hyperspectral/EndmembersExtraction/include/otbVirtualDimensionality.h b/Modules/Hyperspectral/EndmembersExtraction/include/otbVirtualDimensionality.h index 979f7f8bbbd2175fe333706223b4a7847a08d5f2..89e8b9066f151e1f92551172e2b4e77c811f44df 100644 --- a/Modules/Hyperspectral/EndmembersExtraction/include/otbVirtualDimensionality.h +++ b/Modules/Hyperspectral/EndmembersExtraction/include/otbVirtualDimensionality.h @@ -118,8 +118,8 @@ public: protected: VirtualDimensionality(); - ~VirtualDimensionality() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~VirtualDimensionality() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: VirtualDimensionality(const Self &); //purposely not implemented diff --git a/Modules/Hyperspectral/Unmixing/include/otbISRAUnmixingImageFilter.h b/Modules/Hyperspectral/Unmixing/include/otbISRAUnmixingImageFilter.h index ae0dcb19fdebaed33e5c10c87ee0c3ef02608e79..965c5180e838c46aa01cc127240aeb24950872bb 100644 --- a/Modules/Hyperspectral/Unmixing/include/otbISRAUnmixingImageFilter.h +++ b/Modules/Hyperspectral/Unmixing/include/otbISRAUnmixingImageFilter.h @@ -171,9 +171,9 @@ public: protected: ISRAUnmixingImageFilter(); - ~ISRAUnmixingImageFilter() ITK_OVERRIDE; + ~ISRAUnmixingImageFilter() override; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: ISRAUnmixingImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Hyperspectral/Unmixing/include/otbMDMDNMFImageFilter.h b/Modules/Hyperspectral/Unmixing/include/otbMDMDNMFImageFilter.h index ebef4fe9cafecec0bc986e36da73b07d2b09c728..14d05bbca44718b28fa93efbf367ed0d887e2ec8 100644 --- a/Modules/Hyperspectral/Unmixing/include/otbMDMDNMFImageFilter.h +++ b/Modules/Hyperspectral/Unmixing/include/otbMDMDNMFImageFilter.h @@ -193,18 +193,18 @@ public: protected: MDMDNMFImageFilter(); - ~MDMDNMFImageFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~MDMDNMFImageFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; /** GenerateOutputInformation * Propagate vector length info and modify if needed */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; /** Main computation method */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; private: diff --git a/Modules/Hyperspectral/Unmixing/include/otbNCLSUnmixingImageFilter.h b/Modules/Hyperspectral/Unmixing/include/otbNCLSUnmixingImageFilter.h index fc433e998de102330cca1a6f0afd114f1c04e757..e7fe656079cbfd57e18a20669b2ff127911a3b19 100644 --- a/Modules/Hyperspectral/Unmixing/include/otbNCLSUnmixingImageFilter.h +++ b/Modules/Hyperspectral/Unmixing/include/otbNCLSUnmixingImageFilter.h @@ -174,9 +174,9 @@ public: protected: NCLSUnmixingImageFilter(); - ~NCLSUnmixingImageFilter() ITK_OVERRIDE; + ~NCLSUnmixingImageFilter() override; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: NCLSUnmixingImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Hyperspectral/Unmixing/include/otbSparseUnmixingImageFilter.h b/Modules/Hyperspectral/Unmixing/include/otbSparseUnmixingImageFilter.h index 71adb011c1fe4a4f4d34f861c6b784a75808706b..4e38022e23ff13f68c51f07ddb4e1428678e17d4 100644 --- a/Modules/Hyperspectral/Unmixing/include/otbSparseUnmixingImageFilter.h +++ b/Modules/Hyperspectral/Unmixing/include/otbSparseUnmixingImageFilter.h @@ -162,9 +162,9 @@ public: protected: SparseUnmixingImageFilter(); - ~SparseUnmixingImageFilter() ITK_OVERRIDE { } + ~SparseUnmixingImageFilter() override { } - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; virtual void GenerateNumberOfComponentsRequired (); private: SparseUnmixingImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Hyperspectral/Unmixing/include/otbUnConstrainedLeastSquareImageFilter.h b/Modules/Hyperspectral/Unmixing/include/otbUnConstrainedLeastSquareImageFilter.h index 128cf2af005d9709af4e61989f2b9713a37c85ed..ad8ef27c1bec44f73ff81e4df1bf17ee6a136d7e 100644 --- a/Modules/Hyperspectral/Unmixing/include/otbUnConstrainedLeastSquareImageFilter.h +++ b/Modules/Hyperspectral/Unmixing/include/otbUnConstrainedLeastSquareImageFilter.h @@ -174,9 +174,9 @@ public: protected: UnConstrainedLeastSquareImageFilter(); - ~UnConstrainedLeastSquareImageFilter() ITK_OVERRIDE {} + ~UnConstrainedLeastSquareImageFilter() override {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: UnConstrainedLeastSquareImageFilter(const Self &); //purposely not implemented diff --git a/Modules/IO/Carto/include/otbCoordinateToName.h b/Modules/IO/Carto/include/otbCoordinateToName.h index 7fe3307a04c6cdde6986443237820eb8ddb04974..b2bc93de5232d32487141744fbacf8e98ae6b33a 100644 --- a/Modules/IO/Carto/include/otbCoordinateToName.h +++ b/Modules/IO/Carto/include/otbCoordinateToName.h @@ -118,8 +118,8 @@ public: protected: CoordinateToName(); - ~CoordinateToName() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~CoordinateToName() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; void ParseXMLGeonames(std::string& placeName, std::string& countryName) const; virtual void DoEvaluate(); diff --git a/Modules/IO/Carto/include/otbImageToOSMVectorDataGenerator.h b/Modules/IO/Carto/include/otbImageToOSMVectorDataGenerator.h index 85c797c601b2c5e5a658f0a3fccfcc6093213837..d69770c3785edd01b640db38dc71913b9d7c41fa 100644 --- a/Modules/IO/Carto/include/otbImageToOSMVectorDataGenerator.h +++ b/Modules/IO/Carto/include/otbImageToOSMVectorDataGenerator.h @@ -81,13 +81,13 @@ public: const ImageType* GetInput() const; protected: - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; // Method to compute the extent of the image void EstimateImageExtent(); ImageToOSMVectorDataGenerator(); - ~ImageToOSMVectorDataGenerator() ITK_OVERRIDE {} + ~ImageToOSMVectorDataGenerator() override {} private: ImageToOSMVectorDataGenerator(const Self&); //purposely not implemented diff --git a/Modules/IO/Carto/include/otbMapFileProductWriter.h b/Modules/IO/Carto/include/otbMapFileProductWriter.h index edfaf5b272500a2c8e62447977dd1b45da34845f..4ec15cd4e49b7f45f791d8d5a459ac8e10a27799 100644 --- a/Modules/IO/Carto/include/otbMapFileProductWriter.h +++ b/Modules/IO/Carto/include/otbMapFileProductWriter.h @@ -154,7 +154,7 @@ public: itkGetStringMacro(ShapeIndexPath); /** Update Method : Call a porotected Write method */ - void Update() ITK_OVERRIDE + void Update() override { this->Write(); } @@ -164,8 +164,8 @@ public: protected: MapFileProductWriter(); - ~MapFileProductWriter() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~MapFileProductWriter() override; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /**Method for Tiling the input image*/ virtual void Tiling(); diff --git a/Modules/IO/Carto/include/otbOSMDataToVectorDataGenerator.h b/Modules/IO/Carto/include/otbOSMDataToVectorDataGenerator.h index a9f1e106553dd810704b04189b16cdbad2c45dab..5c3383e8070c0f1df921ad5a1c2dbe31d16dfba8 100644 --- a/Modules/IO/Carto/include/otbOSMDataToVectorDataGenerator.h +++ b/Modules/IO/Carto/include/otbOSMDataToVectorDataGenerator.h @@ -166,7 +166,7 @@ public: protected: /** Generate Data method : launch the process */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** * Parse the xml file get from OSM to compose the requested vector @@ -186,7 +186,7 @@ protected: OSMDataToVectorDataGenerator(); - ~OSMDataToVectorDataGenerator() ITK_OVERRIDE; + ~OSMDataToVectorDataGenerator() override; private: OSMDataToVectorDataGenerator(const Self&); //purposely not implemented diff --git a/Modules/IO/Carto/include/otbPlaceNameToLonLat.h b/Modules/IO/Carto/include/otbPlaceNameToLonLat.h index 002a130ce73285b5859ad3e4f9377ea60fbec301..3ea71f9ccf4d1c9d4f74bb2e7be5ebb7faa7ec2f 100644 --- a/Modules/IO/Carto/include/otbPlaceNameToLonLat.h +++ b/Modules/IO/Carto/include/otbPlaceNameToLonLat.h @@ -61,8 +61,8 @@ public: protected: PlaceNameToLonLat(); - ~PlaceNameToLonLat() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~PlaceNameToLonLat() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; void RetrieveXML(const std::ostringstream& urlStream); void ParseXMLYahoo(); void ParseXMLGoogle(); diff --git a/Modules/IO/Carto/include/otbWorldFile.h b/Modules/IO/Carto/include/otbWorldFile.h index 0c07086a3278ba41e45117837d082ee2a94ad42e..5e26171a9470127a75afc909904e4feb658ca511 100644 --- a/Modules/IO/Carto/include/otbWorldFile.h +++ b/Modules/IO/Carto/include/otbWorldFile.h @@ -96,7 +96,7 @@ protected: m_LonSpacing(0.0), m_LatSpacing(0.0), m_LonRotation(0.0), m_LatRotation(0.0), m_ImageFilename("") {} - ~WorldFile() ITK_OVERRIDE {} + ~WorldFile() override {} private: WorldFile(const Self &); //purposely not implemented diff --git a/Modules/IO/ExtendedFilename/include/otbExtendedFilenameToReaderOptions.h b/Modules/IO/ExtendedFilename/include/otbExtendedFilenameToReaderOptions.h index 79c8bb00e0a7058d1a5531174254661deb47da50..374e9dbe568d20e03de71ee53beb6c8d06cb7d68 100644 --- a/Modules/IO/ExtendedFilename/include/otbExtendedFilenameToReaderOptions.h +++ b/Modules/IO/ExtendedFilename/include/otbExtendedFilenameToReaderOptions.h @@ -79,7 +79,7 @@ public: }; /* Set Methods */ - void SetExtendedFileName(const char * extFname) ITK_OVERRIDE; + void SetExtendedFileName(const char * extFname) override; /* Get Methods */ bool SimpleFileNameIsSet () const; bool ExtGEOMFileNameIsSet () const; @@ -101,7 +101,7 @@ public: protected: ExtendedFilenameToReaderOptions(); - ~ExtendedFilenameToReaderOptions() ITK_OVERRIDE {} + ~ExtendedFilenameToReaderOptions() override {} private: ExtendedFilenameToReaderOptions(const Self &); //purposely not implemented diff --git a/Modules/IO/ExtendedFilename/include/otbExtendedFilenameToWriterOptions.h b/Modules/IO/ExtendedFilename/include/otbExtendedFilenameToWriterOptions.h index 81909d152832b2a6ef7f6c98333db05835a805b3..c1754bd2cd363993fee970f4ba6c012f4e57602c 100644 --- a/Modules/IO/ExtendedFilename/include/otbExtendedFilenameToWriterOptions.h +++ b/Modules/IO/ExtendedFilename/include/otbExtendedFilenameToWriterOptions.h @@ -77,7 +77,7 @@ public: }; /* Set Methods */ - void SetExtendedFileName(const char * extFname) ITK_OVERRIDE; + void SetExtendedFileName(const char * extFname) override; /* Get Methods */ bool SimpleFileNameIsSet () const; bool WriteGEOMFileIsSet () const; @@ -102,7 +102,7 @@ public: protected: ExtendedFilenameToWriterOptions(); - ~ExtendedFilenameToWriterOptions() ITK_OVERRIDE {} + ~ExtendedFilenameToWriterOptions() override {} private: ExtendedFilenameToWriterOptions(const Self &); //purposely not implemented diff --git a/Modules/IO/ExtendedFilename/otb-module.cmake b/Modules/IO/ExtendedFilename/otb-module.cmake index cf194a8edde1a755df8dd5343ffaeefbb56b65c9..1e46b70a5bfefcc72cda05d38d35e428fba5d6f5 100644 --- a/Modules/IO/ExtendedFilename/otb-module.cmake +++ b/Modules/IO/ExtendedFilename/otb-module.cmake @@ -26,8 +26,8 @@ product by skipping either geographic or sensor-model information.") otb_module(OTBExtendedFilename DEPENDS + OTBCommon OTBIOGDAL - OTBBoostAdapters OTBITK TEST_DEPENDS diff --git a/Modules/IO/ExtendedFilename/src/CMakeLists.txt b/Modules/IO/ExtendedFilename/src/CMakeLists.txt index 033f0db2d93dfe762ed49684cdbf8cba0eed68b8..35ec302ad43392100078862ecc954abce105eeaa 100644 --- a/Modules/IO/ExtendedFilename/src/CMakeLists.txt +++ b/Modules/IO/ExtendedFilename/src/CMakeLists.txt @@ -20,15 +20,13 @@ set(OTBExtendedFilename_SRC otbExtendedFilenameToReaderOptions.cxx - otbExtendedFilenameHelper.cxx otbExtendedFilenameToWriterOptions.cxx ) add_library(OTBExtendedFilename ${OTBExtendedFilename_SRC}) target_link_libraries(OTBExtendedFilename + ${OTBCommon_LIBRARIES} ${OTBIOGDAL_LIBRARIES} - ${OTBBoost_LIBRARIES} - ) otb_module_target(OTBExtendedFilename) diff --git a/Modules/IO/IOBSQ/include/otbBSQImageIO.h b/Modules/IO/IOBSQ/include/otbBSQImageIO.h index 9b6efa368b25b3155d57771e77be0d1bf882a0e4..b954895cc5f8ca85d20740796f7762f92d9ca0df 100644 --- a/Modules/IO/IOBSQ/include/otbBSQImageIO.h +++ b/Modules/IO/IOBSQ/include/otbBSQImageIO.h @@ -63,19 +63,19 @@ public: /** Determine the file type. Returns true if this ImageIO can read the * file specified. */ - bool CanReadFile(const char*) ITK_OVERRIDE; + bool CanReadFile(const char*) override; /** Determine the file type. Returns true if the ImageIO can stream read the specified file */ - bool CanStreamRead() ITK_OVERRIDE + bool CanStreamRead() override { return true; } /** Set the spacing and dimension information for the set filename. */ - void ReadImageInformation() ITK_OVERRIDE; + void ReadImageInformation() override; /** Reads the data from disk into the memory buffer provided. */ - void Read(void* buffer) ITK_OVERRIDE; + void Read(void* buffer) override; /** Reads 3D data from multiple files assuming one slice per file. */ virtual void ReadVolume(void* buffer); @@ -84,28 +84,28 @@ public: /** Determine the file type. Returns true if this ImageIO can read the * file specified. */ - bool CanWriteFile(const char*) ITK_OVERRIDE; + bool CanWriteFile(const char*) override; /** Determine the file type. Returns true if the ImageIO can stream write the specified file */ - bool CanStreamWrite() ITK_OVERRIDE + bool CanStreamWrite() override { return true; } /** Writes the spacing and dimensions of the image. * Assumes SetFileName has been called with a valid file name. */ - void WriteImageInformation() ITK_OVERRIDE; + void WriteImageInformation() override; /** Writes the data to disk from the memory buffer provided. Make sure * that the IORegion has been set properly. */ - void Write(const void* buffer) ITK_OVERRIDE; + void Write(const void* buffer) override; // JULIEN: NOT USED, NOT IMPLEMENTED // void SampleImage(void* buffer, int XBegin, int YBegin, int SizeXRead, int SizeYRead, int XSample, int YSample); /** Get the number of overviews available into the file specified * This imageIO didn't support overviews */ - unsigned int GetOverviewsCount() ITK_OVERRIDE + unsigned int GetOverviewsCount() override { // MANTIS-1154: Source image is always considered as the best // resolution overview. @@ -114,7 +114,7 @@ public: /** Get information about overviews available into the file specified * This imageIO didn't support overviews */ - std::vector<std::string> GetOverviewsInfo() ITK_OVERRIDE + std::vector<std::string> GetOverviewsInfo() override { std::vector<std::string> desc; return desc; @@ -123,13 +123,13 @@ public: /** Provide hist about the output container to deal with complex pixel * type (Not used here) */ void SetOutputImagePixelType( bool itkNotUsed(isComplexInternalPixelType), - bool itkNotUsed(isVectorImage)) ITK_OVERRIDE{} + bool itkNotUsed(isVectorImage)) override{} protected: /** Constructor.*/ BSQImageIO(); /** Destructor.*/ - ~BSQImageIO() ITK_OVERRIDE; + ~BSQImageIO() override; bool OpenOneraDataFileForReading(const char* filename); bool OpenOneraHeaderFileForReading(const char* filename); @@ -138,7 +138,7 @@ protected: bool OpenOneraDataFileForWriting(const char* filename); bool OpenOneraHeaderFileForWriting(const char* filename); - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: BSQImageIO(const Self &); //purposely not implemented diff --git a/Modules/IO/IOBSQ/include/otbBSQImageIOFactory.h b/Modules/IO/IOBSQ/include/otbBSQImageIOFactory.h index 56337e23a7f57a4a4f9bb59f2cdc31a784e2ee8b..702729fd340565b4c210b011a5a43c8ed08c5a71 100644 --- a/Modules/IO/IOBSQ/include/otbBSQImageIOFactory.h +++ b/Modules/IO/IOBSQ/include/otbBSQImageIOFactory.h @@ -40,8 +40,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - const char* GetITKSourceVersion(void) const ITK_OVERRIDE; - const char* GetDescription(void) const ITK_OVERRIDE; + const char* GetITKSourceVersion(void) const override; + const char* GetDescription(void) const override; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -59,7 +59,7 @@ public: protected: BSQImageIOFactory(); - ~BSQImageIOFactory() ITK_OVERRIDE; + ~BSQImageIOFactory() override; private: BSQImageIOFactory(const Self &); //purposely not implemented diff --git a/Modules/IO/IOGDAL/include/otbGDALDatasetWrapper.h b/Modules/IO/IOGDAL/include/otbGDALDatasetWrapper.h index a20b1405a11b55ad7245003450c86a051a1fbdb4..667b8f7283d7cbc9ae5124921b4d02ee476b6968 100644 --- a/Modules/IO/IOGDAL/include/otbGDALDatasetWrapper.h +++ b/Modules/IO/IOGDAL/include/otbGDALDatasetWrapper.h @@ -79,7 +79,7 @@ public: protected : GDALDatasetWrapper(); - ~GDALDatasetWrapper() ITK_OVERRIDE; + ~GDALDatasetWrapper() override; private: diff --git a/Modules/IO/IOGDAL/include/otbGDALImageIO.h b/Modules/IO/IOGDAL/include/otbGDALImageIO.h index 49b4678ac43729314803f1bb5aecc37bac75cded..e494c588dc57502d3bd7e2d17370d9dde3a13aac 100644 --- a/Modules/IO/IOGDAL/include/otbGDALImageIO.h +++ b/Modules/IO/IOGDAL/include/otbGDALImageIO.h @@ -119,7 +119,7 @@ public: /** Provide hist about the output container to deal with complex pixel * type */ void SetOutputImagePixelType( bool isComplexInternalPixelType, - bool isVectorImage) ITK_OVERRIDE + bool isVectorImage) override { this->SetIsComplex(isComplexInternalPixelType); this->SetIsVectorImage(isVectorImage); @@ -129,19 +129,19 @@ public: /** Determine the file type. Returns true if this ImageIO can read the * file specified. */ - bool CanReadFile(const char*) ITK_OVERRIDE; + bool CanReadFile(const char*) override; /** Determine the file type. Returns true if the ImageIO can stream read the specified file */ - bool CanStreamRead() ITK_OVERRIDE + bool CanStreamRead() override { return true; } /** Set the spacing and dimension information for the set filename. */ - void ReadImageInformation() ITK_OVERRIDE; + void ReadImageInformation() override; /** Reads the data from disk into the memory buffer provided. */ - void Read(void* buffer) ITK_OVERRIDE; + void Read(void* buffer) override; /** Reads 3D data from multiple files assuming one slice per file. */ virtual void ReadVolume(void* buffer); @@ -156,18 +156,18 @@ public: /** Determine the file type. Returns true if this ImageIO can read the * file specified. */ - bool CanWriteFile(const char*) ITK_OVERRIDE; + bool CanWriteFile(const char*) override; /** Determine the file type. Returns true if the ImageIO can stream write the specified file */ - bool CanStreamWrite() ITK_OVERRIDE; + bool CanStreamWrite() override; /** Writes the spacing and dimensions of the image. * Assumes SetFileName has been called with a valid file name. */ - void WriteImageInformation() ITK_OVERRIDE; + void WriteImageInformation() override; /** Writes the data to disk from the memory buffer provided. Make sure * that the IORegion has been set properly. */ - void Write(const void* buffer) ITK_OVERRIDE; + void Write(const void* buffer) override; /** Get all resolutions possible from the file dimensions */ bool GetAvailableResolutions(std::vector<unsigned int>& res); @@ -180,10 +180,10 @@ public: * Currently this overview count is only based on the first band * If no pre-computed overviews are available we provide the overview * count based on size division by 2*/ - unsigned int GetOverviewsCount() ITK_OVERRIDE; + unsigned int GetOverviewsCount() override; /** Get description about overviews available into the file specified */ - std::vector<std::string> GetOverviewsInfo() ITK_OVERRIDE; + std::vector<std::string> GetOverviewsInfo() override; /** Returns gdal pixel type as string */ std::string GetGdalPixelTypeAsString() const; @@ -196,9 +196,9 @@ protected: */ GDALImageIO(); /** Destructor.*/ - ~GDALImageIO() ITK_OVERRIDE; + ~GDALImageIO() override; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Read all information on the image*/ void InternalReadImageInformation(); /** Write all information on the image*/ diff --git a/Modules/IO/IOGDAL/include/otbGDALImageIOFactory.h b/Modules/IO/IOGDAL/include/otbGDALImageIOFactory.h index e4e13cd11a909a11f226e4b39b660b79da4be155..275c0db252434ef5d3db4dbdcf093b1cf713a61b 100644 --- a/Modules/IO/IOGDAL/include/otbGDALImageIOFactory.h +++ b/Modules/IO/IOGDAL/include/otbGDALImageIOFactory.h @@ -43,8 +43,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - const char* GetITKSourceVersion(void) const ITK_OVERRIDE; - const char* GetDescription(void) const ITK_OVERRIDE; + const char* GetITKSourceVersion(void) const override; + const char* GetDescription(void) const override; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -62,7 +62,7 @@ public: protected: GDALImageIOFactory(); - ~GDALImageIOFactory() ITK_OVERRIDE; + ~GDALImageIOFactory() override; private: GDALImageIOFactory(const Self &); //purposely not implemented diff --git a/Modules/IO/IOGDAL/include/otbGDALOverviewsBuilder.h b/Modules/IO/IOGDAL/include/otbGDALOverviewsBuilder.h index 50815a7124281986e471eec07f222b05c95299e7..1a803887faf1dc49a75b0c9bddfd2398afce0249 100644 --- a/Modules/IO/IOGDAL/include/otbGDALOverviewsBuilder.h +++ b/Modules/IO/IOGDAL/include/otbGDALOverviewsBuilder.h @@ -160,15 +160,15 @@ public: void SetInputFileName( const std::string & str ); - void Update() ITK_OVERRIDE; + void Update() override; protected: GDALOverviewsBuilder(); - ~GDALOverviewsBuilder() ITK_OVERRIDE {}; + ~GDALOverviewsBuilder() override {}; - void PrintSelf( std::ostream & os, itk::Indent indent ) const ITK_OVERRIDE; + void PrintSelf( std::ostream & os, itk::Indent indent ) const override; private: diff --git a/Modules/IO/IOGDAL/include/otbOGRIOHelper.h b/Modules/IO/IOGDAL/include/otbOGRIOHelper.h index af76c375c214ca95a427eeffae780d3ad7d78cd9..003ea24d91567335ef86d355541ef2a221ccd085 100644 --- a/Modules/IO/IOGDAL/include/otbOGRIOHelper.h +++ b/Modules/IO/IOGDAL/include/otbOGRIOHelper.h @@ -93,7 +93,7 @@ public: protected: OGRIOHelper(); - ~OGRIOHelper() ITK_OVERRIDE; + ~OGRIOHelper() override; private: OGRIOHelper(const Self &); //purposely not implemented diff --git a/Modules/IO/IOGDAL/include/otbOGRVectorDataIO.h b/Modules/IO/IOGDAL/include/otbOGRVectorDataIO.h index d4b1b8c46cccd977fd1be16c09f2031b7e34a5ae..2344ef6fca541478a916b704f8c9206d526efd62 100644 --- a/Modules/IO/IOGDAL/include/otbOGRVectorDataIO.h +++ b/Modules/IO/IOGDAL/include/otbOGRVectorDataIO.h @@ -91,29 +91,29 @@ public: /** Determine the file type. Returns true if this VectorDataIO can read the * file specified. */ - bool CanReadFile(const char*) const ITK_OVERRIDE; + bool CanReadFile(const char*) const override; /** Reads the data from disk into the memory buffer provided. */ - void Read(itk::DataObject* data) ITK_OVERRIDE; + void Read(itk::DataObject* data) override; /*-------- This part of the interfaces deals with writing data. ----- */ /** Determine the file type. Returns true if this ImageIO can read the * file specified. */ - bool CanWriteFile(const char*) const ITK_OVERRIDE; + bool CanWriteFile(const char*) const override; /** Writes the data to disk from the memory buffer provided */ - void Write(const itk::DataObject* data, char ** papszOptions = ITK_NULLPTR) ITK_OVERRIDE; + void Write(const itk::DataObject* data, char ** papszOptions = ITK_NULLPTR) override; protected: /** Constructor.*/ OGRVectorDataIO(); /** Destructor.*/ - ~OGRVectorDataIO() ITK_OVERRIDE; + ~OGRVectorDataIO() override; /* virtual void InternalReadVectorDataInformation(){}; */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: OGRVectorDataIO(const Self &); //purposely not implemented diff --git a/Modules/IO/IOGDAL/include/otbOGRVectorDataIOFactory.h b/Modules/IO/IOGDAL/include/otbOGRVectorDataIOFactory.h index 8202f5d70401ca025302e5bf66970459dd215e76..c872aeeba8353777a6d041c2a68d5b05605d5cd6 100644 --- a/Modules/IO/IOGDAL/include/otbOGRVectorDataIOFactory.h +++ b/Modules/IO/IOGDAL/include/otbOGRVectorDataIOFactory.h @@ -41,8 +41,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - const char* GetITKSourceVersion(void) const ITK_OVERRIDE; - const char* GetDescription(void) const ITK_OVERRIDE; + const char* GetITKSourceVersion(void) const override; + const char* GetDescription(void) const override; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -59,7 +59,7 @@ public: protected: OGRVectorDataIOFactory(); - ~OGRVectorDataIOFactory() ITK_OVERRIDE; + ~OGRVectorDataIOFactory() override; private: OGRVectorDataIOFactory(const Self &); //purposely not implemented diff --git a/Modules/IO/IOGDAL/src/otbGDALImageIO.cxx b/Modules/IO/IOGDAL/src/otbGDALImageIO.cxx index f4cfe1ecfd01f6360d084c486daa451c0c794896..4f55f67b2b7e26937c2874ce508dad414bd9edb2 100644 --- a/Modules/IO/IOGDAL/src/otbGDALImageIO.cxx +++ b/Modules/IO/IOGDAL/src/otbGDALImageIO.cxx @@ -74,57 +74,6 @@ public: }; // end of GDALDataTypeWrapper -/* -template<class InputType> -void printOutputData(InputType *pData, int nbBands, int nbPixelToRead) -{ - for (unsigned int itPxl = 0; itPxl < (unsigned int) (nbPixelToRead * nbBands); itPxl++) - { - std::cout << "Buffer["<< itPxl << "] = " << *(pData + itPxl) << std::endl; - } -}; - -void printDataBuffer(unsigned char *pData, GDALDataType pxlType, int nbBands, int nbPixelToRead) -{ - if (pxlType == GDT_Int16) - { - printOutputData( static_cast<short*>( static_cast<void*>(pData) ), nbBands, nbPixelToRead); - } - else if (pxlType == GDT_Int32) - { - printOutputData( static_cast<int*>( static_cast<void*>(pData) ), nbBands, nbPixelToRead); - } - else if (pxlType == GDT_Float32) - { - printOutputData( static_cast<float*>( static_cast<void*>(pData) ), nbBands, nbPixelToRead); - } - else if (pxlType == GDT_Float64) - { - printOutputData( static_cast<double*>( static_cast<void*>(pData) ), nbBands, nbPixelToRead); - } - else if (pxlType == GDT_CInt16) - { - printOutputData( static_cast<std::complex<short>*>( static_cast<void*>(pData) ), nbBands, nbPixelToRead); - } - else if (pxlType == GDT_CInt32) - { - printOutputData( static_cast<std::complex<int>*>( static_cast<void*>(pData) ), nbBands, nbPixelToRead); - } - else if (pxlType == GDT_CFloat32) - { - printOutputData( static_cast<std::complex<float>*>( static_cast<void*>(pData) ), nbBands, nbPixelToRead); - } - else if (pxlType == GDT_CFloat64) - { - printOutputData( static_cast<std::complex<double>*>( static_cast<void*>(pData) ), nbBands, nbPixelToRead); - } - else - { - std::cerr << "Pixel type unknown" << std::endl; - } -}; -*/ - GDALImageIO::GDALImageIO() { // By default set number of dimensions to two. @@ -147,9 +96,6 @@ GDALImageIO::GDALImageIO() m_IsIndexed = false; m_DatasetNumber = 0; - //m_poBands = NULL; - //m_hDriver = NULL; - //m_poDataset = NULL; m_NbBands = 0; m_FlagWriteImageInformation = true; @@ -177,7 +123,6 @@ bool GDALImageIO::CanReadFile(const char* file) // First check the extension if (file == ITK_NULLPTR) { - itkDebugMacro(<< "No filename specified."); return false; } m_Dataset = GDALDriverManagerWrapper::GetInstance().Open(file); @@ -207,7 +152,7 @@ void GDALImageIO::Read(void* buffer) // Check if conversion succeed if (p == ITK_NULLPTR) { - itkExceptionMacro(<< "GDAL : Bad alloc"); + itkExceptionMacro(<< "Buffer passed to GDALImageIO for reading is NULL."); return; } @@ -219,15 +164,10 @@ void GDALImageIO::Read(void* buffer) int lNbLinesRegion = this->GetIORegion().GetSize()[1]; int lNbColumnsRegion = this->GetIORegion().GetSize()[0]; - //std::cout << "OriginBuffer= " << lFirstLineRegion << " x " << lFirstColumnRegion << std::endl; - //std::cout << "SizeBuffer= " << lNbLinesRegion << " x " << lNbColumnsRegion << std::endl; - // Compute the origin of the image region to read at the initial resolution int lFirstLine = lFirstLineRegion * (1 << m_ResolutionFactor); int lFirstColumn = lFirstColumnRegion * (1 << m_ResolutionFactor); - //std::cout << "OriginImage= " << lFirstLine << " x " << lFirstColumn << std::endl; - // Compute the size of the image region to read at the initial resolution int lNbLines = lNbLinesRegion * (1 << m_ResolutionFactor); int lNbColumns = lNbColumnsRegion * (1 << m_ResolutionFactor); @@ -238,103 +178,11 @@ void GDALImageIO::Read(void* buffer) if (lFirstColumn + lNbColumns > static_cast<int>(m_OriginalDimensions[0])) lNbColumns = static_cast<int>(m_OriginalDimensions[0]-lFirstColumn); - //std::cout << "SizeImage= " << lNbLines << " x " << lNbColumns << std::endl; - - GDALDataset* dataset = m_Dataset->GetDataSet(); - // This special case is due to the fact the CINT/CLONG types - // do not exists in ITK. In this case we only report the first band - // TODO This should be fixed - /*if (GDALDataTypeIsComplex(m_PxType->pixType) - && (m_PxType->pixType != GDT_CFloat32) - && (m_PxType->pixType != GDT_CFloat64)) - { - int pixelOffset = m_BytePerPixel * m_NbBands; - int lineOffset = m_BytePerPixel * m_NbBands * lNbColumns; - int bandOffset = m_BytePerPixel; - int nbBands = m_NbBands; - - int nbPixelToRead = lNbColumns * lNbLines; - std::streamoff nbBytes = static_cast<std::streamoff>(m_NbBands) * static_cast<std::streamoff>(nbPixelToRead) * static_cast<std::streamoff>(m_BytePerPixel); - unsigned char *pBufferTemp = new unsigned char[static_cast<unsigned int>(nbBytes)]; - - // keep it for the moment - otbMsgDevMacro(<< "Parameters RasterIO (case CInt and CShort):" - << "\n indX = " << lFirstColumn - << "\n indY = " << lFirstLine - << "\n sizeX = " << lNbColumns - << "\n sizeY = " << lNbLines - << "\n GDAL Data Type = " << GDALGetDataTypeName(m_PxType->pixType) - << "\n pixelOffset = " << pixelOffset - << "\n lineOffset = " << lineOffset - << "\n bandOffset = " << bandOffset); - - CPLErr lCrGdal = m_Dataset->GetDataSet()->RasterIO(GF_Read, - lFirstColumn, - lFirstLine, - lNbColumns, - lNbLines, - pBufferTemp, //p, // pData - lNbColumns, - lNbLines, - m_PxType->pixType, - nbBands, - // We want to read all bands - NULL, - pixelOffset, - lineOffset, - bandOffset); - // Check for gdal error - if (lCrGdal == CE_Failure) - { - itkExceptionMacro(<< "Error while reading image (GDAL format) " << m_FileName ); - delete[] pBufferTemp; - return; - } - //std::cout << "RAW BUFFER:" <<std::endl; - //printDataBuffer(pBufferTemp, m_PxType->pixType, m_NbBands, lNbColumns*lNbLines); - - // Convert the buffer to GDT_Float64 type - typedef std::complex<float> RealType; - typedef double ScalarRealType; - - if (m_PxType->pixType == GDT_CInt32) - { - //std::cout << "Convert input File from GDT_CInt32 to GDT_CFloat32" << std::endl; - typedef std::complex<int> ComplexIntType; - - for (unsigned int itPxl = 0; itPxl < (unsigned int) (nbPixelToRead * m_NbBands); itPxl++) - { - ComplexIntType pxlValue = *(static_cast<ComplexIntType*>( static_cast<void*>(pBufferTemp)) + itPxl ); - - RealType pxlValueReal( static_cast<ScalarRealType>(pxlValue.real()), static_cast<ScalarRealType>(pxlValue.imag()) ); - - memcpy((void*) (&(p[itPxl*sizeof(RealType)])), (const void*) (&(pxlValueReal)), (size_t) (sizeof(RealType))); - } - } - else if (m_PxType->pixType == GDT_CInt16) - { - //std::cout << "Convert input File from GDT_CInt16 to GDT_CFloat32" << std::endl; - typedef std::complex<short> ComplexShortType; - - for (unsigned int itPxl = 0; itPxl < (unsigned int) (nbPixelToRead * m_NbBands); itPxl++) - { - ComplexShortType pxlValue = *(static_cast<ComplexShortType*>( static_cast<void*>(pBufferTemp)) + itPxl ); - - RealType pxlValueReal( static_cast<ScalarRealType>(pxlValue.real()), static_cast<ScalarRealType>(pxlValue.imag()) ); - - memcpy((void*) (&(p[itPxl*sizeof(RealType)])), (const void*) (&(pxlValueReal)), (size_t) (sizeof(RealType))); - } - } - //std::cout << "CONVERTED BUFFER:" <<std::endl; - //printDataBuffer(p, GDT_CFloat64, m_NbBands, lNbColumns*lNbLines); - delete[] pBufferTemp; - } - // In the indexed case, one has to retrieve the index image and the // color table, and translate p to a 4 components color values buffer - else*/ if (m_IsIndexed) + if (m_IsIndexed) { // TODO: This is a very special case and seems to be working only // for unsigned char pixels. There might be a gdal method to do @@ -346,8 +194,9 @@ void GDALImageIO::Read(void* buffer) std::streamoff step = static_cast<std::streamoff>(this->GetNumberOfComponents()) * static_cast<std::streamoff>(m_BytePerPixel); - - CPLErr lCrGdal = dataset->GetRasterBand(1)->RasterIO(GF_Read, + otbLogMacro(Debug,<<"GDAL reads ["<<lFirstColumn<<", "<<lFirstColumn+lNbColumns-1<<"]x["<<lFirstLine<<", "<<lFirstLine+lNbLines-1<<"] indexed color image of type "<<GDALGetDataTypeName(m_PxType->pixType)<<" from file "<<m_FileName); + otb::Stopwatch chrono = otb::Stopwatch::StartNew(); + CPLErr lCrGdal = dataset->GetRasterBand(1)->RasterIO(GF_Read, lFirstColumn, lFirstLine, lNbColumns, @@ -358,11 +207,16 @@ void GDALImageIO::Read(void* buffer) m_PxType->pixType, 0, 0); - if (lCrGdal == CE_Failure) + chrono.Stop(); + + if (lCrGdal == CE_Failure) { itkExceptionMacro(<< "Error while reading image (GDAL format) '" << m_FileName.c_str() << "' : " << CPLGetLastErrorMsg()); } + + otbLogMacro(Debug,<< "GDAL read took " << chrono.GetElapsedMilliseconds() << " ms") + // Interpret index as color std::streamoff cpt(0); GDALColorTable* colorTable = dataset->GetRasterBand(1)->GetColorTable(); @@ -394,19 +248,7 @@ void GDALImageIO::Read(void* buffer) } // keep it for the moment - //otbMsgDevMacro(<< "Number of bands inside input file: " << m_NbBands); - otbMsgDevMacro(<< "Parameters RasterIO : \n" - << " indX = " << lFirstColumn << "\n" - << " indY = " << lFirstLine << "\n" - << " sizeX = " << lNbColumns << "\n" - << " sizeY = " << lNbLines << "\n" - << " Buffer Size X = " << lNbColumnsRegion << "\n" - << " Buffer Size Y = " << lNbLinesRegion << "\n" - << " GDAL Data Type = " << GDALGetDataTypeName(m_PxType->pixType) << "\n" - << " nbBands = " << nbBands << "\n" - << " pixelOffset = " << pixelOffset << "\n" - << " lineOffset = " << lineOffset << "\n" - << " bandOffset = " << bandOffset ); + otbLogMacro(Debug,<<"GDAL reads ["<<lFirstColumn<<", "<<lFirstColumnRegion+lNbColumnsRegion-1<<"]x["<<lFirstLineRegion<<", "<<lFirstLineRegion+lNbLinesRegion-1<<"] x "<<nbBands<<" bands of type "<<GDALGetDataTypeName(m_PxType->pixType)<<" from file "<<m_FileName); otb::Stopwatch chrono = otb::Stopwatch::StartNew(); CPLErr lCrGdal = m_Dataset->GetDataSet()->RasterIO(GF_Read, @@ -425,8 +267,6 @@ void GDALImageIO::Read(void* buffer) lineOffset, bandOffset); chrono.Stop(); - otbMsgDevMacro(<< "RasterIO Read took " << chrono.GetElapsedMilliseconds() << " ms") - // Check if gdal call succeed if (lCrGdal == CE_Failure) { @@ -434,8 +274,10 @@ void GDALImageIO::Read(void* buffer) << m_FileName.c_str() << "' : " << CPLGetLastErrorMsg()); return; } - //printDataBuffer(p, m_PxType->pixType, m_NbBands, lNbColumnsRegion*lNbLinesRegion); - } + + otbLogMacro(Debug,<< "GDAL read took " << chrono.GetElapsedMilliseconds() << " ms") + + } } bool GDALImageIO::GetSubDatasetInfo(std::vector<std::string> &names, std::vector<std::string> &desc) @@ -456,8 +298,6 @@ bool GDALImageIO::GetSubDatasetInfo(std::vector<std::string> &names, std::vector std::string key, name; if (System::ParseHdfSubsetName(papszMetadata[cpt], key, name)) { - otbMsgDevMacro(<< "- key: " << key); - otbMsgDevMacro(<< "- name: " << name); // check if this is a dataset name if (key.find("_NAME") != std::string::npos) names.push_back(name); // check if this is a dataset descriptor @@ -609,8 +449,6 @@ void GDALImageIO::InternalReadImageInformation() std::string key, name; if (System::ParseHdfSubsetName(papszMetadata[cpt], key, name)) { - otbMsgDevMacro(<< "- key: " << key); - otbMsgDevMacro(<< "- name: " << name); // check if this is a dataset name if (key.find("_NAME") != std::string::npos) names.push_back(name); } @@ -618,7 +456,6 @@ void GDALImageIO::InternalReadImageInformation() } if (m_DatasetNumber < names.size()) { - otbMsgDevMacro(<< "Reading: " << names[m_DatasetNumber]); m_Dataset = GDALDriverManagerWrapper::GetInstance().Open(names[m_DatasetNumber]); } else @@ -643,8 +480,6 @@ void GDALImageIO::InternalReadImageInformation() m_OriginalDimensions.push_back(dataset->GetRasterXSize()); m_OriginalDimensions.push_back(dataset->GetRasterYSize()); - otbMsgDevMacro(<< "Original Dimensions of the input file: " << m_OriginalDimensions[0] << " x " << m_OriginalDimensions[1]); - // Get Number of Bands m_NbBands = dataset->GetRasterCount(); @@ -661,21 +496,13 @@ void GDALImageIO::InternalReadImageInformation() /*std::cout << "Overviews size of input file" << m_FileName << ": " << m_OverviewsSize.back().first << " x " << m_OverviewsSize.back().second << std::endl; */ - otbMsgDevMacro( << "Overviews size of input file" << m_FileName << ": " - << m_OverviewsSize.back().first << " x " << m_OverviewsSize.back().second); } - otbMsgDevMacro(<< "Number of Overviews inside input file: " << m_NumberOfOverviews); - otbMsgDevMacro(<< "Input file dimension: " << m_Dimensions[0] << ", " << m_Dimensions[1]); - otbMsgDevMacro(<< "Number of bands inside input file: " << m_NbBands); - this->SetNumberOfComponents(m_NbBands); // Set the number of dimensions (verify for the dim ) this->SetNumberOfDimensions(2); - otbMsgDevMacro(<< "Nb of Dimensions of the input file: " << m_NumberOfDimensions); - // Automatically set the Type to Binary for GDAL data this->SetFileTypeToBinary(); @@ -683,7 +510,7 @@ void GDALImageIO::InternalReadImageInformation() // Consider only the data type given by the first band // Maybe be could changed (to check) m_PxType->pixType = dataset->GetRasterBand(1)->GetRasterDataType(); - otbMsgDevMacro(<< "PixelType inside input file: "<< GDALGetDataTypeName(m_PxType->pixType) ); + if (m_PxType->pixType == GDT_Byte) { SetComponentType(UCHAR); @@ -809,7 +636,7 @@ void GDALImageIO::InternalReadImageInformation() // we are reading a complex data set into an image where the pixel // type is Vector<real>: we have to double the number of component // for that to work - otbMsgDevMacro( << "GDALtypeIO= Complex and IFReader::InternalPixelType= Scalar and IFReader::PixelType= Vector"); + otbLogMacro(Warning,<<"Encoding of file ("<<m_FileName<<") is complex but will be read as a VectorImage of scalar type, with twice the number of bands."); this->SetNumberOfComponents(m_NbBands*2); this->SetPixelType(VECTOR); } @@ -831,12 +658,6 @@ void GDALImageIO::InternalReadImageInformation() } } - /*** Parameters set by Internal Read function ***/ - otbMsgDevMacro( << "Pixel Type IFReader = " << GetPixelTypeAsString(this->GetPixelType()) ) - otbMsgDevMacro( << "Number of component IFReader = " << this->GetNumberOfComponents() ) - otbMsgDevMacro( << "Byte per pixel set = " << m_BytePerPixel ) - otbMsgDevMacro( << "Component Type set = " << GetComponentTypeAsString(this->GetComponentType()) ); - /*----------------------------------------------------------------------*/ /*-------------------------- METADATA ----------------------------------*/ /*----------------------------------------------------------------------*/ @@ -854,8 +675,6 @@ void GDALImageIO::InternalReadImageInformation() if(blockSizeX > 0 && blockSizeY > 0) { - otbMsgDevMacro(<< "Original blockSize: "<< blockSizeX << " x " << blockSizeY ); - blockSizeX = uint_ceildivpow2(blockSizeX,m_ResolutionFactor); if (m_Dataset->IsJPEG2000()) { @@ -868,8 +687,6 @@ void GDALImageIO::InternalReadImageInformation() blockSizeY = blockSizeY * (1 << m_ResolutionFactor); } - otbMsgDevMacro(<< "Decimated blockSize: "<< blockSizeX << " x " << blockSizeY ); - itk::EncapsulateMetaData<unsigned int>(dict, MetaDataKey::TileHintX, blockSizeX); itk::EncapsulateMetaData<unsigned int>(dict, MetaDataKey::TileHintY, blockSizeY); } @@ -948,7 +765,6 @@ void GDALImageIO::InternalReadImageInformation() } else { - otbMsgDevMacro( << "No projection => sensor model" ); // Special case for Jpeg2000 files : try to read the origin in the GML box if (m_Dataset->IsJPEG2000()) { @@ -1044,7 +860,7 @@ void GDALImageIO::InternalReadImageInformation() } else { - otbWarningMacro(<< "Incorrect geotransform (spacing = 0)!"); + otbLogMacro(Warning,<< "Geotransform reported by GDAL is invalid (spacing = 0)"); m_Spacing[0] = 1; m_Spacing[1] = 1; } @@ -1065,23 +881,6 @@ void GDALImageIO::InternalReadImageInformation() m_Origin[0] += 0.5*m_Spacing[0]; m_Origin[1] += 0.5*m_Spacing[1]; - // Dataset info - otbMsgDevMacro(<< "**** ReadImageInformation() DATASET INFO: ****" ); - otbMsgDevMacro(<< "Projection Ref: "<< dataset->GetProjectionRef() ); - double GT[6]; - if (dataset->GetGeoTransform(GT) == CE_None) - { - otbMsgDevMacro( <<"Geo Transform: "<< GT[0] << ", " << GT[1] << ", " - << GT[2] << ", " << GT[3] << ", " - << GT[4] << ", " << GT[5] ); - } - else - { - otbMsgDevMacro( << "No Geo Transform: "); - } - otbMsgDevMacro(<< "GCP Projection Ref: "<< dataset->GetGCPProjection() ); - otbMsgDevMacro(<< "GCP Count: " << dataset->GetGCPCount() ); - /* -------------------------------------------------------------------- */ /* Report metadata. */ /* -------------------------------------------------------------------- */ @@ -1289,7 +1088,6 @@ bool GDALImageIO::CanWriteFile(const char* name) // First check the filename if (name == ITK_NULLPTR) { - itkDebugMacro(<< "No filename specified."); return false; } @@ -1307,7 +1105,7 @@ bool GDALImageIO::CanWriteFile(const char* name) if ( GDALGetMetadataItem( driver, GDAL_DCAP_CREATE, ITK_NULLPTR ) == ITK_NULLPTR && GDALGetMetadataItem( driver, GDAL_DCAP_CREATECOPY, ITK_NULLPTR ) == ITK_NULLPTR ) { - itkDebugMacro(<< "The driver " << GDALGetDriverShortName(driver) << " does not support writing"); + otbLogMacro(Warning,<< "GDAL driver " << GDALGetDriverShortName(driver) << " does not support writing"); return false; } return true; @@ -1321,7 +1119,6 @@ bool GDALImageIO::CanStreamWrite() if (driver == ITK_NULLPTR) { - itkDebugMacro(<< "Unable to instantiate driver " << gdalDriverShortName); m_CanStreamWrite = false; } if ( GDALGetMetadataItem( driver, GDAL_DCAP_CREATE, ITK_NULLPTR ) != ITK_NULLPTR ) @@ -1347,7 +1144,7 @@ void GDALImageIO::Write(const void* buffer) // Check if conversion succeed if (buffer == ITK_NULLPTR) { - itkExceptionMacro(<< "GDAL : Bad alloc"); + itkExceptionMacro(<< "Null buffer passed to GDALImageIO for writing."); return; } @@ -1373,18 +1170,7 @@ void GDALImageIO::Write(const void* buffer) // If driver supports streaming if (m_CanStreamWrite) { - - otbMsgDevMacro(<< "RasterIO Write requested region : " << this->GetIORegion() << - "\n, lFirstColumn =" << lFirstColumn << - "\n, lFirstLine =" << lFirstLine << - "\n, lNbColumns =" << lNbColumns << - "\n, lNbLines =" << lNbLines << - "\n, m_PxType =" << GDALGetDataTypeName(m_PxType->pixType) << - "\n, m_NbBands =" << m_NbBands << - "\n, m_BytePerPixel ="<< m_BytePerPixel << - "\n, Pixel offset =" << m_BytePerPixel * m_NbBands << // is nbComp * BytePerPixel - "\n, Line offset =" << m_BytePerPixel * m_NbBands * lNbColumns << // is pixelOffset * nbColumns - "\n, Band offset =" << m_BytePerPixel) // is BytePerPixel + otbLogMacro(Debug,<<"GDAL writes ["<<lFirstColumn<<", "<<lFirstColumn+lNbColumns-1<<"]x["<<lFirstLine<<", "<<lFirstLine+lNbLines-1<<"] x "<<m_NbBands<<" bands of type "<<GDALGetDataTypeName(m_PxType->pixType)<<" to file "<<m_FileName); otb::Stopwatch chrono = otb::Stopwatch::StartNew(); CPLErr lCrGdal = m_Dataset->GetDataSet()->RasterIO(GF_Write, @@ -1408,7 +1194,6 @@ void GDALImageIO::Write(const void* buffer) // Band offset is BytePerPixel m_BytePerPixel); chrono.Stop(); - otbMsgDevMacro(<< "RasterIO Write took " << chrono.GetElapsedMilliseconds() << " ms") // Check if writing succeed if (lCrGdal == CE_Failure) @@ -1416,6 +1201,9 @@ void GDALImageIO::Write(const void* buffer) itkExceptionMacro(<< "Error while writing image (GDAL format) '" << m_FileName.c_str() << "' : " << CPLGetLastErrorMsg()); } + + otbLogMacro(Debug,<< "GDAL write took " << chrono.GetElapsedMilliseconds() << " ms") + // Flush dataset cache m_Dataset->GetDataSet()->FlushCache(); } @@ -1582,55 +1370,6 @@ void GDALImageIO::InternalWriteImageInformation(const void* buffer) if (m_CanStreamWrite) { GDALCreationOptionsType creationOptions = m_CreationOptions; -/* - // Force tile mode for TIFF format if no creation option are given - if( driverShortName == "GTiff" ) - { - if ( CreationOptionContains( "TILED=YES" ) ) - { - // User requested tiled TIFF explicitly - // - // Let GDAL set up the BLOCKXSIZE and BLOCKYSIZE - // or suppose the user have set it also along with TILED=YES - // This allows the user to have complete - // control over the tiling scheme - } - else if ( CreationOptionContains( "BLOCKYSIZE=" ) ) - { - // User did not set "TILED=YES" but set "BLOCKYSIZE=" - // -> He requested a stripped TIFF - } - else - { - // User did not specify "TILED=YES" nor "BLOCKYSIZE=?" - // Switch to TILED mode automatically, and choose BLOCKXSIZE and BLOCKYSIZE for him - - otbMsgDevMacro(<< "Enabling TIFF Tiled mode") - - // Use a fixed tile size - // Take as reference is a 256*256 short int 4 bands tile - const unsigned int ReferenceTileSizeInBytes = 256 * 256 * 4 * 2; - const unsigned int NbPixelPerTile = ReferenceTileSizeInBytes / m_BytePerPixel / m_NbBands; - const unsigned int IdealTileDimension = static_cast<unsigned int>( vcl_sqrt(static_cast<float>(NbPixelPerTile)) ); - - // Set tileDimension to the nearest power of two and aligned to - // 16 pixels (needed by TIFF spec) - unsigned int tileDimension = 16; - while(2*tileDimension < IdealTileDimension) - { - tileDimension*=2; - } - otbMsgDevMacro(<< "Tile dimension : " << tileDimension << " * " << tileDimension) - - std::ostringstream tileDimensionStr; - tileDimensionStr << tileDimension; - - creationOptions.push_back( "TILED=YES" ); - creationOptions.push_back( std::string("BLOCKXSIZE=") + tileDimensionStr.str() ); - creationOptions.push_back( std::string("BLOCKYSIZE=") + tileDimensionStr.str() ); - } - } -*/ m_Dataset = GDALDriverManagerWrapper::GetInstance().Create( driverShortName, GetGdalWriteImageFileName(driverShortName, m_FileName), @@ -1691,7 +1430,7 @@ void GDALImageIO::InternalWriteImageInformation(const void* buffer) // If there is no ProjectionRef, and the GeoTransform is not the identity, // then saving also GCPs is undefined behavior for GDAL, and a WGS84 projection crs // is assigned arbitrarily - otbMsgDevMacro(<< "Skipping GCPs saving to prevent GDAL from assigning a WGS84 projection ref to the file") + otbLogMacro(Warning,<< "Skipping GCPs saving to prevent GDAL from assigning a WGS84 projref to file ("<<m_FileName<<")") } else { @@ -1802,7 +1541,6 @@ void GDALImageIO::InternalWriteImageInformation(const void* buffer) unsigned int equalityPos = svalue.find_first_of('='); std::string tag = svalue.substr(0, equalityPos); std::string value = svalue.substr(equalityPos + 1); - otbMsgDevMacro(<< "Metadata: " << tag << "=" << value); dataset->SetMetadataItem(tag.c_str(), value.c_str(), ITK_NULLPTR); } } @@ -1810,24 +1548,6 @@ void GDALImageIO::InternalWriteImageInformation(const void* buffer) // END - // Dataset info - otbMsgDevMacro( << "**** WriteImageInformation() DATASET INFO: ****" ); - otbMsgDevMacro( << "Projection Ref: "<<dataset->GetProjectionRef() ); - double GT[6]; - if (dataset->GetGeoTransform(GT) == CE_None) - { - otbMsgDevMacro( <<"Geo Transform: "<< GT[0] << ", " << GT[1] << ", " - << GT[2] << ", " << GT[3] << ", " - << GT[4] << ", " << GT[5] ); - } - else - { - otbMsgDevMacro( << "No Geo Transform: "); - } - - otbMsgDevMacro( << "GCP Projection Ref: "<< dataset->GetGCPProjection() ); - otbMsgDevMacro( << "GCP Count: " << dataset->GetGCPCount() ); - // Write no-data flags std::vector<bool> noDataValueAvailable; bool ret = itk::ExposeMetaData<std::vector<bool> >(dict,MetaDataKey::NoDataValueAvailable,noDataValueAvailable); @@ -1926,7 +1646,6 @@ bool GDALImageIO::GetOriginFromGMLBox(std::vector<double> &origin) std::string gmlString = static_cast<std::string>(jp2Metadata.papszGMLMetadata[0]); gmlString.erase(0,18); // We need to remove first part to create a true xml stream - otbMsgDevMacro( << "XML extract from GML box: " << gmlString ); TiXmlDocument doc; doc.Parse(gmlString.c_str()); // Create xml doc from a string @@ -1942,13 +1661,8 @@ bool GDALImageIO::GetOriginFromGMLBox(std::vector<double> &origin) .FirstChild( "gml:limits" ) .FirstChild( "gml:GridEnvelope" ) .FirstChild( "gml:low").ToElement(); - if(originTag) + if(!originTag) { - otbMsgDevMacro( << "\t Origin (" << originTag->Value() <<" tag)= "<< originTag->GetText()); - } - else - { - otbMsgDevMacro( << "Didn't find the GML element which indicate the origin!" ); return false; } @@ -1963,8 +1677,6 @@ bool GDALImageIO::GetOriginFromGMLBox(std::vector<double> &origin) origin[0] += -1.0; origin[1] += -1.0; - otbMsgDevMacro( << "\t Origin from GML box: " << origin[0] << ", " << origin[1] ); - return true; } diff --git a/Modules/IO/IOKML/include/otbKMLVectorDataIO.h b/Modules/IO/IOKML/include/otbKMLVectorDataIO.h index a48dfcb3092447a4ccc3dfb1dd7da05c5ebc75e9..c991edea6cba7c9e697d52109ad95f4ba9ff4034 100644 --- a/Modules/IO/IOKML/include/otbKMLVectorDataIO.h +++ b/Modules/IO/IOKML/include/otbKMLVectorDataIO.h @@ -90,27 +90,27 @@ public: /** Determine the file type. Returns true if this VectorDataIO can read the * file specified. */ - bool CanReadFile(const char*) const ITK_OVERRIDE; + bool CanReadFile(const char*) const override; /** Reads the data from disk into the data structure provided. */ - void Read(itk::DataObject* data) ITK_OVERRIDE; + void Read(itk::DataObject* data) override; /*-------- This part of the interfaces deals with writing data. ----- */ /** Determine the file type. Returns true if this VectorDataIO can read the * file specified. */ - bool CanWriteFile(const char*) const ITK_OVERRIDE; + bool CanWriteFile(const char*) const override; /** Writes the data to disk from the data structure provided */ - void Write(const itk::DataObject* data, char ** papszOptions = ITK_NULLPTR) ITK_OVERRIDE; + void Write(const itk::DataObject* data, char ** papszOptions = ITK_NULLPTR) override; protected: /** Constructor.*/ KMLVectorDataIO(); /** Destructor.*/ - ~KMLVectorDataIO() ITK_OVERRIDE; + ~KMLVectorDataIO() override; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; static const kmldom::FeaturePtr GetRootFeature(const kmldom::ElementPtr& root); diff --git a/Modules/IO/IOKML/include/otbKMLVectorDataIOFactory.h b/Modules/IO/IOKML/include/otbKMLVectorDataIOFactory.h index b480454ac9646647ab56d930257abd8a1747b386..590eaf25febae3f68a6447d51a3bb43b20a7c660 100644 --- a/Modules/IO/IOKML/include/otbKMLVectorDataIOFactory.h +++ b/Modules/IO/IOKML/include/otbKMLVectorDataIOFactory.h @@ -40,8 +40,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - const char* GetITKSourceVersion(void) const ITK_OVERRIDE; - const char* GetDescription(void) const ITK_OVERRIDE; + const char* GetITKSourceVersion(void) const override; + const char* GetDescription(void) const override; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -58,7 +58,7 @@ public: protected: KMLVectorDataIOFactory(); - ~KMLVectorDataIOFactory() ITK_OVERRIDE; + ~KMLVectorDataIOFactory() override; private: KMLVectorDataIOFactory(const Self &); //purposely not implemented diff --git a/Modules/IO/IOLUM/include/otbLUMImageIO.h b/Modules/IO/IOLUM/include/otbLUMImageIO.h index 0597064be56c99b075db81b49241c0e6b2796503..effe0388ca6875025a44580ef59af973ac6f122d 100644 --- a/Modules/IO/IOLUM/include/otbLUMImageIO.h +++ b/Modules/IO/IOLUM/include/otbLUMImageIO.h @@ -62,19 +62,19 @@ public: /** Determine the file type. Returns true if this ImageIO can read the * file specified. */ - bool CanReadFile(const char*) ITK_OVERRIDE; + bool CanReadFile(const char*) override; /** Determine the file type. Returns true if the ImageIO can stream read the specified file */ - bool CanStreamRead() ITK_OVERRIDE + bool CanStreamRead() override { return true; } /** Set the spacing and dimension information for the set filename. */ - void ReadImageInformation() ITK_OVERRIDE; + void ReadImageInformation() override; /** Reads the data from disk into the memory buffer provided. */ - void Read(void* buffer) ITK_OVERRIDE; + void Read(void* buffer) override; /** Reads 3D data from multiple files assuming one slice per file. */ virtual void ReadVolume(void* buffer); @@ -83,27 +83,27 @@ public: /** Determine the file type. Returns true if this ImageIO can read the * file specified. */ - bool CanWriteFile(const char*) ITK_OVERRIDE; + bool CanWriteFile(const char*) override; /** Determine the file type. Returns true if the ImageIO can stream write the specified file */ - bool CanStreamWrite() ITK_OVERRIDE + bool CanStreamWrite() override { return true; } /** Writes the spacing and dimensions of the image. * Assumes SetFileName has been called with a valid file name. */ - void WriteImageInformation() ITK_OVERRIDE; + void WriteImageInformation() override; /** Writes the data to disk from the memory buffer provided. Make sure * that the IORegion has been set properly. */ - void Write(const void* buffer) ITK_OVERRIDE; + void Write(const void* buffer) override; // JULIEN: NOT USED, NOT IMPLEMENTED //void SampleImage(void* buffer, int XBegin, int YBegin, int SizeXRead, int SizeYRead, int XSample, int YSample); /** Get the number of overviews available into the file specified * This imageIO didn't support overviews */ - unsigned int GetOverviewsCount() ITK_OVERRIDE + unsigned int GetOverviewsCount() override { // MANTIS-1154: Source image is always considered as the best // resolution overview. @@ -112,7 +112,7 @@ public: /** Get information about overviews available into the file specified * This imageIO didn't support overviews */ - std::vector<std::string> GetOverviewsInfo() ITK_OVERRIDE + std::vector<std::string> GetOverviewsInfo() override { std::vector<std::string> desc; return desc; @@ -121,13 +121,13 @@ public: /** Provide hist about the output container to deal with complex pixel * type (Not used here) */ void SetOutputImagePixelType( bool itkNotUsed(isComplexInternalPixelType), - bool itkNotUsed(isVectorImage)) ITK_OVERRIDE{} + bool itkNotUsed(isVectorImage)) override{} protected: /** Constructor.*/ LUMImageIO(); /** Destructor.*/ - ~LUMImageIO() ITK_OVERRIDE; + ~LUMImageIO() override; bool OpenOneraDataFileForReading(const char* filename); bool OpenOneraHeaderFileForReading(const char* filename); @@ -136,7 +136,7 @@ protected: bool OpenOneraDataFileForWriting(const char* filename); bool OpenOneraHeaderFileForWriting(const char* filename); - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: LUMImageIO(const Self &); //purposely not implemented diff --git a/Modules/IO/IOLUM/include/otbLUMImageIOFactory.h b/Modules/IO/IOLUM/include/otbLUMImageIOFactory.h index 8a11fe3595350e2c77a2e50e3062cf25252e6c93..f1c06592f7270c4125e2a7db778ce558c15ff8b2 100644 --- a/Modules/IO/IOLUM/include/otbLUMImageIOFactory.h +++ b/Modules/IO/IOLUM/include/otbLUMImageIOFactory.h @@ -40,8 +40,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - const char* GetITKSourceVersion(void) const ITK_OVERRIDE; - const char* GetDescription(void) const ITK_OVERRIDE; + const char* GetITKSourceVersion(void) const override; + const char* GetDescription(void) const override; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -59,7 +59,7 @@ public: protected: LUMImageIOFactory(); - ~LUMImageIOFactory() ITK_OVERRIDE; + ~LUMImageIOFactory() override; private: LUMImageIOFactory(const Self &); //purposely not implemented diff --git a/Modules/IO/IOMSTAR/include/otbMSTARImageIO.h b/Modules/IO/IOMSTAR/include/otbMSTARImageIO.h index 6de01a473c4ebc5253c46dc4098853eec2f356c0..fed00e395b42e341387940c2054ed02d45d10213 100644 --- a/Modules/IO/IOMSTAR/include/otbMSTARImageIO.h +++ b/Modules/IO/IOMSTAR/include/otbMSTARImageIO.h @@ -55,47 +55,47 @@ public: /** Determine the file type. Returns true if this ImageIO can read the * file specified. */ - bool CanReadFile(const char*) ITK_OVERRIDE; + bool CanReadFile(const char*) override; /** Determine the file type. Returns true if the ImageIO can stream read the specified file */ - bool CanStreamRead() ITK_OVERRIDE + bool CanStreamRead() override { return true; } /** Set the spacing and dimension information for the set filename. */ - void ReadImageInformation() ITK_OVERRIDE; + void ReadImageInformation() override; /** Reads the data from disk into the memory buffer provided. */ - void Read(void* buffer) ITK_OVERRIDE; + void Read(void* buffer) override; /*-------- This part of the interfaces deals with writing data. ----- */ /** Determine the file type. Returns true if this ImageIO can write the * file specified. */ - bool CanWriteFile(const char*) ITK_OVERRIDE; + bool CanWriteFile(const char*) override; /** Determine the file type. Returns true if the ImageIO can stream write the specified file */ - bool CanStreamWrite() ITK_OVERRIDE + bool CanStreamWrite() override { return true; } /** Set the spacing and dimension information for the set filename. */ - void WriteImageInformation() ITK_OVERRIDE; + void WriteImageInformation() override; /** Writes the data to disk from the memory buffer provided. Make sure * that the IORegions has been set properly. */ - void Write(const void* buffer) ITK_OVERRIDE; + void Write(const void* buffer) override; MSTARImageIO(); - ~MSTARImageIO() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~MSTARImageIO() override; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Get the number of overviews available into the file specified * This imageIO didn't support overviews */ - unsigned int GetOverviewsCount() ITK_OVERRIDE + unsigned int GetOverviewsCount() override { // MANTIS-1154: Source image is always considered as the best // resolution overview. @@ -104,7 +104,7 @@ public: /** Get information about overviews available into the file specified * This imageIO didn't support overviews */ - std::vector<std::string> GetOverviewsInfo() ITK_OVERRIDE + std::vector<std::string> GetOverviewsInfo() override { std::vector<std::string> desc; return desc; @@ -113,7 +113,7 @@ public: /** Provide hist about the output container to deal with complex pixel * type (Not used here) */ void SetOutputImagePixelType( bool itkNotUsed(isComplexInternalPixelType), - bool itkNotUsed(isVectorImage)) ITK_OVERRIDE{} + bool itkNotUsed(isVectorImage)) override{} private: MSTARImageIO(const Self &); //purposely not implemented diff --git a/Modules/IO/IOMSTAR/include/otbMSTARImageIOFactory.h b/Modules/IO/IOMSTAR/include/otbMSTARImageIOFactory.h index c72d136008073418960c46cb0e14b406cfea219a..0b980fd77e409f9f58bdc372647c01161e1904b7 100644 --- a/Modules/IO/IOMSTAR/include/otbMSTARImageIOFactory.h +++ b/Modules/IO/IOMSTAR/include/otbMSTARImageIOFactory.h @@ -40,8 +40,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - const char* GetITKSourceVersion(void) const ITK_OVERRIDE; - const char* GetDescription(void) const ITK_OVERRIDE; + const char* GetITKSourceVersion(void) const override; + const char* GetDescription(void) const override; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -59,7 +59,7 @@ public: protected: MSTARImageIOFactory(); - ~MSTARImageIOFactory() ITK_OVERRIDE; + ~MSTARImageIOFactory() override; private: MSTARImageIOFactory(const Self &); //purposely not implemented diff --git a/Modules/IO/IOONERA/include/otbONERAImageIO.h b/Modules/IO/IOONERA/include/otbONERAImageIO.h index 3715471e8ffc7e8931298f218b726293fbe32871..620f9ddb6fc4cf26637ab9efd59fe5b77d73b87d 100644 --- a/Modules/IO/IOONERA/include/otbONERAImageIO.h +++ b/Modules/IO/IOONERA/include/otbONERAImageIO.h @@ -60,19 +60,19 @@ public: /** Determine the file type. Returns true if this ImageIO can read the * file specified. */ - bool CanReadFile(const char*) ITK_OVERRIDE; + bool CanReadFile(const char*) override; /** Determine the file type. Returns true if the ImageIO can stream read the specified file */ - bool CanStreamRead() ITK_OVERRIDE + bool CanStreamRead() override { return true; } /** Set the spacing and dimension information for the set filename. */ - void ReadImageInformation() ITK_OVERRIDE; + void ReadImageInformation() override; /** Reads the data from disk into the memory buffer provided. */ - void Read(void* buffer) ITK_OVERRIDE; + void Read(void* buffer) override; /** Reads 3D data from multiple files assuming one slice per file. */ virtual void ReadVolume(void* buffer); @@ -81,27 +81,27 @@ public: /** Determine the file type. Returns true if this ImageIO can read the * file specified. */ - bool CanWriteFile(const char*) ITK_OVERRIDE; + bool CanWriteFile(const char*) override; /** Determine the file type. Returns true if the ImageIO can stream write the specified file */ - bool CanStreamWrite() ITK_OVERRIDE + bool CanStreamWrite() override { return true; } /** Writes the spacing and dimensions of the image. * Assumes SetFileName has been called with a valid file name. */ - void WriteImageInformation() ITK_OVERRIDE; + void WriteImageInformation() override; /** Writes the data to disk from the memory buffer provided. Make sure * that the IORegion has been set properly. */ - void Write(const void* buffer) ITK_OVERRIDE; + void Write(const void* buffer) override; // JULIEN: NOT USED, NOT IMPLEMENTED //void SampleImage(void* buffer, int XBegin, int YBegin, int SizeXRead, int SizeYRead, int XSample, int YSample); /** Get the number of overviews available into the file specified * This imageIO didn't support overviews */ - unsigned int GetOverviewsCount() ITK_OVERRIDE + unsigned int GetOverviewsCount() override { // MANTIS-1154: Source image is always considered as the best // resolution overview. @@ -110,7 +110,7 @@ public: /** Get information about overviews available into the file specified * This imageIO didn't support overviews */ - std::vector<std::string> GetOverviewsInfo() ITK_OVERRIDE + std::vector<std::string> GetOverviewsInfo() override { std::vector<std::string> desc; return desc; @@ -119,13 +119,13 @@ public: /** Provide hist about the output container to deal with complex pixel * type (Not used here) */ void SetOutputImagePixelType( bool itkNotUsed(isComplexInternalPixelType), - bool itkNotUsed(isVectorImage)) ITK_OVERRIDE{} + bool itkNotUsed(isVectorImage)) override{} protected: /** Constructor.*/ ONERAImageIO(); /** Destructor.*/ - ~ONERAImageIO() ITK_OVERRIDE; + ~ONERAImageIO() override; bool OpenOneraDataFileForReading(const char* filename); bool OpenOneraHeaderFileForReading(const char* filename); @@ -136,7 +136,7 @@ protected: bool OpenOneraDataFileForWriting(const char* filename); bool OpenOneraHeaderFileForWriting(const char* filename); - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Dimension along Ox of the image*/ int m_width; diff --git a/Modules/IO/IOONERA/include/otbONERAImageIOFactory.h b/Modules/IO/IOONERA/include/otbONERAImageIOFactory.h index 7b0f638342c194ccad3225185dd4f5cad5ba47d4..673360712754c7fa61f19477666daf655ed7c841 100644 --- a/Modules/IO/IOONERA/include/otbONERAImageIOFactory.h +++ b/Modules/IO/IOONERA/include/otbONERAImageIOFactory.h @@ -40,8 +40,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - const char* GetITKSourceVersion(void) const ITK_OVERRIDE; - const char* GetDescription(void) const ITK_OVERRIDE; + const char* GetITKSourceVersion(void) const override; + const char* GetDescription(void) const override; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -59,7 +59,7 @@ public: protected: ONERAImageIOFactory(); - ~ONERAImageIOFactory() ITK_OVERRIDE; + ~ONERAImageIOFactory() override; private: ONERAImageIOFactory(const Self &); //purposely not implemented diff --git a/Modules/IO/IORAD/include/otbRADImageIO.h b/Modules/IO/IORAD/include/otbRADImageIO.h index c5ebbd9aee2f0e5474f7b8e6b3ba26224547cc5b..d7823fd036d9c7b317f725630f25dd5904b3a423 100644 --- a/Modules/IO/IORAD/include/otbRADImageIO.h +++ b/Modules/IO/IORAD/include/otbRADImageIO.h @@ -62,19 +62,19 @@ public: /** Determine the file type. Returns true if this ImageIO can read the * file specified. */ - bool CanReadFile(const char*) ITK_OVERRIDE; + bool CanReadFile(const char*) override; /** Determine the file type. Returns true if the ImageIO can stream read the specified file */ - bool CanStreamRead() ITK_OVERRIDE + bool CanStreamRead() override { return true; } /** Set the spacing and dimension information for the set filename. */ - void ReadImageInformation() ITK_OVERRIDE; + void ReadImageInformation() override; /** Reads the data from disk into the memory buffer provided. */ - void Read(void* buffer) ITK_OVERRIDE; + void Read(void* buffer) override; /** Reads 3D data from multiple files assuming one slice per file. */ virtual void ReadVolume(void* buffer); @@ -83,28 +83,28 @@ public: /** Determine the file type. Returns true if this ImageIO can read the * file specified. */ - bool CanWriteFile(const char*) ITK_OVERRIDE; + bool CanWriteFile(const char*) override; /** Determine the file type. Returns true if the ImageIO can stream write the specified file */ - bool CanStreamWrite() ITK_OVERRIDE + bool CanStreamWrite() override { return true; } /** Writes the spacing and dimensions of the image. * Assumes SetFileName has been called with a valid file name. */ - void WriteImageInformation() ITK_OVERRIDE; + void WriteImageInformation() override; /** Writes the data to disk from the memory buffer provided. Make sure * that the IORegion has been set properly. */ - void Write(const void* buffer) ITK_OVERRIDE; + void Write(const void* buffer) override; // JULIEN: NOT USED, NOT IMPLEMENTED // void SampleImage(void* buffer, int XBegin, int YBegin, int SizeXRead, int SizeYRead, int XSample, int YSample); /** Get the number of overviews available into the file specified * This imageIO didn't support overviews */ - unsigned int GetOverviewsCount() ITK_OVERRIDE + unsigned int GetOverviewsCount() override { // MANTIS-1154: Source image is always considered as the best // resolution overview. @@ -113,7 +113,7 @@ public: /** Get information about overviews available into the file specified * This imageIO didn't support overviews */ - std::vector<std::string> GetOverviewsInfo() ITK_OVERRIDE + std::vector<std::string> GetOverviewsInfo() override { std::vector<std::string> desc; return desc; @@ -122,13 +122,13 @@ public: /** Provide hist about the output container to deal with complex pixel * type (Not used here) */ void SetOutputImagePixelType( bool itkNotUsed(isComplexInternalPixelType), - bool itkNotUsed(isVectorImage)) ITK_OVERRIDE{} + bool itkNotUsed(isVectorImage)) override{} protected: /** Constructor.*/ RADImageIO(); /** Destructor.*/ - ~RADImageIO() ITK_OVERRIDE; + ~RADImageIO() override; bool OpenOneraDataFileForReading(const char* filename); bool OpenOneraHeaderFileForReading(const char* filename); @@ -138,7 +138,7 @@ protected: bool OpenOneraDataFileForWriting(const char* filename); bool OpenOneraHeaderFileForWriting(const char* filename); - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: RADImageIO(const Self &); //purposely not implemented diff --git a/Modules/IO/IORAD/include/otbRADImageIOFactory.h b/Modules/IO/IORAD/include/otbRADImageIOFactory.h index 19f884fd399ef2cbe37844c9448f4a303aa58603..1a01a6187ab2faca7555001d06d610d1d024bd51 100644 --- a/Modules/IO/IORAD/include/otbRADImageIOFactory.h +++ b/Modules/IO/IORAD/include/otbRADImageIOFactory.h @@ -40,8 +40,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - const char* GetITKSourceVersion(void) const ITK_OVERRIDE; - const char* GetDescription(void) const ITK_OVERRIDE; + const char* GetITKSourceVersion(void) const override; + const char* GetDescription(void) const override; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -59,7 +59,7 @@ public: protected: RADImageIOFactory(); - ~RADImageIOFactory() ITK_OVERRIDE; + ~RADImageIOFactory() override; private: RADImageIOFactory(const Self &); //purposely not implemented diff --git a/Modules/IO/IOTileMap/include/otbTileMapImageIO.h b/Modules/IO/IOTileMap/include/otbTileMapImageIO.h index 99ac2bd784995c50727cd8129538cff8a60dcfa6..27a8db556e7c157f8a0f0d312e7a0d5cb31c2960 100644 --- a/Modules/IO/IOTileMap/include/otbTileMapImageIO.h +++ b/Modules/IO/IOTileMap/include/otbTileMapImageIO.h @@ -92,41 +92,41 @@ public: /** Determine the file type. Returns true if this ImageIO can read the * file specified. */ - bool CanReadFile(const char*) ITK_OVERRIDE; + bool CanReadFile(const char*) override; /** Determine the file type. Returns true if the ImageIO can stream read the specified file */ - bool CanStreamRead() ITK_OVERRIDE + bool CanStreamRead() override { return true; } /** Set the spacing and dimension information for the set filename. */ - void ReadImageInformation() ITK_OVERRIDE; + void ReadImageInformation() override; /** Reads the data from disk into the memory buffer provided. */ - void Read(void* buffer) ITK_OVERRIDE; + void Read(void* buffer) override; /** Determine the file type. Returns true if this ImageIO can read the * file specified. */ - bool CanWriteFile(const char*) ITK_OVERRIDE; + bool CanWriteFile(const char*) override; /** Determine the file type. Returns true if the ImageIO can stream write the specified file */ - bool CanStreamWrite() ITK_OVERRIDE + bool CanStreamWrite() override { return true; } /** Writes the spacing and dimensions of the image. * Assumes SetFileName has been called with a valid file name. */ - void WriteImageInformation() ITK_OVERRIDE; + void WriteImageInformation() override; /** Writes the data to disk from the memory buffer provided. Make sure * that the IORegion has been set properly. */ - void Write(const void* buffer) ITK_OVERRIDE; + void Write(const void* buffer) override; /** Get the number of overviews available into the file specified * This imageIO didn't support overviews */ - unsigned int GetOverviewsCount() ITK_OVERRIDE + unsigned int GetOverviewsCount() override { // MANTIS-1154: Source image is always considered as the best // resolution overview. @@ -135,7 +135,7 @@ public: /** Get information about overviews available into the file specified * This imageIO didn't support overviews */ - std::vector<std::string> GetOverviewsInfo() ITK_OVERRIDE + std::vector<std::string> GetOverviewsInfo() override { std::vector<std::string> desc; return desc; @@ -144,26 +144,26 @@ public: /** Provide hist about the output container to deal with complex pixel * type (Not used here) */ void SetOutputImagePixelType( bool itkNotUsed(isComplexInternalPixelType), - bool itkNotUsed(isVectorImage)) ITK_OVERRIDE{} + bool itkNotUsed(isVectorImage)) override{} protected: /** Constructor.*/ TileMapImageIO(); /** Destructor.*/ - ~TileMapImageIO() ITK_OVERRIDE; + ~TileMapImageIO() override; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Read all information on the image*/ void InternalReadImageInformation(); /** Write all information on the image*/ void InternalWriteImageInformation(); unsigned int GetActualNumberOfSplitsForWritingCanStreamWrite(unsigned int numberOfRequestedSplits, - const ImageIORegion& pasteRegion) const ITK_OVERRIDE; + const ImageIORegion& pasteRegion) const override; ImageIORegion GetSplitRegionForWritingCanStreamWrite(unsigned int ithPiece, unsigned int numberOfActualSplits, - const ImageIORegion& pasteRegion) const ITK_OVERRIDE; + const ImageIORegion& pasteRegion) const override; /** Number of bands of the image*/ int m_NbBands; diff --git a/Modules/IO/IOTileMap/include/otbTileMapImageIOFactory.h b/Modules/IO/IOTileMap/include/otbTileMapImageIOFactory.h index 9edcbc2365c96a68602000a04bb38a462acababd..e946e4064163dd3df2ddd3c37d78827bdfa88798 100644 --- a/Modules/IO/IOTileMap/include/otbTileMapImageIOFactory.h +++ b/Modules/IO/IOTileMap/include/otbTileMapImageIOFactory.h @@ -42,8 +42,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - const char* GetITKSourceVersion(void) const ITK_OVERRIDE; - const char* GetDescription(void) const ITK_OVERRIDE; + const char* GetITKSourceVersion(void) const override; + const char* GetDescription(void) const override; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -61,7 +61,7 @@ public: protected: TileMapImageIOFactory(); - ~TileMapImageIOFactory() ITK_OVERRIDE; + ~TileMapImageIOFactory() override; private: TileMapImageIOFactory(const Self &); //purposely not implemented diff --git a/Modules/IO/IOTileMap/include/otbTileMapImageIOHelper.h b/Modules/IO/IOTileMap/include/otbTileMapImageIOHelper.h index 412e31f2cf32776aef1af1767b9ecc8869e9475d..b9286c5cb7545959cf7d7dbc6ce8b49e415203dd 100644 --- a/Modules/IO/IOTileMap/include/otbTileMapImageIOHelper.h +++ b/Modules/IO/IOTileMap/include/otbTileMapImageIOHelper.h @@ -58,7 +58,7 @@ public: protected: TileMapImageIOHelper() {} - ~TileMapImageIOHelper() ITK_OVERRIDE {} + ~TileMapImageIOHelper() override {} private: TileMapImageIOHelper(const Self &); //purposely not implemented diff --git a/Modules/IO/IOXML/include/otbStatisticsXMLFileReader.h b/Modules/IO/IOXML/include/otbStatisticsXMLFileReader.h index 3eb362df0fac98224c95ad90c53642fe08071ab0..bf4dc01a6cf2cc446b18cc112eb4abffa091ab20 100644 --- a/Modules/IO/IOXML/include/otbStatisticsXMLFileReader.h +++ b/Modules/IO/IOXML/include/otbStatisticsXMLFileReader.h @@ -64,7 +64,7 @@ public: typedef std::map<std::string , std::string> GenericMapType; typedef std::map<std::string , GenericMapType> GenericMapContainer; - void Modified() const ITK_OVERRIDE + void Modified() const override { m_IsUpdated = false; } @@ -95,8 +95,8 @@ protected: virtual void Read(); StatisticsXMLFileReader(); - ~StatisticsXMLFileReader() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~StatisticsXMLFileReader() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: StatisticsXMLFileReader(const Self&); //purposely not implemented diff --git a/Modules/IO/IOXML/include/otbStatisticsXMLFileWriter.h b/Modules/IO/IOXML/include/otbStatisticsXMLFileWriter.h index 0ea02ea82f5cd7401a953b5c34703e649d44b348..c39686c525d700daeb2892e9c11ce5e4880c85da 100644 --- a/Modules/IO/IOXML/include/otbStatisticsXMLFileWriter.h +++ b/Modules/IO/IOXML/include/otbStatisticsXMLFileWriter.h @@ -92,8 +92,8 @@ protected: virtual void GenerateData(); StatisticsXMLFileWriter(); - ~StatisticsXMLFileWriter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~StatisticsXMLFileWriter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: StatisticsXMLFileWriter(const Self&); //purposely not implemented diff --git a/Modules/IO/IOXML/include/otbStatisticsXMLFileWriter.txx b/Modules/IO/IOXML/include/otbStatisticsXMLFileWriter.txx index f1d830132a227162ceb539c3435fd8436b085de4..b20416b4d77617e0c23ea967603cbd910489ea5c 100644 --- a/Modules/IO/IOXML/include/otbStatisticsXMLFileWriter.txx +++ b/Modules/IO/IOXML/include/otbStatisticsXMLFileWriter.txx @@ -72,7 +72,7 @@ StatisticsXMLFileWriter<TMeasurementVector> itkExceptionMacro(<<"The XML output FileName is empty, please set the filename via the method SetFileName"); // Check that the right extension is given : expected .xml */ - std::string extension = itksys::SystemTools::GetFilenameLastExtension(m_FileName); + const std::string extension = itksys::SystemTools::GetFilenameLastExtension(m_FileName); if (itksys::SystemTools::LowerCase(extension) != ".xml") { itkExceptionMacro(<<extension diff --git a/Modules/IO/ImageIO/include/otbImageFileReader.h b/Modules/IO/ImageIO/include/otbImageFileReader.h index 631f9d7dc27fdda1020a734086e71b95607f7786..f2094973c91f914cdc10e79db218168b543f9937 100644 --- a/Modules/IO/ImageIO/include/otbImageFileReader.h +++ b/Modules/IO/ImageIO/include/otbImageFileReader.h @@ -118,17 +118,17 @@ public: typedef ExtendedFilenameToReaderOptions FNameHelperType; /** Prepare image allocation at the first call of the pipeline processing */ - void GenerateOutputInformation(void) ITK_OVERRIDE; + void GenerateOutputInformation(void) override; /** Does the real work. */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** Give the reader a chance to indicate that it will produce more * output than it was requested to produce. ImageFileReader cannot * currently read a portion of an image (since the ImageIO objects * cannot read a portion of an image), so the ImageFileReader must * enlarge the RequestedRegion to the size of the image on disk. */ - void EnlargeOutputRequestedRegion(itk::DataObject *output) ITK_OVERRIDE; + void EnlargeOutputRequestedRegion(itk::DataObject *output) override; /** Set/Get the ImageIO helper class. Often this is created via the object * factory mechanism that determines whether a particular ImageIO can @@ -158,8 +158,8 @@ public: protected: ImageFileReader(); - ~ImageFileReader() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~ImageFileReader() override; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Convert a block of pixels from one type to another. */ void DoConvertBuffer(void* buffer, size_t numberOfPixels); diff --git a/Modules/IO/ImageIO/include/otbImageFileReader.txx b/Modules/IO/ImageIO/include/otbImageFileReader.txx index 98a37bf87b51b5caade4258ab231a45b1f39c87a..512be71058983155680a18eab313c6f6fbb3f51f 100644 --- a/Modules/IO/ImageIO/include/otbImageFileReader.txx +++ b/Modules/IO/ImageIO/include/otbImageFileReader.txx @@ -107,7 +107,6 @@ void ImageFileReader<TOutputImage, ConvertPixelTraits> ::SetImageIO( otb::ImageIOBase * imageIO) { - itkDebugMacro("setting ImageIO to " << imageIO ); if (this->m_ImageIO != imageIO ) { this->m_ImageIO = imageIO; @@ -207,12 +206,6 @@ ImageFileReader<TOutputImage, ConvertPixelTraits> char * loadBuffer = new char[nbBytes]; - otbMsgDevMacro(<< "buffer size for ImageIO::read = " << nbBytes << " = \n" - << "ComponentSize ("<< this->m_ImageIO->GetComponentSize() << ") x " \ - << "Nb of Component ( max(" << this->m_ImageIO->GetNumberOfComponents() \ - << " , "<<m_BandList.size() << ") ) x " \ - << "Nb of Pixel to read (" << region.GetNumberOfPixels() << ")"); - this->m_ImageIO->Read(loadBuffer); if (m_FilenameHelper->BandRangeIsSet()) @@ -387,6 +380,17 @@ ImageFileReader<TOutputImage, ConvertPixelTraits> spacing[i] = 1.0; } origin[i] = 0.5*spacing[i]; + for (unsigned j = 0; j < TOutputImage::ImageDimension; ++j) + { + if (i == j) + { + direction[j][i] = 1.0; + } + else + { + direction[j][i] = 0.0; + } + } } } @@ -398,18 +402,40 @@ ImageFileReader<TOutputImage, ConvertPixelTraits> { std::string lFileNameOssimKeywordlist = GetDerivedDatasetSourceFileName(m_FileName); + std::string extension = itksys::SystemTools::GetFilenameLastExtension(lFileNameOssimKeywordlist); + std::string attachedGeom = lFileNameOssimKeywordlist.substr( + 0, + lFileNameOssimKeywordlist.size() - extension.size()) + std::string(".geom"); // Update otb Keywordlist ImageKeywordlist otb_kwl; - if (!m_FilenameHelper->ExtGEOMFileNameIsSet()) + + // Case 1: external geom supplied through extended filename + if (m_FilenameHelper->ExtGEOMFileNameIsSet()) { - otb_kwl = ReadGeometryFromImage(lFileNameOssimKeywordlist,!m_FilenameHelper->GetSkipRpcTag()); - otbMsgDevMacro(<< "Loading internal kwl"); + otb_kwl = ReadGeometryFromGEOMFile(m_FilenameHelper->GetExtGEOMFileName()); + otbLogMacro(Info,<< "Loading kwl metadata from external geom file "<< m_FilenameHelper->GetExtGEOMFileName()); } + // Case 2: attached geom (if present) + else if (itksys::SystemTools::FileExists(attachedGeom)) + { + otb_kwl = ReadGeometryFromGEOMFile(attachedGeom); + otbLogMacro(Info,<< "Loading kwl metadata from attached geom file "<<attachedGeom); + } + // Case 3: find an ossimPluginProjection + // Case 4: find an ossimProjection + // Case 5: find RPC tags in TIF else { - otb_kwl = ReadGeometryFromGEOMFile(m_FilenameHelper->GetExtGEOMFileName()); - otbMsgDevMacro(<< "Loading external kwl"); + otb_kwl = ReadGeometryFromImage(lFileNameOssimKeywordlist,!m_FilenameHelper->GetSkipRpcTag()); + if(!otb_kwl.Empty()) + { + otbLogMacro(Info,<< "Loading kwl metadata from official product in file "<<lFileNameOssimKeywordlist); + } + else + { + otbLogMacro(Info,<< "No kwl metadata found in file "<<lFileNameOssimKeywordlist); + } } // Don't add an empty ossim keyword list @@ -629,8 +655,6 @@ ImageFileReader<TOutputImage, ConvertPixelTraits> fic_trouve = true; } - otbMsgDevMacro(<< "lFileNameGdal : " << GdalFileName.c_str()); - otbMsgDevMacro(<< "fic_trouve : " << fic_trouve); return (fic_trouve); } diff --git a/Modules/IO/ImageIO/include/otbImageFileWriter.h b/Modules/IO/ImageIO/include/otbImageFileWriter.h index b7bc6499b089a47cf7c75822523e56fb9cf819e0..169e946c7579a241c7bed42424c561101d608912 100644 --- a/Modules/IO/ImageIO/include/otbImageFileWriter.h +++ b/Modules/IO/ImageIO/include/otbImageFileWriter.h @@ -25,6 +25,7 @@ #include "itkProcessObject.h" #include "otbStreamingManager.h" #include "otbExtendedFilenameToWriterOptions.h" +#include "itkFastMutexLock.h" namespace otb { @@ -168,7 +169,7 @@ public: /** Override Update() from ProcessObject because this filter * has no output. */ - void Update() ITK_OVERRIDE; + void Update() override; /** ImageFileWriter Methods */ virtual void SetFileName(const char* extendedFileName); @@ -199,13 +200,21 @@ public: itkGetObjectMacro(ImageIO, otb::ImageIOBase); itkGetConstObjectMacro(ImageIO, otb::ImageIOBase); + /** This override doesn't return a const ref on the actual boolean */ + const bool & GetAbortGenerateData() const override; + + void SetAbortGenerateData(const bool val) override; + protected: ImageFileWriter(); - ~ImageFileWriter() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~ImageFileWriter() override; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Does the real work. */ - void GenerateData(void) ITK_OVERRIDE; + void GenerateData(void) override; + + /** Prepare the streaming and write the output information on disk */ + void GenerateOutputInformation(void) override; private: ImageFileWriter(const ImageFileWriter &); //purposely not implemented @@ -270,6 +279,9 @@ private: * This variable can be the number of components in m_ImageIO or the * number of components in the m_BandList (if used) */ unsigned int m_IOComponents; + + /** Lock to ensure thread-safety (added for the AbortGenerateData flag) */ + itk::SimpleFastMutexLock m_Lock; }; } // end namespace otb diff --git a/Modules/IO/ImageIO/include/otbImageFileWriter.txx b/Modules/IO/ImageIO/include/otbImageFileWriter.txx index b1472291f1ae216f302757ad00b69bfd161b3630..f61c624d02470aa03296ffd03499c85a6c2749e1 100644 --- a/Modules/IO/ImageIO/include/otbImageFileWriter.txx +++ b/Modules/IO/ImageIO/include/otbImageFileWriter.txx @@ -48,6 +48,7 @@ #include "otb_boost_tokenizer_header.h" #include "otbStringUtils.h" +#include "otbUtils.h" namespace otb { @@ -99,7 +100,6 @@ ImageFileWriter<TInputImage> typedef NumberOfDivisionsStrippedStreamingManager<TInputImage> NumberOfDivisionsStrippedStreamingManagerType; typename NumberOfDivisionsStrippedStreamingManagerType::Pointer streamingManager = NumberOfDivisionsStrippedStreamingManagerType::New(); streamingManager->SetNumberOfDivisions(nbDivisions); - m_StreamingManager = streamingManager; } @@ -111,7 +111,6 @@ ImageFileWriter<TInputImage> typedef NumberOfDivisionsTiledStreamingManager<TInputImage> NumberOfDivisionsTiledStreamingManagerType; typename NumberOfDivisionsTiledStreamingManagerType::Pointer streamingManager = NumberOfDivisionsTiledStreamingManagerType::New(); streamingManager->SetNumberOfDivisions(nbDivisions); - m_StreamingManager = streamingManager; } @@ -123,7 +122,6 @@ ImageFileWriter<TInputImage> typedef NumberOfLinesStrippedStreamingManager<TInputImage> NumberOfLinesStrippedStreamingManagerType; typename NumberOfLinesStrippedStreamingManagerType::Pointer streamingManager = NumberOfLinesStrippedStreamingManagerType::New(); streamingManager->SetNumberOfLinesPerStrip(nbLinesPerStrip); - m_StreamingManager = streamingManager; } @@ -136,7 +134,6 @@ ImageFileWriter<TInputImage> typename RAMDrivenStrippedStreamingManagerType::Pointer streamingManager = RAMDrivenStrippedStreamingManagerType::New(); streamingManager->SetAvailableRAMInMB(availableRAM); streamingManager->SetBias(bias); - m_StreamingManager = streamingManager; } @@ -147,8 +144,7 @@ ImageFileWriter<TInputImage> { typedef TileDimensionTiledStreamingManager<TInputImage> TileDimensionTiledStreamingManagerType; typename TileDimensionTiledStreamingManagerType::Pointer streamingManager = TileDimensionTiledStreamingManagerType::New(); - streamingManager->SetTileDimension(tileDimension); - + streamingManager->SetTileDimension(tileDimension); m_StreamingManager = streamingManager; } @@ -238,7 +234,6 @@ void ImageFileWriter<TInputImage> ::SetIORegion(const itk::ImageIORegion& region) { - itkDebugMacro("setting IORegion to " << region); if (m_IORegion != region) { m_IORegion = region; @@ -268,13 +263,11 @@ ImageFileWriter<TInputImage> return static_cast<const InputImageType*>(this->ProcessObject::GetInput(0)); } -/** - * Update method : update output information of input and write to file - */ +/** Prepare everything and call m_ImageIO.WriteInformation() */ template<class TInputImage> void ImageFileWriter<TInputImage> -::Update() +::GenerateOutputInformation(void) { // Update output information on input image InputImagePointer inputPtr = @@ -286,10 +279,12 @@ ImageFileWriter<TInputImage> itkExceptionMacro(<< "No input to writer"); } + otb::Logger::Instance()->LogSetupInformation(); + /** Parse streaming modes */ if(m_FilenameHelper->StreamingTypeIsSet()) { - itkWarningMacro(<<"Streaming configuration through extended filename is used. Any previous streaming configuration (ram value, streaming mode ...) will be ignored."); + otbLogMacro(Warning,<<"Streaming configuration through extended filename is used. Any previous streaming configuration (ram value, streaming mode ...) will be ignored."); std::string type = m_FilenameHelper->GetStreamingType(); @@ -300,22 +295,28 @@ ImageFileWriter<TInputImage> sizemode = m_FilenameHelper->GetStreamingSizeMode(); } - double sizevalue = 0.; + unsigned int sizevalue = 0; + // Save the DefaultRAM value for later + unsigned int oldDefaultRAM = m_StreamingManager->GetDefaultRAM(); + if (sizemode == "auto") + { + sizevalue = oldDefaultRAM; + } if(m_FilenameHelper->StreamingSizeValueIsSet()) { - sizevalue = m_FilenameHelper->GetStreamingSizeValue(); + sizevalue = static_cast<unsigned int>(m_FilenameHelper->GetStreamingSizeValue()); } if(type == "auto") { if(sizemode != "auto") { - itkWarningMacro(<<"In auto streaming type, the sizemode option will be ignored."); + otbLogMacro(Warning,<<"In auto streaming type, the sizemode option will be ignored."); } - if(sizevalue == 0.) + if(sizevalue == 0) { - itkWarningMacro("sizemode is auto but sizevalue is 0. Value will be fetched from the OTB_MAX_RAM_HINT environment variable if set, or else use the default value"); + otbLogMacro(Warning,<<"sizemode is auto but sizevalue is 0. Value will be fetched from the OTB_MAX_RAM_HINT environment variable if set, or else use the default value"); } this->SetAutomaticAdaptativeStreaming(sizevalue); } @@ -323,84 +324,80 @@ ImageFileWriter<TInputImage> { if(sizemode == "auto") { - if(sizevalue == 0.) + if(sizevalue == 0) { - itkWarningMacro("sizemode is auto but sizevalue is 0. Value will be fetched from the OTB_MAX_RAM_HINT environment variable if set, or else use the default value"); + otbLogMacro(Warning,<<"sizemode is auto but sizevalue is 0. Value will be fetched from the OTB_MAX_RAM_HINT environment variable if set, or else use the default value"); } this->SetAutomaticTiledStreaming(sizevalue); } else if(sizemode == "nbsplits") { - if(sizevalue == 0.) + if(sizevalue == 0) { - itkWarningMacro("Streaming sizemode is set to nbsplits but sizevalue is 0. This will result in upredicted behaviour. Please consider setting the sizevalue by using &streaming:sizevalue=x."); + otbLogMacro(Warning,<<"Streaming sizemode is set to nbsplits but sizevalue is 0. This will result in upredicted behaviour. Please consider setting the sizevalue by using &streaming:sizevalue=x."); } - this->SetNumberOfDivisionsTiledStreaming(static_cast<unsigned int>(sizevalue)); + this->SetNumberOfDivisionsTiledStreaming(sizevalue); } else if(sizemode == "height") { - if(sizevalue == 0.) + if(sizevalue == 0) { - itkWarningMacro("Streaming sizemode is set to height but sizevalue is 0. This will result in upredicted behaviour. Please consider setting the sizevalue by using &streaming:sizevalue=x."); + otbLogMacro(Warning,<<"Streaming sizemode is set to height but sizevalue is 0. This will result in upredicted behaviour. Please consider setting the sizevalue by using &streaming:sizevalue=x."); } - this->SetTileDimensionTiledStreaming(static_cast<unsigned int>(sizevalue)); + this->SetTileDimensionTiledStreaming(sizevalue); } } else if(type == "stripped") { if(sizemode == "auto") { - if(sizevalue == 0.) + if(sizevalue == 0) { - itkWarningMacro("sizemode is auto but sizevalue is 0. Value will be fetched from configuration file if any, or from cmake configuration otherwise."); + otbLogMacro(Warning,<<"sizemode is auto but sizevalue is 0. Value will be fetched from configuration file if any, or from cmake configuration otherwise."); } this->SetAutomaticStrippedStreaming(sizevalue); } else if(sizemode == "nbsplits") { - if(sizevalue == 0.) + if(sizevalue == 0) { - itkWarningMacro("Streaming sizemode is set to nbsplits but sizevalue is 0. This will result in upredicted behaviour. Please consider setting the sizevalue by using &streaming:sizevalue=x."); + otbLogMacro(Warning,<<"Streaming sizemode is set to nbsplits but sizevalue is 0. This will result in upredicted behaviour. Please consider setting the sizevalue by using &streaming:sizevalue=x."); } - this->SetNumberOfDivisionsStrippedStreaming(static_cast<unsigned int>(sizevalue)); + this->SetNumberOfDivisionsStrippedStreaming(sizevalue); } else if(sizemode == "height") { - if(sizevalue == 0.) + if(sizevalue == 0) { - itkWarningMacro("Streaming sizemode is set to height but sizevalue is 0. This will result in upredicted behaviour. Please consider setting the sizevalue by using &streaming:sizevalue=x."); + otbLogMacro(Warning,<<"Streaming sizemode is set to height but sizevalue is 0. This will result in upredicted behaviour. Please consider setting the sizevalue by using &streaming:sizevalue=x."); } - this->SetNumberOfLinesStrippedStreaming(static_cast<unsigned int>(sizevalue)); + this->SetNumberOfLinesStrippedStreaming(sizevalue); } } else if (type == "none") { - if(sizemode!="" || sizevalue!=0.) + if(sizemode!="" || sizevalue!=0) { - itkWarningMacro("Streaming is explicitly disabled, sizemode and sizevalue will be ignored."); + otbLogMacro(Warning,<<"Streaming is explicitly disabled, sizemode and sizevalue will be ignored."); } this->SetNumberOfDivisionsTiledStreaming(0); } + + // since we change the m_StreamingManager under the hood, we copy the DefaultRAM + // value to the new streamingManager. + m_StreamingManager->SetDefaultRAM(oldDefaultRAM); } else { if(m_FilenameHelper->StreamingSizeValueIsSet() || m_FilenameHelper->StreamingSizeModeIsSet()) { - itkWarningMacro(<<"No streaming type is set, streaming sizemode and sizevalue will be ignored."); + otbLogMacro(Warning,<<"No streaming type is set, streaming sizemode and sizevalue will be ignored."); } } - this->SetAbortGenerateData(0); - this->SetProgress(0.0); - - /** - * Tell all Observers that the filter is starting - */ - this->InvokeEvent(itk::StartEvent()); - /** Prepare ImageIO : create ImageFactory */ if (m_FileName == "") @@ -418,8 +415,6 @@ ImageFileWriter<TInputImage> if (m_ImageIO.IsNull()) //try creating via factory { - itkDebugMacro(<< "Attempting factory creation of ImageIO for file: " - << m_FileName); this->SetImageIO(ImageIOFactory::CreateImageIO(m_FileName.c_str(), otb::ImageIOFactory::WriteMode)); @@ -429,13 +424,8 @@ ImageFileWriter<TInputImage> { if (!m_ImageIO->CanWriteFile(m_FileName.c_str())) { - itkDebugMacro(<< "ImageIO exists but doesn't know how to write file:" - << m_FileName); - if (m_FactorySpecifiedImageIO) { - itkDebugMacro(<< "Attempting creation of ImageIO with a factory for file:" - << m_FileName); m_ImageIO = ImageIOFactory::CreateImageIO(m_FileName.c_str(), otb::ImageIOFactory::WriteMode); m_FactorySpecifiedImageIO = true; @@ -479,28 +469,24 @@ ImageFileWriter<TInputImage> /** * Grab the input */ - inputPtr->UpdateOutputInformation(); InputImageRegionType inputRegion = inputPtr->GetLargestPossibleRegion(); /** Parse region size modes */ if(m_FilenameHelper->BoxIsSet()) { - std::vector<int> boxVector; - Utils::ConvertStringToVector( - m_FilenameHelper->GetBox(), boxVector, "ExtendedFileName:box", ":"); - - typename InputImageRegionType::IndexType start; + std::vector<int> boxVector; + Utils::ConvertStringToVector( + m_FilenameHelper->GetBox(), boxVector, "ExtendedFileName:box", ":"); + + typename InputImageRegionType::IndexType start; typename InputImageRegionType::SizeType size; start[0] = boxVector[0]; // first index on X start[1] = boxVector[1]; // first index on Y size[0] = boxVector[2]; // size along X size[1] = boxVector[3]; // size along Y - inputRegion.SetSize(size); - - m_ShiftOutputIndex = start; - inputRegion.SetIndex(m_ShiftOutputIndex); + inputRegion.SetIndex(start); if (!inputRegion.Crop(inputPtr->GetLargestPossibleRegion())) { @@ -514,8 +500,9 @@ ImageFileWriter<TInputImage> e.SetDataObject(inputPtr); throw e; } - otbMsgDevMacro(<< "inputRegion " << inputRegion); + otbLogMacro(Info,<<"Writing user defined region ["<<start[0]<<", "<<start[0]+size[0]-1<<"]x["<<start[1]<<", "<<start[1]+size[1]<<"]"); } + m_ShiftOutputIndex = inputRegion.GetIndex(); /** * Determine of number of pieces to divide the input. This will be the @@ -526,9 +513,8 @@ ImageFileWriter<TInputImage> /** Control if the ImageIO is CanStreamWrite */ if (m_ImageIO->CanStreamWrite() == false) { - otbWarningMacro( - << "The ImageFactory selected for the image file <" << m_FileName.c_str() << - "> does not support streaming."); + otbLogMacro(Warning,<<"The file format of " << m_FileName << + " does not support streaming. All data will be loaded to memory"); this->SetNumberOfDivisionsStrippedStreaming(1); } @@ -537,26 +523,23 @@ ImageFileWriter<TInputImage> * Not sure that if this modification is needed */ else if (inputPtr->GetBufferedRegion() == inputRegion) { - otbMsgDevMacro(<< "Buffered region is the largest possible region, there is no need for streaming."); + otbLogMacro(Debug,<< "Buffered region is the largest possible region, there is no need for streaming."); this->SetNumberOfDivisionsStrippedStreaming(1); } m_StreamingManager->PrepareStreaming(inputPtr, inputRegion); m_NumberOfDivisions = m_StreamingManager->GetNumberOfSplits(); - otbMsgDebugMacro(<< "Number Of Stream Divisions : " << m_NumberOfDivisions); - /** - * Loop over the number of pieces, execute the upstream pipeline on each - * piece, and copy the results into the output image. - */ - InputImageRegionType streamRegion; + const auto firstSplitSize = m_StreamingManager->GetSplit(0).GetSize(); + otbLogMacro(Info,<<"File "<<m_FileName<<" will be written in "<<m_NumberOfDivisions<<" blocks of "<<firstSplitSize[0]<<"x"<<firstSplitSize[1]<<" pixels"); // // Setup the ImageIO with information from inputPtr // - m_ImageIO->SetNumberOfDimensions(TInputImage::ImageDimension); + typename TInputImage::PointType origin; + inputPtr->TransformIndexToPhysicalPoint(inputRegion.GetIndex(), origin); const typename TInputImage::SpacingType& spacing = inputPtr->GetSpacing(); - const typename TInputImage::PointType& origin = inputPtr->GetOrigin(); const typename TInputImage::DirectionType& direction = inputPtr->GetDirection(); + m_ImageIO->SetNumberOfDimensions(TInputImage::ImageDimension); int direction_sign(0); for (unsigned int i = 0; i < TInputImage::ImageDimension; ++i) { @@ -567,7 +550,7 @@ ImageFileWriter<TInputImage> // Final image size m_ImageIO->SetDimensions(i, inputRegion.GetSize(i)); m_ImageIO->SetSpacing(i, direction_sign * spacing[i]); - m_ImageIO->SetOrigin(i, origin[i] + static_cast<double>(inputRegion.GetIndex()[i]) * spacing[i]); + m_ImageIO->SetOrigin(i, origin[i]); vnl_vector<double> axisDirection(TInputImage::ImageDimension); // Please note: direction cosines are stored as columns of the @@ -588,12 +571,33 @@ ImageFileWriter<TInputImage> m_ImageIO->SetFileName(m_FileName.c_str()); m_ImageIO->WriteImageInformation(); +} +/** + * Update method : update output information of input and write to file + */ +template<class TInputImage> +void +ImageFileWriter<TInputImage> +::Update() +{ + this->UpdateOutputInformation(); + + this->SetAbortGenerateData(0); + this->SetProgress(0.0); + + /** + * Tell all Observers that the filter is starting + */ + this->InvokeEvent(itk::StartEvent()); + this->UpdateProgress(0); m_CurrentDivision = 0; m_DivisionProgress = 0; // Get the source process object + InputImagePointer inputPtr = + const_cast<InputImageType *>(this->GetInput()); itk::ProcessObject* source = inputPtr->GetSource(); m_IsObserving = false; m_ObserverID = 0; @@ -612,9 +616,15 @@ ImageFileWriter<TInputImage> } else { - itkWarningMacro(<< "Could not get the source process object. Progress report might be buggy"); + otbLogMacro(Warning,<< "Could not get the source process object. Progress report might be buggy"); } + /** + * Loop over the number of pieces, execute the upstream pipeline on each + * piece, and copy the results into the output image. + */ + InputImageRegionType streamRegion; + for (m_CurrentDivision = 0; m_CurrentDivision < m_NumberOfDivisions && !this->GetAbortGenerateData(); m_CurrentDivision++, m_DivisionProgress = 0, this->UpdateFilterProgress()) @@ -630,7 +640,6 @@ ImageFileWriter<TInputImage> for (unsigned int i = 0; i < TInputImage::ImageDimension; ++i) { ioRegion.SetSize(i, streamRegion.GetSize(i)); - ioRegion.SetIndex(i, streamRegion.GetIndex(i)); //Set the ioRegion index using the shifted index ( (0,0 without box parameter)) ioRegion.SetIndex(i, streamRegion.GetIndex(i) - m_ShiftOutputIndex[i]); } @@ -649,6 +658,13 @@ ImageFileWriter<TInputImage> { this->UpdateProgress(1.0); } + else + { + itk::ProcessAborted e(__FILE__, __LINE__); + e.SetLocation(ITK_LOCATION); + e.SetDescription("Image writing has been aborted"); + throw e; + } // Notify end event observers this->InvokeEvent(itk::EndEvent()); @@ -676,7 +692,7 @@ ImageFileWriter<TInputImage> //Reset global shift on input region (box parameter) //It allows calling multiple update over the writer - m_ShiftOutputIndex.Fill(0); + m_ShiftOutputIndex = inputPtr->GetLargestPossibleRegion().GetIndex(); } @@ -732,10 +748,7 @@ ImageFileWriter<TInputImage> InputImageRegionType ioRegion; // No shift of the ioRegion from the buffered region is expected - typename InputImageRegionType::IndexType tmpIndex; - tmpIndex.Fill(0); itk::ImageIORegionAdaptor<TInputImage::ImageDimension>:: - //Convert(m_ImageIO->GetIORegion(), ioRegion, tmpIndex); Convert(m_ImageIO->GetIORegion(), ioRegion, m_ShiftOutputIndex); InputImageRegionType bufferedRegion = input->GetBufferedRegion(); @@ -746,9 +759,6 @@ ImageFileWriter<TInputImage> { if ( m_NumberOfDivisions > 1 || m_UserSpecifiedIORegion) { - itkDebugMacro("Requested stream region does not match generated output"); - itkDebugMacro("input filter may not support streaming well"); - cacheImage = InputImageType::New(); cacheImage->CopyInformation(input); @@ -843,6 +853,29 @@ ImageFileWriter<TInputImage> return this->m_FilenameHelper->GetSimpleFileName(); } +template <class TInputImage> +const bool & +ImageFileWriter<TInputImage> +::GetAbortGenerateData() const +{ + m_Lock.Lock(); + // protected read here + bool ret = Superclass::GetAbortGenerateData(); + m_Lock.Unlock(); + if (ret) return otb::Utils::TrueConstant; + return otb::Utils::FalseConstant; +} + +template <class TInputImage> +void +ImageFileWriter<TInputImage> +::SetAbortGenerateData(bool val) +{ + m_Lock.Lock(); + Superclass::SetAbortGenerateData(val); + m_Lock.Unlock(); +} + } // end namespace otb #endif diff --git a/Modules/IO/ImageIO/include/otbImageIOFactory.h b/Modules/IO/ImageIO/include/otbImageIOFactory.h index 13643537e9e17db2f493f35b484184c5b3cd349e..591999ac6ef4aa91d5017f171fad14df516bb1d7 100644 --- a/Modules/IO/ImageIO/include/otbImageIOFactory.h +++ b/Modules/IO/ImageIO/include/otbImageIOFactory.h @@ -23,6 +23,7 @@ #include "itkObject.h" #include "otbImageIOBase.h" +#include "OTBImageIOExport.h" namespace otb { @@ -31,7 +32,7 @@ namespace otb * * \ingroup OTBImageIO */ -class ITK_EXPORT ImageIOFactory : public itk::Object +class OTBImageIO_EXPORT ImageIOFactory : public itk::Object { public: /** Standard class typedefs. */ @@ -59,7 +60,7 @@ public: protected: ImageIOFactory(); - ~ImageIOFactory() ITK_OVERRIDE; + ~ImageIOFactory() override; private: ImageIOFactory(const Self &); //purposely not implemented diff --git a/Modules/IO/ImageIO/include/otbImageSeriesFileReader.h b/Modules/IO/ImageIO/include/otbImageSeriesFileReader.h index 173ccc99d4a2a4a0647936eb8cf98d6d606f432a..d31a890d683304f5f75c2791b690c1329f3635f8 100644 --- a/Modules/IO/ImageIO/include/otbImageSeriesFileReader.h +++ b/Modules/IO/ImageIO/include/otbImageSeriesFileReader.h @@ -428,12 +428,12 @@ public: protected: ImageSeriesFileReader(); - ~ImageSeriesFileReader () ITK_OVERRIDE {} + ~ImageSeriesFileReader () override {} /** * Tests the coherency of the Meta File (especifically band selection) with the image types */ - void TestBandSelection(std::vector<unsigned int>& itkNotUsed(bands)) ITK_OVERRIDE{} + void TestBandSelection(std::vector<unsigned int>& itkNotUsed(bands)) override{} /** GenerateData * This method will be specialised if template definitions follow: @@ -441,7 +441,7 @@ protected: * - TImage is an Image and TInteranalImage is a VectorImage * - TImage and TInternalImage are of Image type. */ - void GenerateData(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; + void GenerateData(DataObjectPointerArraySizeType idx) override; using Superclass::GenerateData; /** @@ -449,10 +449,10 @@ protected: * This allows specific (or global) initialization in the GenerateData methods, * that the user may invoke through GenerateOutput() or GenerateOutput( idx ). */ - void AllocateListOfComponents(void) ITK_OVERRIDE; + void AllocateListOfComponents(void) override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + void PrintSelf(std::ostream& os, itk::Indent indent) const override { return Superclass::PrintSelf(os, indent); } diff --git a/Modules/IO/ImageIO/include/otbImageSeriesFileReaderBase.h b/Modules/IO/ImageIO/include/otbImageSeriesFileReaderBase.h index fa32e38fc204d95aada2b8021e5f6ba6640ea9a8..58b071957e30e90b09ee7899db4d04227b0d0de1 100644 --- a/Modules/IO/ImageIO/include/otbImageSeriesFileReaderBase.h +++ b/Modules/IO/ImageIO/include/otbImageSeriesFileReaderBase.h @@ -133,7 +133,7 @@ public: { return m_ListOfFileNames.size(); } - OutputImageListType * GetOutput(void) ITK_OVERRIDE; + OutputImageListType * GetOutput(void) override; virtual OutputImageType * GetOutput(DataObjectPointerArraySizeType idx); /** Performs selective file extraction */ @@ -141,14 +141,14 @@ public: virtual OutputImageType * GenerateOutput(DataObjectPointerArraySizeType idx); /** Synchronization */ - void Update() ITK_OVERRIDE + void Update() override { this->GenerateData(); } protected: ImageSeriesFileReaderBase(); - ~ImageSeriesFileReaderBase () ITK_OVERRIDE {} + ~ImageSeriesFileReaderBase () override {} enum FileType { kFileName = 0, kImageFileName, kAnyFileName }; /** @@ -159,7 +159,7 @@ protected: virtual void TestFileExistenceAndReadability(std::string& file, FileType fileType); virtual void TestBandSelection(std::vector<unsigned int>& itkNotUsed(bands)) {} - void GenerateData(void) ITK_OVERRIDE; + void GenerateData(void) override; /** GenerateData * This method will be specialised if template definitions follow: @@ -181,7 +181,7 @@ protected: virtual void AllocateListOfComponents(void); /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; std::string m_FileName; OutputImageListPointerType m_OutputList; diff --git a/Modules/IO/ImageIO/include/otbMultiImageFileWriter.h b/Modules/IO/ImageIO/include/otbMultiImageFileWriter.h new file mode 100644 index 0000000000000000000000000000000000000000..d8b05f5c4bdaa69a60606dc5a5ed4db1ef47b416 --- /dev/null +++ b/Modules/IO/ImageIO/include/otbMultiImageFileWriter.h @@ -0,0 +1,296 @@ +/* + * Copyright (C) CS SI + * + * 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 otbMultiImageFileWriter_h +#define otbMultiImageFileWriter_h + +#include "otbImageFileWriter.h" +#include "otbImage.h" +#include "itkImageBase.h" +#include "itkProcessObject.h" +#include "itkImageIOBase.h" +#include "OTBImageIOExport.h" + +#include <boost/shared_ptr.hpp> + +namespace otb +{ + +/** \class MultiImageFileWriter + * \brief Streams a pipeline with multiple outputs. + * It writes each output to a file. Inputs + * are connected to the writer using the AddInputImage method. + * The type of streaming can be chosen. Each output may have a different size. + * When the user gives a number of lines per strip or a tile size, the value + * is interpreted on the first input to deduce the number of streams. This + * number of streams is then used to split the other inputs. + * + * \ingroup OTBImageIO + */ +class OTBImageIO_EXPORT MultiImageFileWriter: public itk::ProcessObject +{ +public: + /** Standard class typedefs. */ + typedef MultiImageFileWriter Self; + typedef itk::ProcessObject Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + itkNewMacro(Self); + + itkTypeMacro(MultiImageFileWriter, itk::ProcessObject); + + /** Public typedefs */ + typedef itk::ImageBase<2> ImageBaseType; + typedef ImageBaseType::RegionType RegionType; + typedef ImageBaseType::IndexType IndexType; + typedef ImageBaseType::IndexValueType IndexValueType; + typedef ImageBaseType::SizeType SizeType; + typedef ImageBaseType::SizeValueType SizeValueType; + + /** Set the streaming mode to 'stripped' and configure the number of strips + * which will be used to stream the image */ + void SetNumberOfDivisionsStrippedStreaming(unsigned int nbDivisions); + + /** Set the streaming mode to 'tiled' and configure the number of tiles + * which will be used to stream the image */ + void SetNumberOfDivisionsTiledStreaming(unsigned int nbDivisions); + + /** Set the streaming mode to 'stripped' and configure the number of strips + * which will be used to stream the image with respect to a number of line + * per strip */ + void SetNumberOfLinesStrippedStreaming(unsigned int nbLinesPerStrip); + + /** Set the streaming mode to 'stripped' and configure the number of MB + * available. The actual number of divisions is computed automatically + * by estimating the memory consumption of the pipeline. + * Setting the availableRAM parameter to 0 means that the available RAM + * is set from the CMake configuration option. + * The bias parameter is a multiplier applied on the estimated memory size + * of the pipeline and can be used to fine tune the potential gap between + * estimated memory and actual memory used, which can happen because of + * composite filters for example */ + void SetAutomaticStrippedStreaming(unsigned int availableRAM = 0, double bias = 1.0); + + /** Set the streaming mode to 'tiled' and configure the dimension of the tiles + * in pixels for each dimension (square tiles will be generated) */ + void SetTileDimensionTiledStreaming(unsigned int tileDimension); + + /** Set the streaming mode to 'tiled' and configure the number of MB + * available. The actual number of divisions is computed automatically + * by estimating the memory consumption of the pipeline. + * Tiles will be square. + * Setting the availableRAM parameter to 0 means that the available RAM + * is set from the CMake configuration option + * The bias parameter is a multiplier applied on the estimated memory size + * of the pipeline and can be used to fine tune the potential gap between + * estimated memory and actual memory used, which can happen because of + * composite filters for example */ + void SetAutomaticTiledStreaming(unsigned int availableRAM = 0, double bias = 1.0); + + /** Set the streaming mode to 'adaptative' and configure the number of MB + * available. The actual number of divisions is computed automatically + * by estimating the memory consumption of the pipeline. + * Tiles will try to match the input file tile scheme. + * Setting the availableRAM parameter to 0 means that the available RAM + * is set from the CMake configuration option */ + void SetAutomaticAdaptativeStreaming(unsigned int availableRAM = 0, double bias = 1.0); + + virtual void UpdateOutputData(itk::DataObject * itkNotUsed(output)); + + /** Connect a new input to the multi-writer. Only the input pointer is + * required. If the filename list is empty, + * streaming will occur without writing. It the filename list contains more + * than one element, then the output will be divided into this number of + * granule files. The resolution factor specifies the ratio between the height of this image and the + * height of a reference image. The number of lines per strip class parameter will be modified according to this factor, so + * that images with different resolutions can be streamed together. For example, use 1.0 for a 10m pixels image, 0.5 for a 20m + * pixels image, and specify the number of lines per strip according to the 10m pixels image. + * You may specify top and bottom margins that will be removed from the input image, according to its largest possible region. + */ + template <class TImage> + void AddInputImage(const TImage* inputPtr, const std::string & fileName) + { + Sink<TImage> * sink = new Sink<TImage>(inputPtr, fileName); + m_SinkList.push_back(SinkBase::Pointer(sink)); + unsigned int size = m_SinkList.size(); + this->SetNthInput(size - 1, const_cast<itk::DataObject*>(dynamic_cast<const itk::DataObject*>(inputPtr))); + } + + /** Add a new ImageFileWriter to the multi-writer. This is an alternative method + * when you already have an instanciated writer. + */ + template <class TWriter> + void AddInputWriter(const TWriter* writer) + { + Sink<typename TWriter::InputImageType > * sink = + new Sink<typename TWriter::InputImageType >(writer); + m_SinkList.push_back(SinkBase::Pointer(sink)); + unsigned int size = m_SinkList.size(); + this->SetNthInput(size - 1, const_cast<itk::DataObject*>(dynamic_cast<const itk::DataObject*>(writer->GetInput()))); + } + + virtual void UpdateOutputInformation(); + + virtual void Update() + { + this->UpdateOutputInformation(); + this->UpdateOutputData(NULL); + } + +protected: + /** SetInput is changed to protected. Use AddInputImage to connect the + * pipeline to the writer + */ + virtual void SetInput(const itk::ProcessObject::DataObjectIdentifierType & key, itk::DataObject* image) + { this->Superclass::SetInput(key, image); } + + /** SetNthInput is changed to protected. Use AddInputImage to connect the + * pipeline to the writer + */ + virtual void SetNthInput(itk::ProcessObject::DataObjectPointerArraySizeType i, itk::DataObject* image) + { this->Superclass::SetNthInput(i, image); } + + MultiImageFileWriter(); + virtual ~MultiImageFileWriter() {} + + /** GenerateData calls the Write method for each connected input */ + virtual void GenerateData(void); + + /** GenerateInputRequestedRegion can predict approximate input regions + * based on the requested region of the fake output. Only usefull for + * pipeline memory print estimation + */ + virtual void GenerateInputRequestedRegion(); + + /** Computes the number of divisions */ + virtual void InitializeStreaming(); + + /** Goes up the pipeline starting at imagePtr, resetting all requested regions + * to a null region. This may be usefull when mixing inputs of different + * resolutions. */ + void ResetAllRequestedRegions(ImageBaseType* imagePtr); + + /** Returns the current stream region of the given input */ + virtual RegionType GetStreamRegion(int inputIndex); + + void operator =(const MultiImageFileWriter&); //purposely not implemented + + void ObserveSourceFilterProgress(itk::Object* object, const itk::EventObject & event) + { + if (typeid(event) != typeid(itk::ProgressEvent)) + { + return; + } + + itk::ProcessObject* processObject = dynamic_cast<itk::ProcessObject*>(object); + if (processObject) + { + m_DivisionProgress = processObject->GetProgress(); + } + + this->UpdateFilterProgress(); + } + + void UpdateFilterProgress() + { + this->UpdateProgress((m_DivisionProgress + m_CurrentDivision) / m_NumberOfDivisions); + } + +private: + typedef otb::Image<unsigned char, 2> FakeOutputType; + typedef StreamingManager<FakeOutputType> StreamingManagerType; + /** Streaming manager used for the N inputs */ + StreamingManagerType::Pointer m_StreamingManager; + + //Division parameters + unsigned int m_NumberOfDivisions; + unsigned int m_CurrentDivision; + float m_DivisionProgress; + + bool m_IsObserving; + unsigned long m_ObserverID; + + /** \class SinkBase + * Internal base wrapper class to handle each ImageFileWriter + * + * \ingroup OTBImageIO + */ + class SinkBase + { + public: + SinkBase() {} + SinkBase(ImageBaseType::ConstPointer inputImage) : + m_InputImage(inputImage) + {} + virtual ~SinkBase() {} + virtual ImageBaseType::ConstPointer GetInput() const { return m_InputImage; } + virtual ImageBaseType::Pointer GetInput() { return const_cast<ImageBaseType*>(m_InputImage.GetPointer()); } + virtual void WriteImageInformation() = 0; + virtual void Write(const RegionType & streamRegion) = 0; + virtual bool CanStreamWrite() = 0; + typedef boost::shared_ptr<SinkBase> Pointer; + protected: + /** The image on which streaming is performed */ + ImageBaseType::ConstPointer m_InputImage; + }; + + /** \class Sink + * Wrapper class for each ImageFileWriter + * + * \ingroup OTBImageIO + */ + template <class TImage> + class Sink : public SinkBase + { + public: + Sink() {} + Sink(typename TImage::ConstPointer inputImage, + const std::string & filename); + Sink(typename otb::ImageFileWriter<TImage>::ConstPointer writer); + + virtual ~Sink() {} + + virtual void WriteImageInformation(); + virtual void Write(const RegionType & streamRegion); + virtual bool CanStreamWrite(); + typedef boost::shared_ptr<Sink> Pointer; + private: + /** Actual writer for this image */ + typename otb::ImageFileWriter<TImage>::Pointer m_Writer; + + /** An ImageIO used to actually write data to a file */ + otb::ImageIOBase::Pointer m_ImageIO; + }; + + /** The list of inputs and their associated parameters, built using AddInput */ + typedef std::vector<boost::shared_ptr<SinkBase> > SinkListType; + SinkListType m_SinkList; + + std::vector<RegionType> m_StreamRegionList; +}; + +} // end of namespace otb + +#ifndef OTB_MANUAL_INSTANTIATION +#include "otbMultiImageFileWriter.txx" +#endif + +#endif // otbMultiImageFileWriter_h diff --git a/Modules/IO/ImageIO/include/otbMultiImageFileWriter.txx b/Modules/IO/ImageIO/include/otbMultiImageFileWriter.txx new file mode 100644 index 0000000000000000000000000000000000000000..5e6d6304dc52aa3dc95a497b45264ff2cc15d277 --- /dev/null +++ b/Modules/IO/ImageIO/include/otbMultiImageFileWriter.txx @@ -0,0 +1,89 @@ +/* + * Copyright (C) CS SI + * + * 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 otbMultiImageFileWriter_txx +#define otbMultiImageFileWriter_txx + +#include "otbMultiImageFileWriter.h" +#include "otbImageIOFactory.h" +#include "otbMacro.h" + +namespace otb +{ + +template <class TImage> +MultiImageFileWriter::Sink<TImage> +::Sink(typename TImage::ConstPointer inputImage, + const std::string & fileName): + SinkBase(dynamic_cast<const ImageBaseType*>(inputImage.GetPointer())), + m_Writer(otb::ImageFileWriter<TImage>::New()), + m_ImageIO(NULL) +{ + m_Writer->SetFileName(fileName); + m_Writer->SetInput(inputImage); +} + +template <class TImage> +MultiImageFileWriter::Sink<TImage> +::Sink(typename otb::ImageFileWriter<TImage>::ConstPointer writer): + SinkBase(dynamic_cast<const ImageBaseType*>(writer->GetInput()->GetPointer())), + m_Writer(writer), + m_ImageIO(NULL) +{ +} + +template <class TImage> +bool +MultiImageFileWriter::Sink<TImage> +::CanStreamWrite() +{ + if (m_ImageIO.IsNull()) + return false; + return m_ImageIO->CanStreamWrite(); +} + +template <class TImage> +void +MultiImageFileWriter::Sink<TImage> +::WriteImageInformation() +{ + m_Writer->UpdateOutputInformation(); + m_ImageIO = m_Writer->GetImageIO(); +} + +template <class TImage> +void +MultiImageFileWriter::Sink<TImage> +::Write(const RegionType & streamRegion) +{ + // Write the image stream + itk::ImageIORegion ioRegion(TImage::ImageDimension); + for (unsigned int i = 0; i < TImage::ImageDimension; ++i) + { + ioRegion.SetSize(i, streamRegion.GetSize(i)); + ioRegion.SetIndex(i, streamRegion.GetIndex(i)); + } + m_ImageIO->SetIORegion(ioRegion); + m_Writer->UpdateOutputData(nullptr); +} + +} // end of namespace otb + +#endif // otbMultiImageFileWriter_txx diff --git a/Modules/IO/ImageIO/include/otbScalarBufferToImageFileWriter.h b/Modules/IO/ImageIO/include/otbScalarBufferToImageFileWriter.h index 548611ada1cc86963d6b263e9b16c468c5a88eca..b09880bce29f0fcca68a4e81b2817ad644bded56 100644 --- a/Modules/IO/ImageIO/include/otbScalarBufferToImageFileWriter.h +++ b/Modules/IO/ImageIO/include/otbScalarBufferToImageFileWriter.h @@ -91,17 +91,17 @@ public: m_Buffer = pBuff; } - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; - void Update() ITK_OVERRIDE + void Update() override { this->GenerateData(); } protected: ScalarBufferToImageFileWriter(); - ~ScalarBufferToImageFileWriter() ITK_OVERRIDE { /* don't call ClearBuffer, user's care */} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~ScalarBufferToImageFileWriter() override { /* don't call ClearBuffer, user's care */} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: diff --git a/Modules/IO/ImageIO/otb-module.cmake b/Modules/IO/ImageIO/otb-module.cmake index 552d431d5a41aba8c23ba62004eac3e60a905c80..d592ba8b086549b5a132f64f0867282e9b7a4de8 100644 --- a/Modules/IO/ImageIO/otb-module.cmake +++ b/Modules/IO/ImageIO/otb-module.cmake @@ -22,6 +22,7 @@ set(DOCUMENTATION "This module contains classes related to the reading and the writing of remote sensing images.") otb_module(OTBImageIO + ENABLE_SHARED DEPENDS OTBBoostAdapters OTBCommon diff --git a/Modules/IO/ImageIO/src/CMakeLists.txt b/Modules/IO/ImageIO/src/CMakeLists.txt index 2d580c6541b14e92fb19e500276f5146103257e0..e604942a7cd4b8473e595bd457dfbdac05523938 100644 --- a/Modules/IO/ImageIO/src/CMakeLists.txt +++ b/Modules/IO/ImageIO/src/CMakeLists.txt @@ -20,6 +20,7 @@ set(OTBImageIO_SRC otbImageIOFactory.cxx + otbMultiImageFileWriter.cxx ) add_library(OTBImageIO ${OTBImageIO_SRC}) diff --git a/Modules/IO/ImageIO/src/otbMultiImageFileWriter.cxx b/Modules/IO/ImageIO/src/otbMultiImageFileWriter.cxx new file mode 100644 index 0000000000000000000000000000000000000000..a3f32a8d36bd404a271c2fd58d61b94488faf981 --- /dev/null +++ b/Modules/IO/ImageIO/src/otbMultiImageFileWriter.cxx @@ -0,0 +1,443 @@ +/* + * Copyright (C) CS SI + * + * 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 "otbMultiImageFileWriter.h" +#include "otbImageIOFactory.h" + +namespace otb +{ + +MultiImageFileWriter +::MultiImageFileWriter() : + m_NumberOfDivisions(0), + m_CurrentDivision(0), + m_DivisionProgress(0.0), + m_IsObserving(true), + m_ObserverID(0) +{ + // By default, we use tiled streaming, with automatic tile size + // We don't set any parameter, so the memory size is retrieved from the OTB configuration options + this->SetAutomaticAdaptativeStreaming(); + // add a fake output to drive memory estimation + this->SetNthOutput(0, FakeOutputType::New()); +} + +void +MultiImageFileWriter +::SetNumberOfDivisionsStrippedStreaming(unsigned int nbDivisions) +{ + typedef NumberOfDivisionsStrippedStreamingManager<FakeOutputType> NumberOfDivisionsStrippedStreamingManagerType; + NumberOfDivisionsStrippedStreamingManagerType::Pointer streamingManager = + NumberOfDivisionsStrippedStreamingManagerType::New(); + streamingManager->SetNumberOfDivisions(nbDivisions); + + m_StreamingManager = streamingManager; +} + +void +MultiImageFileWriter +::SetNumberOfDivisionsTiledStreaming(unsigned int nbDivisions) +{ + typedef NumberOfDivisionsTiledStreamingManager<FakeOutputType> NumberOfDivisionsTiledStreamingManagerType; + NumberOfDivisionsTiledStreamingManagerType::Pointer streamingManager = + NumberOfDivisionsTiledStreamingManagerType::New(); + streamingManager->SetNumberOfDivisions(nbDivisions); + + m_StreamingManager = streamingManager; +} + +void +MultiImageFileWriter +::SetNumberOfLinesStrippedStreaming(unsigned int nbLinesPerStrip) +{ + typedef NumberOfLinesStrippedStreamingManager<FakeOutputType> NumberOfLinesStrippedStreamingManagerType; + NumberOfLinesStrippedStreamingManagerType::Pointer streamingManager = + NumberOfLinesStrippedStreamingManagerType::New(); + streamingManager->SetNumberOfLinesPerStrip(nbLinesPerStrip); + + m_StreamingManager = streamingManager; +} + +void +MultiImageFileWriter +::SetAutomaticStrippedStreaming(unsigned int availableRAM, double bias) +{ + typedef RAMDrivenStrippedStreamingManager<FakeOutputType> RAMDrivenStrippedStreamingManagerType; + RAMDrivenStrippedStreamingManagerType::Pointer streamingManager = + RAMDrivenStrippedStreamingManagerType::New(); + streamingManager->SetAvailableRAMInMB(availableRAM); + streamingManager->SetBias(bias); + + m_StreamingManager = streamingManager; +} + +void +MultiImageFileWriter +::SetTileDimensionTiledStreaming(unsigned int tileDimension) +{ + typedef TileDimensionTiledStreamingManager<FakeOutputType> TileDimensionTiledStreamingManagerType; + TileDimensionTiledStreamingManagerType::Pointer streamingManager = + TileDimensionTiledStreamingManagerType::New(); + streamingManager->SetTileDimension(tileDimension); + + m_StreamingManager = streamingManager; +} + +void +MultiImageFileWriter +::SetAutomaticTiledStreaming(unsigned int availableRAM, double bias) +{ + typedef RAMDrivenTiledStreamingManager<FakeOutputType> RAMDrivenTiledStreamingManagerType; + RAMDrivenTiledStreamingManagerType::Pointer streamingManager = + RAMDrivenTiledStreamingManagerType::New(); + streamingManager->SetAvailableRAMInMB(availableRAM); + streamingManager->SetBias(bias); + m_StreamingManager = streamingManager; +} + +void +MultiImageFileWriter +::SetAutomaticAdaptativeStreaming(unsigned int availableRAM, double bias) +{ + typedef RAMDrivenAdaptativeStreamingManager<FakeOutputType> RAMDrivenAdaptativeStreamingManagerType; + RAMDrivenAdaptativeStreamingManagerType::Pointer streamingManager = + RAMDrivenAdaptativeStreamingManagerType::New(); + streamingManager->SetAvailableRAMInMB(availableRAM); + streamingManager->SetBias(bias); + m_StreamingManager = streamingManager; +} + +void +MultiImageFileWriter +::InitializeStreaming() +{ +// const ImageBaseType* inputPtr = this->GetInput(0); + if(m_SinkList.size() == 0) + itkExceptionMacro("At least one input must be connected to the writer\n"); + const ImageBaseType* inputPtr = m_SinkList[0]->GetInput(); + if(!inputPtr) + itkExceptionMacro("At least one input must be connected to the writer\n"); + + /** Control if the ImageIO is CanStreamWrite */ + m_NumberOfDivisions = 1; + bool canStream = true; + bool isBuffered = true; + for (unsigned int inputIndex = 0; inputIndex < m_SinkList.size(); ++inputIndex) + { + if (!m_SinkList[inputIndex]->CanStreamWrite()) + { + canStream = false; + } + if (m_SinkList[inputIndex]->GetInput()->GetBufferedRegion() != + m_SinkList[inputIndex]->GetInput()->GetLargestPossibleRegion()) + { + isBuffered = false; + } + } + if (canStream == false) + { + otbWarningMacro( + << "One of the selected ImageIO does not support streaming."); + this->SetNumberOfDivisionsStrippedStreaming(m_NumberOfDivisions); + } + + /** Compare the buffered region with the inputRegion which is the largest + * possible region or a user defined region through extended filename + * Not sure that if this modification is needed */ + else if (isBuffered) + { + otbMsgDevMacro(<< "Buffered region is the largest possible region, there is" + " no need for streaming."); + this->SetNumberOfDivisionsStrippedStreaming(m_NumberOfDivisions); + } + else + { + /** + * Determine of number of pieces to divide the input. This will be the + * first estimated on the fake output, which has the same size as the + * first input. Then there is a check that each input can be split into + * this number of pieces. + */ + FakeOutputType * fakeOut = static_cast<FakeOutputType *>( + this->itk::ProcessObject::GetOutput(0)); + RegionType region = fakeOut->GetLargestPossibleRegion(); + m_StreamingManager->PrepareStreaming(fakeOut, region); + m_NumberOfDivisions = m_StreamingManager->GetNumberOfSplits(); + // Check this number of division is compatible with all inputs + bool nbDivValid = false; + while ( (!nbDivValid) && 1 < m_NumberOfDivisions) + { + unsigned int smallestNbDiv = m_NumberOfDivisions; + for (unsigned int i = 0; i < m_SinkList.size(); ++i) + { + unsigned int div = m_StreamingManager->GetSplitter()->GetNumberOfSplits( + m_SinkList[i]->GetInput()->GetLargestPossibleRegion(), + m_NumberOfDivisions); + smallestNbDiv = std::min(div, smallestNbDiv); + } + if (smallestNbDiv == m_NumberOfDivisions) + { + nbDivValid = true; + } + else + { + m_NumberOfDivisions = smallestNbDiv; + } + } + if (m_NumberOfDivisions == 1) + { + otbWarningMacro("Can't find a common split scheme between all inputs, streaming disabled\n"); + } + otbMsgDebugMacro(<< "Number Of Stream Divisions : " << m_NumberOfDivisions); + } +} + +void +MultiImageFileWriter +::ResetAllRequestedRegions(ImageBaseType* imagePtr) +{ + RegionType nullRegion = imagePtr->GetLargestPossibleRegion(); + nullRegion.SetSize(0, 0); + nullRegion.SetSize(1, 0); + + imagePtr->SetRequestedRegion(nullRegion); + if(imagePtr->GetSource()) + { + itk::ProcessObject::DataObjectPointerArray inputs = imagePtr->GetSource()->GetInputs(); + for( itk::ProcessObject::DataObjectPointerArray::iterator + it = inputs.begin(); + it != inputs.end(); + ++it ) + { + ImageBaseType * inputImagePtr = dynamic_cast<ImageBaseType*>(it->GetPointer()); + if(inputImagePtr != NULL) + { + ResetAllRequestedRegions(inputImagePtr); + } + } + } +} + +void +MultiImageFileWriter +::UpdateOutputInformation() +{ + for(unsigned int inputIndex = 0; inputIndex < m_SinkList.size(); ++inputIndex) + { + m_SinkList[inputIndex]->WriteImageInformation(); + } + this->GenerateOutputInformation(); +} + +void +MultiImageFileWriter +::UpdateOutputData(itk::DataObject * itkNotUsed(output)) +{ + /** + * prevent chasing our tail + */ + if (this->m_Updating) + { + return; + } + + // Initialize streaming + this->InitializeStreaming(); + + this->SetAbortGenerateData(0); + this->SetProgress(0.0); + this->m_Updating = true; + + /** + * Tell all Observers that the filter is starting + */ + this->InvokeEvent(itk::StartEvent()); + + this->UpdateProgress(0); + m_CurrentDivision = 0; + m_DivisionProgress = 0; + + /** Loop over the number of pieces, set and propagate requested regions then + * update pipeline upstream + */ + int numInputs = m_SinkList.size(); //this->GetNumberOfInputs(); + m_StreamRegionList.resize(numInputs); + itkDebugMacro( "Number of streaming divisions: " << m_NumberOfDivisions); + + // Add observer only to first input + if(numInputs > 0) + { + m_IsObserving = false; + m_ObserverID = 0; + + typedef itk::MemberCommand<Self> CommandType; + typedef CommandType::Pointer CommandPointerType; + + CommandPointerType command = CommandType::New(); + command->SetCallbackFunction(this, &Self::ObserveSourceFilterProgress); + + itk::ProcessObject* src = this->GetInput(0)->GetSource(); + m_ObserverID = src->AddObserver(itk::ProgressEvent(), command); + m_IsObserving = true; + } + + for (m_CurrentDivision = 0; m_CurrentDivision < m_NumberOfDivisions && !this->GetAbortGenerateData(); + m_CurrentDivision++, m_DivisionProgress = 0, this->UpdateFilterProgress()) + { + // Update all stream regions + for(int inputIndex = 0; inputIndex < numInputs; ++inputIndex) + { + m_StreamRegionList[inputIndex] = GetStreamRegion(inputIndex); + } + + // NOTE : this reset was probably designed to work with the next section + // Where the final requested region is the "union" between the computed + // requested region and the current requested region. + + // Reset requested regions for all images + for(int inputIndex = 0; inputIndex < numInputs; ++inputIndex) + { + ResetAllRequestedRegions(m_SinkList[inputIndex]->GetInput()); + } + + for(int inputIndex = 0; inputIndex < numInputs; ++inputIndex) + { + ImageBaseType::Pointer inputPtr = m_SinkList[inputIndex]->GetInput(); + RegionType inputRequestedRegion = m_StreamRegionList[inputIndex]; + const RegionType & currentInputRequestedRegion = inputPtr->GetRequestedRegion(); + if( currentInputRequestedRegion != inputPtr->GetLargestPossibleRegion() + && currentInputRequestedRegion.GetNumberOfPixels() != 0) + { + IndexType startIndex = currentInputRequestedRegion.GetIndex(); + IndexType lastIndex = currentInputRequestedRegion.GetUpperIndex(); + startIndex[0] = std::min(startIndex[0], inputRequestedRegion.GetIndex(0)); + startIndex[1] = std::min(startIndex[1], inputRequestedRegion.GetIndex(1)); + lastIndex[0] = std::max(lastIndex[0], inputRequestedRegion.GetUpperIndex()[0]); + lastIndex[1] = std::max(lastIndex[1], inputRequestedRegion.GetUpperIndex()[1]); + inputRequestedRegion.SetIndex(startIndex); + inputRequestedRegion.SetUpperIndex(lastIndex); + } + + inputPtr->SetRequestedRegion(inputRequestedRegion); + inputPtr->PropagateRequestedRegion(); + } + + /** Call GenerateData to write streams to files if needed */ + this->GenerateData(); + } + + /** + * If we ended due to aborting, push the progress up to 1.0 (since + * it probably didn't end there) + */ + if (!this->GetAbortGenerateData()) + { + this->UpdateProgress(1.0); + } + + // Notify end event observers + this->InvokeEvent(itk::EndEvent()); + + if (m_IsObserving) + { + ImageBaseType::Pointer inputPtr = m_SinkList[0]->GetInput(); // const_cast<ImageBaseType *>(this->GetInput(0)); + itk::ProcessObject* source = inputPtr->GetSource(); + m_IsObserving = false; + source->RemoveObserver(m_ObserverID); + } + + /** + * Release any inputs if marked for release + */ + this->ReleaseInputs(); + + // Mark that we are no longer updating the data in this filter + this->m_Updating = false; +} + + +void +MultiImageFileWriter +::GenerateInputRequestedRegion() +{ + Superclass::GenerateInputRequestedRegion(); + + // Approximate conversion of output requested region into each input, + // but this is only to have a consistent pipeline memory estimation. + int numInputs = m_SinkList.size(); //this->GetNumberOfInputs(); + + FakeOutputType* fakeOut = static_cast<FakeOutputType *>( + this->itk::ProcessObject::GetOutput(0)); + + if (numInputs) + { + RegionType refLargest = fakeOut->GetLargestPossibleRegion(); + RegionType refRequest = fakeOut->GetRequestedRegion(); + IndexType idxLargest = refLargest.GetIndex(); + SizeType sizeLargest = refLargest.GetSize(); + IndexType idxRequest = refRequest.GetIndex(); + SizeType sizeRequest = refRequest.GetSize(); + for (int i = 0; i < numInputs; ++i) + { + ImageBaseType* inputPtr = m_SinkList[i]->GetInput(); + if(!inputPtr) + { + return; + } + RegionType region = inputPtr->GetLargestPossibleRegion(); + IndexType idx = region.GetIndex(); + SizeType size = region.GetSize(); + idx[0] += size[0] * (idxRequest[0] - idxLargest[0]) / sizeLargest[0]; + idx[1] += size[1] * (idxRequest[1] - idxLargest[1]) / sizeLargest[1]; + size[0] *= sizeRequest[0] / sizeLargest[0]; + size[1] *= sizeRequest[1] / sizeLargest[1]; + region.SetIndex(idx); + region.SetSize(size); + inputPtr->SetRequestedRegion(region); + } + } +} + +void +MultiImageFileWriter +::GenerateData() +{ + int numInputs = m_SinkList.size(); + for(int inputIndex = 0; inputIndex < numInputs; ++inputIndex) + { + m_SinkList[inputIndex]->Write(m_StreamRegionList[inputIndex]); + } +} + +MultiImageFileWriter::RegionType +MultiImageFileWriter +::GetStreamRegion(int inputIndex) +{ + const SinkBase::Pointer sink = m_SinkList[inputIndex]; + RegionType region = sink->GetInput()->GetLargestPossibleRegion(); + + m_StreamingManager->GetSplitter()->GetSplit( + m_CurrentDivision, + m_NumberOfDivisions, + region); + return region; +} + +} // end of namespace otb diff --git a/Modules/IO/ImageIO/test/CMakeLists.txt b/Modules/IO/ImageIO/test/CMakeLists.txt index aac49fcdeab48d245227689b5aeb6461f6d6dd07..110b25410e8bfd8f663a505fa202b4399d213609 100644 --- a/Modules/IO/ImageIO/test/CMakeLists.txt +++ b/Modules/IO/ImageIO/test/CMakeLists.txt @@ -76,6 +76,7 @@ otbImageIOFactoryNew.cxx otbCompareWritingComplexImage.cxx otbImageFileReaderOptBandTest.cxx otbImageFileWriterOptBandTest.cxx +otbMultiImageFileWriterTest.cxx ) add_executable(otbImageIOTestDriver ${OTBImageIOTests}) @@ -1339,3 +1340,31 @@ otb_add_test(NAME ioTvImageIOToWriterOptions_OptBandReorgTest COMMAND otbImageIO ${TEMP}/QB_Toulouse_Ortho_XS_WriterOptBandReorg.tif?bands=2,:,-3,2:-1 4 ) + +otb_add_test(NAME ioTvMultiImageFileWriter_SameSize + COMMAND otbImageIOTestDriver + --compare-n-images ${EPSILON_9} 2 + ${INPUTDATA}/GomaAvant.png + ${TEMP}/ioTvMultiImageFileWriter_SameSize1.tif + ${INPUTDATA}/GomaApres.png + ${TEMP}/ioTvMultiImageFileWriter_SameSize2.tif + otbMultiImageFileWriterTest + ${INPUTDATA}/GomaAvant.png + ${INPUTDATA}/GomaApres.png + ${TEMP}/ioTvMultiImageFileWriter_SameSize1.tif + ${TEMP}/ioTvMultiImageFileWriter_SameSize2.tif + 50) + +otb_add_test(NAME ioTvMultiImageFileWriter_DiffSize + COMMAND otbImageIOTestDriver + --compare-n-images ${EPSILON_9} 2 + ${INPUTDATA}/GomaAvant.png + ${TEMP}/ioTvMultiImageFileWriter_DiffSize1.tif + ${INPUTDATA}/QB_Toulouse_Ortho_PAN.tif + ${TEMP}/ioTvMultiImageFileWriter_DiffSize2.tif + otbMultiImageFileWriterTest + ${INPUTDATA}/GomaAvant.png + ${INPUTDATA}/QB_Toulouse_Ortho_PAN.tif + ${TEMP}/ioTvMultiImageFileWriter_DiffSize1.tif + ${TEMP}/ioTvMultiImageFileWriter_DiffSize2.tif + 25) diff --git a/Modules/IO/ImageIO/test/otbImageIOTestDriver.cxx b/Modules/IO/ImageIO/test/otbImageIOTestDriver.cxx index fb2aa583aa73653ece1ffb9f523ae6caaec71d84..4a7ff9409a53d34ec7d404c6f6d56cc57c8917bf 100644 --- a/Modules/IO/ImageIO/test/otbImageIOTestDriver.cxx +++ b/Modules/IO/ImageIO/test/otbImageIOTestDriver.cxx @@ -154,4 +154,5 @@ void RegisterTests() REGISTER_TEST(otbCompareWritingComplexImageTest); REGISTER_TEST(otbImageFileReaderOptBandTest); REGISTER_TEST(otbImageFileWriterOptBandTest); + REGISTER_TEST(otbMultiImageFileWriterTest); } diff --git a/Modules/IO/ImageIO/test/otbMultiImageFileWriterTest.cxx b/Modules/IO/ImageIO/test/otbMultiImageFileWriterTest.cxx new file mode 100644 index 0000000000000000000000000000000000000000..77d6ede243b19c34694ff18a74959457c060a0d0 --- /dev/null +++ b/Modules/IO/ImageIO/test/otbMultiImageFileWriterTest.cxx @@ -0,0 +1,65 @@ +/* + * Copyright (C) CS SI + * + * 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 "otbMultiImageFileWriter.h" +#include "otbImage.h" +#include "otbImageFileReader.h" + +int otbMultiImageFileWriterTest(int argc, char* argv[]) +{ + typedef unsigned short PixelType1; + typedef otb::Image<PixelType1, 2> ImageType1; + typedef otb::ImageFileReader<ImageType1> ReaderType1; + + typedef double PixelType2; + typedef otb::Image<PixelType2, 2> ImageType2; + typedef otb::ImageFileReader<ImageType2> ReaderType2; + + typedef otb::MultiImageFileWriter WriterType; + + if (argc < 6) + { + std::cout << "Usage: " << argv[0] << " inputImageFileName1 inputImageFileName2 outputImageFileName1 outputImageFileName2 numberOfLinesPerStrip\n"; + return EXIT_FAILURE; + } + + const char * inputImageFileName1 = argv[1]; + const char * inputImageFileName2 = argv[2]; + const std::string outputImageFileName1 = argv[3]; + const std::string outputImageFileName2 = argv[4]; + const int numberOfLinesPerStrip = atoi(argv[5]); + + ReaderType1::Pointer reader1 = ReaderType1::New(); + reader1->SetFileName( inputImageFileName1 ); + + ReaderType2::Pointer reader2 = ReaderType2::New(); + reader2->SetFileName( inputImageFileName2 ); + + WriterType::Pointer writer = WriterType::New(); + writer->AddInputImage( reader1->GetOutput(), outputImageFileName1); + writer->AddInputImage( reader2->GetOutput(), outputImageFileName2); + writer->SetNumberOfLinesStrippedStreaming( numberOfLinesPerStrip ); + + writer->Update(); + + std::cout << writer << std::endl; + + return EXIT_SUCCESS; +} diff --git a/Modules/IO/KMZWriter/include/otbKmzProductWriter.h b/Modules/IO/KMZWriter/include/otbKmzProductWriter.h index 869fe49bc2f1d9cd9b50992291e34216836b19ae..d8957ee2d68e5a3cd08c9ff922cbe9857c3f8917 100644 --- a/Modules/IO/KMZWriter/include/otbKmzProductWriter.h +++ b/Modules/IO/KMZWriter/include/otbKmzProductWriter.h @@ -136,7 +136,7 @@ public: itkSetStringMacro(Path); /** Update Method */ - void Update() ITK_OVERRIDE + void Update() override { this->Write(); } @@ -167,8 +167,8 @@ public: protected: KmzProductWriter(); - ~KmzProductWriter() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~KmzProductWriter() override; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /**Method for Tiling the input image*/ virtual void Tiling(); diff --git a/Modules/IO/TestKernel/include/otbDifferenceImageFilter.h b/Modules/IO/TestKernel/include/otbDifferenceImageFilter.h index 042e2a5a5bbfb9713151ebb7f912f6ceffbff0d1..1eb5e1e7749068106a3d910a678c2407ed40be01 100644 --- a/Modules/IO/TestKernel/include/otbDifferenceImageFilter.h +++ b/Modules/IO/TestKernel/include/otbDifferenceImageFilter.h @@ -91,9 +91,9 @@ public: protected: DifferenceImageFilter(); - ~DifferenceImageFilter() ITK_OVERRIDE {} + ~DifferenceImageFilter() override {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** DifferenceImageFilter can be implemented as a multithreaded * filter. Therefore, this implementation provides a @@ -107,11 +107,11 @@ protected: * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType& threadRegion, - itk::ThreadIdType threadId) ITK_OVERRIDE; + itk::ThreadIdType threadId) override; - void BeforeThreadedGenerateData() ITK_OVERRIDE; - void AfterThreadedGenerateData() ITK_OVERRIDE; - void GenerateOutputInformation() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; + void AfterThreadedGenerateData() override; + void GenerateOutputInformation() override; ScalarRealType m_DifferenceThreshold; RealType m_MeanDifference; diff --git a/Modules/IO/TestKernel/include/otbReadDataFile.h b/Modules/IO/TestKernel/include/otbReadDataFile.h new file mode 100644 index 0000000000000000000000000000000000000000..0e7174be6ec50038bb217f4248cbd5be604d6566 --- /dev/null +++ b/Modules/IO/TestKernel/include/otbReadDataFile.h @@ -0,0 +1,116 @@ +/* + * 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 "otbStringUtils.h" +#include "otb_boost_string_header.h" + +#include "itkListSample.h" +#include <fstream> +#include <string> +#include <algorithm> + +namespace otb +{ +/** Utility function to read the data file letter.scale, a CSV type file + * (whitespace separators) with the letter index in first column, followed by + * 16 descriptors. Each descriptor is a pair 'index:value' + */ +template <typename TInput, typename TTarget> +bool ReadDataFile( + const std::string & infname, + itk::SmartPointer<itk::Statistics::ListSample<TInput> > samples, + itk::SmartPointer<itk::Statistics::ListSample<TTarget> > labels) +{ + typedef typename itk::Statistics::ListSample<TInput>::MeasurementType IValueType; + typedef typename itk::Statistics::ListSample<TTarget>::MeasurementType TValueType; + + std::ifstream ifs; + ifs.open(infname.c_str()); + + if(!ifs) + { + std::cout<<"Could not read file "<<infname<<std::endl; + return false; + } + + labels->SetMeasurementVectorSize(1); + unsigned int nbfeatures = 0; + + while (!ifs.eof()) + { + std::string line; + std::getline(ifs, line); + boost::algorithm::trim(line); + + if(nbfeatures == 0) + { + nbfeatures = std::count(line.begin(),line.end(),' '); + samples->SetMeasurementVectorSize(nbfeatures); + } + + if(line.size()>1) + { + TInput sample; + itk::NumericTraits<TInput>::SetLength(sample, nbfeatures); + + std::string::size_type pos = line.find_first_of(" ", 0); + + // Parse label + TTarget label; + itk::NumericTraits<TTarget>::SetLength(label,1); + label[0] = boost::lexical_cast<TValueType>(line.substr(0, pos)); + + bool endOfLine = false; + unsigned int id = 0; + + while(!endOfLine) + { + std::string::size_type nextpos = line.find_first_of(" ", pos+1); + if(nextpos == std::string::npos) + { + endOfLine = true; + nextpos = line.size(); + } + + std::string::size_type semicolonpos = line.find_first_of(":", pos+1, nextpos-pos-1); + if (semicolonpos == std::string::npos) + { + id++; + sample[id - 1] = boost::lexical_cast<IValueType>(line.substr(pos+1,nextpos-pos-1)); + } + else + { + id = boost::lexical_cast<unsigned int>(line.substr(pos+1,semicolonpos-pos-1)); + sample[id - 1] = boost::lexical_cast<IValueType>( + line.substr(semicolonpos+1,nextpos-semicolonpos-1)); + } + pos = nextpos; + + } + samples->PushBack(sample); + labels->PushBack(label); + } + } + + ifs.close(); + return true; +} + +} // end of namespace otb diff --git a/Modules/IO/TestKernel/include/otbTestHelper.h b/Modules/IO/TestKernel/include/otbTestHelper.h index 32e0dba890815d4381d93f0005c4551fcb12c4c8..0bf593400f920792cd212eaaaa307fcdf13641b1 100644 --- a/Modules/IO/TestKernel/include/otbTestHelper.h +++ b/Modules/IO/TestKernel/include/otbTestHelper.h @@ -71,7 +71,7 @@ public: std::string("Integer"),std::string("Integer64"))); } - ~TestHelper() ITK_OVERRIDE{} + ~TestHelper() override{} int RegressionTestAllImages(const StringList& baselineFilenamesImage, const StringList& testFilenamesImage); diff --git a/Modules/IO/TestKernel/include/otbTestMain.h b/Modules/IO/TestKernel/include/otbTestMain.h index ccb70a639cc5ec5a295d775affc2d5a510747c7d..7a833306b5ecfd8e6b434488a0932f3fdc2a5933 100644 --- a/Modules/IO/TestKernel/include/otbTestMain.h +++ b/Modules/IO/TestKernel/include/otbTestMain.h @@ -28,7 +28,7 @@ #include <iostream> #include "itkMultiThreader.h" -#include "itkMacro.h" +#include "otbMacro.h" #include "otbOGRDriversInit.h" #include "otbTestHelper.h" @@ -298,6 +298,7 @@ int main(int ac, char* av[]) } else { + otb::Logger::Instance()->LogSetupInformation(); MainFuncPointer f = j->second; int result; try diff --git a/Modules/IO/VectorDataIO/include/otbVectorDataFileReader.h b/Modules/IO/VectorDataIO/include/otbVectorDataFileReader.h index 71b3bea7bc57bc48248102f297ee88567a4fb769..3571baf21b87d41305427bc5fd48aebd42503996 100644 --- a/Modules/IO/VectorDataIO/include/otbVectorDataFileReader.h +++ b/Modules/IO/VectorDataIO/include/otbVectorDataFileReader.h @@ -120,20 +120,20 @@ public: /** Prepare the allocation of the output vector data during the first back * propagation of the pipeline. */ - void GenerateOutputInformation(void) ITK_OVERRIDE; + void GenerateOutputInformation(void) override; /** Does the real work. */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; protected: VectorDataFileReader(); - ~VectorDataFileReader() ITK_OVERRIDE; + ~VectorDataFileReader() override; std::string m_ExceptionMessage; typename VectorDataIOBaseType::Pointer m_VectorDataIO; bool m_UserSpecifiedVectorDataIO; // keep track whether the - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; std::string m_FileName; // The file to be read diff --git a/Modules/IO/VectorDataIO/include/otbVectorDataFileWriter.h b/Modules/IO/VectorDataIO/include/otbVectorDataFileWriter.h index 520586e661569cf1be3ae4c0bc714fd212a34156..4ef6ba6e129fca2ba33423931ef40cae66b15a4a 100644 --- a/Modules/IO/VectorDataIO/include/otbVectorDataFileWriter.h +++ b/Modules/IO/VectorDataIO/include/otbVectorDataFileWriter.h @@ -93,9 +93,9 @@ public: /** Does the real work. */ virtual void Write(); - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; - void Update() ITK_OVERRIDE + void Update() override { this->Write(); } @@ -106,9 +106,9 @@ public: protected: VectorDataFileWriter(); - ~VectorDataFileWriter() ITK_OVERRIDE; + ~VectorDataFileWriter() override; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; std::string m_FileName; // The file to be read typename VectorDataIOBaseType::Pointer m_VectorDataIO; diff --git a/Modules/IO/VectorDataIO/include/otbVectorDataIOFactory.h b/Modules/IO/VectorDataIO/include/otbVectorDataIOFactory.h index 556722fb3b7dacfa10d40deb8680e16c3f5a93d8..62754644faf24d031217cbbb0597b8ac83e6fde9 100644 --- a/Modules/IO/VectorDataIO/include/otbVectorDataIOFactory.h +++ b/Modules/IO/VectorDataIO/include/otbVectorDataIOFactory.h @@ -62,7 +62,7 @@ public: protected: VectorDataIOFactory(); - ~VectorDataIOFactory() ITK_OVERRIDE; + ~VectorDataIOFactory() override; private: VectorDataIOFactory(const Self &); //purposely not implemented diff --git a/Modules/Learning/DempsterShafer/include/otbConfusionMatrixToMassOfBelief.h b/Modules/Learning/DempsterShafer/include/otbConfusionMatrixToMassOfBelief.h index da0cdcfa220493c7a20f78367b7484dabeb6fc35..bc5891e2469b0d5370750e00696977d538049fd6 100644 --- a/Modules/Learning/DempsterShafer/include/otbConfusionMatrixToMassOfBelief.h +++ b/Modules/Learning/DempsterShafer/include/otbConfusionMatrixToMassOfBelief.h @@ -85,7 +85,7 @@ public: enum MassOfBeliefDefinitionMethod {PRECISION, RECALL, ACCURACY, KAPPA}; - void Update() ITK_OVERRIDE; + void Update() override; /** Accessors */ itkSetMacro(ConfusionMatrix, ConfusionMatrixType); @@ -141,10 +141,10 @@ protected: ConfusionMatrixToMassOfBelief(); /** Destructor */ - ~ConfusionMatrixToMassOfBelief() ITK_OVERRIDE {}; + ~ConfusionMatrixToMassOfBelief() override {}; /** Triggers the computation of the confusion matrix */ - void GenerateData(void) ITK_OVERRIDE; + void GenerateData(void) override; private: ConfusionMatrixToMassOfBelief(const Self&); //purposely not implemented diff --git a/Modules/Learning/DempsterShafer/include/otbDSFusionOfClassifiersImageFilter.h b/Modules/Learning/DempsterShafer/include/otbDSFusionOfClassifiersImageFilter.h index 723a1aed1b4761410990a8717076f9822766a176..32d4d430fd7a836f70ead380c99aee5178e9c143 100644 --- a/Modules/Learning/DempsterShafer/include/otbDSFusionOfClassifiersImageFilter.h +++ b/Modules/Learning/DempsterShafer/include/otbDSFusionOfClassifiersImageFilter.h @@ -140,16 +140,16 @@ protected: /** Constructor */ DSFusionOfClassifiersImageFilter(); /** Destructor */ - ~DSFusionOfClassifiersImageFilter() ITK_OVERRIDE {} + ~DSFusionOfClassifiersImageFilter() override {} /** Generate output information */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; /** Threaded generate data */ - void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) override; /** Before threaded generate data */ - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: DSFusionOfClassifiersImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Learning/DempsterShafer/include/otbJointMassOfBeliefFilter.h b/Modules/Learning/DempsterShafer/include/otbJointMassOfBeliefFilter.h index ac454c1e6f78dfe55da6624b31292f6ba9838b4e..8e8807b7122aecdef62caa855b17dd13f72ce092 100644 --- a/Modules/Learning/DempsterShafer/include/otbJointMassOfBeliefFilter.h +++ b/Modules/Learning/DempsterShafer/include/otbJointMassOfBeliefFilter.h @@ -71,11 +71,11 @@ public: /** Remove the last input */ using Superclass::PopBackInput; - void PopBackInput() ITK_OVERRIDE; + void PopBackInput() override; /** Remove the first input */ using Superclass::PopFrontInput; - void PopFrontInput() ITK_OVERRIDE; + void PopFrontInput() override; /** Get the idx th input */ const MassFunctionType * GetInput(unsigned int idx); @@ -88,13 +88,13 @@ protected: JointMassOfBeliefFilter(); /** Destructor */ - ~JointMassOfBeliefFilter() ITK_OVERRIDE {} + ~JointMassOfBeliefFilter() override {} /** GenerateData */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: JointMassOfBeliefFilter(const Self&); //purposely not implemented diff --git a/Modules/Learning/DempsterShafer/include/otbMassOfBelief.h b/Modules/Learning/DempsterShafer/include/otbMassOfBelief.h index 7e2eff5636242dba64335f8bc7e79cb3a7d03a23..70e8f909fea2001d0ddfccae78b7558ce74eaf3e 100644 --- a/Modules/Learning/DempsterShafer/include/otbMassOfBelief.h +++ b/Modules/Learning/DempsterShafer/include/otbMassOfBelief.h @@ -180,10 +180,10 @@ protected: MassOfBelief() {} /** Desctructor */ - ~MassOfBelief() ITK_OVERRIDE {} + ~MassOfBelief() override {} /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: MassOfBelief(const Self&); //purposely not implemented diff --git a/Modules/Learning/DempsterShafer/include/otbStandardDSCostFunction.h b/Modules/Learning/DempsterShafer/include/otbStandardDSCostFunction.h index 6623a418958c3d93d2ede1b1d60f32a4b10b3ffe..2c90a53c1e08b887442d6cbd975d1712d1c21b84 100644 --- a/Modules/Learning/DempsterShafer/include/otbStandardDSCostFunction.h +++ b/Modules/Learning/DempsterShafer/include/otbStandardDSCostFunction.h @@ -95,14 +95,14 @@ public: /** This method returns the value of the cost function corresponding * to the specified parameters. */ - MeasureType GetValue( const ParametersType & parameters ) const ITK_OVERRIDE; + MeasureType GetValue( const ParametersType & parameters ) const override; /** This method returns the derivative of the cost function corresponding * to the specified parameters. */ void GetDerivative( const ParametersType & parameters, - DerivativeType & derivative ) const ITK_OVERRIDE; + DerivativeType & derivative ) const override; - unsigned int GetNumberOfParameters(void) const ITK_OVERRIDE; + unsigned int GetNumberOfParameters(void) const override; itkSetMacro(Weight, double); itkGetConstMacro(Weight, double); @@ -151,9 +151,9 @@ protected: /** Constructor */ StandardDSCostFunction(); /** Destructor */ - ~StandardDSCostFunction() ITK_OVERRIDE {} + ~StandardDSCostFunction() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: StandardDSCostFunction(const Self &); //purposely not implemented diff --git a/Modules/Learning/DempsterShafer/include/otbVectorDataToDSValidatedVectorDataFilter.h b/Modules/Learning/DempsterShafer/include/otbVectorDataToDSValidatedVectorDataFilter.h index 5b331ae6aae32cd9b7364c14c504f964c66ac10f..2a3731307e351be26d95ce30771a647c003c097f 100644 --- a/Modules/Learning/DempsterShafer/include/otbVectorDataToDSValidatedVectorDataFilter.h +++ b/Modules/Learning/DempsterShafer/include/otbVectorDataToDSValidatedVectorDataFilter.h @@ -161,13 +161,13 @@ public: protected: /** Triggers the Computation */ - void GenerateData(void) ITK_OVERRIDE; + void GenerateData(void) override; /** Constructor */ VectorDataToDSValidatedVectorDataFilter(); /** Destructor */ - ~VectorDataToDSValidatedVectorDataFilter() ITK_OVERRIDE {} + ~VectorDataToDSValidatedVectorDataFilter() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; std::string GetNextID() { diff --git a/Modules/ThirdParty/Qt4/CMakeLists.txt b/Modules/Learning/DimensionalityReductionLearning/CMakeLists.txt similarity index 80% rename from Modules/ThirdParty/Qt4/CMakeLists.txt rename to Modules/Learning/DimensionalityReductionLearning/CMakeLists.txt index 808c53c5b2c2e80abc9d90950134948e50267b08..79b6f276d592e5f9f1c41c03ff95589982b8cb76 100644 --- a/Modules/ThirdParty/Qt4/CMakeLists.txt +++ b/Modules/Learning/DimensionalityReductionLearning/CMakeLists.txt @@ -18,10 +18,6 @@ # limitations under the License. # -project( OTBQt4 ) - -set( OTBQt4_SYSTEM_INCLUDE_DIRS ${QT_INCLUDE_DIRS} ) -set( OTBQt4_LIBRARIES "${QT_LIBRARIES}" ) -set( QT_VERSION "${QTVERSION}" CACHE INTERNAL "" FORCE ) +project(OTBDimensionalityReduction) otb_module_impl() diff --git a/Modules/Learning/DimensionalityReductionLearning/README.md b/Modules/Learning/DimensionalityReductionLearning/README.md new file mode 100644 index 0000000000000000000000000000000000000000..a46b8fbf8af741f44690a747f973b08a5114e2d0 --- /dev/null +++ b/Modules/Learning/DimensionalityReductionLearning/README.md @@ -0,0 +1,25 @@ +This module contains a new dimensionality reduction framework for the Orfeo Toolbox. + +The framework is based on Machine learning models and a dimensionality reduction algorithm +can be trained and used using the model class, in the same fashion as Machine Learning Models +for Classification (supervised or unspervised) and Regression. + +The algorithms featured in the module are (27/06/2017) : + - autoencoders and multi layer autoencoders, with several regularization options + - PCA + - SOM + + Autoencoders and PCA models are using Shark ML library, while SOM model is based on the SOM classes of the OTB. + + More specifically, the module contains : + + - Autoencoder models, PCA models and SOM models, with methods for training, serialization and prediction (i.e. reduction) + - A Dimensionality Reduction Model Factory and a factories for each model, which allow the user to create objects of the model classes + - A (OTB ImageToImage) filter that can be used to perform dimensionality reduction on an image. This filter supports threading and streaming + - An application for training the models according to a shapefile + - An application for using a trained model on a shapefile + - An application for using a trained model on an image (using the filter) + + /!\ Work In Progress /!\ + + diff --git a/Modules/Learning/DimensionalityReductionLearning/include/otbAutoencoderModel.h b/Modules/Learning/DimensionalityReductionLearning/include/otbAutoencoderModel.h new file mode 100644 index 0000000000000000000000000000000000000000..5fe7ec2f27c9f91f21a2ce2417502f5d4beac54d --- /dev/null +++ b/Modules/Learning/DimensionalityReductionLearning/include/otbAutoencoderModel.h @@ -0,0 +1,193 @@ +/* + * 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 otbAutoencoderModel_h +#define otbAutoencoderModel_h + +#include "otbMachineLearningModelTraits.h" +#include "otbMachineLearningModel.h" +#include <fstream> + +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wunused-parameter" +#pragma GCC diagnostic ignored "-Woverloaded-virtual" +#pragma GCC diagnostic ignored "-Wsign-compare" +#endif +#include "otb_shark.h" +#include <shark/Algorithms/StoppingCriteria/AbstractStoppingCriterion.h> +#include <shark/Models/LinearModel.h> +#include <shark/Models/ConcatenatedModel.h> +#include <shark/Models/NeuronLayers.h> +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic pop +#endif + +namespace otb +{ +/** + * \class AutoencoderModel + * + * Autoencoder model wrapper class + * + * \ingroup OTBDimensionalityReductionLearning + */ +template <class TInputValue, class NeuronType> +class ITK_EXPORT AutoencoderModel + : public MachineLearningModel< + itk::VariableLengthVector< TInputValue>, + itk::VariableLengthVector< TInputValue> > +{ +public: + typedef AutoencoderModel Self; + typedef MachineLearningModel< + itk::VariableLengthVector< TInputValue>, + itk::VariableLengthVector< TInputValue> > Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + typedef typename Superclass::InputValueType InputValueType; + typedef typename Superclass::InputSampleType InputSampleType; + typedef typename Superclass::InputListSampleType InputListSampleType; + typedef typename InputListSampleType::Pointer ListSamplePointerType; + typedef typename Superclass::TargetValueType TargetValueType; + typedef typename Superclass::TargetSampleType TargetSampleType; + typedef typename Superclass::TargetListSampleType TargetListSampleType; + + /// Confidence map related typedefs + typedef typename Superclass::ConfidenceValueType ConfidenceValueType; + typedef typename Superclass::ConfidenceSampleType ConfidenceSampleType; + typedef typename Superclass::ConfidenceListSampleType ConfidenceListSampleType; + + /// Neural network related typedefs + typedef shark::ConcatenatedModel<shark::RealVector> ModelType; + typedef shark::LinearModel<shark::RealVector,NeuronType> LayerType; + typedef shark::LinearModel<shark::RealVector, shark::LinearNeuron> OutLayerType; + + itkNewMacro(Self); + itkTypeMacro(AutoencoderModel, DimensionalityReductionModel); + + itkGetMacro(NumberOfHiddenNeurons,itk::Array<unsigned int>); + itkSetMacro(NumberOfHiddenNeurons,itk::Array<unsigned int>); + + itkGetMacro(NumberOfIterations,unsigned int); + itkSetMacro(NumberOfIterations,unsigned int); + + itkGetMacro(NumberOfIterationsFineTuning,unsigned int); + itkSetMacro(NumberOfIterationsFineTuning,unsigned int); + + itkGetMacro(Epsilon,double); + itkSetMacro(Epsilon,double); + + itkGetMacro(InitFactor,double); + itkSetMacro(InitFactor,double); + + itkGetMacro(Regularization,itk::Array<double>); + itkSetMacro(Regularization,itk::Array<double>); + + itkGetMacro(Noise,itk::Array<double>); + itkSetMacro(Noise,itk::Array<double>); + + itkGetMacro(Rho,itk::Array<double>); + itkSetMacro(Rho,itk::Array<double>); + + itkGetMacro(Beta,itk::Array<double>); + itkSetMacro(Beta,itk::Array<double>); + + itkGetMacro(WriteLearningCurve,bool); + itkSetMacro(WriteLearningCurve,bool); + + itkSetMacro(WriteWeights, bool); + itkGetMacro(WriteWeights, bool); + + itkGetMacro(LearningCurveFileName,std::string); + itkSetMacro(LearningCurveFileName,std::string); + + bool CanReadFile(const std::string & filename) override; + bool CanWriteFile(const std::string & filename) override; + + void Save(const std::string & filename, const std::string & name="") override; + void Load(const std::string & filename, const std::string & name="") override; + + void Train() override; + + template <class T> + void TrainOneLayer( + shark::AbstractStoppingCriterion<T> & criterion, + unsigned int, + shark::Data<shark::RealVector> &, + std::ostream&); + + template <class T> + void TrainOneSparseLayer( + shark::AbstractStoppingCriterion<T> & criterion, + unsigned int, + shark::Data<shark::RealVector> &, + std::ostream&); + + template <class T> + void TrainNetwork( + shark::AbstractStoppingCriterion<T> & criterion, + shark::Data<shark::RealVector> &, + std::ostream&); + +protected: + AutoencoderModel(); + ~AutoencoderModel() override; + + virtual TargetSampleType DoPredict( + const InputSampleType& input, + ConfidenceValueType * quality = ITK_NULLPTR) const override; + + virtual void DoPredictBatch( + const InputListSampleType *, + const unsigned int & startIndex, + const unsigned int & size, + TargetListSampleType *, + ConfidenceListSampleType * quality = ITK_NULLPTR) const override; + +private: + /** Internal Network */ + ModelType m_Encoder; + std::vector<LayerType> m_InLayers; + OutLayerType m_OutLayer; + itk::Array<unsigned int> m_NumberOfHiddenNeurons; + /** Training parameters */ + unsigned int m_NumberOfIterations; // stop the training after a fixed number of iterations + unsigned int m_NumberOfIterationsFineTuning; // stop the fine tuning after a fixed number of iterations + double m_Epsilon; // Stops the training when the training error seems to converge + itk::Array<double> m_Regularization; // L2 Regularization parameter + itk::Array<double> m_Noise; // probability for an input to be set to 0 (denosing autoencoder) + itk::Array<double> m_Rho; // Sparsity parameter + itk::Array<double> m_Beta; // Sparsity regularization parameter + double m_InitFactor; // Weight initialization factor (the weights are intialized at m_initfactor/sqrt(inputDimension) ) + + bool m_WriteLearningCurve; // Flag for writting the learning curve into a txt file + std::string m_LearningCurveFileName; // Name of the output learning curve printed after training + bool m_WriteWeights; +}; +} // end namespace otb + +#ifndef OTB_MANUAL_INSTANTIATION +#include "otbAutoencoderModel.txx" +#endif + +#endif + diff --git a/Modules/Learning/DimensionalityReductionLearning/include/otbAutoencoderModel.txx b/Modules/Learning/DimensionalityReductionLearning/include/otbAutoencoderModel.txx new file mode 100644 index 0000000000000000000000000000000000000000..e5a26e9ee3dc8cbf4918222f4b7b45bc93e925cb --- /dev/null +++ b/Modules/Learning/DimensionalityReductionLearning/include/otbAutoencoderModel.txx @@ -0,0 +1,436 @@ +/* + * 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 otbAutoencoderModel_txx +#define otbAutoencoderModel_txx + +#include "otbAutoencoderModel.h" +#include "otbMacro.h" + +#include <fstream> + +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wunused-parameter" +#pragma GCC diagnostic ignored "-Woverloaded-virtual" +#endif +#include "otbSharkUtils.h" +//include train function +#include <shark/ObjectiveFunctions/ErrorFunction.h> +//~ #include <shark/ObjectiveFunctions/SparseAutoencoderError.h>//the error function performing the regularisation of the hidden neurons + +#include <shark/Algorithms/GradientDescent/Rprop.h>// the RProp optimization algorithm +#include <shark/ObjectiveFunctions/Loss/SquaredLoss.h> // squared loss used for regression +#include <shark/ObjectiveFunctions/Regularizer.h> //L2 regulariziation +//~ #include <shark/Models/ImpulseNoiseModel.h> //noise source to corrupt the inputs + +#include <shark/Algorithms/StoppingCriteria/MaxIterations.h> //A simple stopping criterion that stops after a fixed number of iterations +#include <shark/Algorithms/StoppingCriteria/TrainingProgress.h> //Stops when the algorithm seems to converge, Tracks the progress of the training error over a period of time + +#include <shark/Algorithms/GradientDescent/Adam.h> +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic pop +#endif + +namespace otb +{ + +template <class TInputValue, class NeuronType> +AutoencoderModel<TInputValue,NeuronType>::AutoencoderModel() +{ + this->m_IsDoPredictBatchMultiThreaded = true; + this->m_WriteLearningCurve = false; +} + +template <class TInputValue, class NeuronType> +AutoencoderModel<TInputValue,NeuronType>::~AutoencoderModel() +{ +} + +template <class TInputValue, class NeuronType> +void +AutoencoderModel<TInputValue,NeuronType> +::Train() +{ + std::vector<shark::RealVector> features; + Shark::ListSampleToSharkVector(this->GetInputListSample(), features); + shark::Data<shark::RealVector> inputSamples = shark::createDataFromRange( features ); + shark::Data<shark::RealVector> inputSamples_copy = inputSamples; + + std::ofstream ofs; + if (this->m_WriteLearningCurve == true) + { + ofs.open(m_LearningCurveFileName); + ofs << "learning curve" << std::endl; + } + + // Initialization of the feed forward neural network + m_Encoder = ModelType(); + m_InLayers.clear(); + size_t previousShape = shark::dataDimension(inputSamples); + for (unsigned int i = 0 ; i < m_NumberOfHiddenNeurons.Size(); ++i) + { + m_InLayers.push_back( LayerType(previousShape, m_NumberOfHiddenNeurons[i]) ); + previousShape = m_NumberOfHiddenNeurons[i]; + m_Encoder.add(&(m_InLayers.back()), true); + } + for (unsigned int i = std::max(0,static_cast<int>(m_NumberOfHiddenNeurons.Size()-1)) ; i > 0; --i) + { + m_InLayers.push_back( LayerType(previousShape, m_NumberOfHiddenNeurons[i-1]) ); + previousShape = m_NumberOfHiddenNeurons[i-1]; + } + m_OutLayer = OutLayerType(previousShape, shark::dataDimension(inputSamples)); + + // Training of the autoencoders pairwise, starting from the first and last layers + for (unsigned int i = 0 ; i < m_NumberOfHiddenNeurons.Size(); ++i) + { + if (m_Epsilon > 0) + { + shark::TrainingProgress<> criterion(5,m_Epsilon); + // Shark doesn't allow to train a layer using a sparsity term AND a noisy input. + if (m_Noise[i] != 0) + { + TrainOneLayer(criterion, i, inputSamples, ofs); + } + else + { + TrainOneSparseLayer(criterion, i, inputSamples, ofs); + } + criterion.reset(); + } + else + { + shark::MaxIterations<> criterion(m_NumberOfIterations); + // Shark doesn't allow to train a layer using a sparsity term AND a noisy input. + if (m_Noise[i] != 0) + { + TrainOneLayer(criterion, i, inputSamples, ofs); + otbMsgDevMacro(<< "m_Noise " << m_Noise[0]); + } + else + { + TrainOneSparseLayer( criterion, i, inputSamples, ofs); + } + criterion.reset(); + } + // encode the samples with the last encoder trained + inputSamples = m_InLayers[i](inputSamples); + } + if (m_NumberOfIterationsFineTuning > 0) + { + shark::MaxIterations<> criterion(m_NumberOfIterationsFineTuning); + TrainNetwork(criterion, inputSamples_copy, ofs); + } + this->SetDimension(m_NumberOfHiddenNeurons[m_NumberOfHiddenNeurons.Size()-1]); +} + +template <class TInputValue, class NeuronType> +template <class T> +void +AutoencoderModel<TInputValue,NeuronType> +::TrainOneLayer( + shark::AbstractStoppingCriterion<T> & criterion, + unsigned int layer_index, + shark::Data<shark::RealVector> &samples, + std::ostream& File) +{ + typedef shark::AbstractModel<shark::RealVector,shark::RealVector> BaseModelType; + ModelType net; + net.add(&(m_InLayers[layer_index]), true); + net.add( (layer_index ? + (BaseModelType*) &(m_InLayers[m_NumberOfHiddenNeurons.Size()*2 - 1 - layer_index]) : + (BaseModelType*) &m_OutLayer) , true); + + otbMsgDevMacro(<< "Noise " << m_Noise[layer_index]); + std::size_t inputs = dataDimension(samples); + initRandomUniform(net,-m_InitFactor*std::sqrt(1.0/inputs),m_InitFactor*std::sqrt(1.0/inputs)); + + //~ shark::ImpulseNoiseModel noise(inputs,m_Noise[layer_index],1.0); //set an input pixel with probability m_Noise to 0 + //~ shark::ConcatenatedModel<shark::RealVector,shark::RealVector> model = noise>> net; + shark::LabeledData<shark::RealVector,shark::RealVector> trainSet(samples,samples);//labels identical to inputs + shark::SquaredLoss<shark::RealVector> loss; + //~ shark::ErrorFunction error(trainSet, &model, &loss); + shark::ErrorFunction<> error(trainSet, &net, &loss); + + shark::TwoNormRegularizer<> regularizer(error.numberOfVariables()); + error.setRegularizer(m_Regularization[layer_index],®ularizer); + + shark::Adam<> optimizer; + error.init(); + optimizer.init(error); + + otbMsgDevMacro(<<"Error before training : " << optimizer.solution().value); + if (this->m_WriteLearningCurve == true) + { + File << "end layer" << std::endl; + } + + unsigned int i=0; + do + { + i++; + optimizer.step(error); + if (this->m_WriteLearningCurve == true) + { + File << optimizer.solution().value << std::endl; + } + otbMsgDevMacro(<<"Error after " << i << " iterations : " << optimizer.solution().value); + } while( !criterion.stop( optimizer.solution() ) ); + + net.setParameterVector(optimizer.solution().point); +} + +template <class TInputValue, class NeuronType> +template <class T> +void AutoencoderModel<TInputValue,NeuronType>::TrainOneSparseLayer( + shark::AbstractStoppingCriterion<T> & criterion, + unsigned int layer_index, + shark::Data<shark::RealVector> &samples, + std::ostream& File) +{ + typedef shark::AbstractModel<shark::RealVector,shark::RealVector> BaseModelType; + ModelType net; + net.add(&(m_InLayers[layer_index]), true); + net.add( (layer_index ? + (BaseModelType*) &(m_InLayers[m_NumberOfHiddenNeurons.Size()*2 - 1 - layer_index]) : + (BaseModelType*) &m_OutLayer) , true); + + std::size_t inputs = dataDimension(samples); + shark::initRandomUniform(net,-m_InitFactor*std::sqrt(1.0/inputs),m_InitFactor*std::sqrt(1.0/inputs)); + + // Idea : set the initials value for the output weights higher than the input weights + + shark::LabeledData<shark::RealVector,shark::RealVector> trainSet(samples,samples);//labels identical to inputs + shark::SquaredLoss<shark::RealVector> loss; + //~ shark::SparseAutoencoderError error(trainSet,&net, &loss, m_Rho[layer_index], m_Beta[layer_index]); + // SparseAutoencoderError doesn't exist anymore, for now use a plain ErrorFunction + shark::ErrorFunction<> error(trainSet, &net, &loss); + + shark::TwoNormRegularizer<> regularizer(error.numberOfVariables()); + error.setRegularizer(m_Regularization[layer_index],®ularizer); + shark::Adam<> optimizer; + error.init(); + optimizer.init(error); + + otbMsgDevMacro(<<"Error before training : " << optimizer.solution().value); + unsigned int i=0; + do + { + i++; + optimizer.step(error); + otbMsgDevMacro(<<"Error after " << i << " iterations : " << optimizer.solution().value); + if (this->m_WriteLearningCurve == true) + { + File << optimizer.solution().value << std::endl; + } + } while( !criterion.stop( optimizer.solution() ) ); + if (this->m_WriteLearningCurve == true) + { + File << "end layer" << std::endl; + } + net.setParameterVector(optimizer.solution().point); +} + +template <class TInputValue, class NeuronType> +template <class T> +void +AutoencoderModel<TInputValue,NeuronType> +::TrainNetwork( + shark::AbstractStoppingCriterion<T> & criterion, + shark::Data<shark::RealVector> &samples, + std::ostream& File) +{ + // create full network + ModelType net; + for (auto &layer : m_InLayers) + { + net.add(&layer, true); + } + net.add(&m_OutLayer, true); + + //labels identical to inputs + shark::LabeledData<shark::RealVector,shark::RealVector> trainSet(samples,samples); + shark::SquaredLoss<shark::RealVector> loss; + + shark::ErrorFunction<> error(trainSet, &net, &loss); + shark::TwoNormRegularizer<> regularizer(error.numberOfVariables()); + error.setRegularizer(m_Regularization[0],®ularizer); + + shark::Adam<> optimizer; + error.init(); + optimizer.init(error); + otbMsgDevMacro(<<"Error before training : " << optimizer.solution().value); + unsigned int i=0; + while( !criterion.stop( optimizer.solution() ) ) + { + i++; + optimizer.step(error); + otbMsgDevMacro(<<"Error after " << i << " iterations : " << optimizer.solution().value); + if (this->m_WriteLearningCurve == true) + { + File << optimizer.solution().value << std::endl; + } + } +} + +template <class TInputValue, class NeuronType> +bool +AutoencoderModel<TInputValue,NeuronType> +::CanReadFile(const std::string & filename) +{ + try + { + this->Load(filename); + } + catch(...) + { + return false; + } + return true; +} + +template <class TInputValue, class NeuronType> +bool +AutoencoderModel<TInputValue,NeuronType> +::CanWriteFile(const std::string & /*filename*/) +{ + return true; +} + +template <class TInputValue, class NeuronType> +void +AutoencoderModel<TInputValue,NeuronType> +::Save(const std::string & filename, const std::string & /*name*/) +{ + otbMsgDevMacro(<< "saving model ..."); + std::ofstream ofs(filename); + ofs << "Autoencoder" << std::endl; // the first line of the model file contains a key + ofs << (m_InLayers.size() + 1) << std::endl; // second line is the number of encoders/decoders + shark::TextOutArchive oa(ofs); + for (const auto &layer : m_InLayers) + { + oa << layer; + } + oa << m_OutLayer; + ofs.close(); +} + +template <class TInputValue, class NeuronType> +void +AutoencoderModel<TInputValue,NeuronType> +::Load(const std::string & filename, const std::string & /*name*/) +{ + std::ifstream ifs(filename); + char buffer[256]; + // check first line + ifs.getline(buffer,256); + std::string bufferStr(buffer); + if (bufferStr != "Autoencoder"){ + itkExceptionMacro(<< "Error opening " << filename.c_str() ); + } + // check second line + ifs.getline(buffer,256); + int nbLevels = boost::lexical_cast<int>(buffer); + if (nbLevels < 2 || nbLevels%2 == 1) + { + itkExceptionMacro(<< "Unexpected number of levels : "<<buffer ); + } + m_InLayers.clear(); + m_Encoder = ModelType(); + shark::TextInArchive ia(ifs); + for (int i=0 ; (i+1) < nbLevels ; i++) + { + LayerType layer; + ia >> layer; + m_InLayers.push_back(layer); + } + ia >> m_OutLayer; + ifs.close(); + + for (int i=0 ; i < nbLevels/2 ; i++) + { + m_Encoder.add(&(m_InLayers[i]) ,true); + } + + this->SetDimension( m_Encoder.outputShape()[0] ); +} + +template <class TInputValue, class NeuronType> +typename AutoencoderModel<TInputValue,NeuronType>::TargetSampleType +AutoencoderModel<TInputValue,NeuronType> +::DoPredict(const InputSampleType & value, ConfidenceValueType * /*quality*/) const +{ + shark::RealVector samples(value.Size()); + for(size_t i = 0; i < value.Size();i++) + { + samples[i]=value[i]; + } + + std::vector<shark::RealVector> features; + features.push_back(samples); + + shark::Data<shark::RealVector> data = shark::createDataFromRange(features); + + // features layer for a network containing the encoder and decoder part + data = m_Encoder(data); + TargetSampleType target; + target.SetSize(this->m_Dimension); + + for(unsigned int a = 0; a < this->m_Dimension; ++a) + { + target[a]=data.element(0)[a]; + } + return target; +} + +template <class TInputValue, class NeuronType> +void +AutoencoderModel<TInputValue,NeuronType> +::DoPredictBatch( + const InputListSampleType *input, + const unsigned int & startIndex, + const unsigned int & size, + TargetListSampleType * targets, + ConfidenceListSampleType * /*quality*/) const +{ + std::vector<shark::RealVector> features; + Shark::ListSampleRangeToSharkVector(input, features,startIndex,size); + shark::Data<shark::RealVector> data = shark::createDataFromRange(features); + TargetSampleType target; + // features layer for a network containing the encoder and decoder part + data = m_Encoder(data); + + unsigned int id = startIndex; + target.SetSize(this->m_Dimension); + + for(const auto& p : data.elements()) + { + for(unsigned int a = 0; a < this->m_Dimension; ++a) + { + target[a]=p[a]; + } + targets->SetMeasurementVector(id,target); + ++id; + } +} + +} // namespace otb + +#endif diff --git a/Modules/Learning/DimensionalityReductionLearning/include/otbAutoencoderModelFactory.h b/Modules/Learning/DimensionalityReductionLearning/include/otbAutoencoderModelFactory.h new file mode 100644 index 0000000000000000000000000000000000000000..e04170ec37e5e7b12064fd8d26992288e5573c62 --- /dev/null +++ b/Modules/Learning/DimensionalityReductionLearning/include/otbAutoencoderModelFactory.h @@ -0,0 +1,78 @@ +/* + * 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 otbAutoencoderModelFactory_h +#define otbAutoencoderModelFactory_h + +#include "itkObjectFactoryBase.h" +#include "itkImageIOBase.h" + +namespace otb +{ + +/** + * \class AutoencoderModelFactory + * + * Factory for AutoencoderModel + * + * \ingroup OTBDimensionalityReductionLearning + */ +template <class TInputValue, class TTargetValue, class NeuronType> +class ITK_EXPORT AutoencoderModelFactory : public itk::ObjectFactoryBase +{ +public: + /** Standard class typedefs. */ + typedef AutoencoderModelFactory Self; + typedef itk::ObjectFactoryBase Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + /** Class methods used to interface with the registered factories. */ + const char* GetITKSourceVersion(void) const override; + const char* GetDescription(void) const override; + + /** Method for class instantiation. */ + itkFactorylessNewMacro(Self); + + /** Run-time type information (and related methods). */ + itkTypeMacro(AutoencoderModelFactory, itk::ObjectFactoryBase); + + /** Register one factory of this type */ + static void RegisterOneFactory(void) + { + Pointer AEFactory = AutoencoderModelFactory::New(); + itk::ObjectFactoryBase::RegisterFactory(AEFactory); + } + +protected: + AutoencoderModelFactory(); + ~AutoencoderModelFactory() override; + +private: + AutoencoderModelFactory(const Self &); //purposely not implemented + void operator =(const Self&); //purposely not implemented +}; + +} //namespace otb + +#ifndef OTB_MANUAL_INSTANTIATION +#include "otbAutoencoderModelFactory.txx" +#endif + +#endif diff --git a/Modules/Learning/DimensionalityReductionLearning/include/otbAutoencoderModelFactory.txx b/Modules/Learning/DimensionalityReductionLearning/include/otbAutoencoderModelFactory.txx new file mode 100644 index 0000000000000000000000000000000000000000..c55f718a622ccd6ecc9632bd8cac7b9aa38c78bf --- /dev/null +++ b/Modules/Learning/DimensionalityReductionLearning/include/otbAutoencoderModelFactory.txx @@ -0,0 +1,66 @@ +/* + * 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 otbAutoencoderModelFactory_txx +#define otbAutoencoderModelFactory_txx + +#include "otbAutoencoderModelFactory.h" +#include "otbAutoencoderModel.h" + +#include "itkCreateObjectFunction.h" +#include "itkVersion.h" + +namespace otb +{ +template <class TInputValue, class TOutputValue, class NeuronType> +AutoencoderModelFactory<TInputValue,TOutputValue, NeuronType>::AutoencoderModelFactory() +{ + std::string classOverride = std::string("DimensionalityReductionModel"); + std::string subclass = std::string("AutoencoderModel"); + + this->RegisterOverride( + classOverride.c_str(), + subclass.c_str(), + "Shark AE ML Model", + 1, + itk::CreateObjectFunction<AutoencoderModel<TInputValue,NeuronType > >::New()); +} + +template <class TInputValue, class TOutputValue, class NeuronType> +AutoencoderModelFactory<TInputValue,TOutputValue, NeuronType>::~AutoencoderModelFactory() +{ +} + +template <class TInputValue, class TOutputValue, class NeuronType> +const char* +AutoencoderModelFactory<TInputValue,TOutputValue, NeuronType>::GetITKSourceVersion(void) const +{ + return ITK_SOURCE_VERSION; +} + +template <class TInputValue, class TOutputValue, class NeuronType> +const char* +AutoencoderModelFactory<TInputValue,TOutputValue, NeuronType>::GetDescription() const +{ + return "Autoencoder model factory"; +} + +} // end namespace otb + +#endif diff --git a/Modules/Learning/DimensionalityReductionLearning/include/otbDimensionalityReductionModelFactory.h b/Modules/Learning/DimensionalityReductionLearning/include/otbDimensionalityReductionModelFactory.h new file mode 100644 index 0000000000000000000000000000000000000000..98c84903833c5ec6d7da5fd6d2ac0cb4e114870b --- /dev/null +++ b/Modules/Learning/DimensionalityReductionLearning/include/otbDimensionalityReductionModelFactory.h @@ -0,0 +1,84 @@ +/* + * 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 otbDimensionalityReductionModelFactory_h +#define otbDimensionalityReductionModelFactory_h + +#include "otbMachineLearningModelFactoryBase.h" +#include "otbMachineLearningModel.h" + +namespace otb +{ +/** \class MachineLearningModelFactory + * \brief Creation of object instance using object factory. + * + * \ingroup OTBDimensionalityReductionLearning + */ +template <class TInputValue, class TOutputValue> +class DimensionalityReductionModelFactory : public MachineLearningModelFactoryBase +{ +public: + /** Standard class typedefs. */ + typedef DimensionalityReductionModelFactory Self; + typedef itk::Object Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + /** Class Methods used to interface with the registered factories */ + + /** Run-time type information (and related methods). */ + itkTypeMacro(DimensionalityReductionModelFactory, itk::Object); + + /** Convenient typedefs. */ + typedef otb::MachineLearningModel< + itk::VariableLengthVector< TInputValue >, + itk::VariableLengthVector< TOutputValue> > DimensionalityReductionModelType; + typedef typename DimensionalityReductionModelType::Pointer DimensionalityReductionModelTypePointer; + + /** Mode in which the files is intended to be used */ + typedef enum { ReadMode, WriteMode } FileModeType; + + /** Create the appropriate MachineLearningModel depending on the particulars of the file. */ + static DimensionalityReductionModelTypePointer CreateDimensionalityReductionModel(const std::string& path, FileModeType mode); + + static void CleanFactories(); + +protected: + DimensionalityReductionModelFactory(); + ~DimensionalityReductionModelFactory() override; + +private: + DimensionalityReductionModelFactory(const Self &); //purposely not implemented + void operator =(const Self&); //purposely not implemented + + /** Register Built-in factories */ + static void RegisterBuiltInFactories(); + + /** Register a single factory, ensuring it has not been registered + * twice */ + static void RegisterFactory(itk::ObjectFactoryBase * factory); +}; + +} // end namespace otb + +#ifndef OTB_MANUAL_INSTANTIATION +#include "otbDimensionalityReductionModelFactory.txx" +#endif + +#endif diff --git a/Modules/Learning/DimensionalityReductionLearning/include/otbDimensionalityReductionModelFactory.txx b/Modules/Learning/DimensionalityReductionLearning/include/otbDimensionalityReductionModelFactory.txx new file mode 100644 index 0000000000000000000000000000000000000000..451fce5b7c7b8ff866d3a921a883682c4e3426a8 --- /dev/null +++ b/Modules/Learning/DimensionalityReductionLearning/include/otbDimensionalityReductionModelFactory.txx @@ -0,0 +1,200 @@ +/* + * 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 otbDimensionalityReductionModelFactory_txx +#define otbDimensionalityReductionModelFactory_txx + +#include "otbDimensionalityReductionModelFactory.h" +#include "otbConfigure.h" + +#include "otbSOMModelFactory.h" + +#ifdef OTB_USE_SHARK +#include "otbAutoencoderModelFactory.h" +#include "otbPCAModelFactory.h" +#endif + +#include "itkMutexLockHolder.h" + +namespace otb +{ + +template <class TInputValue, class TTargetValue> +using LogAutoencoderModelFactory = AutoencoderModelFactory<TInputValue, TTargetValue, shark::LogisticNeuron> ; + +template <class TInputValue, class TTargetValue> +using SOM2DModelFactory = SOMModelFactory<TInputValue, TTargetValue, 2> ; + +template <class TInputValue, class TTargetValue> +using SOM3DModelFactory = SOMModelFactory<TInputValue, TTargetValue, 3> ; + +template <class TInputValue, class TTargetValue> +using SOM4DModelFactory = SOMModelFactory<TInputValue, TTargetValue, 4> ; + +template <class TInputValue, class TTargetValue> +using SOM5DModelFactory = SOMModelFactory<TInputValue, TTargetValue, 5> ; + + +template <class TInputValue, class TOutputValue> +typename DimensionalityReductionModelFactory<TInputValue,TOutputValue>::DimensionalityReductionModelTypePointer +DimensionalityReductionModelFactory<TInputValue,TOutputValue> +::CreateDimensionalityReductionModel(const std::string& path, FileModeType mode) +{ + RegisterBuiltInFactories(); + + std::list<DimensionalityReductionModelTypePointer> possibleDimensionalityReductionModel; + std::list<LightObject::Pointer> allobjects = + itk::ObjectFactoryBase::CreateAllInstance("DimensionalityReductionModel"); + + for(std::list<LightObject::Pointer>::iterator i = allobjects.begin(); + i != allobjects.end(); ++i) + { + DimensionalityReductionModelType* io = + dynamic_cast<DimensionalityReductionModelType*>(i->GetPointer()); + if(io) + { + possibleDimensionalityReductionModel.push_back(io); + } + else + { + std::cerr << "Error DimensionalityReductionModel Factory did not return an DimensionalityReductionModel: " + << (*i)->GetNameOfClass() + << std::endl; + } + } + + for(typename std::list<DimensionalityReductionModelTypePointer>::iterator k = possibleDimensionalityReductionModel.begin(); + k != possibleDimensionalityReductionModel.end(); ++k) + { + if( mode == ReadMode ) + { + if((*k)->CanReadFile(path)) + { + return *k; + } + } + else if( mode == WriteMode ) + { + if((*k)->CanWriteFile(path)) + { + return *k; + } + } + } + return ITK_NULLPTR; +} + +template <class TInputValue, class TOutputValue> +void +DimensionalityReductionModelFactory<TInputValue,TOutputValue> +::RegisterBuiltInFactories() +{ + itk::MutexLockHolder<itk::SimpleMutexLock> lockHolder(mutex); + + RegisterFactory(SOM2DModelFactory<TInputValue,TOutputValue>::New()); + RegisterFactory(SOM3DModelFactory<TInputValue,TOutputValue>::New()); + RegisterFactory(SOM4DModelFactory<TInputValue,TOutputValue>::New()); + RegisterFactory(SOM5DModelFactory<TInputValue,TOutputValue>::New()); + +#ifdef OTB_USE_SHARK + RegisterFactory(PCAModelFactory<TInputValue,TOutputValue>::New()); + RegisterFactory(LogAutoencoderModelFactory<TInputValue,TOutputValue>::New()); +#endif +} + +template <class TInputValue, class TOutputValue> +void +DimensionalityReductionModelFactory<TInputValue,TOutputValue> +::RegisterFactory(itk::ObjectFactoryBase * factory) +{ + // Unregister any previously registered factory of the same class + // Might be more intensive but static bool is not an option due to + // ld error. + itk::ObjectFactoryBase::UnRegisterFactory(factory); + itk::ObjectFactoryBase::RegisterFactory(factory); +} + +template <class TInputValue, class TOutputValue> +void +DimensionalityReductionModelFactory<TInputValue,TOutputValue> +::CleanFactories() +{ + itk::MutexLockHolder<itk::SimpleMutexLock> lockHolder(mutex); + + std::list<itk::ObjectFactoryBase*> factories = itk::ObjectFactoryBase::GetRegisteredFactories(); + std::list<itk::ObjectFactoryBase*>::iterator itFac; + + for (itFac = factories.begin(); itFac != factories.end() ; ++itFac) + { + // SOM 5D + SOM5DModelFactory<TInputValue,TOutputValue> *som5dFactory = + dynamic_cast<SOM5DModelFactory<TInputValue,TOutputValue> *>(*itFac); + if (som5dFactory) + { + itk::ObjectFactoryBase::UnRegisterFactory(som5dFactory); + continue; + } + // SOM 4D + SOM4DModelFactory<TInputValue,TOutputValue> *som4dFactory = + dynamic_cast<SOM4DModelFactory<TInputValue,TOutputValue> *>(*itFac); + if (som4dFactory) + { + itk::ObjectFactoryBase::UnRegisterFactory(som4dFactory); + continue; + } + // SOM 3D + SOM3DModelFactory<TInputValue,TOutputValue> *som3dFactory = + dynamic_cast<SOM3DModelFactory<TInputValue,TOutputValue> *>(*itFac); + if (som3dFactory) + { + itk::ObjectFactoryBase::UnRegisterFactory(som3dFactory); + continue; + } + // SOM 2D + SOM2DModelFactory<TInputValue,TOutputValue> *som2dFactory = + dynamic_cast<SOM2DModelFactory<TInputValue,TOutputValue> *>(*itFac); + if (som2dFactory) + { + itk::ObjectFactoryBase::UnRegisterFactory(som2dFactory); + continue; + } +#ifdef OTB_USE_SHARK + // Autoencoder + LogAutoencoderModelFactory<TInputValue,TOutputValue> *aeFactory = + dynamic_cast<LogAutoencoderModelFactory<TInputValue,TOutputValue> *>(*itFac); + if (aeFactory) + { + itk::ObjectFactoryBase::UnRegisterFactory(aeFactory); + continue; + } + // PCA + PCAModelFactory<TInputValue,TOutputValue> *pcaFactory = + dynamic_cast<PCAModelFactory<TInputValue,TOutputValue> *>(*itFac); + if (pcaFactory) + { + itk::ObjectFactoryBase::UnRegisterFactory(pcaFactory); + continue; + } +#endif + } +} + +} // end namespace otb + +#endif diff --git a/Modules/Learning/DimensionalityReductionLearning/include/otbImageDimensionalityReductionFilter.h b/Modules/Learning/DimensionalityReductionLearning/include/otbImageDimensionalityReductionFilter.h new file mode 100644 index 0000000000000000000000000000000000000000..0cfab267dd0df607cc580ff60d13bad01ea152f8 --- /dev/null +++ b/Modules/Learning/DimensionalityReductionLearning/include/otbImageDimensionalityReductionFilter.h @@ -0,0 +1,146 @@ +/* + * 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 otbImageDimensionalityReduction_h +#define otbImageDimensionalityReduction_h + +#include "itkImageToImageFilter.h" +#include "otbMachineLearningModel.h" +#include "otbImage.h" + +namespace otb +{ +/** \class ImageClassificationFilter + * \brief This filter performs the classification of a VectorImage using a Model. + * + * This filter is streamed and threaded, allowing to classify huge images + * while fully using several core. + * + * \sa Classifier + * \ingroup Streamed + * \ingroup Threaded + * + * \ingroup OTBDimensionalityReductionLearning + */ +template <class TInputImage, class TOutputImage, class TMaskImage = TOutputImage> +class ITK_EXPORT ImageDimensionalityReductionFilter + : public itk::ImageToImageFilter<TInputImage, TOutputImage> +{ +public: + /** Standard typedefs */ + typedef ImageDimensionalityReductionFilter Self; + typedef itk::ImageToImageFilter<TInputImage, TOutputImage> Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + /** Type macro */ + itkNewMacro(Self); + + /** Creation through object factory macro */ + itkTypeMacro(ImageDimensionalityReductionFilter, ImageToImageFilter); + + typedef TInputImage InputImageType; + typedef typename InputImageType::ConstPointer InputImageConstPointerType; + typedef typename InputImageType::InternalPixelType ValueType; + + typedef TMaskImage MaskImageType; + typedef typename MaskImageType::ConstPointer MaskImageConstPointerType; + typedef typename MaskImageType::Pointer MaskImagePointerType; + + typedef TOutputImage OutputImageType; + typedef typename OutputImageType::Pointer OutputImagePointerType; + typedef typename OutputImageType::RegionType OutputImageRegionType; + typedef typename OutputImageType::InternalPixelType LabelType; + + typedef MachineLearningModel<itk::VariableLengthVector<ValueType>, itk::VariableLengthVector<LabelType>> ModelType; + typedef typename ModelType::Pointer ModelPointerType; + + typedef otb::Image<double> ConfidenceImageType; + typedef typename ConfidenceImageType::Pointer ConfidenceImagePointerType; + + /** Set/Get the model */ + itkSetObjectMacro(Model, ModelType); + itkGetObjectMacro(Model, ModelType); + + /** Set/Get the default label */ + itkSetMacro(DefaultLabel, LabelType); + itkGetMacro(DefaultLabel, LabelType); + + /** Set/Get the confidence map flag */ + itkSetMacro(UseConfidenceMap, bool); + itkGetMacro(UseConfidenceMap, bool); + + itkSetMacro(BatchMode, bool); + itkGetMacro(BatchMode, bool); + itkBooleanMacro(BatchMode); + + /** + * If set, only pixels within the mask will be classified. + * All pixels with a value greater than 0 in the mask, will be classified. + * \param mask The input mask. + */ + void SetInputMask(const MaskImageType * mask); + + /** + * Get the input mask. + * \return The mask. + */ + const MaskImageType * GetInputMask(void); + + /** + * Get the output confidence map + */ + ConfidenceImageType * GetOutputConfidence(void); + +protected: + /** Constructor */ + ImageDimensionalityReductionFilter(); + /** Destructor */ + ~ImageDimensionalityReductionFilter() override {} + + /** Generate output information */ + virtual void GenerateOutputInformation() override; + + /** Threaded generate data */ + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) override; + void ClassicThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId); + void BatchThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId); + /** Before threaded generate data */ + void BeforeThreadedGenerateData() override; + /**PrintSelf method */ + void PrintSelf(std::ostream& os, itk::Indent indent) const override; + +private: + ImageDimensionalityReductionFilter(const Self &); //purposely not implemented + void operator =(const Self&); //purposely not implemented + + /** The model used for classification */ + ModelPointerType m_Model; + /** Default label for invalid pixels (when using a mask) */ + LabelType m_DefaultLabel; + /** Flag to produce the confidence map (if the model supports it) */ + bool m_UseConfidenceMap; + bool m_BatchMode; +}; +} // End namespace otb +#ifndef OTB_MANUAL_INSTANTIATION +#include "otbImageDimensionalityReductionFilter.txx" +#endif + +#endif diff --git a/Modules/Learning/DimensionalityReductionLearning/include/otbImageDimensionalityReductionFilter.txx b/Modules/Learning/DimensionalityReductionLearning/include/otbImageDimensionalityReductionFilter.txx new file mode 100644 index 0000000000000000000000000000000000000000..140a8cd874e3555f73d985e6234c926c93e04993 --- /dev/null +++ b/Modules/Learning/DimensionalityReductionLearning/include/otbImageDimensionalityReductionFilter.txx @@ -0,0 +1,221 @@ +/* + * 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 otbImageDimensionalityReductionFilter_txx +#define otbImageDimensionalityReductionFilter_txx + +#include "otbImageDimensionalityReductionFilter.h" +#include "itkImageRegionIterator.h" +#include "itkProgressReporter.h" + +namespace otb +{ +/** + * Constructor + */ +template <class TInputImage, class TOutputImage, class TMaskImage> +ImageDimensionalityReductionFilter<TInputImage, TOutputImage, TMaskImage> +::ImageDimensionalityReductionFilter() +{ + this->SetNumberOfIndexedInputs(2); + this->SetNumberOfRequiredInputs(1); + + this->SetNumberOfRequiredOutputs(2); + this->SetNthOutput(0,TOutputImage::New()); + this->SetNthOutput(1,ConfidenceImageType::New()); + m_UseConfidenceMap = false; + m_BatchMode = true; +} + +template <class TInputImage, class TOutputImage, class TMaskImage> +void +ImageDimensionalityReductionFilter<TInputImage, TOutputImage, TMaskImage> +::SetInputMask(const MaskImageType * mask) +{ + this->itk::ProcessObject::SetNthInput(1, const_cast<MaskImageType *>(mask)); +} + +template <class TInputImage, class TOutputImage, class TMaskImage> +const typename ImageDimensionalityReductionFilter<TInputImage, TOutputImage, TMaskImage> +::MaskImageType * +ImageDimensionalityReductionFilter<TInputImage, TOutputImage, TMaskImage> +::GetInputMask() +{ + if (this->GetNumberOfInputs() < 2) + { + return ITK_NULLPTR; + } + return static_cast<const MaskImageType *>(this->itk::ProcessObject::GetInput(1)); +} + +template <class TInputImage, class TOutputImage, class TMaskImage> +typename ImageDimensionalityReductionFilter<TInputImage, TOutputImage, TMaskImage> +::ConfidenceImageType * +ImageDimensionalityReductionFilter<TInputImage, TOutputImage, TMaskImage> +::GetOutputConfidence() +{ + if (this->GetNumberOfOutputs() < 2) + { + return ITK_NULLPTR; + } + return static_cast<ConfidenceImageType *>(this->itk::ProcessObject::GetOutput(1)); +} + +template <class TInputImage, class TOutputImage, class TMaskImage> +void +ImageDimensionalityReductionFilter<TInputImage, TOutputImage, TMaskImage> +::BeforeThreadedGenerateData() +{ + if(m_BatchMode) + { + #ifdef _OPENMP + // OpenMP will take care of threading + this->SetNumberOfThreads(1); + #endif + } +} + +template <class TInputImage, class TOutputImage, class TMaskImage> +void +ImageDimensionalityReductionFilter<TInputImage, TOutputImage, TMaskImage> +::ClassicThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) +{ + // Get the input pointers + InputImageConstPointerType inputPtr = this->GetInput(); + MaskImageConstPointerType inputMaskPtr = this->GetInputMask(); + OutputImagePointerType outputPtr = this->GetOutput(); + ConfidenceImagePointerType confidencePtr = this->GetOutputConfidence(); + + // Progress reporting + itk::ProgressReporter progress(this, threadId, outputRegionForThread.GetNumberOfPixels()); + + // Define iterators + typedef itk::ImageRegionConstIterator<InputImageType> InputIteratorType; + typedef itk::ImageRegionIterator<OutputImageType> OutputIteratorType; + + InputIteratorType inIt(inputPtr, outputRegionForThread); + OutputIteratorType outIt(outputPtr, outputRegionForThread); + + // Walk the part of the image + for (inIt.GoToBegin(), outIt.GoToBegin(); !inIt.IsAtEnd() && !outIt.IsAtEnd(); ++inIt, ++outIt) + { + // Classifify + outIt.Set(m_Model->Predict(inIt.Get())); + progress.CompletedPixel(); + } +} + +template <class TInputImage, class TOutputImage, class TMaskImage> +void ImageDimensionalityReductionFilter<TInputImage, TOutputImage, TMaskImage>::GenerateOutputInformation() +{ + Superclass::GenerateOutputInformation(); + if (!m_Model) + { + itkGenericExceptionMacro(<< "No model for dimensionality reduction"); + } + this->GetOutput()->SetNumberOfComponentsPerPixel( m_Model->GetDimension() ); +} + +template <class TInputImage, class TOutputImage, class TMaskImage> +void +ImageDimensionalityReductionFilter<TInputImage, TOutputImage, TMaskImage> +::BatchThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) +{ + // Get the input pointers + InputImageConstPointerType inputPtr = this->GetInput(); + MaskImageConstPointerType inputMaskPtr = this->GetInputMask(); + OutputImagePointerType outputPtr = this->GetOutput(); + ConfidenceImagePointerType confidencePtr = this->GetOutputConfidence(); + + // Progress reporting + itk::ProgressReporter progress(this, threadId, outputRegionForThread.GetNumberOfPixels()); + + // Define iterators + typedef itk::ImageRegionConstIterator<InputImageType> InputIteratorType; + typedef itk::ImageRegionIterator<OutputImageType> OutputIteratorType; + + InputIteratorType inIt(inputPtr, outputRegionForThread); + OutputIteratorType outIt(outputPtr, outputRegionForThread); + + typedef typename ModelType::InputSampleType InputSampleType; + typedef typename ModelType::InputListSampleType InputListSampleType; + typedef typename ModelType::TargetValueType TargetValueType; + typedef typename ModelType::TargetListSampleType TargetListSampleType; + + typename InputListSampleType::Pointer samples = InputListSampleType::New(); + unsigned int num_features = inputPtr->GetNumberOfComponentsPerPixel(); + samples->SetMeasurementVectorSize(num_features); + InputSampleType sample(num_features); + + // Fill the samples + for (inIt.GoToBegin(); !inIt.IsAtEnd(); ++inIt) + { + typename InputImageType::PixelType pix = inIt.Get(); + for(size_t feat=0; feat<num_features; ++feat) + { + sample[feat]=pix[feat]; + } + samples->PushBack(sample); + } + //Make the batch prediction + typename TargetListSampleType::Pointer labels; + + // This call is threadsafe + labels = m_Model->PredictBatch(samples); + + // Set the output values + typename TargetListSampleType::ConstIterator labIt = labels->Begin(); + for (outIt.GoToBegin(); !outIt.IsAtEnd(); ++outIt) + { + itk::VariableLengthVector<TargetValueType> labelValue; + labelValue = labIt.GetMeasurementVector(); + ++labIt; + outIt.Set(labelValue); + progress.CompletedPixel(); + } +} + +template <class TInputImage, class TOutputImage, class TMaskImage> +void +ImageDimensionalityReductionFilter<TInputImage, TOutputImage, TMaskImage> +::ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) +{ + if(m_BatchMode) + { + this->BatchThreadedGenerateData(outputRegionForThread, threadId); + } + else + { + this->ClassicThreadedGenerateData(outputRegionForThread, threadId); + } +} + +/** + * PrintSelf Method + */ +template <class TInputImage, class TOutputImage, class TMaskImage> +void +ImageDimensionalityReductionFilter<TInputImage, TOutputImage, TMaskImage> +::PrintSelf(std::ostream& os, itk::Indent indent) const +{ + Superclass::PrintSelf(os, indent); +} + +} // End namespace otb +#endif diff --git a/Modules/Learning/DimensionalityReductionLearning/include/otbPCAModel.h b/Modules/Learning/DimensionalityReductionLearning/include/otbPCAModel.h new file mode 100644 index 0000000000000000000000000000000000000000..cfecceb3904ed5ac2282c4a61f07782f23898c5e --- /dev/null +++ b/Modules/Learning/DimensionalityReductionLearning/include/otbPCAModel.h @@ -0,0 +1,122 @@ +/* + * 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 otbPCAModel_h +#define otbPCAModel_h + +#include "otbMachineLearningModelTraits.h" +#include "otbMachineLearningModel.h" + +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wunused-parameter" +#pragma GCC diagnostic ignored "-Woverloaded-virtual" +#pragma GCC diagnostic ignored "-Wsign-compare" +#endif +#include "otb_shark.h" +#include <shark/Algorithms/Trainers/PCA.h> +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic pop +#endif + +namespace otb +{ + +/** \class PCAModel + * + * This class wraps a PCA model implemented by Shark, in a otb::MachineLearningModel + * + * \ingroup OTBDimensionalityReductionLearning + */ +template <class TInputValue> +class ITK_EXPORT PCAModel + : public MachineLearningModel< + itk::VariableLengthVector< TInputValue >, + itk::VariableLengthVector< TInputValue > > +{ +public: + typedef PCAModel Self; + typedef MachineLearningModel< + itk::VariableLengthVector< TInputValue >, + itk::VariableLengthVector< TInputValue> > Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + typedef typename Superclass::InputValueType InputValueType; + typedef typename Superclass::InputSampleType InputSampleType; + typedef typename Superclass::InputListSampleType InputListSampleType; + typedef typename InputListSampleType::Pointer ListSamplePointerType; + typedef typename Superclass::TargetValueType TargetValueType; + typedef typename Superclass::TargetSampleType TargetSampleType; + typedef typename Superclass::TargetListSampleType TargetListSampleType; + + // Confidence map related typedefs + typedef typename Superclass::ConfidenceValueType ConfidenceValueType; + typedef typename Superclass::ConfidenceSampleType ConfidenceSampleType; + typedef typename Superclass::ConfidenceListSampleType ConfidenceListSampleType; + + itkNewMacro(Self); + itkTypeMacro(PCAModel, DimensionalityReductionModel); + + itkSetMacro(DoResizeFlag,bool); + + itkSetMacro(WriteEigenvectors, bool); + itkGetMacro(WriteEigenvectors, bool); + + bool CanReadFile(const std::string & filename) override; + bool CanWriteFile(const std::string & filename) override; + + void Save(const std::string & filename, const std::string & name="") override; + void Load(const std::string & filename, const std::string & name="") override; + + void Train() override; + +protected: + PCAModel(); + ~PCAModel() override; + + virtual TargetSampleType DoPredict( + const InputSampleType& input, + ConfidenceValueType * quality = ITK_NULLPTR) const override; + + virtual void DoPredictBatch( + const InputListSampleType *, + const unsigned int & startIndex, + const unsigned int & size, + TargetListSampleType *, + ConfidenceListSampleType * quality = ITK_NULLPTR) const override; + +private: + shark::LinearModel<> m_Encoder; + shark::LinearModel<> m_Decoder; + shark::PCA m_PCA; + bool m_DoResizeFlag; + bool m_WriteEigenvectors; +}; +} // end namespace otb + + +#ifndef OTB_MANUAL_INSTANTIATION +#include "otbPCAModel.txx" +#endif + + +#endif + diff --git a/Modules/Learning/DimensionalityReductionLearning/include/otbPCAModel.txx b/Modules/Learning/DimensionalityReductionLearning/include/otbPCAModel.txx new file mode 100644 index 0000000000000000000000000000000000000000..a387852fecc386d9c5f2a6c27c7bf39cd7a3649d --- /dev/null +++ b/Modules/Learning/DimensionalityReductionLearning/include/otbPCAModel.txx @@ -0,0 +1,197 @@ +/* + * 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 otbPCAModel_txx +#define otbPCAModel_txx + +#include "otbPCAModel.h" + +#include <fstream> +#include "itkMacro.h" +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wunused-parameter" +#pragma GCC diagnostic ignored "-Woverloaded-virtual" +#endif +#include "otbSharkUtils.h" +//include train function +#include <shark/ObjectiveFunctions/ErrorFunction.h> +#include <shark/Algorithms/GradientDescent/Rprop.h>// the RProp optimization algorithm +#include <shark/ObjectiveFunctions/Loss/SquaredLoss.h> // squared loss used for regression +#include <shark/ObjectiveFunctions/Regularizer.h> //L2 regulariziation +#include <shark/ObjectiveFunctions/ErrorFunction.h> +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic pop +#endif + +namespace otb +{ + +template <class TInputValue> +PCAModel<TInputValue>::PCAModel() +{ + this->m_IsDoPredictBatchMultiThreaded = true; + this->m_Dimension = 0; +} + +template <class TInputValue> +PCAModel<TInputValue>::~PCAModel() +{ +} + +template <class TInputValue> +void +PCAModel<TInputValue>::Train() +{ + std::vector<shark::RealVector> features; + + Shark::ListSampleToSharkVector(this->GetInputListSample(), features); + + shark::Data<shark::RealVector> inputSamples = shark::createDataFromRange( features ); + m_PCA.setData(inputSamples); + m_PCA.encoder(m_Encoder, this->m_Dimension); + m_PCA.decoder(m_Decoder, this->m_Dimension); +} + +template <class TInputValue> +bool +PCAModel<TInputValue>::CanReadFile(const std::string & filename) +{ + try + { + this->Load(filename); + m_Encoder.name(); + } + catch(...) + { + return false; + } + return true; +} + +template <class TInputValue> +bool PCAModel<TInputValue>::CanWriteFile(const std::string & /*filename*/) +{ + return true; +} + +template <class TInputValue> +void +PCAModel<TInputValue>::Save(const std::string & filename, const std::string & /*name*/) +{ + std::ofstream ofs(filename); + ofs << "pca" << std::endl; //first line + shark::TextOutArchive oa(ofs); + m_Encoder.write(oa); + ofs.close(); + + if (this->m_WriteEigenvectors == true) // output the map vectors in a txt file + { + std::ofstream otxt(filename+".txt"); + + otxt << "Eigenvectors : " << m_PCA.eigenvectors() << std::endl; + otxt << "Eigenvalues : " << m_PCA.eigenvalues() << std::endl; + + std::vector<shark::RealVector> features; + + shark::SquaredLoss<shark::RealVector> loss; + Shark::ListSampleToSharkVector(this->GetInputListSample(), features); + shark::Data<shark::RealVector> inputSamples = shark::createDataFromRange( features ); + otxt << "Reconstruction error : " << + loss.eval(inputSamples,m_Decoder(m_Encoder(inputSamples))) << std::endl; + otxt.close(); + } +} + +template <class TInputValue> +void +PCAModel<TInputValue>::Load(const std::string & filename, const std::string & /*name*/) +{ + std::ifstream ifs(filename); + char encoder[256]; + ifs.getline(encoder,256); + std::string encoderstr(encoder); + + if (encoderstr != "pca"){ + itkExceptionMacro(<< "Error opening " << filename.c_str() ); + } + shark::TextInArchive ia(ifs); + m_Encoder.read(ia); + ifs.close(); + if (this->m_Dimension ==0) + { + this->m_Dimension = m_Encoder.outputShape()[0]; + } + + auto eigenvectors = m_Encoder.matrix(); + eigenvectors.resize(this->m_Dimension,m_Encoder.inputShape()[0]); + + m_Encoder.setStructure(eigenvectors, m_Encoder.offset() ); +} + +template <class TInputValue> +typename PCAModel<TInputValue>::TargetSampleType +PCAModel<TInputValue>::DoPredict(const InputSampleType & value, ConfidenceValueType * /*quality*/) const +{ + shark::RealVector samples(value.Size()); + for(size_t i = 0; i < value.Size();i++) + { + samples[i]=value[i]; + } + + std::vector<shark::RealVector> features; + features.push_back(samples); + + shark::Data<shark::RealVector> data = shark::createDataFromRange(features); + + data = m_Encoder(data); + TargetSampleType target; + target.SetSize(this->m_Dimension); + + for(unsigned int a = 0; a < this->m_Dimension; ++a){ + target[a]=data.element(0)[a]; + } + return target; +} + +template <class TInputValue> +void PCAModel<TInputValue> +::DoPredictBatch(const InputListSampleType *input, const unsigned int & startIndex, const unsigned int & size, TargetListSampleType * targets, ConfidenceListSampleType * /*quality*/) const +{ + std::vector<shark::RealVector> features; + Shark::ListSampleRangeToSharkVector(input, features,startIndex,size); + shark::Data<shark::RealVector> data = shark::createDataFromRange(features); + TargetSampleType target; + data = m_Encoder(data); + unsigned int id = startIndex; + target.SetSize(this->m_Dimension); + for(const auto& p : data.elements()) + { + for(unsigned int a = 0; a < this->m_Dimension; ++a) + { + target[a]=p[a]; + } + targets->SetMeasurementVector(id,target); + ++id; + } +} + +} // namespace otb +#endif diff --git a/Modules/Learning/DimensionalityReductionLearning/include/otbPCAModelFactory.h b/Modules/Learning/DimensionalityReductionLearning/include/otbPCAModelFactory.h new file mode 100644 index 0000000000000000000000000000000000000000..4080014b1032602850da11b010e33388cd54281f --- /dev/null +++ b/Modules/Learning/DimensionalityReductionLearning/include/otbPCAModelFactory.h @@ -0,0 +1,77 @@ +/* + * 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 otbPCAModelFactory_h +#define otbPCAModelFactory_h + +#include "itkObjectFactoryBase.h" +#include "itkImageIOBase.h" + +namespace otb +{ + +/** \class PCAModelFactory + * + * Factory for the PCAModel + * + * \ingroup OTBDimensionalityReductionLearning + */ +template <class TInputValue, class TTargetValue> +class ITK_EXPORT PCAModelFactory : public itk::ObjectFactoryBase +{ +public: + /** Standard class typedefs. */ + typedef PCAModelFactory Self; + typedef itk::ObjectFactoryBase Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + /** Class methods used to interface with the registered factories. */ + const char* GetITKSourceVersion(void) const override; + const char* GetDescription(void) const override; + + /** Method for class instantiation. */ + itkFactorylessNewMacro(Self); + + /** Run-time type information (and related methods). */ + itkTypeMacro(PCAModelFactory, itk::ObjectFactoryBase); + + /** Register one factory of this type */ + static void RegisterOneFactory(void) + { + Pointer PCAFactory = PCAModelFactory::New(); + itk::ObjectFactoryBase::RegisterFactory(PCAFactory); + } + +protected: + PCAModelFactory(); + ~PCAModelFactory() override; + +private: + PCAModelFactory(const Self &); //purposely not implemented + void operator =(const Self&); //purposely not implemented +}; + +} //namespace otb + +#ifndef OTB_MANUAL_INSTANTIATION +#include "otbPCAModelFactory.txx" +#endif + +#endif diff --git a/Modules/Learning/DimensionalityReductionLearning/include/otbPCAModelFactory.txx b/Modules/Learning/DimensionalityReductionLearning/include/otbPCAModelFactory.txx new file mode 100644 index 0000000000000000000000000000000000000000..ab31accbe01b926a1d4ca57b4f23b3fc813cd931 --- /dev/null +++ b/Modules/Learning/DimensionalityReductionLearning/include/otbPCAModelFactory.txx @@ -0,0 +1,65 @@ +/* + * 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 otbPCAFactory_txx +#define otbPCAFactory_txx + +#include "otbPCAModelFactory.h" + +#include "itkCreateObjectFunction.h" +#include "otbPCAModel.h" +#include "itkVersion.h" + +namespace otb +{ + +template <class TInputValue, class TOutputValue> +PCAModelFactory<TInputValue,TOutputValue>::PCAModelFactory() +{ + std::string classOverride = std::string("DimensionalityReductionModel"); + std::string subclass = std::string("PCAModel"); + + this->RegisterOverride( + classOverride.c_str(), + subclass.c_str(), + "Shark PCA ML Model", + 1, + itk::CreateObjectFunction<PCAModel<TInputValue>>::New()); +} + +template <class TInputValue, class TOutputValue> +PCAModelFactory<TInputValue,TOutputValue>::~PCAModelFactory() +{ +} + +template <class TInputValue, class TOutputValue> +const char* PCAModelFactory<TInputValue,TOutputValue>::GetITKSourceVersion(void) const +{ + return ITK_SOURCE_VERSION; +} + +template <class TInputValue, class TOutputValue> +const char* PCAModelFactory<TInputValue,TOutputValue>::GetDescription() const +{ + return "PCA model factory"; +} + +} // end namespace otb + +#endif diff --git a/Modules/Learning/DimensionalityReductionLearning/include/otbSOMModel.h b/Modules/Learning/DimensionalityReductionLearning/include/otbSOMModel.h new file mode 100644 index 0000000000000000000000000000000000000000..e7c77a245cd7b408f3687f5b236c6db0c881edcc --- /dev/null +++ b/Modules/Learning/DimensionalityReductionLearning/include/otbSOMModel.h @@ -0,0 +1,155 @@ +/* + * 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 otbSOMModel_h +#define otbSOMModel_h + +#include "otbSOMMap.h" + +#include "itkEuclideanDistanceMetric.h" // the distance function + +#include "otbCzihoSOMLearningBehaviorFunctor.h" +#include "otbCzihoSOMNeighborhoodBehaviorFunctor.h" + +#include "otbMachineLearningModelTraits.h" +#include "otbMachineLearningModel.h" + +namespace otb +{ + +/** \class SOMModel + * MachineLearningModel for Self-Organizing Map + * + * \ingroup OTBDimensionalityReductionLearning + */ +template <class TInputValue, unsigned int MapDimension> +class ITK_EXPORT SOMModel + : public MachineLearningModel< + itk::VariableLengthVector< TInputValue >, + itk::VariableLengthVector< TInputValue > > +{ +public: + typedef SOMModel Self; + typedef MachineLearningModel< + itk::VariableLengthVector< TInputValue >, + itk::VariableLengthVector< TInputValue > > Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + typedef typename Superclass::InputValueType InputValueType; + typedef typename Superclass::InputSampleType InputSampleType; + typedef typename Superclass::InputListSampleType InputListSampleType; + typedef typename InputListSampleType::Pointer ListSamplePointerType; + typedef typename Superclass::TargetValueType TargetValueType; + typedef typename Superclass::TargetSampleType TargetSampleType; + typedef typename Superclass::TargetListSampleType TargetListSampleType; + + // Confidence map related typedefs + typedef typename Superclass::ConfidenceValueType ConfidenceValueType; + typedef typename Superclass::ConfidenceSampleType ConfidenceSampleType; + typedef typename Superclass::ConfidenceListSampleType ConfidenceListSampleType; + + typedef SOMMap< + itk::VariableLengthVector<TInputValue>, + itk::Statistics::EuclideanDistanceMetric< + itk::VariableLengthVector<TInputValue> >, + MapDimension> MapType; + typedef typename MapType::SizeType SizeType; + typedef typename MapType::SpacingType SpacingType; + + typedef Functor::CzihoSOMLearningBehaviorFunctor SOMLearningBehaviorFunctorType; + typedef Functor::CzihoSOMNeighborhoodBehaviorFunctor SOMNeighborhoodBehaviorFunctorType; + + itkNewMacro(Self); + itkTypeMacro(SOMModel, DimensionalityReductionModel); + + /** Accessors */ + itkSetMacro(NumberOfIterations, unsigned int); + itkGetMacro(NumberOfIterations, unsigned int); + itkSetMacro(BetaInit, double); + itkGetMacro(BetaInit, double); + itkSetMacro(WriteMap, bool); + itkGetMacro(WriteMap, bool); + itkSetMacro(BetaEnd, double); + itkGetMacro(BetaEnd, double); + itkSetMacro(MinWeight, InputValueType); + itkGetMacro(MinWeight, InputValueType); + itkSetMacro(MaxWeight, InputValueType); + itkGetMacro(MaxWeight, InputValueType); + itkSetMacro(MapSize, SizeType); + itkGetMacro(MapSize, SizeType); + itkSetMacro(NeighborhoodSizeInit, SizeType); + itkGetMacro(NeighborhoodSizeInit, SizeType); + itkSetMacro(RandomInit, bool); + itkGetMacro(RandomInit, bool); + itkSetMacro(Seed, unsigned int); + itkGetMacro(Seed, unsigned int); + + bool CanReadFile(const std::string & filename) override; + bool CanWriteFile(const std::string & filename) override; + + void Save(const std::string & filename, const std::string & name="") override; + void Load(const std::string & filename, const std::string & name="") override; + + void Train() override; + +protected: + SOMModel(); + ~SOMModel() override; + +private: + typename MapType::Pointer m_SOMMap; + + virtual TargetSampleType DoPredict( + const InputSampleType& input, + ConfidenceValueType * quality = ITK_NULLPTR) const override; + + /** Map size (width, height) */ + SizeType m_MapSize; + /** Number of iterations */ + unsigned int m_NumberOfIterations; + /** Initial learning coefficient */ + double m_BetaInit; + /** Final learning coefficient */ + double m_BetaEnd; + /** Initial neighborhood size */ + SizeType m_NeighborhoodSizeInit; + /** Minimum initial neuron weights */ + InputValueType m_MinWeight; + /** Maximum initial neuron weights */ + InputValueType m_MaxWeight; + /** Random initialization bool */ + bool m_RandomInit; + /** Seed for random initialization */ + unsigned int m_Seed; + /** Behavior of the Learning weightening (link to the beta coefficient) */ + SOMLearningBehaviorFunctorType m_BetaFunctor; + /** Behavior of the Neighborhood extent */ + SOMNeighborhoodBehaviorFunctorType m_NeighborhoodSizeFunctor; + /** Write the SOM Map vectors in a txt file */ + bool m_WriteMap; +}; + +} // end namespace otb + +#ifndef OTB_MANUAL_INSTANTIATION +#include "otbSOMModel.txx" +#endif + +#endif diff --git a/Modules/Learning/DimensionalityReductionLearning/include/otbSOMModel.txx b/Modules/Learning/DimensionalityReductionLearning/include/otbSOMModel.txx new file mode 100644 index 0000000000000000000000000000000000000000..e1d7dc3fc6251abbdbd3aa210cd3c3ebced903d8 --- /dev/null +++ b/Modules/Learning/DimensionalityReductionLearning/include/otbSOMModel.txx @@ -0,0 +1,229 @@ +/* + * 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 otbSOMModel_txx +#define otbSOMModel_txx + +#include "otbSOMModel.h" +#include "otbSOM.h" + +#include "itkMacro.h" +#include "itkImageRegionIterator.h" +#include "itkImageRegionConstIterator.h" +#include "itkImage.h" + +#include <fstream> + +namespace otb +{ + +namespace internal +{ +template<typename T> +std::ostream& BinaryWrite(std::ostream& stream, const T& value) +{ + return stream.write(reinterpret_cast<const char*>(&value), sizeof(T)); +} + +std::ostream& BinaryWriteString(std::ofstream& stream, const std::string& value) +{ + return stream.write(value.c_str(), value.length()); +} + +template<typename T> +std::istream & BinaryRead(std::istream& stream, T& value) +{ + return stream.read(reinterpret_cast<char*>(&value), sizeof(T)); +} +} // end of namespace internal + +template <class TInputValue, unsigned int MapDimension> +SOMModel<TInputValue, MapDimension>::SOMModel() +{ + this->m_Dimension = MapType::ImageDimension; +} + +template <class TInputValue, unsigned int MapDimension> +SOMModel<TInputValue, MapDimension>::~SOMModel() +{ +} + +template <class TInputValue, unsigned int MapDimension> +void +SOMModel<TInputValue, MapDimension>::Train() +{ + typedef otb::SOM<InputListSampleType, MapType> EstimatorType; + typename EstimatorType::Pointer estimator = EstimatorType::New(); + estimator->SetListSample(this->GetInputListSample()); + estimator->SetMapSize(m_MapSize); + estimator->SetNeighborhoodSizeInit(m_NeighborhoodSizeInit); + estimator->SetNumberOfIterations(m_NumberOfIterations); + estimator->SetBetaInit(m_BetaInit); + estimator->SetBetaEnd(m_BetaEnd); + estimator->SetMaxWeight(m_MaxWeight); + estimator->Update(); + m_SOMMap = estimator->GetOutput(); +} + +template <class TInputValue, unsigned int MapDimension> +bool +SOMModel<TInputValue, MapDimension>::CanReadFile(const std::string & filename) +{ + try + { + this->Load(filename); + } + catch(...) + { + return false; + } + return true; +} + +template <class TInputValue, unsigned int MapDimension> +bool +SOMModel<TInputValue, MapDimension>::CanWriteFile(const std::string & /*filename*/) +{ + return true; +} + +template <class TInputValue, unsigned int MapDimension> +void +SOMModel<TInputValue, MapDimension>::Save(const std::string & filename, const std::string & /*name*/) +{ + itk::ImageRegionConstIterator<MapType> inputIterator(m_SOMMap,m_SOMMap->GetLargestPossibleRegion()); + inputIterator.GoToBegin(); + std::ofstream ofs(filename, std::ios::binary); + internal::BinaryWriteString(ofs,"som"); + internal::BinaryWrite(ofs,static_cast<unsigned int>(MapDimension)); + SizeType size = m_SOMMap->GetLargestPossibleRegion().GetSize() ; + for (size_t i=0;i<MapDimension;i++) + { + internal::BinaryWrite(ofs,size[i]); + } + + internal::BinaryWrite(ofs,inputIterator.Get().GetNumberOfElements()); + while(!inputIterator.IsAtEnd()) + { + InputSampleType vect = inputIterator.Get(); + for (size_t i=0;i<vect.GetNumberOfElements();i++) + { + internal::BinaryWrite(ofs,vect[i]); + } + ++inputIterator; + } + ofs.close(); + + // output the map vectors in a txt file + if (this->m_WriteMap == true) + { + std::ofstream otxt(filename+".txt"); + inputIterator.GoToBegin(); + while(!inputIterator.IsAtEnd()) + { + InputSampleType vect = inputIterator.Get(); + for (size_t i=0;i<vect.GetNumberOfElements();i++) + { + otxt << vect[i] << " "; + } + otxt << std::endl; + ++inputIterator; + } + otxt.close(); + } +} + +template <class TInputValue, unsigned int MapDimension> +void +SOMModel<TInputValue, MapDimension>::Load(const std::string & filename, const std::string & /*name*/) +{ + std::ifstream ifs(filename, std::ios::binary); + + /** Read the model key (should be som) */ + char s[]=" "; + for (int i=0; i<3; i++) + { + internal::BinaryRead(ifs,s[i]); + } + std::string modelType(s); + /** Read the dimension of the map (should be equal to MapDimension) */ + + unsigned int dimension; + internal::BinaryRead(ifs,dimension); + if (modelType != "som" || dimension != MapDimension) + { + itkExceptionMacro(<< "Error opening " << filename.c_str() ); + } + + SizeType size; + itk::Index< MapDimension > index; + for (unsigned int i=0 ; i<MapDimension; i++) + { + internal::BinaryRead(ifs,size[i]); + index[i]=0; + } + unsigned int numberOfElements; + internal::BinaryRead(ifs,numberOfElements); + m_SOMMap = MapType::New(); + typename MapType::RegionType region; + region.SetSize( size ); + m_SOMMap->SetNumberOfComponentsPerPixel(numberOfElements); + region.SetIndex( index ); + m_SOMMap->SetRegions( region ); + m_SOMMap->Allocate(); + + itk::ImageRegionIterator<MapType> outputIterator(m_SOMMap,region); + outputIterator.GoToBegin(); + std::string value; + while(!outputIterator.IsAtEnd()) + { + InputSampleType vect(numberOfElements); + for (unsigned int i=0 ; i<numberOfElements; i++) + { + // InputValue type is not the same during training anddimredvector. + float v; + internal::BinaryRead(ifs,v); + vect[i] = static_cast<double>(v); + } + outputIterator.Set(vect); + ++outputIterator; + } + ifs.close(); + this->m_Dimension = MapType::ImageDimension; +} + +template <class TInputValue, unsigned int MapDimension> +typename SOMModel<TInputValue, MapDimension>::TargetSampleType +SOMModel<TInputValue, MapDimension>::DoPredict( + const InputSampleType & value, + ConfidenceValueType * /*quality*/) const +{ + TargetSampleType target; + target.SetSize(this->m_Dimension); + + auto winner =m_SOMMap->GetWinner(value); + for (unsigned int i=0; i< this->m_Dimension ;i++) + { + target[i] = winner.GetElement(i); + } + return target; +} + +} // namespace otb +#endif diff --git a/Modules/Learning/DimensionalityReductionLearning/include/otbSOMModelFactory.h b/Modules/Learning/DimensionalityReductionLearning/include/otbSOMModelFactory.h new file mode 100644 index 0000000000000000000000000000000000000000..3276d635961ae665f73faf7ec2d825d65e496ae8 --- /dev/null +++ b/Modules/Learning/DimensionalityReductionLearning/include/otbSOMModelFactory.h @@ -0,0 +1,78 @@ +/* + * 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 otbSOMModelFactory_h +#define otbSOMModelFactory_h + +#include "itkObjectFactoryBase.h" +#include "itkImageIOBase.h" + +namespace otb +{ + +/** \class SOMModelFactory + * + * Factory for SOMModel + * + * \ingroup OTBDimensionalityReductionLearning + */ +template <class TInputValue, class TTargetValue, unsigned int MapDimension> +class ITK_EXPORT SOMModelFactory : public itk::ObjectFactoryBase +{ +public: + /** Standard class typedefs. */ + typedef SOMModelFactory Self; + typedef itk::ObjectFactoryBase Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + /** Class methods used to interface with the registered factories. */ + const char* GetITKSourceVersion(void) const override; + const char* GetDescription(void) const override; + + /** Method for class instantiation. */ + itkFactorylessNewMacro(Self); + + /** Run-time type information (and related methods). */ + itkTypeMacro(SOMModelFactory, itk::ObjectFactoryBase); + + /** Register one factory of this type */ + static void RegisterOneFactory(void) + { + Pointer SOMFactory = SOMModelFactory::New(); + itk::ObjectFactoryBase::RegisterFactory(SOMFactory); + } + +protected: + SOMModelFactory(); + ~SOMModelFactory() override; + +private: + SOMModelFactory(const Self &); //purposely not implemented + void operator =(const Self&); //purposely not implemented + +}; + +} //namespace otb + +#ifndef OTB_MANUAL_INSTANTIATION +#include "otbSOMModelFactory.txx" +#endif + +#endif diff --git a/Modules/Learning/DimensionalityReductionLearning/include/otbSOMModelFactory.txx b/Modules/Learning/DimensionalityReductionLearning/include/otbSOMModelFactory.txx new file mode 100644 index 0000000000000000000000000000000000000000..5799660768e900fa37e2dc1f4365a5f37b66079d --- /dev/null +++ b/Modules/Learning/DimensionalityReductionLearning/include/otbSOMModelFactory.txx @@ -0,0 +1,64 @@ +/* + * 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 otbSOMFactory_txx +#define otbSOMFactory_txx + +#include "otbSOMModelFactory.h" + +#include "itkCreateObjectFunction.h" +#include "otbSOMModel.h" +#include "itkVersion.h" + +namespace otb +{ +template <class TInputValue, class TOutputValue, unsigned int MapDimension> +SOMModelFactory<TInputValue,TOutputValue,MapDimension>::SOMModelFactory() +{ + std::string classOverride = std::string("DimensionalityReductionModel"); + std::string subclass = std::string("SOMModel"); + + this->RegisterOverride( + classOverride.c_str(), + subclass.c_str(), + "SOM DR Model", + 1, + itk::CreateObjectFunction<SOMModel<TInputValue, MapDimension>>::New()); +} + +template <class TInputValue, class TOutputValue, unsigned int MapDimension> +SOMModelFactory<TInputValue,TOutputValue,MapDimension>::~SOMModelFactory() +{ +} + +template <class TInputValue, class TOutputValue, unsigned int MapDimension> +const char* SOMModelFactory<TInputValue,TOutputValue,MapDimension>::GetITKSourceVersion(void) const +{ + return ITK_SOURCE_VERSION; +} + +template <class TInputValue, class TOutputValue, unsigned int MapDimension> +const char* SOMModelFactory<TInputValue,TOutputValue,MapDimension>::GetDescription() const +{ + return "SOM model factory"; +} + +} // end namespace otb + +#endif diff --git a/Modules/Learning/DimensionalityReductionLearning/otb-module.cmake b/Modules/Learning/DimensionalityReductionLearning/otb-module.cmake new file mode 100644 index 0000000000000000000000000000000000000000..aaff635d359f095f0e8cd79c32ebac618498e6bc --- /dev/null +++ b/Modules/Learning/DimensionalityReductionLearning/otb-module.cmake @@ -0,0 +1,36 @@ +# +# 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 "Dimensionality reduction application") +otb_module(OTBDimensionalityReductionLearning + DEPENDS + OTBCommon + OTBITK + OTBShark + OTBBoost + OTBSOM + OTBLearningBase + + TEST_DEPENDS + OTBTestKernel + + DESCRIPTION + "${DOCUMENTATION}" +) diff --git a/Modules/Learning/DimensionalityReductionLearning/test/CMakeLists.txt b/Modules/Learning/DimensionalityReductionLearning/test/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..e51906297744b458c625bcc8b0d78f65a67a529a --- /dev/null +++ b/Modules/Learning/DimensionalityReductionLearning/test/CMakeLists.txt @@ -0,0 +1,102 @@ +# +# 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(OTBDimensionalityReductionLearningTests +otbDimensionalityReductionLearningTestDriver.cxx +otbAutoencoderModelTest.cxx +otbPCAModelTest.cxx +otbSOMModelTest.cxx +) + +add_executable(otbDimensionalityReductionLearningTestDriver ${OTBDimensionalityReductionLearningTests}) +target_link_libraries(otbDimensionalityReductionLearningTestDriver ${OTBDimensionalityReductionLearning-Test_LIBRARIES}) +otb_module_target_label(otbDimensionalityReductionLearningTestDriver) + +# Tests Declaration +# --------------- Autoencoder -------------------------------- +otb_add_test(NAME leTuAutoencoderModelNew COMMAND + otbDimensionalityReductionLearningTestDriver + otbAutoencoderModelNew + ) + +otb_add_test(NAME leTvAutoencoderModelTrain COMMAND + otbDimensionalityReductionLearningTestDriver + otbAutoencoderModeTrain + ${INPUTDATA}/letter_light.scale + ${TEMP}/model.ae + ) + +otb_add_test(NAME leTvAutoencoderModelCanRead COMMAND + otbDimensionalityReductionLearningTestDriver + otbAutoencoderModelCanRead + ${TEMP}/model.ae + ) + +set_property(TEST leTvAutoencoderModelCanRead APPEND PROPERTY DEPENDS leTvAutoencoderModelTrain) + +# --------------- PCA -------------------------------- +otb_add_test(NAME leTuPCAModelNew COMMAND + otbDimensionalityReductionLearningTestDriver + otbPCAModelNew + ) + +otb_add_test(NAME leTvPCAModelTrain COMMAND + otbDimensionalityReductionLearningTestDriver + otbPCAModeTrain + ${INPUTDATA}/letter_light.scale + ${TEMP}/model.pca + ) + +otb_add_test(NAME leTvPCAModelCanRead COMMAND + otbDimensionalityReductionLearningTestDriver + otbPCAModelCanRead + ${TEMP}/model.pca + ) + +set_property(TEST leTvPCAModelCanRead APPEND PROPERTY DEPENDS leTvPCAModelTrain) + +# --------------- SOM -------------------------------- +otb_add_test(NAME leTuSOMModelNew COMMAND + otbDimensionalityReductionLearningTestDriver + otbSOMModelNew + ) + +otb_add_test(NAME leTvSOMModelTrain COMMAND + otbDimensionalityReductionLearningTestDriver + otbSOMModeTrain + ${INPUTDATA}/letter_light.scale + ${TEMP}/model2D.som + ${TEMP}/model3D.som + ${TEMP}/model4D.som + ${TEMP}/model5D.som + ) + +otb_add_test(NAME leTvSOMModelCanRead COMMAND + otbDimensionalityReductionLearningTestDriver + otbSOMModelCanRead + ${TEMP}/model2D.som + ${TEMP}/model3D.som + ${TEMP}/model4D.som + ${TEMP}/model5D.som + ) + +set_property(TEST leTvSOMModelCanRead APPEND PROPERTY DEPENDS leTvSOMModelTrain) diff --git a/Modules/Learning/DimensionalityReductionLearning/test/otbAutoencoderModelTest.cxx b/Modules/Learning/DimensionalityReductionLearning/test/otbAutoencoderModelTest.cxx new file mode 100644 index 0000000000000000000000000000000000000000..ad3880f6f54b9e4fb234d4d3a9297a2918c02d27 --- /dev/null +++ b/Modules/Learning/DimensionalityReductionLearning/test/otbAutoencoderModelTest.cxx @@ -0,0 +1,105 @@ +/* + * 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 "otbAutoencoderModel.h" +#include "otbReadDataFile.h" +#include "itkMacro.h" + +typedef otb::AutoencoderModel<double, shark::LogisticNeuron> LogAutoencoderModel; +typedef LogAutoencoderModel::InputListSampleType InputListSampleType; +typedef LogAutoencoderModel::TargetListSampleType TargetListSampleType; + +int otbAutoencoderModelNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) +{ + LogAutoencoderModel::Pointer model = LogAutoencoderModel::New(); + + return EXIT_SUCCESS; +} + +int otbAutoencoderModelCanRead(int argc, char * argv []) +{ + if (argc < 2) + { + std::cerr << "Usage: " << argv[0] << " <model>" << std::endl; + return EXIT_FAILURE; + } + + LogAutoencoderModel::Pointer model = LogAutoencoderModel::New(); + std::string filename(argv[1]); + if (! model->CanReadFile(filename) ) + { + std::cerr << "Failed to read model file : "<< filename << std::endl; + return EXIT_FAILURE; + } + return EXIT_SUCCESS; +} + +int otbAutoencoderModeTrain(int argc, char * argv []) +{ + if (argc < 3) + { + std::cerr << "Usage: " << argv[0] << " letter.scale model.out" << std::endl; + return EXIT_FAILURE; + } + + // Extract data from letter.scale + InputListSampleType::Pointer samples = InputListSampleType::New(); + TargetListSampleType::Pointer target = TargetListSampleType::New(); + if (!otb::ReadDataFile(argv[1], samples, target)) + { + std::cout << "Failed to read samples file " << argv[1] << std::endl; + return EXIT_FAILURE; + } + + itk::Array<unsigned int> nb_neuron; + itk::Array<float> noise; + itk::Array<float> regularization; + itk::Array<float> rho; + itk::Array<float> beta; + + nb_neuron.SetSize(1); + noise.SetSize(1); + regularization.SetSize(1); + rho.SetSize(1); + beta.SetSize(1); + + nb_neuron[0] = 14; + noise[0] = 0.0; + regularization[0] = 0.01; + rho[0] = 0.0; + beta[0] = 0.0; + + LogAutoencoderModel::Pointer model = LogAutoencoderModel::New(); + model->SetNumberOfHiddenNeurons(nb_neuron); + model->SetNumberOfIterations(50); + model->SetNumberOfIterationsFineTuning(0); + model->SetEpsilon(0.0); + model->SetInitFactor(1.0); + model->SetRegularization(regularization); + model->SetNoise(noise); + model->SetRho(rho); + model->SetBeta(beta); + model->SetWriteWeights(true); + model->SetInputListSample(samples); + model->Train(); + model->Save(std::string(argv[2])); + + return EXIT_SUCCESS; +} diff --git a/Modules/Learning/DimensionalityReductionLearning/test/otbDimensionalityReductionLearningTestDriver.cxx b/Modules/Learning/DimensionalityReductionLearning/test/otbDimensionalityReductionLearningTestDriver.cxx new file mode 100644 index 0000000000000000000000000000000000000000..6e0c644798e2501bbc77a3c7dc3a28c55b87f5d8 --- /dev/null +++ b/Modules/Learning/DimensionalityReductionLearning/test/otbDimensionalityReductionLearningTestDriver.cxx @@ -0,0 +1,34 @@ +/* + * 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(otbAutoencoderModelNew); + REGISTER_TEST(otbAutoencoderModelCanRead); + REGISTER_TEST(otbAutoencoderModeTrain); + REGISTER_TEST(otbPCAModelNew); + REGISTER_TEST(otbPCAModelCanRead); + REGISTER_TEST(otbPCAModeTrain); + REGISTER_TEST(otbSOMModelNew); + REGISTER_TEST(otbSOMModelCanRead); + REGISTER_TEST(otbSOMModeTrain); +} diff --git a/Modules/Learning/DimensionalityReductionLearning/test/otbImageDimensionalityReductionFilterTest.cxx b/Modules/Learning/DimensionalityReductionLearning/test/otbImageDimensionalityReductionFilterTest.cxx new file mode 100644 index 0000000000000000000000000000000000000000..a2b8da9d9a15553f2681fa732d90711d1b24306f --- /dev/null +++ b/Modules/Learning/DimensionalityReductionLearning/test/otbImageDimensionalityReductionFilterTest.cxx @@ -0,0 +1,20 @@ +/* + * 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. + */ + diff --git a/Modules/Learning/DimensionalityReductionLearning/test/otbPCAModelTest.cxx b/Modules/Learning/DimensionalityReductionLearning/test/otbPCAModelTest.cxx new file mode 100644 index 0000000000000000000000000000000000000000..6fe3945e43729e464de4f264025dd78fb8610e16 --- /dev/null +++ b/Modules/Learning/DimensionalityReductionLearning/test/otbPCAModelTest.cxx @@ -0,0 +1,78 @@ +/* + * 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 "otbPCAModel.h" +#include "otbReadDataFile.h" + +typedef otb::PCAModel<double> PCAModelType; +typedef PCAModelType::InputListSampleType InputListSampleType; +typedef PCAModelType::TargetListSampleType TargetListSampleType; + +int otbPCAModelNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) +{ + PCAModelType::Pointer model = PCAModelType::New(); + + return EXIT_SUCCESS; +} + +int otbPCAModelCanRead(int argc, char * argv []) +{ + if (argc < 2) + { + std::cerr << "Usage: " << argv[0] << " <model>" << std::endl; + return EXIT_FAILURE; + } + + PCAModelType::Pointer model = PCAModelType::New(); + std::string filename(argv[1]); + if (! model->CanReadFile(filename) ) + { + std::cerr << "Failed to read model file : "<< filename << std::endl; + return EXIT_FAILURE; + } + return EXIT_SUCCESS; +} + +int otbPCAModeTrain(int argc, char * argv []) +{ + if (argc < 3) + { + std::cerr << "Usage: " << argv[0] << " letter.scale model.out" << std::endl; + return EXIT_FAILURE; + } + + // Extract data from letter.scale + InputListSampleType::Pointer samples = InputListSampleType::New(); + TargetListSampleType::Pointer target = TargetListSampleType::New(); + if (!otb::ReadDataFile(argv[1], samples, target)) + { + std::cout << "Failed to read samples file " << argv[1] << std::endl; + return EXIT_FAILURE; + } + + PCAModelType::Pointer model = PCAModelType::New(); + model->SetDimension(14); + model->SetWriteEigenvectors(true); + model->SetInputListSample(samples); + model->Train(); + model->Save(std::string(argv[2])); + + return EXIT_SUCCESS; +} diff --git a/Modules/Learning/DimensionalityReductionLearning/test/otbSOMModelTest.cxx b/Modules/Learning/DimensionalityReductionLearning/test/otbSOMModelTest.cxx new file mode 100644 index 0000000000000000000000000000000000000000..092cac8404ced25b8a106e5ac5037bbaa06ced71 --- /dev/null +++ b/Modules/Learning/DimensionalityReductionLearning/test/otbSOMModelTest.cxx @@ -0,0 +1,168 @@ +/* + * 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 "otbSOMModel.h" +#include "otbReadDataFile.h" + +typedef otb::SOMModel<double,2> SOMModel2D; +typedef otb::SOMModel<double,3> SOMModel3D; +typedef otb::SOMModel<double,4> SOMModel4D; +typedef otb::SOMModel<double,5> SOMModel5D; + +typedef SOMModel2D::InputListSampleType InputListSampleType; +typedef SOMModel2D::TargetListSampleType TargetListSampleType; + +int otbSOMModelNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) +{ + SOMModel2D::Pointer model2D = SOMModel2D::New(); + SOMModel3D::Pointer model3D = SOMModel3D::New(); + SOMModel4D::Pointer model4D = SOMModel4D::New(); + SOMModel5D::Pointer model5D = SOMModel5D::New(); + + return EXIT_SUCCESS; +} + +int otbSOMModelCanRead(int argc, char * argv []) +{ + if (argc < 2) + { + std::cerr << "Usage: " << argv[0] << " <model2D> <model3D> <model4D> <model5D>" << std::endl; + return EXIT_FAILURE; + } + + std::string filename2D(argv[1]); + std::string filename3D(argv[2]); + std::string filename4D(argv[3]); + std::string filename5D(argv[4]); + + SOMModel2D::Pointer model2D = SOMModel2D::New(); + SOMModel3D::Pointer model3D = SOMModel3D::New(); + SOMModel4D::Pointer model4D = SOMModel4D::New(); + SOMModel5D::Pointer model5D = SOMModel5D::New(); + + if (! model2D->CanReadFile(filename2D) ) + { + std::cerr << "Failed to read model file : "<< filename2D << std::endl; + return EXIT_FAILURE; + } + if (! model3D->CanReadFile(filename3D) ) + { + std::cerr << "Failed to read model file : "<< filename3D << std::endl; + return EXIT_FAILURE; + } + if (! model4D->CanReadFile(filename4D) ) + { + std::cerr << "Failed to read model file : "<< filename4D << std::endl; + return EXIT_FAILURE; + } + if (! model5D->CanReadFile(filename5D) ) + { + std::cerr << "Failed to read model file : "<< filename5D << std::endl; + return EXIT_FAILURE; + } + return EXIT_SUCCESS; +} + +int otbSOMModeTrain(int argc, char * argv []) +{ + if (argc < 3) + { + std::cerr << "Usage: " << argv[0] << " letter.scale model2D.out model3D.out model4D.out model5D.out" << std::endl; + return EXIT_FAILURE; + } + + // Extract data from letter.scale + InputListSampleType::Pointer samples = InputListSampleType::New(); + TargetListSampleType::Pointer target = TargetListSampleType::New(); + if (!otb::ReadDataFile(argv[1], samples, target)) + { + std::cout << "Failed to read samples file " << argv[1] << std::endl; + return EXIT_FAILURE; + } + + SOMModel2D::Pointer model2D = SOMModel2D::New(); + SOMModel3D::Pointer model3D = SOMModel3D::New(); + SOMModel4D::Pointer model4D = SOMModel4D::New(); + SOMModel5D::Pointer model5D = SOMModel5D::New(); + + SOMModel2D::SizeType size2D, radius2D; + size2D.Fill(10); + radius2D.Fill(3); + SOMModel3D::SizeType size3D, radius3D; + size3D.Fill(6); + radius3D.Fill(3); + SOMModel4D::SizeType size4D, radius4D; + size4D.Fill(4); + radius4D.Fill(2); + SOMModel5D::SizeType size5D, radius5D; + size5D.Fill(3); + radius5D.Fill(2); + + std::cout << "Train 2D model..."<< std::endl; + model2D->SetNumberOfIterations(10); + model2D->SetBetaInit(1.0); + model2D->SetWriteMap(true); + model2D->SetBetaEnd(0.1); + model2D->SetMaxWeight(10.0); + model2D->SetMapSize(size2D); + model2D->SetNeighborhoodSizeInit(radius2D); + model2D->SetInputListSample(samples); + model2D->Train(); + model2D->Save(std::string(argv[2])); + + std::cout << "Train 3D model..."<< std::endl; + model3D->SetNumberOfIterations(10); + model3D->SetBetaInit(1.0); + model3D->SetWriteMap(true); + model3D->SetBetaEnd(0.1); + model3D->SetMaxWeight(10.0); + model3D->SetMapSize(size3D); + model3D->SetNeighborhoodSizeInit(radius3D); + model3D->SetInputListSample(samples); + model3D->Train(); + model3D->Save(std::string(argv[3])); + + std::cout << "Train 4D model..."<< std::endl; + model4D->SetNumberOfIterations(10); + model4D->SetBetaInit(1.0); + model4D->SetWriteMap(true); + model4D->SetBetaEnd(0.1); + model4D->SetMaxWeight(10.0); + model4D->SetMapSize(size4D); + model4D->SetNeighborhoodSizeInit(radius4D); + model4D->SetInputListSample(samples); + model4D->Train(); + model4D->Save(std::string(argv[4])); + + std::cout << "Train 5D model..."<< std::endl; + model5D->SetNumberOfIterations(10); + model5D->SetBetaInit(1.0); + model5D->SetWriteMap(true); + model5D->SetBetaEnd(0.1); + model5D->SetMaxWeight(10.0); + model5D->SetMapSize(size5D); + model5D->SetNeighborhoodSizeInit(radius5D); + model5D->SetInputListSample(samples); + model5D->Train(); + model5D->Save(std::string(argv[5])); + + return EXIT_SUCCESS; +} + diff --git a/Modules/Learning/LearningBase/CMakeLists.txt b/Modules/Learning/LearningBase/CMakeLists.txt index b3460da963ae8c229aee0b34e3120fb27d27d6ec..45b573a3dc2006a8f638f7b81a80880adebc334a 100644 --- a/Modules/Learning/LearningBase/CMakeLists.txt +++ b/Modules/Learning/LearningBase/CMakeLists.txt @@ -20,4 +20,6 @@ project(OTBLearningBase) +set(OTBLearningBase_LIBRARIES OTBLearningBase) + otb_module_impl() diff --git a/Modules/Learning/LearningBase/include/otbDecisionTree.h b/Modules/Learning/LearningBase/include/otbDecisionTree.h index 9a9d277dc411d49911752b7a184630dc9ea3a185..1bb14365c0312f5c6e15c04620e811500233d200 100644 --- a/Modules/Learning/LearningBase/include/otbDecisionTree.h +++ b/Modules/Learning/LearningBase/include/otbDecisionTree.h @@ -100,11 +100,11 @@ protected: /** Constructor */ DecisionTree(); /** Destructor */ - ~DecisionTree() ITK_OVERRIDE; + ~DecisionTree() override; /** Output information redefinition */ /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: DecisionTree(const Self &); // purposely not implemented diff --git a/Modules/Learning/LearningBase/include/otbGaussianModelComponent.h b/Modules/Learning/LearningBase/include/otbGaussianModelComponent.h index 58472ddf43660af56d8caf9c769932b9e97cd4da..3677f64c12586de80930684ea484c210c11221ad 100644 --- a/Modules/Learning/LearningBase/include/otbGaussianModelComponent.h +++ b/Modules/Learning/LearningBase/include/otbGaussianModelComponent.h @@ -80,21 +80,21 @@ public: typedef typename CovarianceEstimatorType::MatrixType CovarianceType; /** Sets the input sample */ - void SetSample(const TSample* sample) ITK_OVERRIDE; + void SetSample(const TSample* sample) override; /** Sets the component's distribution parameters. * e.g. Then user can call directly Pdf( MeasurementVectorType & ) */ void SetParameters(const ParametersType& parameters); /** Show the parameters in a minimal form in comparison to PrintSelf */ - void ShowParameters(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void ShowParameters(std::ostream& os, itk::Indent indent) const override; protected: GaussianModelComponent(); - ~GaussianModelComponent() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~GaussianModelComponent() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; private: GaussianModelComponent(const Self &); //purposely not implemented diff --git a/Modules/Learning/LearningBase/include/otbImageClassificationFilter.h b/Modules/Learning/LearningBase/include/otbImageClassificationFilter.h index 620177e5af42420b3a58a0bced7db1abfe82b4ac..ee2eddff5a825d3ee3dde5fe73baeba1336ff100 100644 --- a/Modules/Learning/LearningBase/include/otbImageClassificationFilter.h +++ b/Modules/Learning/LearningBase/include/otbImageClassificationFilter.h @@ -113,16 +113,16 @@ protected: /** Constructor */ ImageClassificationFilter(); /** Destructor */ - ~ImageClassificationFilter() ITK_OVERRIDE {} + ~ImageClassificationFilter() override {} /** Threaded generate data */ - void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) override; void ClassicThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId); void BatchThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId); /** Before threaded generate data */ - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: ImageClassificationFilter(const Self &); //purposely not implemented diff --git a/Modules/Learning/LearningBase/include/otbKMeansImageClassificationFilter.h b/Modules/Learning/LearningBase/include/otbKMeansImageClassificationFilter.h index c188f311986629c69234ab870968d5fbada8c459..53a0a83fe5cd4ba9890c074b349ef1140253a28d 100644 --- a/Modules/Learning/LearningBase/include/otbKMeansImageClassificationFilter.h +++ b/Modules/Learning/LearningBase/include/otbKMeansImageClassificationFilter.h @@ -106,14 +106,14 @@ protected: /** Constructor */ KMeansImageClassificationFilter(); /** Destructor */ - ~KMeansImageClassificationFilter() ITK_OVERRIDE {} + ~KMeansImageClassificationFilter() override {} /** Threaded generate data */ - void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) override; /** Before threaded generate data */ - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: KMeansImageClassificationFilter(const Self &); //purposely not implemented diff --git a/Modules/Learning/LearningBase/include/otbMachineLearningModel.h b/Modules/Learning/LearningBase/include/otbMachineLearningModel.h index 552880cb9a83a4e43b7e29ae75689613633e5ef0..49e409ec8f30a5a0c095a1f77f79424d3c7fc4dc 100644 --- a/Modules/Learning/LearningBase/include/otbMachineLearningModel.h +++ b/Modules/Learning/LearningBase/include/otbMachineLearningModel.h @@ -116,7 +116,11 @@ public: */ TargetSampleType Predict(const InputSampleType& input, ConfidenceValueType *quality = ITK_NULLPTR) const; - + /**\name Set and get the dimension of the model for dimensionality reduction models */ + //@{ + itkSetMacro(Dimension,unsigned int); + itkGetMacro(Dimension,unsigned int); + //@} /** Predict a batch of samples (InputListSampleType) * \param input The batch of sample to predict @@ -128,29 +132,29 @@ public: */ typename TargetListSampleType::Pointer PredictBatch(const InputListSampleType * input, ConfidenceListSampleType * quality = ITK_NULLPTR) const; - /**\name Classification model file manipulation */ - //@{ - /** Save the model to file */ +/**\name Classification model file manipulation */ +//@{ +/** Save the model to file */ virtual void Save(const std::string & filename, const std::string & name="") = 0; - /** Load the model from file */ +/** Load the model from file */ virtual void Load(const std::string & filename, const std::string & name="") = 0; - //@} +//@} - /**\name Classification model file compatibility tests */ - //@{ - /** Is the input model file readable and compatible with the corresponding classifier ? */ +/**\name Classification model file compatibility tests */ +//@{ +/** Is the input model file readable and compatible with the corresponding classifier ? */ virtual bool CanReadFile(const std::string &) = 0; - /** Is the input model file writable and compatible with the corresponding classifier ? */ +/** Is the input model file writable and compatible with the corresponding classifier ? */ virtual bool CanWriteFile(const std::string &) = 0; - //@} +//@} - /** Query capacity to produce a confidence index */ +/** Query capacity to produce a confidence index */ bool HasConfidenceIndex() const {return m_ConfidenceIndex;} - /**\name Input list of samples accessors */ - //@{ +/**\name Input list of samples accessors */ +//@{ itkSetObjectMacro(InputListSample,InputListSampleType); itkGetObjectMacro(InputListSample,InputListSampleType); itkGetConstObjectMacro(InputListSample,InputListSampleType); @@ -177,14 +181,17 @@ protected: MachineLearningModel(); /** Destructor */ - ~MachineLearningModel() ITK_OVERRIDE; + ~MachineLearningModel() override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Input list sample */ typename InputListSampleType::Pointer m_InputListSample; + /** Validation list sample if provided for some models */ + typename InputListSampleType::Pointer m_ValidationListSample; + /** Target list sample */ typename TargetListSampleType::Pointer m_TargetListSample; @@ -192,7 +199,7 @@ protected: /** flag to choose between classification and regression modes */ bool m_RegressionMode; - + /** flag that indicates if the model supports regression, child * classes should modify it in their constructor if they support * regression mode */ @@ -203,6 +210,9 @@ protected: /** Is DoPredictBatch multi-threaded ? */ bool m_IsDoPredictBatchMultiThreaded; + + /** Output Dimension of the model, used by Dimensionality Reduction models*/ + unsigned int m_Dimension; private: /** Actual implementation of BatchPredicition diff --git a/Modules/Learning/LearningBase/include/otbMachineLearningModel.txx b/Modules/Learning/LearningBase/include/otbMachineLearningModel.txx index 00da0413879e83f013cf98053413e81dbcac0193..a983cb2fa0aaa6f6b0a7d7747e0ee1e0ac7636a5 100644 --- a/Modules/Learning/LearningBase/include/otbMachineLearningModel.txx +++ b/Modules/Learning/LearningBase/include/otbMachineLearningModel.txx @@ -38,7 +38,8 @@ MachineLearningModel<TInputValue,TOutputValue,TConfidenceValue> m_RegressionMode(false), m_IsRegressionSupported(false), m_ConfidenceIndex(false), - m_IsDoPredictBatchMultiThreaded(false) + m_IsDoPredictBatchMultiThreaded(false), + m_Dimension(0) {} @@ -98,11 +99,11 @@ MachineLearningModel<TInputValue,TOutputValue,TConfidenceValue> else { - #ifdef _OPENMP +#ifdef _OPENMP // OpenMP threading here unsigned int nb_threads(0), threadId(0), nb_batches(0); - #pragma omp parallel shared(nb_threads,nb_batches) private(threadId) +#pragma omp parallel shared(nb_threads,nb_batches) private(threadId) { // Get number of threads configured with ITK omp_set_num_threads(itk::MultiThreader::GetGlobalDefaultNumberOfThreads()); @@ -122,9 +123,9 @@ MachineLearningModel<TInputValue,TOutputValue,TConfidenceValue> this->DoPredictBatch(input,batch_start,batch_size,targets,quality); } } - #else +#else this->DoPredictBatch(input,0,input->Size(),targets,quality); - #endif +#endif return targets; } } @@ -169,12 +170,12 @@ MachineLearningModel<TInputValue,TOutputValue,TConfidenceValue> template <class TInputValue, class TOutputValue, class TConfidenceValue> void -MachineLearningModel<TInputValue,TOutputValue,TConfidenceValue> -::PrintSelf(std::ostream& os, itk::Indent indent) const -{ - // Call superclass implementation - Superclass::PrintSelf(os,indent); -} -} + MachineLearningModel<TInputValue,TOutputValue,TConfidenceValue> + ::PrintSelf(std::ostream& os, itk::Indent indent) const + { + // Call superclass implementation + Superclass::PrintSelf(os,indent); + } + } #endif diff --git a/Modules/Learning/LearningBase/include/otbMachineLearningModelFactoryBase.h b/Modules/Learning/LearningBase/include/otbMachineLearningModelFactoryBase.h index 0ca61f2c37483d0735c146f9355b4a4a8d4c5d35..ef2d6f02bf3439949d0ceaee37182f4b7b40ebb8 100644 --- a/Modules/Learning/LearningBase/include/otbMachineLearningModelFactoryBase.h +++ b/Modules/Learning/LearningBase/include/otbMachineLearningModelFactoryBase.h @@ -22,7 +22,7 @@ #define otbMachineLearningModelFactoryBase_h #include "itkMutexLock.h" -#include "OTBSupervisedExport.h" +#include "OTBLearningBaseExport.h" namespace otb { @@ -34,7 +34,7 @@ namespace otb * * \ingroup OTBLearningBase */ -class OTBSupervised_EXPORT MachineLearningModelFactoryBase : public itk::Object +class OTBLearningBase_EXPORT MachineLearningModelFactoryBase : public itk::Object { public: /** Standard class typedefs. */ @@ -48,7 +48,7 @@ public: protected: MachineLearningModelFactoryBase(); - ~MachineLearningModelFactoryBase() ITK_OVERRIDE; + ~MachineLearningModelFactoryBase() override; static itk::SimpleMutexLock mutex; diff --git a/Modules/Learning/LearningBase/include/otbSEMClassifier.h b/Modules/Learning/LearningBase/include/otbSEMClassifier.h index a97ba10eb191a99f8195e8126068a8b47d02e86a..0b598f44b5106525ee11506425e64f1038985460 100644 --- a/Modules/Learning/LearningBase/include/otbSEMClassifier.h +++ b/Modules/Learning/LearningBase/include/otbSEMClassifier.h @@ -156,7 +156,7 @@ public: int AddComponent(int id, ComponentType* component); /** Runs the optimization process. */ - void Update() ITK_OVERRIDE; + void Update() override; /** Termination status after running optimization */ typedef enum { CONVERGED = 0, NOT_CONVERGED = 1 } TerminationCodeType; @@ -176,12 +176,12 @@ public: /* Return the classification result (as an image) */ TOutputImage * GetOutputImage(); - void Modified() const ITK_OVERRIDE; + void Modified() const override; protected: SEMClassifier(); - ~SEMClassifier() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~SEMClassifier() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Initialize the first segmentation, either randomly or by using * a ClassLabelVectorType given in SetClassLabels. */ diff --git a/Modules/Learning/LearningBase/otb-module.cmake b/Modules/Learning/LearningBase/otb-module.cmake index b4fab23bbaec200852575ff64dbb2424475542c6..c0af985032de6d4a2acd11988be1b9a177cf8219 100644 --- a/Modules/Learning/LearningBase/otb-module.cmake +++ b/Modules/Learning/LearningBase/otb-module.cmake @@ -22,19 +22,19 @@ set(DOCUMENTATION "This module contains OTB generic Machine Learning framework mainly based on OpenCV.") otb_module(OTBLearningBase + ENABLE_SHARED DEPENDS OTBCommon - OTBITK - OTBImageIO OTBImageBase + OTBITK - OPTIONAL_DEPENDS + OPTIONAL_DEPENDS OTBShark - TEST_DEPENDS + TEST_DEPENDS + OTBBoost OTBTestKernel OTBImageIO - OTBImageBase DESCRIPTION "${DOCUMENTATION}" diff --git a/Modules/Learning/LearningBase/src/CMakeLists.txt b/Modules/Learning/LearningBase/src/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..4a7ef1c0d25c764f375e5b6fc3652efd2c430963 --- /dev/null +++ b/Modules/Learning/LearningBase/src/CMakeLists.txt @@ -0,0 +1,32 @@ +# +# 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(OTBLearningBase_SRC + otbMachineLearningModelFactoryBase.cxx + ) + +add_library(OTBLearningBase ${OTBLearningBase_SRC}) +target_link_libraries(OTBLearningBase + ${OTBCommon_LIBRARIES} + ${OTBImageBase_LIBRARIES} + ${OTBITK_LIBRARIES} + ) + +otb_module_target(OTBLearningBase) diff --git a/Modules/Learning/Supervised/src/otbMachineLearningModelFactoryBase.cxx b/Modules/Learning/LearningBase/src/otbMachineLearningModelFactoryBase.cxx similarity index 100% rename from Modules/Learning/Supervised/src/otbMachineLearningModelFactoryBase.cxx rename to Modules/Learning/LearningBase/src/otbMachineLearningModelFactoryBase.cxx diff --git a/Modules/Learning/LearningBase/test/CMakeLists.txt b/Modules/Learning/LearningBase/test/CMakeLists.txt index d1d16c3e65801e606c6e6903538b65264a4483a6..48e28cc5cad320ffa41eee0659ff6979d0bf4457 100644 --- a/Modules/Learning/LearningBase/test/CMakeLists.txt +++ b/Modules/Learning/LearningBase/test/CMakeLists.txt @@ -32,6 +32,10 @@ otbKMeansImageClassificationFilterNew.cxx otbMachineLearningModelTemplates.cxx ) +if(OTB_USE_SHARK) + set(OTBLearningBaseTests ${OTBLearningBaseTests} otbSharkUtilsTests.cxx) +endif() + add_executable(otbLearningBaseTestDriver ${OTBLearningBaseTests}) target_link_libraries(otbLearningBaseTestDriver ${OTBLearningBase-Test_LIBRARIES}) otb_module_target_label(otbLearningBaseTestDriver) @@ -68,3 +72,7 @@ otb_add_test(NAME leTuDecisionTreeNew COMMAND otbLearningBaseTestDriver otb_add_test(NAME leTuKMeansImageClassificationFilterNew COMMAND otbLearningBaseTestDriver otbKMeansImageClassificationFilterNew) +if(OTB_USE_SHARK) + otb_add_test(NAME leTuSharkNormalizeLabels COMMAND otbLearningBaseTestDriver + otbSharkNormalizeLabels) +endif() diff --git a/Modules/Learning/LearningBase/test/otbLearningBaseTestDriver.cxx b/Modules/Learning/LearningBase/test/otbLearningBaseTestDriver.cxx index 5b38bf300dd4520c18e198b6e6643848cbdc937c..dc2d36b7943129ec6519ebbc4f194d1dd6078800 100644 --- a/Modules/Learning/LearningBase/test/otbLearningBaseTestDriver.cxx +++ b/Modules/Learning/LearningBase/test/otbLearningBaseTestDriver.cxx @@ -29,4 +29,7 @@ void RegisterTests() REGISTER_TEST(otbSEMClassifierNew); REGISTER_TEST(otbDecisionTreeNew); REGISTER_TEST(otbKMeansImageClassificationFilterNew); +#ifdef OTB_USE_SHARK + REGISTER_TEST(otbSharkNormalizeLabels); +#endif } diff --git a/Modules/Learning/LearningBase/test/otbSharkUtilsTests.cxx b/Modules/Learning/LearningBase/test/otbSharkUtilsTests.cxx new file mode 100644 index 0000000000000000000000000000000000000000..bc3783cb728b0f5ad0f6b2d43620b18ba7939e30 --- /dev/null +++ b/Modules/Learning/LearningBase/test/otbSharkUtilsTests.cxx @@ -0,0 +1,54 @@ +/* + * 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 "itkMacro.h" +#include "otbSharkUtils.h" + + +int otbSharkNormalizeLabels(int itkNotUsed(argc), char* itkNotUsed(argv) []) +{ + std::vector<unsigned int> inLabels = {2, 2, 3, 20, 1}; + std::vector<unsigned int> expectedDictionary = {2, 3, 20, 1}; + std::vector<unsigned int> expectedLabels = {0, 0, 1, 2, 3}; + + auto newLabels = inLabels; + std::vector<unsigned int> labelDict; + otb::Shark::NormalizeLabelsAndGetDictionary(newLabels, labelDict); + + if(newLabels != expectedLabels) + { + std::cout << "Wrong new labels\n"; + for(size_t i = 0; i<newLabels.size(); ++i) + std::cout << "Got " << newLabels[i] << " expected " << expectedLabels[i] << '\n'; + + return EXIT_FAILURE; + } + + if(labelDict != expectedDictionary) + { + std::cout << "Wrong dictionary\n"; + for(size_t i = 0; i<labelDict.size(); ++i) + std::cout << "Got " << labelDict[i] << " expected " << expectedDictionary[i] << '\n'; + + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} diff --git a/Modules/Learning/Markov/include/otbMRFEnergy.h b/Modules/Learning/Markov/include/otbMRFEnergy.h index c8acb543851b2ab055171fdd4363142a41e44756..933539d7ce54951d919eae2ef407cc36807fdd83 100644 --- a/Modules/Learning/Markov/include/otbMRFEnergy.h +++ b/Modules/Learning/Markov/include/otbMRFEnergy.h @@ -142,7 +142,7 @@ protected: MRFEnergy() : m_NumberOfParameters(1), m_Parameters(0) {}; - ~MRFEnergy() ITK_OVERRIDE {} + ~MRFEnergy() override {} unsigned int m_NumberOfParameters; ParametersType m_Parameters; }; @@ -224,7 +224,7 @@ protected: m_NumberOfParameters(1), m_Parameters(0) {}; - ~MRFEnergy() ITK_OVERRIDE {} + ~MRFEnergy() override {} unsigned int m_NumberOfParameters; ParametersType m_Parameters; }; diff --git a/Modules/Learning/Markov/include/otbMRFEnergyEdgeFidelity.h b/Modules/Learning/Markov/include/otbMRFEnergyEdgeFidelity.h index d37e5f7655f1ac2f258fba751c9e417be54689ef..5aa6715c913cdb2ada97ef9134ed045700a92533 100644 --- a/Modules/Learning/Markov/include/otbMRFEnergyEdgeFidelity.h +++ b/Modules/Learning/Markov/include/otbMRFEnergyEdgeFidelity.h @@ -63,7 +63,7 @@ public: itkTypeMacro(MRFEnergyEdgeFidelity, MRFEnergy); - double GetSingleValue(const InputImagePixelType& value1, const LabelledImagePixelType& value2) ITK_OVERRIDE + double GetSingleValue(const InputImagePixelType& value1, const LabelledImagePixelType& value2) override { double val1 = static_cast<double>(value1); double val2 = static_cast<double>(value2); @@ -74,7 +74,7 @@ public: protected: // The constructor and destructor. MRFEnergyEdgeFidelity() {}; - ~MRFEnergyEdgeFidelity() ITK_OVERRIDE {} + ~MRFEnergyEdgeFidelity() override {} }; } diff --git a/Modules/Learning/Markov/include/otbMRFEnergyFisherClassification.h b/Modules/Learning/Markov/include/otbMRFEnergyFisherClassification.h index 574a589e07db16225490b763835181ca8a14c979..5950ad20463eb58a812258ebc738a72dcbe9235e 100644 --- a/Modules/Learning/Markov/include/otbMRFEnergyFisherClassification.h +++ b/Modules/Learning/Markov/include/otbMRFEnergyFisherClassification.h @@ -59,14 +59,14 @@ public: itkNewMacro(Self); itkTypeMacro(MRFEnergyFisherClassification, MRFEnergy); - void SetNumberOfParameters(const unsigned int nParameters) ITK_OVERRIDE + void SetNumberOfParameters(const unsigned int nParameters) override { Superclass::SetNumberOfParameters(nParameters); this->m_Parameters.SetSize(nParameters); this->Modified(); } - double GetSingleValue(const InputImagePixelType & value1, const LabelledImagePixelType & value2) ITK_OVERRIDE + double GetSingleValue(const InputImagePixelType & value1, const LabelledImagePixelType & value2) override { if ((unsigned int)value2 >= this->GetNumberOfParameters()/3) { @@ -88,7 +88,7 @@ public: protected: // The constructor and destructor. MRFEnergyFisherClassification() {}; - ~MRFEnergyFisherClassification() ITK_OVERRIDE {}; + ~MRFEnergyFisherClassification() override {}; }; } #endif diff --git a/Modules/Learning/Markov/include/otbMRFEnergyGaussian.h b/Modules/Learning/Markov/include/otbMRFEnergyGaussian.h index 5670c06c90ab36ab337a31b01762cde54e6b21ad..556e402433eae610c179a650a1b8caadbd1e967a 100644 --- a/Modules/Learning/Markov/include/otbMRFEnergyGaussian.h +++ b/Modules/Learning/Markov/include/otbMRFEnergyGaussian.h @@ -68,7 +68,7 @@ public: itkNewMacro(Self); - double GetSingleValue(const InputImagePixelType& value1, const LabelledImagePixelType& value2) ITK_OVERRIDE + double GetSingleValue(const InputImagePixelType& value1, const LabelledImagePixelType& value2) override { return vnl_math_sqr((static_cast<double>(value1)) - (static_cast<double>(value2))); @@ -81,7 +81,7 @@ protected: this->m_NumberOfParameters = 0; this->m_Parameters.SetSize(this->m_NumberOfParameters); }; - ~MRFEnergyGaussian() ITK_OVERRIDE {} + ~MRFEnergyGaussian() override {} }; } diff --git a/Modules/Learning/Markov/include/otbMRFEnergyGaussianClassification.h b/Modules/Learning/Markov/include/otbMRFEnergyGaussianClassification.h index 09d617587663178aa07a661817b5e714713fbb7b..1864da2897112f894039ddb8213557012b2f1ef4 100644 --- a/Modules/Learning/Markov/include/otbMRFEnergyGaussianClassification.h +++ b/Modules/Learning/Markov/include/otbMRFEnergyGaussianClassification.h @@ -64,14 +64,14 @@ public: itkTypeMacro(MRFEnergyGaussianClassification, MRFEnergy); - void SetNumberOfParameters(const unsigned int nParameters) ITK_OVERRIDE + void SetNumberOfParameters(const unsigned int nParameters) override { Superclass::SetNumberOfParameters(nParameters); this->m_Parameters.SetSize(nParameters); this->Modified(); } - double GetSingleValue(const InputImagePixelType& value1, const LabelledImagePixelType& value2) ITK_OVERRIDE + double GetSingleValue(const InputImagePixelType& value1, const LabelledImagePixelType& value2) override { if ((unsigned int) value2 >= this->GetNumberOfParameters() / 2) { @@ -89,7 +89,7 @@ public: protected: // The constructor and destructor. MRFEnergyGaussianClassification() {}; - ~MRFEnergyGaussianClassification() ITK_OVERRIDE {} + ~MRFEnergyGaussianClassification() override {} }; } diff --git a/Modules/Learning/Markov/include/otbMRFEnergyPotts.h b/Modules/Learning/Markov/include/otbMRFEnergyPotts.h index 5f41c47a42cacd3e2b24dbee7556b8756e4e54fb..3c54c69179cf229a1c2d6224d00a6715cfd3e927 100644 --- a/Modules/Learning/Markov/include/otbMRFEnergyPotts.h +++ b/Modules/Learning/Markov/include/otbMRFEnergyPotts.h @@ -66,7 +66,7 @@ public: itkNewMacro(Self); - double GetSingleValue(const InputImagePixelType& value1, const LabelledImagePixelType& value2) ITK_OVERRIDE + double GetSingleValue(const InputImagePixelType& value1, const LabelledImagePixelType& value2) override { if (value1 != value2) { @@ -86,7 +86,7 @@ protected: this->m_Parameters.SetSize(this->m_NumberOfParameters); this->m_Parameters[0] = 1.0; }; - ~MRFEnergyPotts() ITK_OVERRIDE {} + ~MRFEnergyPotts() override {} }; } diff --git a/Modules/Learning/Markov/include/otbMRFOptimizer.h b/Modules/Learning/Markov/include/otbMRFOptimizer.h index 110db833e4cb7069f7269f3ac5473190f2afb5b0..65638b0ed270651fab7f68e0a1addfb4367d41ed 100644 --- a/Modules/Learning/Markov/include/otbMRFOptimizer.h +++ b/Modules/Learning/Markov/include/otbMRFOptimizer.h @@ -76,7 +76,7 @@ protected: MRFOptimizer() : m_NumberOfParameters(1), m_Parameters(1) {} - ~MRFOptimizer() ITK_OVERRIDE {} + ~MRFOptimizer() override {} unsigned int m_NumberOfParameters; ParametersType m_Parameters; diff --git a/Modules/Learning/Markov/include/otbMRFOptimizerICM.h b/Modules/Learning/Markov/include/otbMRFOptimizerICM.h index f6f777e059a195d238ce22fc456c14e3ba60d21d..4380e161a819dd1f8c2b0d7a0ac1d27dbd960b17 100644 --- a/Modules/Learning/Markov/include/otbMRFOptimizerICM.h +++ b/Modules/Learning/Markov/include/otbMRFOptimizerICM.h @@ -52,7 +52,7 @@ public: itkTypeMacro(MRFOptimizerICM, MRFOptimizer); - inline bool Compute(double deltaEnergy) ITK_OVERRIDE + inline bool Compute(double deltaEnergy) override { if (deltaEnergy < 0) { @@ -66,7 +66,7 @@ public: protected: MRFOptimizerICM() {} - ~MRFOptimizerICM() ITK_OVERRIDE {} + ~MRFOptimizerICM() override {} }; diff --git a/Modules/Learning/Markov/include/otbMRFOptimizerMetropolis.h b/Modules/Learning/Markov/include/otbMRFOptimizerMetropolis.h index 5b7c75d66817354fb5dfc7cb025bed9f1df067aa..f188046bedc75fa776186f26e54592409b402ae8 100644 --- a/Modules/Learning/Markov/include/otbMRFOptimizerMetropolis.h +++ b/Modules/Learning/Markov/include/otbMRFOptimizerMetropolis.h @@ -72,7 +72,7 @@ public: this->Modified(); } - inline bool Compute(double deltaEnergy) ITK_OVERRIDE + inline bool Compute(double deltaEnergy) override { if (deltaEnergy < 0) { @@ -112,7 +112,7 @@ protected: m_Generator = RandomGeneratorType::GetInstance(); m_Generator->SetSeed(); } - ~MRFOptimizerMetropolis() ITK_OVERRIDE {} + ~MRFOptimizerMetropolis() override {} RandomGeneratorType::Pointer m_Generator; }; diff --git a/Modules/Learning/Markov/include/otbMRFSampler.h b/Modules/Learning/Markov/include/otbMRFSampler.h index 74daee5d8407990fc30a79ed0a77a074b99aa38b..bc505d7b1b11f1ba0d19f3ca2df4d118ed4e9038 100644 --- a/Modules/Learning/Markov/include/otbMRFSampler.h +++ b/Modules/Learning/Markov/include/otbMRFSampler.h @@ -111,7 +111,7 @@ protected: m_EnergyRegularization = EnergyRegularizationType::New(); m_EnergyFidelity = EnergyFidelityType::New(); }; - ~MRFSampler() ITK_OVERRIDE {} + ~MRFSampler() override {} }; diff --git a/Modules/Learning/Markov/include/otbMRFSamplerMAP.h b/Modules/Learning/Markov/include/otbMRFSamplerMAP.h index dc14a7aafb5742b3df403d712ff5a4bb504f23f9..2bd8688102aa8c56767d11e9c3d6b68ce3e4fb93 100644 --- a/Modules/Learning/Markov/include/otbMRFSamplerMAP.h +++ b/Modules/Learning/Markov/include/otbMRFSamplerMAP.h @@ -65,7 +65,7 @@ public: itkTypeMacro(MRFSamplerMAP, MRFSampler); inline int Compute(const InputImageNeighborhoodIterator& itData, - const LabelledImageNeighborhoodIterator& itRegul) ITK_OVERRIDE + const LabelledImageNeighborhoodIterator& itRegul) override { if (this->m_NumberOfClasses == 0) { @@ -103,7 +103,7 @@ public: protected: // The constructor and destructor. MRFSamplerMAP() {}; - ~MRFSamplerMAP() ITK_OVERRIDE {} + ~MRFSamplerMAP() override {} }; diff --git a/Modules/Learning/Markov/include/otbMRFSamplerRandom.h b/Modules/Learning/Markov/include/otbMRFSamplerRandom.h index d00eb26929cc6f1f33e3f35e5c81dbe7e9f5a296..5f60b4aca9fcc3224f1954ccde5dcb4b7f920815 100644 --- a/Modules/Learning/Markov/include/otbMRFSamplerRandom.h +++ b/Modules/Learning/Markov/include/otbMRFSamplerRandom.h @@ -66,7 +66,7 @@ public: itkTypeMacro(MRFSamplerRandom, MRFSampler); - inline int Compute(const InputImageNeighborhoodIterator& itData, const LabelledImageNeighborhoodIterator& itRegul) ITK_OVERRIDE + inline int Compute(const InputImageNeighborhoodIterator& itData, const LabelledImageNeighborhoodIterator& itRegul) override { this->m_EnergyBefore = this->m_EnergyFidelity->GetValue(itData, itRegul.GetCenterPixel()); this->m_EnergyBefore += this->m_Lambda @@ -97,7 +97,7 @@ protected: m_Generator = RandomGeneratorType::GetInstance(); m_Generator->SetSeed(); } - ~MRFSamplerRandom() ITK_OVERRIDE {} + ~MRFSamplerRandom() override {} private: RandomGeneratorType::Pointer m_Generator; diff --git a/Modules/Learning/Markov/include/otbMRFSamplerRandomMAP.h b/Modules/Learning/Markov/include/otbMRFSamplerRandomMAP.h index 2ebf55bad5e70a728bef5e837dafdde77725bfda..5c37d94230e454c5e6db4b7f6d9f301ededbc358 100644 --- a/Modules/Learning/Markov/include/otbMRFSamplerRandomMAP.h +++ b/Modules/Learning/Markov/include/otbMRFSamplerRandomMAP.h @@ -72,7 +72,7 @@ public: itkTypeMacro(MRFSamplerRandomMAP, MRFSampler); - void SetNumberOfClasses(const unsigned int nClasses) ITK_OVERRIDE + void SetNumberOfClasses(const unsigned int nClasses) override { if ((nClasses != this->m_NumberOfClasses) || (m_EnergiesInvalid == true)) { @@ -85,7 +85,7 @@ public: } } - inline int Compute(const InputImageNeighborhoodIterator& itData, const LabelledImageNeighborhoodIterator& itRegul) ITK_OVERRIDE + inline int Compute(const InputImageNeighborhoodIterator& itData, const LabelledImageNeighborhoodIterator& itRegul) override { if (this->m_NumberOfClasses == 0) { @@ -166,7 +166,7 @@ protected: m_Generator = RandomGeneratorType::GetInstance(); m_Generator->SetSeed(); } - ~MRFSamplerRandomMAP() ITK_OVERRIDE + ~MRFSamplerRandomMAP() override { if (m_Energy != ITK_NULLPTR) free(m_Energy); if (m_RepartitionFunction != ITK_NULLPTR) free(m_RepartitionFunction); diff --git a/Modules/Learning/Markov/include/otbMarkovRandomFieldFilter.h b/Modules/Learning/Markov/include/otbMarkovRandomFieldFilter.h index 9e5eeed25be7e712b58bc1760094450aa490a57b..1d94c27531460a01eaf81c37536b5bfe6c590c15 100644 --- a/Modules/Learning/Markov/include/otbMarkovRandomFieldFilter.h +++ b/Modules/Learning/Markov/include/otbMarkovRandomFieldFilter.h @@ -319,8 +319,8 @@ public: protected: MarkovRandomFieldFilter(); - ~MarkovRandomFieldFilter() ITK_OVERRIDE{} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~MarkovRandomFieldFilter() override{} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Allocate memory for labelled images. This is automatically called * in GenerateData(). @@ -335,10 +335,10 @@ protected: virtual void ApplyMarkovRandomFieldFilter(); - void GenerateData() ITK_OVERRIDE; - void GenerateInputRequestedRegion() ITK_OVERRIDE; - void EnlargeOutputRequestedRegion(itk::DataObject *) ITK_OVERRIDE; - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateData() override; + void GenerateInputRequestedRegion() override; + void EnlargeOutputRequestedRegion(itk::DataObject *) override; + void GenerateOutputInformation() override; MarkovRandomFieldFilter(const Self &); //purposely not implemented void operator =(const Self&); //purposely not implemented diff --git a/Modules/Learning/SOM/include/otbPeriodicSOM.h b/Modules/Learning/SOM/include/otbPeriodicSOM.h index c1a5d603294c1c243b6f3e4610a3816e7a8fd04c..5f71f8cac2a6880b7f99c57c2d18824e9090afbd 100644 --- a/Modules/Learning/SOM/include/otbPeriodicSOM.h +++ b/Modules/Learning/SOM/include/otbPeriodicSOM.h @@ -91,19 +91,19 @@ protected: /** Constructor */ PeriodicSOM() {} /** Destructor */ - ~PeriodicSOM() ITK_OVERRIDE {} + ~PeriodicSOM() override {} /** Output information redefinition */ - void GenerateOutputInformation() ITK_OVERRIDE + void GenerateOutputInformation() override { Superclass::GenerateOutputInformation (); } /** Output allocation redefinition */ - void AllocateOutputs() ITK_OVERRIDE + void AllocateOutputs() override { Superclass::AllocateOutputs(); } /** Main computation method */ - void GenerateData(void) ITK_OVERRIDE + void GenerateData(void) override { Superclass::GenerateData(); } @@ -113,16 +113,16 @@ protected: * \param beta The learning coefficient, * \param radius The radius of the nieghbourhood. */ - void UpdateMap(const NeuronType& sample, double beta, SizeType& radius) ITK_OVERRIDE; + void UpdateMap(const NeuronType& sample, double beta, SizeType& radius) override; /** * Step one iteration. */ - void Step(unsigned int currentIteration) ITK_OVERRIDE + void Step(unsigned int currentIteration) override { Superclass::Step(currentIteration); } /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + void PrintSelf(std::ostream& os, itk::Indent indent) const override { Superclass::PrintSelf(os, indent); } diff --git a/Modules/Learning/SOM/include/otbSOM.h b/Modules/Learning/SOM/include/otbSOM.h index 1563b51165ef6dc010dbe3f274bc837b6f74b1ed..56daddf8bb92a601ef3e03402beb51f1ac5d5f01 100644 --- a/Modules/Learning/SOM/include/otbSOM.h +++ b/Modules/Learning/SOM/include/otbSOM.h @@ -125,13 +125,13 @@ protected: /** Constructor */ SOM(); /** Destructor */ - ~SOM() ITK_OVERRIDE; + ~SOM() override; /** Output information redefinition */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; /** Output allocation redefinition */ - void AllocateOutputs() ITK_OVERRIDE; + void AllocateOutputs() override; /** Main computation method */ - void GenerateData(void) ITK_OVERRIDE; + void GenerateData(void) override; /** * Update the output map with a new sample. * \param sample The new sample to learn, @@ -144,7 +144,7 @@ protected: */ virtual void Step(unsigned int currentIteration); /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: SOM(const Self &); // purposely not implemented diff --git a/Modules/Learning/SOM/include/otbSOMActivationBuilder.h b/Modules/Learning/SOM/include/otbSOMActivationBuilder.h index 3d3ff3916853f1189e8305f8647a3632fe103b5f..928d7208264f2d4cf2f3295ec2afb7c8a12c9830 100644 --- a/Modules/Learning/SOM/include/otbSOMActivationBuilder.h +++ b/Modules/Learning/SOM/include/otbSOMActivationBuilder.h @@ -74,11 +74,11 @@ protected: /** Constructor */ SOMActivationBuilder(); /** Destructor */ - ~SOMActivationBuilder() ITK_OVERRIDE; + ~SOMActivationBuilder() override; /** Main computation method */ - void GenerateData(void) ITK_OVERRIDE; + void GenerateData(void) override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: SOMActivationBuilder(const Self &); // purposely not implemented diff --git a/Modules/Learning/SOM/include/otbSOMClassifier.h b/Modules/Learning/SOM/include/otbSOMClassifier.h index 6bc0e09701b01c8bda198bf2483bfd2c0286cd2f..55027d4435a73a54db0114e79ffc6de10042c4cc 100644 --- a/Modules/Learning/SOM/include/otbSOMClassifier.h +++ b/Modules/Learning/SOM/include/otbSOMClassifier.h @@ -88,11 +88,11 @@ protected: /** Constructor */ SOMClassifier(); /** Destructor */ - ~SOMClassifier() ITK_OVERRIDE {} + ~SOMClassifier() override {} /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Starts the classification process */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; private: /// The input sample diff --git a/Modules/Learning/SOM/include/otbSOMImageClassificationFilter.h b/Modules/Learning/SOM/include/otbSOMImageClassificationFilter.h index 2d1dbb35f28a582398e0bbc747925076492fd331..08bbb8bf059b18b135aa782fbbd555e283abbc43 100644 --- a/Modules/Learning/SOM/include/otbSOMImageClassificationFilter.h +++ b/Modules/Learning/SOM/include/otbSOMImageClassificationFilter.h @@ -104,14 +104,14 @@ protected: /** Constructor */ SOMImageClassificationFilter(); /** Destructor */ - ~SOMImageClassificationFilter() ITK_OVERRIDE {} + ~SOMImageClassificationFilter() override {} /** Threaded generate data */ - void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) override; /** Before threaded generate data */ - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: SOMImageClassificationFilter(const Self &); //purposely not implemented diff --git a/Modules/Learning/SOM/include/otbSOMMap.h b/Modules/Learning/SOM/include/otbSOMMap.h index 662d782b07c72fc0cfbba6457d312914f75ecb49..160a38e29950dcec7f73800b642aac400e5da424 100644 --- a/Modules/Learning/SOM/include/otbSOMMap.h +++ b/Modules/Learning/SOM/include/otbSOMMap.h @@ -92,9 +92,9 @@ protected: /** Constructor */ SOMMap(); /** Destructor */ - ~SOMMap() ITK_OVERRIDE; + ~SOMMap() override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: SOMMap(const Self &); // purposely not implemented diff --git a/Modules/Learning/SOM/include/otbSOMWithMissingValue.h b/Modules/Learning/SOM/include/otbSOMWithMissingValue.h index aadcbe20fedd2a380d61106dd7d9dc718c6897e9..02fba263c4041ced10533b1f1fb89d14eac7f520 100644 --- a/Modules/Learning/SOM/include/otbSOMWithMissingValue.h +++ b/Modules/Learning/SOM/include/otbSOMWithMissingValue.h @@ -81,34 +81,34 @@ protected: /** Constructor */ SOMWithMissingValue (); /** Destructor */ - ~SOMWithMissingValue() ITK_OVERRIDE; + ~SOMWithMissingValue() override; /** Output information redefinition */ - void GenerateOutputInformation() ITK_OVERRIDE + void GenerateOutputInformation() override { Superclass::GenerateOutputInformation (); } /** Output allocation redefinition */ - void AllocateOutputs() ITK_OVERRIDE + void AllocateOutputs() override { Superclass::AllocateOutputs(); } /** Main computation method */ - void GenerateData(void) ITK_OVERRIDE + void GenerateData(void) override { Superclass::GenerateData(); } /** * Update the output map with a new sample, depending on the availability of the data */ - void UpdateMap(const NeuronType& sample, double beta, SizeType& radius) ITK_OVERRIDE; + void UpdateMap(const NeuronType& sample, double beta, SizeType& radius) override; /** Step one iteration. */ - void Step(unsigned int currentIteration) ITK_OVERRIDE + void Step(unsigned int currentIteration) override { Superclass::Step(currentIteration); } /** PrintSelf method */ -void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; +void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: diff --git a/Modules/Learning/SOM/include/otbSOMbasedImageFilter.h b/Modules/Learning/SOM/include/otbSOMbasedImageFilter.h index 7e9105ad1fbd1e0158fa0ee8bd95001eaf3c1392..f33342d6a1d305922fff1c59454b024ccf941ce2 100644 --- a/Modules/Learning/SOM/include/otbSOMbasedImageFilter.h +++ b/Modules/Learning/SOM/include/otbSOMbasedImageFilter.h @@ -144,10 +144,10 @@ public: protected: // throw the Map to the functor - void BeforeThreadedGenerateData(void) ITK_OVERRIDE; + void BeforeThreadedGenerateData(void) override; SOMbasedImageFilter (); - ~SOMbasedImageFilter () ITK_OVERRIDE {} + ~SOMbasedImageFilter () override {} private: SOMbasedImageFilter (const Self &); diff --git a/Modules/Learning/Sampling/include/otbImageSampleExtractorFilter.h b/Modules/Learning/Sampling/include/otbImageSampleExtractorFilter.h index c36b029b1c5d73ef8a4b5ec940f07abcad7917ff..d7c32c9d18bb2c33e98a2dcb5cb8a68f2d22d842 100644 --- a/Modules/Learning/Sampling/include/otbImageSampleExtractorFilter.h +++ b/Modules/Learning/Sampling/include/otbImageSampleExtractorFilter.h @@ -73,10 +73,10 @@ public: /** Get the output samples OGR container */ ogr::DataSource* GetOutputSamples(); - void Synthetize(void) ITK_OVERRIDE{} + void Synthetize(void) override{} /** Reset method called before starting the streaming*/ - void Reset(void) ITK_OVERRIDE; + void Reset(void) override; itkSetMacro(SampleFieldPrefix, std::string); itkGetMacro(SampleFieldPrefix, std::string); @@ -91,14 +91,14 @@ protected: /** Constructor */ PersistentImageSampleExtractorFilter(); /** Destructor */ - ~PersistentImageSampleExtractorFilter() ITK_OVERRIDE {} + ~PersistentImageSampleExtractorFilter() override {} - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; /** process only points */ - void ThreadedGenerateVectorData(const ogr::Layer& layerForThread, itk::ThreadIdType threadid) ITK_OVERRIDE; + void ThreadedGenerateVectorData(const ogr::Layer& layerForThread, itk::ThreadIdType threadid) override; private: PersistentImageSampleExtractorFilter(const Self &); //purposely not implemented @@ -178,7 +178,7 @@ protected: /** Constructor */ ImageSampleExtractorFilter() {} /** Destructor */ - ~ImageSampleExtractorFilter() ITK_OVERRIDE {} + ~ImageSampleExtractorFilter() override {} private: ImageSampleExtractorFilter(const Self &); //purposely not implemented diff --git a/Modules/Learning/Sampling/include/otbOGRDataToClassStatisticsFilter.h b/Modules/Learning/Sampling/include/otbOGRDataToClassStatisticsFilter.h index f7e03efd3632e77d8620e219984c504423ac65f6..0b34b436e2d406158f3806f1cbab4308a200946f 100644 --- a/Modules/Learning/Sampling/include/otbOGRDataToClassStatisticsFilter.h +++ b/Modules/Learning/Sampling/include/otbOGRDataToClassStatisticsFilter.h @@ -67,10 +67,10 @@ public: /** Runtime information support. */ itkTypeMacro(PersistentOGRDataToClassStatisticsFilter, PersistentSamplingFilterBase); - void Synthetize(void) ITK_OVERRIDE; + void Synthetize(void) override; /** Reset method called before starting the streaming*/ - void Reset(void) ITK_OVERRIDE; + void Reset(void) override; /** the class count map is stored as output #2 */ const ClassCountObjectType* GetClassCountOutput() const; @@ -82,24 +82,24 @@ public: /** Make a DataObject of the correct type to be used as the specified * output. */ - itk::DataObject::Pointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; + itk::DataObject::Pointer MakeOutput(DataObjectPointerArraySizeType idx) override; using Superclass::MakeOutput; protected: /** Constructor */ PersistentOGRDataToClassStatisticsFilter(); /** Destructor */ - ~PersistentOGRDataToClassStatisticsFilter() ITK_OVERRIDE {} + ~PersistentOGRDataToClassStatisticsFilter() override {} /** Implement generic method called at each candidate position */ void ProcessSample(const ogr::Feature& feature, typename TInputImage::IndexType& imgIndex, typename TInputImage::PointType& imgPoint, - itk::ThreadIdType& threadid) ITK_OVERRIDE; + itk::ThreadIdType& threadid) override; /** Prepare temporary variables for the current feature */ void PrepareFeature(const ogr::Feature& feature, - itk::ThreadIdType& threadid) ITK_OVERRIDE; + itk::ThreadIdType& threadid) override; private: PersistentOGRDataToClassStatisticsFilter(const Self &); //purposely not implemented @@ -183,7 +183,7 @@ protected: /** Constructor */ OGRDataToClassStatisticsFilter() {} /** Destructor */ - ~OGRDataToClassStatisticsFilter() ITK_OVERRIDE {} + ~OGRDataToClassStatisticsFilter() override {} private: OGRDataToClassStatisticsFilter(const Self &); //purposely not implemented diff --git a/Modules/Learning/Sampling/include/otbOGRDataToSamplePositionFilter.h b/Modules/Learning/Sampling/include/otbOGRDataToSamplePositionFilter.h index 8393766bcb81489c5e2582e2b1a38bb8912a4251..5b1364e277a56a1b3fbd079ce987ea6cfad0416a 100644 --- a/Modules/Learning/Sampling/include/otbOGRDataToSamplePositionFilter.h +++ b/Modules/Learning/Sampling/include/otbOGRDataToSamplePositionFilter.h @@ -88,10 +88,10 @@ public: /** Runtime information support. */ itkTypeMacro(PersistentOGRDataToSamplePositionFilter, PersistentSamplingFilterBase); - void Synthetize(void) ITK_OVERRIDE{} + void Synthetize(void) override{} /** Reset method called before starting the streaming*/ - void Reset(void) ITK_OVERRIDE; + void Reset(void) override; /** Get a reference to the internal samplers at a given level */ SamplerMapType& GetSamplers(unsigned int level); @@ -115,7 +115,7 @@ public: /** Make a DataObject of the correct type to be used as the specified * output. */ - itk::DataObject::Pointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; + itk::DataObject::Pointer MakeOutput(DataObjectPointerArraySizeType idx) override; using Superclass::MakeOutput; /** Get/Set of the field name storing the original FID of each sample */ @@ -126,21 +126,21 @@ protected: /** Constructor */ PersistentOGRDataToSamplePositionFilter(); /** Destructor */ - ~PersistentOGRDataToSamplePositionFilter() ITK_OVERRIDE {} + ~PersistentOGRDataToSamplePositionFilter() override {} /** Call samplers on a current position, for a given class */ void ProcessSample(const ogr::Feature& feature, typename TInputImage::IndexType& imgIndex, typename TInputImage::PointType& imgPoint, - itk::ThreadIdType& threadid) ITK_OVERRIDE; + itk::ThreadIdType& threadid) override; /** Method to split the input OGRDataSource * according to the class partition */ - void DispatchInputVectors(void) ITK_OVERRIDE; + void DispatchInputVectors(void) override; /** Fill the output vectors with a special ordering (class partition) */ - void FillOneOutput(unsigned int outIdx, ogr::DataSource* outDS, bool update) ITK_OVERRIDE; + void FillOneOutput(unsigned int outIdx, ogr::DataSource* outDS, bool update) override; private: PersistentOGRDataToSamplePositionFilter(const Self &); //purposely not implemented @@ -259,7 +259,7 @@ protected: /** Constructor */ OGRDataToSamplePositionFilter() {} /** Destructor */ - ~OGRDataToSamplePositionFilter() ITK_OVERRIDE {} + ~OGRDataToSamplePositionFilter() override {} private: OGRDataToSamplePositionFilter(const Self &); //purposely not implemented diff --git a/Modules/Learning/Sampling/include/otbPersistentSamplingFilterBase.h b/Modules/Learning/Sampling/include/otbPersistentSamplingFilterBase.h index bb3b0ac40623ccd7766562f13755ad3e18cae45d..6c8e2ab53cadc6647ee923ca0d419dbe90ce595f 100644 --- a/Modules/Learning/Sampling/include/otbPersistentSamplingFilterBase.h +++ b/Modules/Learning/Sampling/include/otbPersistentSamplingFilterBase.h @@ -97,21 +97,21 @@ protected: /** Constructor */ PersistentSamplingFilterBase(); /** Destructor */ - ~PersistentSamplingFilterBase() ITK_OVERRIDE {} + ~PersistentSamplingFilterBase() override {} /** Use the same output information as input image, check the field index * and the mask footprint */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; /** Use an empty region to input image (pixel values not needed) and set * the requested region for the mask */ - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; /** Generate data should thread over */ - void GenerateData(void) ITK_OVERRIDE; + void GenerateData(void) override; /** Allocate in-memory layers for input and outputs */ - void AllocateOutputs(void) ITK_OVERRIDE; + void AllocateOutputs(void) override; /** Start of main processing loop */ virtual void ThreadedGenerateVectorData(const ogr::Layer& layerForThread, itk::ThreadIdType threadid); diff --git a/Modules/Learning/Sampling/include/otbPersistentSamplingFilterBase.txx b/Modules/Learning/Sampling/include/otbPersistentSamplingFilterBase.txx index 2973a7a8a3a2e251cdef0ffcf55f034eb6b217aa..502438a0d2a4ebb6bc1b85ce59e8e419fb16206a 100644 --- a/Modules/Learning/Sampling/include/otbPersistentSamplingFilterBase.txx +++ b/Modules/Learning/Sampling/include/otbPersistentSamplingFilterBase.txx @@ -265,6 +265,11 @@ PersistentSamplingFilterBase<TInputImage,TMaskImage> } this->m_InMemoryOutputs.push_back(tmpContainer); } + + if (oSRS) + { + oSRS->Release(); + } } template <class TInputImage, class TMaskImage> @@ -734,7 +739,7 @@ PersistentSamplingFilterBase<TInputImage,TMaskImage> } const unsigned int nbFeatThread = std::ceil(inLayer.GetFeatureCount(true) / (float) numberOfThreads); - assert(nbFeatThread > 0); + //assert(nbFeatThread > 0); OGRFeatureDefn &layerDefn = inLayer.GetLayerDefn(); ogr::Layer::const_iterator featIt = inLayer.begin(); @@ -807,6 +812,11 @@ PersistentSamplingFilterBase<TInputImage,TMaskImage> OGRFieldDefn fieldDefn(layerDefn.GetFieldDefn(k)); outLayer.CreateField(fieldDefn); } + + if (oSRS) + { + oSRS->Release(); + } } // Add new fields diff --git a/Modules/Learning/Sampling/include/otbSampleAugmentation.h b/Modules/Learning/Sampling/include/otbSampleAugmentation.h new file mode 100644 index 0000000000000000000000000000000000000000..8196b3e9da759e330f6a652a13377b9f609e0d57 --- /dev/null +++ b/Modules/Learning/Sampling/include/otbSampleAugmentation.h @@ -0,0 +1,235 @@ +/* + * 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 otbSampleAugmentation_h +#define otbSampleAugmentation_h + +#ifdef _OPENMP + # include <omp.h> +#endif + +#include <vector> +#include <algorithm> +#include <random> +#include <ctime> +#include <cassert> +#include <iostream> + +namespace otb +{ + +namespace sampleAugmentation +{ +using SampleType = std::vector<double>; +using SampleVectorType = std::vector<SampleType>; + +/** +Estimate standard deviations of the components in one pass using +Welford's algorithm +*/ +SampleType EstimateStds(const SampleVectorType& samples) +{ + const auto nbSamples = samples.size(); + const auto nbComponents = samples[0].size(); + SampleType stds(nbComponents, 0.0); + SampleType means(nbComponents, 0.0); + for(size_t i=0; i<nbSamples; ++i) + { + auto norm_factor = 1.0/(i+1); +#ifdef _OPENMP +#pragma omp parallel for +#endif + for(size_t j=0; j<nbComponents; ++j) + { + const auto mu = means[j]; + const auto x = samples[i][j]; + auto muNew = mu+(x-mu)*norm_factor; + stds[j] += (x-mu)*(x-muNew); + means[j] = muNew; + } + } +#ifdef _OPENMP +#pragma omp parallel for +#endif + for(size_t j=0; j<nbComponents; ++j) + { + stds[j] = std::sqrt(stds[j]/nbSamples); + } + return stds; +} + +/** Create new samples by replicating input samples. We loop through +* the input samples and add them to the new data set until nbSamples +* are added. The elements of newSamples are removed before proceeding. +*/ +void ReplicateSamples(const SampleVectorType& inSamples, + const size_t nbSamples, + SampleVectorType& newSamples) +{ + newSamples.resize(nbSamples); + size_t imod{0}; +#ifdef _OPENMP +#pragma omp parallel for +#endif + for(size_t i=0; i<nbSamples; ++i) + { + if (imod == inSamples.size()) imod = 0; + newSamples[i] = inSamples[imod++]; + } + +} + +/** Create new samples by adding noise to existing samples. Gaussian +* noise is added to randomly selected samples. The standard deviation +* of the noise added to each component is the same as the one of the +* input variables divided by stdFactor (defaults to 10). The +* elements of newSamples are removed before proceeding. +*/ +void JitterSamples(const SampleVectorType& inSamples, + const size_t nbSamples, + SampleVectorType& newSamples, + float stdFactor=10, + const int seed = std::time(nullptr)) +{ + newSamples.resize(nbSamples); + const auto nbComponents = inSamples[0].size(); + std::random_device rd; + std::mt19937 gen(rd()); + // The input samples are selected randomly with replacement + std::srand(seed); + // We use one gaussian distribution per component since they may + // have different stds + auto stds = EstimateStds(inSamples); + std::vector<std::normal_distribution<double>> gaussDis(nbComponents); +#ifdef _OPENMP +#pragma omp parallel for +#endif + for(size_t i=0; i<nbComponents; ++i) + gaussDis[i] = std::normal_distribution<double>{0.0, stds[i]/stdFactor}; + + for(size_t i=0; i<nbSamples; ++i) + { + newSamples[i] = inSamples[std::rand()%inSamples.size()]; +#ifdef _OPENMP +#pragma omp parallel for +#endif + for(size_t j=0; j<nbComponents; ++j) + newSamples[i][j] += gaussDis[j](gen); + } +} + + +struct NeighborType +{ + size_t index; + double distance; +}; + +struct NeighborSorter +{ + constexpr bool operator ()(const NeighborType& a, const NeighborType& b) const + { + return b.distance > a.distance; + } +}; + +double ComputeSquareDistance(const SampleType& x, const SampleType& y) +{ + assert(x.size()==y.size()); + double dist{0}; + for(size_t i=0; i<x.size(); ++i) + { + dist += (x[i]-y[i])*(x[i]-y[i]); + } + return dist/(x.size()*x.size()); +} + +using NNIndicesType = std::vector<NeighborType>; +using NNVectorType = std::vector<NNIndicesType>; +/** Returns the indices of the nearest neighbors for each input sample +*/ +void FindKNNIndices(const SampleVectorType& inSamples, + const size_t nbNeighbors, + NNVectorType& nnVector) +{ + const auto nbSamples = inSamples.size(); + nnVector.resize(nbSamples); + #ifdef _OPENMP + #pragma omp parallel for + #endif + for(size_t sampleIdx=0; sampleIdx<nbSamples; ++sampleIdx) + { + NNIndicesType nns; + for(size_t neighborIdx=0; neighborIdx<nbSamples; ++neighborIdx) + { + if(sampleIdx!=neighborIdx) + nns.push_back({neighborIdx, ComputeSquareDistance(inSamples[sampleIdx], + inSamples[neighborIdx])}); + } + std::partial_sort(nns.begin(), nns.begin()+nbNeighbors, nns.end(), NeighborSorter{}); + nns.resize(nbNeighbors); + nnVector[sampleIdx] = std::move(nns); + } +} + +/** Generate the new sample in the line linking s1 and s2 +*/ +SampleType SmoteCombine(const SampleType& s1, const SampleType& s2, double position) +{ + auto result = s1; + for(size_t i=0; i<s1.size(); ++i) + result[i] = s1[i]+(s2[i]-s1[i])*position; + return result; +} + +/** Create new samples using the SMOTE algorithm +Chawla, N. V., Bowyer, K. W., Hall, L. O., & Kegelmeyer, W. P., Smote: +synthetic minority over-sampling technique, Journal of artificial +intelligence research, 16(), 321–357 (2002). +http://dx.doi.org/10.1613/jair.953 +*/ +void Smote(const SampleVectorType& inSamples, + const size_t nbSamples, + SampleVectorType& newSamples, + const int nbNeighbors, + const int seed = std::time(nullptr)) +{ + newSamples.resize(nbSamples); + NNVectorType nnVector; + FindKNNIndices(inSamples, nbNeighbors, nnVector); + // The input samples are selected randomly with replacement + std::srand(seed); + #ifdef _OPENMP + #pragma omp parallel for + #endif + for(size_t i=0; i<nbSamples; ++i) + { + const auto sampleIdx = std::rand()%(inSamples.size()); + const auto sample = inSamples[sampleIdx]; + const auto neighborIdx = nnVector[sampleIdx][std::rand()%nbNeighbors].index; + const auto neighbor = inSamples[neighborIdx]; + newSamples[i] = SmoteCombine(sample, neighbor, std::rand()/double{RAND_MAX}); + } +} + +}//end namespaces sampleAugmentation +}//end namespace otb + +#endif diff --git a/Modules/Learning/Sampling/include/otbSampleAugmentationFilter.h b/Modules/Learning/Sampling/include/otbSampleAugmentationFilter.h new file mode 100644 index 0000000000000000000000000000000000000000..63b8af0a7a95dabb33795817a4a4b302d495b832 --- /dev/null +++ b/Modules/Learning/Sampling/include/otbSampleAugmentationFilter.h @@ -0,0 +1,175 @@ +/* + * 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 otbSampleAugmentationFilter_h +#define otbSampleAugmentationFilter_h + +#include "itkProcessObject.h" +#include "otbOGRDataSourceWrapper.h" +#include "otbSampleAugmentation.h" +#include "OTBSamplingExport.h" + +namespace otb +{ + + +/** + * \class SampleAugmentationFilter + * + * \brief Filter to generate synthetic samples from existing ones + * + * This class generates synthetic samples from existing ones either by + * replication, jitter (adding gaussian noise to the features of + * existing samples) or SMOTE (linear combination of pairs + * neighbouring samples of the same class. + * + * \ingroup OTBSampling + */ + +class OTBSampling_EXPORT SampleAugmentationFilter : + public itk::ProcessObject +{ +public: + + /** typedef for the classes standards. */ + typedef SampleAugmentationFilter Self; + typedef itk::ProcessObject Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + /** Method for management of the object factory. */ + itkNewMacro(Self); + + /** Return the name of the class. */ + itkTypeMacro(SampleAugmentationFilter, ProcessObject); + + typedef ogr::DataSource OGRDataSourceType; + typedef typename OGRDataSourceType::Pointer OGRDataSourcePointerType; + typedef ogr::Layer OGRLayerType; + + typedef itk::ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType; + + using SampleType = sampleAugmentation::SampleType; + using SampleVectorType = sampleAugmentation::SampleVectorType; + + enum class Strategy { Replicate, Jitter, Smote }; + + /** Set/Get the input OGRDataSource of this process object. */ + using Superclass::SetInput; + virtual void SetInput(const OGRDataSourceType* ds); + const OGRDataSourceType* GetInput(unsigned int idx); + + virtual void SetOutputSamples(ogr::DataSource* data); + + /** Set the Field Name in which labels will be written. (default is "class") + * A field "ClassFieldName" of type integer is created in the output memory layer. + */ + itkSetMacro(ClassFieldName, std::string); + /** + * Return the Field name in which labels have been written. + */ + itkGetMacro(ClassFieldName, std::string); + + + itkSetMacro(Layer, size_t); + itkGetMacro(Layer, size_t); + itkSetMacro(Label, int); + itkGetMacro(Label, int); + void SetStrategy(Strategy s) + { + m_Strategy = s; + } + Strategy GetStrategy() const + { + return m_Strategy; + } + itkSetMacro(NumberOfSamples, int); + itkGetMacro(NumberOfSamples, int); + void SetExcludedFields(const std::vector<std::string>& ef) + { + m_ExcludedFields = ef; + } + std::vector<std::string> GetExcludedFields() const + { + return m_ExcludedFields; + } + itkSetMacro(StdFactor, double); + itkGetMacro(StdFactor, double); + itkSetMacro(SmoteNeighbors, size_t); + itkGetMacro(SmoteNeighbors, size_t); + itkSetMacro(Seed, int); + itkGetMacro(Seed, int); +/** + * Get the output \c ogr::DataSource which is a "memory" datasource. + */ + const OGRDataSourceType * GetOutput(); + +protected: + SampleAugmentationFilter(); + ~SampleAugmentationFilter() ITK_OVERRIDE {} + + /** Generate Data method*/ + void GenerateData() ITK_OVERRIDE; + + /** DataObject pointer */ + typedef itk::DataObject::Pointer DataObjectPointer; + + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; + using Superclass::MakeOutput; + + + SampleVectorType ExtractSamples(const ogr::DataSource::Pointer vectors, + size_t layerName, + const std::string& classField, const int label, + const std::vector<std::string>& excludedFields = {}); + + void SampleToOGRFeatures(const ogr::DataSource::Pointer& vectors, + ogr::DataSource* output, + const SampleVectorType& samples, + const size_t layerName, + const std::string& classField, int label, + const std::vector<std::string>& excludedFields = {}); + + std::set<size_t> GetExcludedFieldsIds(const std::vector<std::string>& excludedFields, + const ogr::Layer& inputLayer); + bool IsNumericField(const ogr::Feature& feature, const int idx); + + ogr::Feature SelectTemplateFeature(const ogr::Layer& inputLayer, + const std::string& classField, int label); +private: + SampleAugmentationFilter(const Self &); //purposely not implemented + void operator =(const Self&); //purposely not implemented + + std::string m_ClassFieldName; + size_t m_Layer; + int m_Label; + std::vector<std::string> m_ExcludedFields; + Strategy m_Strategy; + int m_NumberOfSamples; + double m_StdFactor; + size_t m_SmoteNeighbors; + int m_Seed; + +}; + + +} // end namespace otb + +#endif diff --git a/Modules/Learning/Sampling/include/otbSamplingRateCalculator.h b/Modules/Learning/Sampling/include/otbSamplingRateCalculator.h index f391a23410e50999e7af7f937427e8779d5c9efa..c16a758a5d82b51578de112e59963470f3625f41 100644 --- a/Modules/Learning/Sampling/include/otbSamplingRateCalculator.h +++ b/Modules/Learning/Sampling/include/otbSamplingRateCalculator.h @@ -24,6 +24,7 @@ #include "itkImageRegion.h" #include "itkVectorContainer.h" #include <set> +#include "OTBSamplingExport.h" namespace otb { @@ -36,7 +37,7 @@ namespace otb * \ingroup OTBSampling */ -class ITK_EXPORT SamplingRateCalculator +class OTBSampling_EXPORT SamplingRateCalculator : public itk::Object { public: @@ -49,7 +50,7 @@ public: /** typdefs **/ typedef std::map<std::string, unsigned long> ClassCountMapType; typedef ClassCountMapType::const_iterator constItMapType; - typedef struct Triplet + typedef struct OTBSampling_EXPORT Triplet { unsigned long Required; unsigned long Tot; @@ -110,10 +111,10 @@ protected: SamplingRateCalculator(); /** Destructor */ - ~SamplingRateCalculator() ITK_OVERRIDE {} + ~SamplingRateCalculator() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: SamplingRateCalculator(const Self &); //purposely not implemented diff --git a/Modules/Learning/Sampling/include/otbSamplingRateCalculatorList.h b/Modules/Learning/Sampling/include/otbSamplingRateCalculatorList.h index 56dc647b53c2d0661881185e9e3c58e880184571..ad9d86a54edded0d444b6a9b8463f775be5107f7 100644 --- a/Modules/Learning/Sampling/include/otbSamplingRateCalculatorList.h +++ b/Modules/Learning/Sampling/include/otbSamplingRateCalculatorList.h @@ -23,6 +23,7 @@ #include "otbSamplingRateCalculator.h" #include "otbObjectList.h" +#include "OTBSamplingExport.h" namespace otb { @@ -37,7 +38,7 @@ namespace otb * * \ingroup OTBSampling */ -class ITK_EXPORT SamplingRateCalculatorList +class OTBSampling_EXPORT SamplingRateCalculatorList : public ObjectList<SamplingRateCalculator> { public: @@ -98,7 +99,7 @@ protected: SamplingRateCalculatorList(){} /** Destructor */ - ~SamplingRateCalculatorList() ITK_OVERRIDE {} + ~SamplingRateCalculatorList() override {} private: SamplingRateCalculatorList(const Self &); //purposely not implemented diff --git a/Modules/Learning/Sampling/otb-module.cmake b/Modules/Learning/Sampling/otb-module.cmake index 4eb65c39829be9317c80589eac55b93f934db40e..2b8ca50f8a4579e401b3d83fb04212f1a63b3cc0 100644 --- a/Modules/Learning/Sampling/otb-module.cmake +++ b/Modules/Learning/Sampling/otb-module.cmake @@ -21,6 +21,7 @@ set(DOCUMENTATION "This module contains OTB sampling framework.") otb_module(OTBSampling + ENABLE_SHARED DEPENDS OTBCommon OTBConversion diff --git a/Modules/Learning/Sampling/src/CMakeLists.txt b/Modules/Learning/Sampling/src/CMakeLists.txt index 8504c688f4827bd93006e71961bb5255b4cfb809..bef592365baf129ebdfd02742ca5d76830d11b06 100644 --- a/Modules/Learning/Sampling/src/CMakeLists.txt +++ b/Modules/Learning/Sampling/src/CMakeLists.txt @@ -21,7 +21,8 @@ set(OTBSampling_SRC otbSamplingRateCalculator.cxx otbSamplingRateCalculatorList.cxx -) + otbSampleAugmentationFilter.cxx + ) add_library(OTBSampling ${OTBSampling_SRC}) target_link_libraries(OTBSampling diff --git a/Modules/Learning/Sampling/src/otbSampleAugmentationFilter.cxx b/Modules/Learning/Sampling/src/otbSampleAugmentationFilter.cxx new file mode 100644 index 0000000000000000000000000000000000000000..5778de0d9324b7a022cab8569c3b25a48260cfc8 --- /dev/null +++ b/Modules/Learning/Sampling/src/otbSampleAugmentationFilter.cxx @@ -0,0 +1,269 @@ +/* + * 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 "otbSampleAugmentationFilter.h" +#include "stdint.h" //needed for uintptr_t + +namespace otb +{ + +SampleAugmentationFilter +::SampleAugmentationFilter() : m_ClassFieldName{"class"}, m_Layer{0}, m_Label{1}, + m_Strategy{SampleAugmentationFilter::Strategy::Replicate}, + m_NumberOfSamples{100}, m_StdFactor{10.0}, + m_SmoteNeighbors{5}, m_Seed{0} +{ + this->SetNumberOfRequiredInputs(1); + this->SetNumberOfRequiredOutputs(1); + this->ProcessObject::SetNthOutput(0, this->MakeOutput(0) ); +} + + +typename SampleAugmentationFilter::DataObjectPointer +SampleAugmentationFilter +::MakeOutput(DataObjectPointerArraySizeType itkNotUsed(idx)) +{ + return static_cast< DataObjectPointer >(OGRDataSourceType::New().GetPointer()); +} + +const typename SampleAugmentationFilter::OGRDataSourceType * +SampleAugmentationFilter +::GetOutput() +{ + return static_cast< const OGRDataSourceType *>( + this->ProcessObject::GetOutput(0)); +} + +void +SampleAugmentationFilter +::SetInput(const otb::ogr::DataSource* ds) +{ + this->Superclass::SetNthInput(0, const_cast<otb::ogr::DataSource *>(ds)); +} + +const typename SampleAugmentationFilter::OGRDataSourceType * +SampleAugmentationFilter +::GetInput(unsigned int idx) +{ + return static_cast<const OGRDataSourceType *> + (this->itk::ProcessObject::GetInput(idx)); +} + +void +SampleAugmentationFilter +::SetOutputSamples(ogr::DataSource* data) +{ + this->SetNthOutput(0,data); +} + + +void +SampleAugmentationFilter +::GenerateData(void) +{ + + OGRDataSourcePointerType inputDS = dynamic_cast<OGRDataSourceType*>(this->itk::ProcessObject::GetInput(0)); + auto outputDS = static_cast<ogr::DataSource *>(this->itk::ProcessObject::GetOutput(0)); + auto inSamples = this->ExtractSamples(inputDS, m_Layer, + m_ClassFieldName, + m_Label, + m_ExcludedFields); + SampleVectorType newSamples; + switch (m_Strategy) + { + case Strategy::Replicate: + { + sampleAugmentation::ReplicateSamples(inSamples, m_NumberOfSamples, + newSamples); + } + break; + case Strategy::Jitter: + { + sampleAugmentation::JitterSamples(inSamples, m_NumberOfSamples, + newSamples, + m_StdFactor, + m_Seed); + } + break; + case Strategy::Smote: + { + sampleAugmentation::Smote(inSamples, m_NumberOfSamples, + newSamples, + m_SmoteNeighbors, + m_Seed); + } + break; + } + this->SampleToOGRFeatures(inputDS, outputDS, newSamples, m_Layer, + m_ClassFieldName, + m_Label, + m_ExcludedFields); + + + // this->SetNthOutput(0,outputDS); +} + +/** Extracts the samples of a single class from the vector data to a +* vector and excludes some unwanted features. +*/ +SampleAugmentationFilter::SampleVectorType +SampleAugmentationFilter +::ExtractSamples(const ogr::DataSource::Pointer vectors, + size_t layerName, + const std::string& classField, const int label, + const std::vector<std::string>& excludedFields) +{ + ogr::Layer layer = vectors->GetLayer(layerName); + auto featureIt = layer.begin(); + if(featureIt==layer.end()) + { + itkExceptionMacro("Layer " << layerName << " of input sample file is empty.\n"); + } + int cFieldIndex = (*featureIt).ogr().GetFieldIndex( classField.c_str() ); + if( cFieldIndex < 0 ) + { + itkExceptionMacro( "The field name for class label (" << classField + << ") has not been found in the vector file " ); + } + + auto numberOfFields = (*featureIt).ogr().GetFieldCount(); + auto excludedIds = this->GetExcludedFieldsIds(excludedFields, layer); + SampleVectorType samples; + int sampleCount{0}; + while( featureIt!=layer.end() ) + { + // Retrieve all the features for each field in the ogr layer. + if((*featureIt).ogr().GetFieldAsInteger(classField.c_str()) == label) + { + + SampleType mv; + for(auto idx=0; idx<numberOfFields; ++idx) + { + if(excludedIds.find(idx) == excludedIds.cend() && + this->IsNumericField((*featureIt), idx)) + mv.push_back((*featureIt).ogr().GetFieldAsDouble(idx)); + } + samples.push_back(mv); + ++sampleCount; + } + ++featureIt; + } + if(sampleCount==0) + { + itkExceptionMacro("Could not find any samples in layer " << layerName << + " with label " << label << '\n'); + } + return samples; +} + +void +SampleAugmentationFilter +::SampleToOGRFeatures(const ogr::DataSource::Pointer& vectors, + ogr::DataSource* output, + const SampleAugmentationFilter::SampleVectorType& samples, + const size_t layerName, + const std::string& classField, int label, + const std::vector<std::string>& excludedFields) +{ + + auto inputLayer = vectors->GetLayer(layerName); + auto excludedIds = this->GetExcludedFieldsIds(excludedFields, inputLayer); + + OGRSpatialReference * oSRS = nullptr; + if (inputLayer.GetSpatialRef()) + { + oSRS = inputLayer.GetSpatialRef()->Clone(); + } + OGRFeatureDefn &layerDefn = inputLayer.GetLayerDefn(); + + auto outputLayer = output->CreateLayer(inputLayer.GetName(), oSRS, + inputLayer.GetGeomType()); + for (int k=0 ; k < layerDefn.GetFieldCount() ; k++) + { + OGRFieldDefn originDefn(layerDefn.GetFieldDefn(k)); + ogr::FieldDefn fieldDefn(originDefn); + outputLayer.CreateField(fieldDefn); + } + + auto featureCount = outputLayer.GetFeatureCount(false); + auto templateFeature = this->SelectTemplateFeature(inputLayer, classField, label); + for(const auto& sample : samples) + { + ogr::Feature dstFeature(outputLayer.GetLayerDefn()); + dstFeature.SetFrom( templateFeature, TRUE ); + dstFeature.SetFID(++featureCount); + auto sampleFieldCounter = 0; + for (int k=0 ; k < layerDefn.GetFieldCount() ; k++) + { + if(excludedIds.find(k) == excludedIds.cend() && + this->IsNumericField(dstFeature, k)) + { + dstFeature.ogr().SetField(k, sample[sampleFieldCounter++]); + } + } + outputLayer.CreateFeature( dstFeature ); + } +} + +std::set<size_t> +SampleAugmentationFilter +::GetExcludedFieldsIds(const std::vector<std::string>& excludedFields, + const ogr::Layer& inputLayer) +{ + auto feature = *(inputLayer).begin(); + std::set<size_t> excludedIds; + if( excludedFields.size() != 0) + { + for(const auto& fieldName : excludedFields) + { + auto idx = feature.ogr().GetFieldIndex( fieldName.c_str() ); + excludedIds.insert(idx); + } + } + return excludedIds; +} + +bool +SampleAugmentationFilter +::IsNumericField(const ogr::Feature& feature, + const int idx) +{ + OGRFieldType fieldType = feature.ogr().GetFieldDefnRef(idx)->GetType(); + return (fieldType == OFTInteger + || ogr::version_proxy::IsOFTInteger64( fieldType ) + || fieldType == OFTReal); +} + +ogr::Feature +SampleAugmentationFilter +::SelectTemplateFeature(const ogr::Layer& inputLayer, + const std::string& classField, int label) +{ + auto wh = std::find_if(inputLayer.begin(), inputLayer.end(), + [&](auto& featureIt) + { + return featureIt.ogr().GetFieldAsInteger(classField.c_str()) == + label; + }); + return (wh == inputLayer.end()) ? *(inputLayer.begin()) : *wh; + +} +} // end namespace otb + diff --git a/Modules/Learning/Sampling/src/otbSamplingRateCalculator.cxx b/Modules/Learning/Sampling/src/otbSamplingRateCalculator.cxx index a7e8f2bc3ff14263ed453d6c46066e74d68c8356..86de38dfb0c5d8c596a1b0f73576c49b1d4200d3 100644 --- a/Modules/Learning/Sampling/src/otbSamplingRateCalculator.cxx +++ b/Modules/Learning/Sampling/src/otbSamplingRateCalculator.cxx @@ -233,7 +233,7 @@ SamplingRateCalculator std::string::size_type pos5 = line.find_first_not_of(" \t", parts[2].begin() - line.begin()); std::string::size_type pos6 = line.find_last_not_of(" \t", parts[2].end() - line.begin() -1); std::string::size_type pos7 = line.find_first_not_of(" \t", parts[3].begin() - line.begin()); - std::string::size_type pos8 = line.find_last_not_of(" \t", parts[3].end() - line.begin() -1); + std::string::size_type pos8 = line.find_last_not_of(" \t\r", parts[3].end() - line.begin() -1); if (pos2 != std::string::npos && pos1 <= pos2 && pos4 != std::string::npos && pos3 <= pos4 && pos6 != std::string::npos && pos5 <= pos6 && @@ -336,7 +336,7 @@ SamplingRateCalculator std::string::size_type pos1 = line.find_first_not_of(" \t", parts[0].begin() - line.begin()); std::string::size_type pos2 = line.find_last_not_of(" \t", parts[0].end() - line.begin() -1); std::string::size_type pos3 = line.find_first_not_of(" \t", parts[1].begin() - line.begin()); - std::string::size_type pos4 = line.find_last_not_of(" \t", parts[1].end() - line.begin() -1); + std::string::size_type pos4 = line.find_last_not_of(" \t\r", parts[1].end() - line.begin() -1); if (pos2 != std::string::npos && pos1 <= pos2 && pos4 != std::string::npos && pos3 <= pos4) { diff --git a/Modules/Learning/Sampling/test/otbImageSampleExtractorFilterTest.cxx b/Modules/Learning/Sampling/test/otbImageSampleExtractorFilterTest.cxx index 138032ea734aad7266bdfb020d54d547be05a9b3..414a7730276e95d4f41392d04c458d9f3af80035 100644 --- a/Modules/Learning/Sampling/test/otbImageSampleExtractorFilterTest.cxx +++ b/Modules/Learning/Sampling/test/otbImageSampleExtractorFilterTest.cxx @@ -129,6 +129,7 @@ int otbImageSampleExtractorFilterUpdate(int argc, char* argv[]) output->CreateLayer( inLayer.GetName(), oSRS, inLayer.GetLayerDefn().GetGeomType()); + oSRS->Release(); otb::ogr::Layer dstLayer = output->GetLayer(0); OGRFieldDefn labelField(classFieldName.c_str(),OFTString); dstLayer.CreateField(labelField, true); diff --git a/Modules/Learning/Supervised/include/otbBoostMachineLearningModel.h b/Modules/Learning/Supervised/include/otbBoostMachineLearningModel.h index ec96746f6db0a8646b4fef008ca8ec6fa9194bf4..36c22666d5e6f71fcedad011e8bac219d93c0ba6 100644 --- a/Modules/Learning/Supervised/include/otbBoostMachineLearningModel.h +++ b/Modules/Learning/Supervised/include/otbBoostMachineLearningModel.h @@ -99,21 +99,21 @@ public: itkSetMacro(MaxDepth, int); /** Train the machine learning model */ - void Train() ITK_OVERRIDE; + void Train() override; /** Save the model to file */ - void Save(const std::string & filename, const std::string & name="") ITK_OVERRIDE; + void Save(const std::string & filename, const std::string & name="") override; /** Load the model from file */ - void Load(const std::string & filename, const std::string & name="") ITK_OVERRIDE; + void Load(const std::string & filename, const std::string & name="") override; /**\name Classification model file compatibility tests */ //@{ /** Is the input model file readable and compatible with the corresponding classifier ? */ - bool CanReadFile(const std::string &) ITK_OVERRIDE; + bool CanReadFile(const std::string &) override; /** Is the input model file writable and compatible with the corresponding classifier ? */ - bool CanWriteFile(const std::string &) ITK_OVERRIDE; + bool CanWriteFile(const std::string &) override; //@} protected: @@ -121,14 +121,14 @@ protected: BoostMachineLearningModel(); /** Destructor */ - ~BoostMachineLearningModel() ITK_OVERRIDE; + ~BoostMachineLearningModel() override; /** Predict values using the model */ - TargetSampleType DoPredict(const InputSampleType& input, ConfidenceValueType *quality=ITK_NULLPTR) const ITK_OVERRIDE; + TargetSampleType DoPredict(const InputSampleType& input, ConfidenceValueType *quality=ITK_NULLPTR) const override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: BoostMachineLearningModel(const Self &); //purposely not implemented diff --git a/Modules/Learning/Supervised/include/otbBoostMachineLearningModelFactory.h b/Modules/Learning/Supervised/include/otbBoostMachineLearningModelFactory.h index 2344f857b1b3794bcbc77224dec7f290fe70f0fc..909dc5e84cdecae0274f55395e8af0578b9476a4 100644 --- a/Modules/Learning/Supervised/include/otbBoostMachineLearningModelFactory.h +++ b/Modules/Learning/Supervised/include/otbBoostMachineLearningModelFactory.h @@ -44,8 +44,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - const char* GetITKSourceVersion(void) const ITK_OVERRIDE; - const char* GetDescription(void) const ITK_OVERRIDE; + const char* GetITKSourceVersion(void) const override; + const char* GetDescription(void) const override; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -62,7 +62,7 @@ public: protected: BoostMachineLearningModelFactory(); - ~BoostMachineLearningModelFactory() ITK_OVERRIDE; + ~BoostMachineLearningModelFactory() override; private: BoostMachineLearningModelFactory(const Self &); //purposely not implemented diff --git a/Modules/Learning/Supervised/include/otbConfusionMatrixCalculator.h b/Modules/Learning/Supervised/include/otbConfusionMatrixCalculator.h index 465b0ae9a30a2024cb3384a2b9181fa8c51ad0ad..6db693ce26b5ba6e02708e2adcd6d05ef24d6561 100644 --- a/Modules/Learning/Supervised/include/otbConfusionMatrixCalculator.h +++ b/Modules/Learning/Supervised/include/otbConfusionMatrixCalculator.h @@ -137,8 +137,8 @@ public: protected: ConfusionMatrixCalculator(); - ~ConfusionMatrixCalculator() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~ConfusionMatrixCalculator() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: diff --git a/Modules/Learning/Supervised/include/otbConfusionMatrixMeasurements.h b/Modules/Learning/Supervised/include/otbConfusionMatrixMeasurements.h index 2b50388427368260acf538453d8da67d37151d3a..96790db5a8b7bee3ae20d470769fd05cd3423f61 100644 --- a/Modules/Learning/Supervised/include/otbConfusionMatrixMeasurements.h +++ b/Modules/Learning/Supervised/include/otbConfusionMatrixMeasurements.h @@ -143,7 +143,7 @@ public: protected: ConfusionMatrixMeasurements(); - ~ConfusionMatrixMeasurements() ITK_OVERRIDE {} + ~ConfusionMatrixMeasurements() override {} //void PrintSelf(std::ostream& os, itk::Indent indent) const; diff --git a/Modules/Learning/Supervised/include/otbCvRTreesWrapper.h b/Modules/Learning/Supervised/include/otbCvRTreesWrapper.h index a3874b1c5fa0d278ba755bf7117fe74f4ae4eab7..7ec589690132e0d9527ceb476191df11eedb3469 100644 --- a/Modules/Learning/Supervised/include/otbCvRTreesWrapper.h +++ b/Modules/Learning/Supervised/include/otbCvRTreesWrapper.h @@ -42,7 +42,7 @@ class OTBSupervised_EXPORT CvRTreesWrapper public: typedef std::vector<unsigned int> VotesVectorType; CvRTreesWrapper(); - ~CvRTreesWrapper() ITK_OVERRIDE; + ~CvRTreesWrapper() override; /** Compute the number of votes for each class. */ void get_votes(const cv::Mat& sample, diff --git a/Modules/Learning/Supervised/include/otbDecisionTreeMachineLearningModel.h b/Modules/Learning/Supervised/include/otbDecisionTreeMachineLearningModel.h index 260fc835c79e2aaca65625e7928e3d8ffd122c50..fc47f214052ff9a2f1aebdcd4181d4118181b0f6 100644 --- a/Modules/Learning/Supervised/include/otbDecisionTreeMachineLearningModel.h +++ b/Modules/Learning/Supervised/include/otbDecisionTreeMachineLearningModel.h @@ -154,21 +154,21 @@ public: } /** Train the machine learning model */ - void Train() ITK_OVERRIDE; + void Train() override; /** Save the model to file */ - void Save(const std::string & filename, const std::string & name="") ITK_OVERRIDE; + void Save(const std::string & filename, const std::string & name="") override; /** Load the model from file */ - void Load(const std::string & filename, const std::string & name="") ITK_OVERRIDE; + void Load(const std::string & filename, const std::string & name="") override; /**\name Classification model file compatibility tests */ //@{ /** Is the input model file readable and compatible with the corresponding classifier ? */ - bool CanReadFile(const std::string &) ITK_OVERRIDE; + bool CanReadFile(const std::string &) override; /** Is the input model file writable and compatible with the corresponding classifier ? */ - bool CanWriteFile(const std::string &) ITK_OVERRIDE; + bool CanWriteFile(const std::string &) override; //@} protected: @@ -176,13 +176,13 @@ protected: DecisionTreeMachineLearningModel(); /** Destructor */ - ~DecisionTreeMachineLearningModel() ITK_OVERRIDE; + ~DecisionTreeMachineLearningModel() override; /** Predict values using the model */ - TargetSampleType DoPredict(const InputSampleType& input, ConfidenceValueType *quality=ITK_NULLPTR) const ITK_OVERRIDE; + TargetSampleType DoPredict(const InputSampleType& input, ConfidenceValueType *quality=ITK_NULLPTR) const override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: DecisionTreeMachineLearningModel(const Self &); //purposely not implemented diff --git a/Modules/Learning/Supervised/include/otbDecisionTreeMachineLearningModelFactory.h b/Modules/Learning/Supervised/include/otbDecisionTreeMachineLearningModelFactory.h index 1c73cf6de6cb4d577dcea62f8e367a5631d2c116..5635cee32dfb2b77420992ea988f3610359b7061 100644 --- a/Modules/Learning/Supervised/include/otbDecisionTreeMachineLearningModelFactory.h +++ b/Modules/Learning/Supervised/include/otbDecisionTreeMachineLearningModelFactory.h @@ -44,8 +44,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - const char* GetITKSourceVersion(void) const ITK_OVERRIDE; - const char* GetDescription(void) const ITK_OVERRIDE; + const char* GetITKSourceVersion(void) const override; + const char* GetDescription(void) const override; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -62,7 +62,7 @@ public: protected: DecisionTreeMachineLearningModelFactory(); - ~DecisionTreeMachineLearningModelFactory() ITK_OVERRIDE; + ~DecisionTreeMachineLearningModelFactory() override; private: DecisionTreeMachineLearningModelFactory(const Self &); //purposely not implemented diff --git a/Modules/Learning/Supervised/include/otbExhaustiveExponentialOptimizer.h b/Modules/Learning/Supervised/include/otbExhaustiveExponentialOptimizer.h index cae5fb092d593407aa0855a1e62cb6a7b249d397..ae1c135e0a6e5e21e99bc451890078e53509704a 100644 --- a/Modules/Learning/Supervised/include/otbExhaustiveExponentialOptimizer.h +++ b/Modules/Learning/Supervised/include/otbExhaustiveExponentialOptimizer.h @@ -61,7 +61,7 @@ public: /** Run-time type information (and related methods). */ itkTypeMacro(ExhaustiveExponentialOptimizer,itk::SingleValuedNonLinearOptimizer); - void StartOptimization(void) ITK_OVERRIDE; + void StartOptimization(void) override; void StartWalking(void); void ResumeWalking(void); @@ -83,8 +83,8 @@ public: protected: ExhaustiveExponentialOptimizer(); - ~ExhaustiveExponentialOptimizer() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~ExhaustiveExponentialOptimizer() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Advance to the next grid position. */ void AdvanceOneStep(void); diff --git a/Modules/Learning/Supervised/include/otbGradientBoostedTreeMachineLearningModel.h b/Modules/Learning/Supervised/include/otbGradientBoostedTreeMachineLearningModel.h index 4ff453acb0cbd60ba029ff86846e3e072b59e6e9..19bbab10de3dc89a7bb5e5f9a287f19340f3fa59 100644 --- a/Modules/Learning/Supervised/include/otbGradientBoostedTreeMachineLearningModel.h +++ b/Modules/Learning/Supervised/include/otbGradientBoostedTreeMachineLearningModel.h @@ -105,21 +105,21 @@ public: itkSetMacro(UseSurrogates, bool); /** Train the machine learning model */ - void Train() ITK_OVERRIDE; + void Train() override; /** Save the model to file */ - void Save(const std::string & filename, const std::string & name="") ITK_OVERRIDE; + void Save(const std::string & filename, const std::string & name="") override; /** Load the model from file */ - void Load(const std::string & filename, const std::string & name="") ITK_OVERRIDE; + void Load(const std::string & filename, const std::string & name="") override; /**\name Classification model file compatibility tests */ //@{ /** Is the input model file readable and compatible with the corresponding classifier ? */ - bool CanReadFile(const std::string &) ITK_OVERRIDE; + bool CanReadFile(const std::string &) override; /** Is the input model file writable and compatible with the corresponding classifier ? */ - bool CanWriteFile(const std::string &) ITK_OVERRIDE; + bool CanWriteFile(const std::string &) override; //@} protected: @@ -127,14 +127,14 @@ protected: GradientBoostedTreeMachineLearningModel(); /** Destructor */ - ~GradientBoostedTreeMachineLearningModel() ITK_OVERRIDE; + ~GradientBoostedTreeMachineLearningModel() override; /** Predict values using the model */ - TargetSampleType DoPredict(const InputSampleType& input, ConfidenceValueType *quality=ITK_NULLPTR) const ITK_OVERRIDE; + TargetSampleType DoPredict(const InputSampleType& input, ConfidenceValueType *quality=ITK_NULLPTR) const override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: GradientBoostedTreeMachineLearningModel(const Self &); //purposely not implemented diff --git a/Modules/Learning/Supervised/include/otbGradientBoostedTreeMachineLearningModelFactory.h b/Modules/Learning/Supervised/include/otbGradientBoostedTreeMachineLearningModelFactory.h index 7d4d1faad88822285bac50fed67eea52d22883ce..4cc7203d881ee85a7ec69dee818383497738016d 100644 --- a/Modules/Learning/Supervised/include/otbGradientBoostedTreeMachineLearningModelFactory.h +++ b/Modules/Learning/Supervised/include/otbGradientBoostedTreeMachineLearningModelFactory.h @@ -46,8 +46,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - const char* GetITKSourceVersion(void) const ITK_OVERRIDE; - const char* GetDescription(void) const ITK_OVERRIDE; + const char* GetITKSourceVersion(void) const override; + const char* GetDescription(void) const override; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -64,7 +64,7 @@ public: protected: GradientBoostedTreeMachineLearningModelFactory(); - ~GradientBoostedTreeMachineLearningModelFactory() ITK_OVERRIDE; + ~GradientBoostedTreeMachineLearningModelFactory() override; private: GradientBoostedTreeMachineLearningModelFactory(const Self &); //purposely not implemented diff --git a/Modules/Learning/Supervised/include/otbKNearestNeighborsMachineLearningModel.h b/Modules/Learning/Supervised/include/otbKNearestNeighborsMachineLearningModel.h index 069ff1eb47b7570f08aba5592ede2e4da8ef49ab..d23411d923b324b843f53556149e68f3fd811bb6 100644 --- a/Modules/Learning/Supervised/include/otbKNearestNeighborsMachineLearningModel.h +++ b/Modules/Learning/Supervised/include/otbKNearestNeighborsMachineLearningModel.h @@ -79,21 +79,21 @@ public: itkSetMacro(DecisionRule, int); /** Train the machine learning model */ - void Train() ITK_OVERRIDE; + void Train() override; /** Save the model to file */ - void Save(const std::string & filename, const std::string & name="") ITK_OVERRIDE; + void Save(const std::string & filename, const std::string & name="") override; /** Load the model from file */ - void Load(const std::string & filename, const std::string & name="") ITK_OVERRIDE; + void Load(const std::string & filename, const std::string & name="") override; /**\name Classification model file compatibility tests */ //@{ /** Is the input model file readable and compatible with the corresponding classifier ? */ - bool CanReadFile(const std::string &) ITK_OVERRIDE; + bool CanReadFile(const std::string &) override; /** Is the input model file writable and compatible with the corresponding classifier ? */ - bool CanWriteFile(const std::string &) ITK_OVERRIDE; + bool CanWriteFile(const std::string &) override; //@} protected: @@ -101,14 +101,14 @@ protected: KNearestNeighborsMachineLearningModel(); /** Destructor */ - ~KNearestNeighborsMachineLearningModel() ITK_OVERRIDE; + ~KNearestNeighborsMachineLearningModel() override; /** Predict values using the model */ - TargetSampleType DoPredict(const InputSampleType& input, ConfidenceValueType *quality=ITK_NULLPTR) const ITK_OVERRIDE; + TargetSampleType DoPredict(const InputSampleType& input, ConfidenceValueType *quality=ITK_NULLPTR) const override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: KNearestNeighborsMachineLearningModel(const Self &); //purposely not implemented diff --git a/Modules/Learning/Supervised/include/otbKNearestNeighborsMachineLearningModelFactory.h b/Modules/Learning/Supervised/include/otbKNearestNeighborsMachineLearningModelFactory.h index acb79f0543da6f355d8aa644e6a563e5ebc6ac91..717a09313e1f3d77cd20ab07b7e99817a53a9b76 100644 --- a/Modules/Learning/Supervised/include/otbKNearestNeighborsMachineLearningModelFactory.h +++ b/Modules/Learning/Supervised/include/otbKNearestNeighborsMachineLearningModelFactory.h @@ -44,8 +44,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - const char* GetITKSourceVersion(void) const ITK_OVERRIDE; - const char* GetDescription(void) const ITK_OVERRIDE; + const char* GetITKSourceVersion(void) const override; + const char* GetDescription(void) const override; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -62,7 +62,7 @@ public: protected: KNearestNeighborsMachineLearningModelFactory(); - ~KNearestNeighborsMachineLearningModelFactory() ITK_OVERRIDE; + ~KNearestNeighborsMachineLearningModelFactory() override; private: KNearestNeighborsMachineLearningModelFactory(const Self &); //purposely not implemented diff --git a/Modules/Learning/Supervised/include/otbLabelMapClassifier.h b/Modules/Learning/Supervised/include/otbLabelMapClassifier.h index 75dc291f3df947dbe9a9ab6d45d4fca8ccd73470..51f102b96c175b8b59521c1e391d64ff41dc085e 100644 --- a/Modules/Learning/Supervised/include/otbLabelMapClassifier.h +++ b/Modules/Learning/Supervised/include/otbLabelMapClassifier.h @@ -89,11 +89,11 @@ public: protected: LabelMapClassifier(); - ~LabelMapClassifier() ITK_OVERRIDE {}; + ~LabelMapClassifier() override {}; - void ThreadedProcessLabelObject( LabelObjectType * labelObject ) ITK_OVERRIDE; + void ThreadedProcessLabelObject( LabelObjectType * labelObject ) override; - void ReleaseInputs() ITK_OVERRIDE; + void ReleaseInputs() override; private: diff --git a/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModel.h b/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModel.h index 329722af5a2dd5d971f6dfaa0f86ef29be3dc188..8d96b2a179bf7ea9aa541bacb2edd4a5b68a64cc 100644 --- a/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModel.h +++ b/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModel.h @@ -64,21 +64,21 @@ public: itkTypeMacro(SVMMachineLearningModel, MachineLearningModel); /** Train the machine learning model */ - void Train() ITK_OVERRIDE; + void Train() override; /** Save the model to file */ - void Save(const std::string &filename, const std::string & name="") ITK_OVERRIDE; + void Save(const std::string &filename, const std::string & name="") override; /** Load the model from file */ - void Load(const std::string & filename, const std::string & name="") ITK_OVERRIDE; + void Load(const std::string & filename, const std::string & name="") override; /**\name Classification model file compatibility tests */ //@{ /** Is the input model file readable and compatible with the corresponding classifier ? */ - bool CanReadFile(const std::string &) ITK_OVERRIDE; + bool CanReadFile(const std::string &) override; /** Is the input model file writable and compatible with the corresponding classifier ? */ - bool CanWriteFile(const std::string &) ITK_OVERRIDE; + bool CanWriteFile(const std::string &) override; //@} #define otbSetSVMParameterMacro(name, alias, type) \ @@ -269,13 +269,13 @@ protected: LibSVMMachineLearningModel(); /** Destructor */ - ~LibSVMMachineLearningModel() ITK_OVERRIDE; + ~LibSVMMachineLearningModel() override; /** Predict values using the model */ - TargetSampleType DoPredict(const InputSampleType& input, ConfidenceValueType *quality=ITK_NULLPTR) const ITK_OVERRIDE; + TargetSampleType DoPredict(const InputSampleType& input, ConfidenceValueType *quality=ITK_NULLPTR) const override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: LibSVMMachineLearningModel(const Self &); //purposely not implemented diff --git a/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModel.txx b/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModel.txx index 2b14f6dca92ebe4c97d4305b16afe744e5635944..1d1c03e39a67864cbcbe81c014c4a97d7aca59df 100644 --- a/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModel.txx +++ b/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModel.txx @@ -66,7 +66,7 @@ LibSVMMachineLearningModel<TInputValue,TOutputValue> this->m_Problem.l = 0; this->m_Problem.y = ITK_NULLPTR; this->m_Problem.x = ITK_NULLPTR; -#ifndef OTB_SHOW_ALL_MSG_DEBUG +#ifndef NDEBUG svm_set_print_string_function(&otb::Utils::PrintNothing); #endif } diff --git a/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModelFactory.h b/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModelFactory.h index 288573e7356dc0b07a828435f4a5b4d146737b69..08bd6c767e7dbe4c7a7b7c34495f3c5ed38f8a54 100644 --- a/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModelFactory.h +++ b/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModelFactory.h @@ -42,8 +42,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - const char* GetITKSourceVersion(void) const ITK_OVERRIDE; - const char* GetDescription(void) const ITK_OVERRIDE; + const char* GetITKSourceVersion(void) const override; + const char* GetDescription(void) const override; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -60,7 +60,7 @@ public: protected: LibSVMMachineLearningModelFactory(); - ~LibSVMMachineLearningModelFactory() ITK_OVERRIDE; + ~LibSVMMachineLearningModelFactory() override; private: LibSVMMachineLearningModelFactory(const Self &); //purposely not implemented diff --git a/Modules/Learning/Supervised/include/otbMachineLearningModelFactory.h b/Modules/Learning/Supervised/include/otbMachineLearningModelFactory.h index 5339802b1d8ae90915e2ffb506a4e5f9dcc6ce77..67ef0758cb98e450695371dbf26c30c2b7e6045d 100644 --- a/Modules/Learning/Supervised/include/otbMachineLearningModelFactory.h +++ b/Modules/Learning/Supervised/include/otbMachineLearningModelFactory.h @@ -60,7 +60,7 @@ public: protected: MachineLearningModelFactory(); - ~MachineLearningModelFactory() ITK_OVERRIDE; + ~MachineLearningModelFactory() override; private: MachineLearningModelFactory(const Self &); //purposely not implemented diff --git a/Modules/Learning/Supervised/include/otbNeuralNetworkMachineLearningModel.h b/Modules/Learning/Supervised/include/otbNeuralNetworkMachineLearningModel.h index 3253c23686fcd46e2afcf513546518ade051cb6f..44a1bad5856c67d36ec0f75053212c3eac532a3a 100644 --- a/Modules/Learning/Supervised/include/otbNeuralNetworkMachineLearningModel.h +++ b/Modules/Learning/Supervised/include/otbNeuralNetworkMachineLearningModel.h @@ -153,21 +153,21 @@ public: itkSetMacro(Epsilon, double); /** Train the machine learning model */ - void Train() ITK_OVERRIDE; + void Train() override; /** Save the model to file */ - void Save(const std::string & filename, const std::string & name="") ITK_OVERRIDE; + void Save(const std::string & filename, const std::string & name="") override; /** Load the model from file */ - void Load(const std::string & filename, const std::string & name="") ITK_OVERRIDE; + void Load(const std::string & filename, const std::string & name="") override; /**\name Classification model file compatibility tests */ //@{ /** Is the input model file readable and compatible with the corresponding classifier ? */ - bool CanReadFile(const std::string &) ITK_OVERRIDE; + bool CanReadFile(const std::string &) override; /** Is the input model file writable and compatible with the corresponding classifier ? */ - bool CanWriteFile(const std::string &) ITK_OVERRIDE; + bool CanWriteFile(const std::string &) override; //@} protected: @@ -175,15 +175,15 @@ protected: NeuralNetworkMachineLearningModel(); /** Destructor */ - ~NeuralNetworkMachineLearningModel() ITK_OVERRIDE; + ~NeuralNetworkMachineLearningModel() override; /** Predict values using the model */ - TargetSampleType DoPredict(const InputSampleType& input, ConfidenceValueType *quality=ITK_NULLPTR) const ITK_OVERRIDE; + TargetSampleType DoPredict(const InputSampleType& input, ConfidenceValueType *quality=ITK_NULLPTR) const override; void LabelsToMat(const TargetListSampleType * listSample, cv::Mat & output); /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: NeuralNetworkMachineLearningModel(const Self &); //purposely not implemented diff --git a/Modules/Learning/Supervised/include/otbNeuralNetworkMachineLearningModelFactory.h b/Modules/Learning/Supervised/include/otbNeuralNetworkMachineLearningModelFactory.h index af6c7b0a265d4bd3ac45a09823997b359efec594..ad8f1dce904e94a8fa317f8410efdf58e3d29e3b 100644 --- a/Modules/Learning/Supervised/include/otbNeuralNetworkMachineLearningModelFactory.h +++ b/Modules/Learning/Supervised/include/otbNeuralNetworkMachineLearningModelFactory.h @@ -44,8 +44,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - const char* GetITKSourceVersion(void) const ITK_OVERRIDE; - const char* GetDescription(void) const ITK_OVERRIDE; + const char* GetITKSourceVersion(void) const override; + const char* GetDescription(void) const override; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -62,7 +62,7 @@ public: protected: NeuralNetworkMachineLearningModelFactory(); - ~NeuralNetworkMachineLearningModelFactory() ITK_OVERRIDE; + ~NeuralNetworkMachineLearningModelFactory() override; private: NeuralNetworkMachineLearningModelFactory(const Self &); //purposely not implemented diff --git a/Modules/Learning/Supervised/include/otbNormalBayesMachineLearningModel.h b/Modules/Learning/Supervised/include/otbNormalBayesMachineLearningModel.h index 0b1ddc2c3c03512cd482f88fdb0dd330959aa6d4..da1ae46c05e52e6e4029acba01e9ea7c894f0e98 100644 --- a/Modules/Learning/Supervised/include/otbNormalBayesMachineLearningModel.h +++ b/Modules/Learning/Supervised/include/otbNormalBayesMachineLearningModel.h @@ -59,21 +59,21 @@ public: itkTypeMacro(NormalBayesMachineLearningModel, MachineLearningModel); /** Train the machine learning model */ - void Train() ITK_OVERRIDE; + void Train() override; /** Save the model to file */ - void Save(const std::string & filename, const std::string & name="") ITK_OVERRIDE; + void Save(const std::string & filename, const std::string & name="") override; /** Load the model from file */ - void Load(const std::string & filename, const std::string & name="") ITK_OVERRIDE; + void Load(const std::string & filename, const std::string & name="") override; /**\name Classification model file compatibility tests */ //@{ /** Is the input model file readable and compatible with the corresponding classifier ? */ - bool CanReadFile(const std::string &) ITK_OVERRIDE; + bool CanReadFile(const std::string &) override; /** Is the input model file writable and compatible with the corresponding classifier ? */ - bool CanWriteFile(const std::string &) ITK_OVERRIDE; + bool CanWriteFile(const std::string &) override; //@} protected: @@ -81,14 +81,14 @@ protected: NormalBayesMachineLearningModel(); /** Destructor */ - ~NormalBayesMachineLearningModel() ITK_OVERRIDE; + ~NormalBayesMachineLearningModel() override; /** Predict values using the model */ - TargetSampleType DoPredict(const InputSampleType& input, ConfidenceValueType *quality=ITK_NULLPTR) const ITK_OVERRIDE; + TargetSampleType DoPredict(const InputSampleType& input, ConfidenceValueType *quality=ITK_NULLPTR) const override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: NormalBayesMachineLearningModel(const Self &); //purposely not implemented diff --git a/Modules/Learning/Supervised/include/otbNormalBayesMachineLearningModelFactory.h b/Modules/Learning/Supervised/include/otbNormalBayesMachineLearningModelFactory.h index 517b93cfefc2978f8f838cd5493bbd4712ae82b9..13306b5b8217b644b6941cf8ba6eb3499eba6d7e 100644 --- a/Modules/Learning/Supervised/include/otbNormalBayesMachineLearningModelFactory.h +++ b/Modules/Learning/Supervised/include/otbNormalBayesMachineLearningModelFactory.h @@ -44,8 +44,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - const char* GetITKSourceVersion(void) const ITK_OVERRIDE; - const char* GetDescription(void) const ITK_OVERRIDE; + const char* GetITKSourceVersion(void) const override; + const char* GetDescription(void) const override; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -62,7 +62,7 @@ public: protected: NormalBayesMachineLearningModelFactory(); - ~NormalBayesMachineLearningModelFactory() ITK_OVERRIDE; + ~NormalBayesMachineLearningModelFactory() override; private: NormalBayesMachineLearningModelFactory(const Self &); //purposely not implemented diff --git a/Modules/Learning/Supervised/include/otbRandomForestsMachineLearningModel.h b/Modules/Learning/Supervised/include/otbRandomForestsMachineLearningModel.h index 04bbbca95184da9f4406f8c902349ba8301adb17..4dd7f0c828d144b41d957dbeacaccaee2359bbb5 100644 --- a/Modules/Learning/Supervised/include/otbRandomForestsMachineLearningModel.h +++ b/Modules/Learning/Supervised/include/otbRandomForestsMachineLearningModel.h @@ -64,21 +64,21 @@ public: itkTypeMacro(RandomForestsMachineLearningModel, MachineLearningModel); /** Train the machine learning model */ - void Train() ITK_OVERRIDE; + void Train() override; /** Save the model to file */ - void Save(const std::string & filename, const std::string & name="") ITK_OVERRIDE; + void Save(const std::string & filename, const std::string & name="") override; /** Load the model from file */ - void Load(const std::string & filename, const std::string & name="") ITK_OVERRIDE; + void Load(const std::string & filename, const std::string & name="") override; /**\name Classification model file compatibility tests */ //@{ /** Is the input model file readable and compatible with the corresponding classifier ? */ - bool CanReadFile(const std::string &) ITK_OVERRIDE; + bool CanReadFile(const std::string &) override; /** Is the input model file writable and compatible with the corresponding classifier ? */ - bool CanWriteFile(const std::string &) ITK_OVERRIDE; + bool CanWriteFile(const std::string &) override; //@} //Setters of RT parameters (documentation get from opencv doxygen 2.4) @@ -135,14 +135,14 @@ protected: RandomForestsMachineLearningModel(); /** Destructor */ - ~RandomForestsMachineLearningModel() ITK_OVERRIDE; + ~RandomForestsMachineLearningModel() override; /** Predict values using the model */ - TargetSampleType DoPredict(const InputSampleType& input, ConfidenceValueType *quality=ITK_NULLPTR) const ITK_OVERRIDE; + TargetSampleType DoPredict(const InputSampleType& input, ConfidenceValueType *quality=ITK_NULLPTR) const override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /* /\** Input list sample *\/ */ /* typename InputListSampleType::Pointer m_InputListSample; */ diff --git a/Modules/Learning/Supervised/include/otbRandomForestsMachineLearningModelFactory.h b/Modules/Learning/Supervised/include/otbRandomForestsMachineLearningModelFactory.h index f84f937213eb7e7bfb5fd052fd16c85febbd9090..92dd605664f8ad8cb3fc7c9aa8ccfe56208c608d 100644 --- a/Modules/Learning/Supervised/include/otbRandomForestsMachineLearningModelFactory.h +++ b/Modules/Learning/Supervised/include/otbRandomForestsMachineLearningModelFactory.h @@ -44,8 +44,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - const char* GetITKSourceVersion(void) const ITK_OVERRIDE; - const char* GetDescription(void) const ITK_OVERRIDE; + const char* GetITKSourceVersion(void) const override; + const char* GetDescription(void) const override; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -62,7 +62,7 @@ public: protected: RandomForestsMachineLearningModelFactory(); - ~RandomForestsMachineLearningModelFactory() ITK_OVERRIDE; + ~RandomForestsMachineLearningModelFactory() override; private: RandomForestsMachineLearningModelFactory(const Self &); //purposely not implemented diff --git a/Modules/Learning/Supervised/include/otbSVMCrossValidationCostFunction.h b/Modules/Learning/Supervised/include/otbSVMCrossValidationCostFunction.h index ceb76a148636d70d4dd3d0b3b836de2c6cb36d87..4056c47c5466322ebfe0eadbd912957208dd2a82 100644 --- a/Modules/Learning/Supervised/include/otbSVMCrossValidationCostFunction.h +++ b/Modules/Learning/Supervised/include/otbSVMCrossValidationCostFunction.h @@ -82,19 +82,19 @@ public: itkGetMacro(DerivativeStep, ParametersValueType); /** \return The accuracy value corresponding the parameters */ - MeasureType GetValue(const ParametersType& parameters) const ITK_OVERRIDE; + MeasureType GetValue(const ParametersType& parameters) const override; /** \return The accuracy derivative corresponding to the parameters */ - void GetDerivative(const ParametersType& parameters, DerivativeType& derivative) const ITK_OVERRIDE; + void GetDerivative(const ParametersType& parameters, DerivativeType& derivative) const override; /** \return the number of parameters to optimize */ - unsigned int GetNumberOfParameters(void) const ITK_OVERRIDE; + unsigned int GetNumberOfParameters(void) const override; protected: /// Constructor SVMCrossValidationCostFunction(); /// Destructor - ~SVMCrossValidationCostFunction() ITK_OVERRIDE; + ~SVMCrossValidationCostFunction() override; /** Update svm parameters struct according to the input parameters */ diff --git a/Modules/Learning/Supervised/include/otbSVMMachineLearningModel.h b/Modules/Learning/Supervised/include/otbSVMMachineLearningModel.h index 07059be9b8c0a0a42f78f8fc9753da1e365c8a5b..d0c36eeb3b55eb7d5acc60d16c454a9ba4bfffa9 100644 --- a/Modules/Learning/Supervised/include/otbSVMMachineLearningModel.h +++ b/Modules/Learning/Supervised/include/otbSVMMachineLearningModel.h @@ -66,21 +66,21 @@ public: itkTypeMacro(SVMMachineLearningModel, MachineLearningModel); /** Train the machine learning model */ - void Train() ITK_OVERRIDE; + void Train() override; /** Save the model to file */ - void Save(const std::string & filename, const std::string & name="") ITK_OVERRIDE; + void Save(const std::string & filename, const std::string & name="") override; /** Load the model from file */ - void Load(const std::string & filename, const std::string & name="") ITK_OVERRIDE; + void Load(const std::string & filename, const std::string & name="") override; /**\name Classification model file compatibility tests */ //@{ /** Is the input model file readable and compatible with the corresponding classifier ? */ - bool CanReadFile(const std::string &) ITK_OVERRIDE; + bool CanReadFile(const std::string &) override; /** Is the input model file writable and compatible with the corresponding classifier ? */ - bool CanWriteFile(const std::string &) ITK_OVERRIDE; + bool CanWriteFile(const std::string &) override; //@} //Setters/Getters to SVM model @@ -138,14 +138,14 @@ protected: SVMMachineLearningModel(); /** Destructor */ - ~SVMMachineLearningModel() ITK_OVERRIDE; + ~SVMMachineLearningModel() override; /** Predict values using the model */ - TargetSampleType DoPredict(const InputSampleType& input, ConfidenceValueType *quality=ITK_NULLPTR) const ITK_OVERRIDE; + TargetSampleType DoPredict(const InputSampleType& input, ConfidenceValueType *quality=ITK_NULLPTR) const override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: SVMMachineLearningModel(const Self &); //purposely not implemented diff --git a/Modules/Learning/Supervised/include/otbSVMMachineLearningModelFactory.h b/Modules/Learning/Supervised/include/otbSVMMachineLearningModelFactory.h index 7ea10ad559302084c942088f35a3b3651b727edd..07ab9b744de2b5e735d4996775ec5f2319e645ea 100644 --- a/Modules/Learning/Supervised/include/otbSVMMachineLearningModelFactory.h +++ b/Modules/Learning/Supervised/include/otbSVMMachineLearningModelFactory.h @@ -44,8 +44,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - const char* GetITKSourceVersion(void) const ITK_OVERRIDE; - const char* GetDescription(void) const ITK_OVERRIDE; + const char* GetITKSourceVersion(void) const override; + const char* GetDescription(void) const override; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -62,7 +62,7 @@ public: protected: SVMMachineLearningModelFactory(); - ~SVMMachineLearningModelFactory() ITK_OVERRIDE; + ~SVMMachineLearningModelFactory() override; private: SVMMachineLearningModelFactory(const Self &); //purposely not implemented diff --git a/Modules/Learning/Supervised/include/otbSVMMarginSampler.h b/Modules/Learning/Supervised/include/otbSVMMarginSampler.h index c6a3ae1daedefaeb20b5701150675f2c04a98ae4..ab02a0f7b5a08c81782ea7f9d1dccc4ed5d22af3 100644 --- a/Modules/Learning/Supervised/include/otbSVMMarginSampler.h +++ b/Modules/Learning/Supervised/include/otbSVMMarginSampler.h @@ -86,11 +86,11 @@ public: protected: SVMMarginSampler(); - ~SVMMarginSampler() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~SVMMarginSampler() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Starts the classification process */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; virtual void DoMarginSampling(); private: diff --git a/Modules/Learning/Supervised/include/otbSharkRandomForestsMachineLearningModel.h b/Modules/Learning/Supervised/include/otbSharkRandomForestsMachineLearningModel.h index 8d2c0c81233c5e5486ec8068f86298a2f7053ab8..41015ee9dc7f5f6bb6c3d1defbfad5ccb1c0c47b 100644 --- a/Modules/Learning/Supervised/include/otbSharkRandomForestsMachineLearningModel.h +++ b/Modules/Learning/Supervised/include/otbSharkRandomForestsMachineLearningModel.h @@ -33,7 +33,10 @@ #pragma GCC diagnostic ignored "-Wsign-compare" #pragma GCC diagnostic ignored "-Wcast-align" #pragma GCC diagnostic ignored "-Wunknown-pragmas" +#pragma GCC diagnostic ignored "-Wheader-guard" +#pragma GCC diagnostic ignored "-Wmissing-field-initializers" #endif +#include <shark/Models/Classifier.h> #include "otb_shark.h" #include "shark/Algorithms/Trainers/RFTrainer.h" #if defined(__GNUC__) || defined(__clang__) @@ -83,21 +86,21 @@ public: itkTypeMacro(SharkRandomForestsMachineLearningModel, MachineLearningModel); /** Train the machine learning model */ - virtual void Train() ITK_OVERRIDE; + virtual void Train() override; /** Save the model to file */ - virtual void Save(const std::string & filename, const std::string & name="") ITK_OVERRIDE; + virtual void Save(const std::string & filename, const std::string & name="") override; /** Load the model from file */ - virtual void Load(const std::string & filename, const std::string & name="") ITK_OVERRIDE; + virtual void Load(const std::string & filename, const std::string & name="") override; /**\name Classification model file compatibility tests */ //@{ /** Is the input model file readable and compatible with the corresponding classifier ? */ - virtual bool CanReadFile(const std::string &) ITK_OVERRIDE; + virtual bool CanReadFile(const std::string &) override; /** Is the input model file writable and compatible with the corresponding classifier ? */ - virtual bool CanWriteFile(const std::string &) ITK_OVERRIDE; + virtual bool CanWriteFile(const std::string &) override; //@} /** From Shark doc: Get the number of trees to grow.*/ @@ -134,6 +137,10 @@ public: /** If true, margin confidence value will be computed */ itkSetMacro(ComputeMargin, bool); + /** If true, class labels will be normalised in [0 ... nbClasses] */ + itkGetMacro(NormalizeClassLabels, bool); + itkSetMacro(NormalizeClassLabels, bool); + protected: /** Constructor */ SharkRandomForestsMachineLearningModel(); @@ -142,20 +149,22 @@ protected: virtual ~SharkRandomForestsMachineLearningModel(); /** Predict values using the model */ - virtual TargetSampleType DoPredict(const InputSampleType& input, ConfidenceValueType *quality=ITK_NULLPTR) const ITK_OVERRIDE; + virtual TargetSampleType DoPredict(const InputSampleType& input, ConfidenceValueType *quality=ITK_NULLPTR) const override; - virtual void DoPredictBatch(const InputListSampleType *, const unsigned int & startIndex, const unsigned int & size, TargetListSampleType *, ConfidenceListSampleType * = ITK_NULLPTR) const ITK_OVERRIDE; + virtual void DoPredictBatch(const InputListSampleType *, const unsigned int & startIndex, const unsigned int & size, TargetListSampleType *, ConfidenceListSampleType * = ITK_NULLPTR) const override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: SharkRandomForestsMachineLearningModel(const Self &); //purposely not implemented void operator =(const Self&); //purposely not implemented - shark::RFClassifier m_RFModel; - shark::RFTrainer m_RFTrainer; + shark::RFClassifier<unsigned int> m_RFModel; + shark::RFTrainer<unsigned int> m_RFTrainer; + std::vector<unsigned int> m_ClassDictionary; + bool m_NormalizeClassLabels; unsigned int m_NumberOfTrees; unsigned int m_MTry; diff --git a/Modules/Learning/Supervised/include/otbSharkRandomForestsMachineLearningModel.txx b/Modules/Learning/Supervised/include/otbSharkRandomForestsMachineLearningModel.txx index 207f1abdd77e4b5cfffd9bc5d104c4b40232f853..72c816069bebddc048a0f8af48f24579a55fa38b 100644 --- a/Modules/Learning/Supervised/include/otbSharkRandomForestsMachineLearningModel.txx +++ b/Modules/Learning/Supervised/include/otbSharkRandomForestsMachineLearningModel.txx @@ -32,7 +32,6 @@ #pragma GCC diagnostic ignored "-Woverloaded-virtual" #pragma GCC diagnostic ignored "-Wignored-qualifiers" #endif -#include <shark/Models/Converter.h> #if defined(__GNUC__) || defined(__clang__) #pragma GCC diagnostic pop #endif @@ -52,6 +51,7 @@ SharkRandomForestsMachineLearningModel<TInputValue,TOutputValue> this->m_ConfidenceIndex = true; this->m_IsRegressionSupported = false; this->m_IsDoPredictBatchMultiThreaded = true; + this->m_NormalizeClassLabels = true; } @@ -76,13 +76,17 @@ SharkRandomForestsMachineLearningModel<TInputValue,TOutputValue> Shark::ListSampleToSharkVector(this->GetInputListSample(), features); Shark::ListSampleToSharkVector(this->GetTargetListSample(), class_labels); + if(m_NormalizeClassLabels) + { + Shark::NormalizeLabelsAndGetDictionary(class_labels, m_ClassDictionary); + } shark::ClassificationDataset TrainSamples = shark::createLabeledDataFromRange(features,class_labels); //Set parameters m_RFTrainer.setMTry(m_MTry); m_RFTrainer.setNTrees(m_NumberOfTrees); m_RFTrainer.setNodeSize(m_NodeSize); - m_RFTrainer.setOOBratio(m_OobRatio); + // m_RFTrainer.setOOBratio(m_OobRatio); m_RFTrainer.train(m_RFModel, TrainSamples); } @@ -125,15 +129,20 @@ SharkRandomForestsMachineLearningModel<TInputValue,TOutputValue> } if (quality != ITK_NULLPTR) { - shark::RealVector probas = m_RFModel(samples); + shark::RealVector probas = m_RFModel.decisionFunction()(samples); (*quality) = ComputeConfidence(probas, m_ComputeMargin); } - shark::ArgMaxConverter<shark::RFClassifier> amc; - amc.decisionFunction() = m_RFModel; - unsigned int res; - amc.eval(samples, res); + unsigned int res{0}; + m_RFModel.eval(samples, res); TargetSampleType target; - target[0] = static_cast<TOutputValue>(res); + if(m_NormalizeClassLabels) + { + target[0] = m_ClassDictionary[static_cast<TOutputValue>(res)]; + } + else + { + target[0] = static_cast<TOutputValue>(res); + } return target; } @@ -157,13 +166,13 @@ SharkRandomForestsMachineLearningModel<TInputValue,TOutputValue> Shark::ListSampleRangeToSharkVector(input, features,startIndex,size); shark::Data<shark::RealVector> inputSamples = shark::createDataFromRange(features); - #ifdef _OPENMP +#ifdef _OPENMP omp_set_num_threads(itk::MultiThreader::GetGlobalDefaultNumberOfThreads()); - #endif +#endif if(quality != ITK_NULLPTR) { - shark::Data<shark::RealVector> probas = m_RFModel(inputSamples); + shark::Data<shark::RealVector> probas = m_RFModel.decisionFunction()(inputSamples); unsigned int id = startIndex; for(shark::RealVector && p : probas.elements()) { @@ -175,14 +184,19 @@ SharkRandomForestsMachineLearningModel<TInputValue,TOutputValue> } } - shark::ArgMaxConverter<shark::RFClassifier> amc; - amc.decisionFunction() = m_RFModel; - auto prediction = amc(inputSamples); + auto prediction = m_RFModel(inputSamples); unsigned int id = startIndex; for(const auto& p : prediction.elements()) { TargetSampleType target; - target[0] = static_cast<TOutputValue>(p); + if(m_NormalizeClassLabels) + { + target[0] = m_ClassDictionary[static_cast<TOutputValue>(p)]; + } + else + { + target[0] = static_cast<TOutputValue>(p); + } targets->SetMeasurementVector(id,target); ++id; } @@ -199,7 +213,18 @@ SharkRandomForestsMachineLearningModel<TInputValue,TOutputValue> itkExceptionMacro(<< "Error opening " << filename.c_str() ); } // Add comment with model file name - ofs << "#" << m_RFModel.name() << std::endl; + ofs << "#" << m_RFModel.name(); + if(m_NormalizeClassLabels) ofs << " with_dictionary"; + ofs << std::endl; + if(m_NormalizeClassLabels) + { + ofs << m_ClassDictionary.size() << " "; + for(const auto& l : m_ClassDictionary) + { + ofs << l << " "; + } + ofs << std::endl; + } shark::TextOutArchive oa(ofs); m_RFModel.save(oa,0); } @@ -219,6 +244,10 @@ SharkRandomForestsMachineLearningModel<TInputValue,TOutputValue> { if( line.find( m_RFModel.name() ) == std::string::npos ) itkExceptionMacro( "The model file : " + filename + " cannot be read." ); + if( line.find( "with_dictionary" ) == std::string::npos ) + { + m_NormalizeClassLabels=false; + } } else { @@ -226,6 +255,18 @@ SharkRandomForestsMachineLearningModel<TInputValue,TOutputValue> ifs.clear(); ifs.seekg( 0, std::ios::beg ); } + if(m_NormalizeClassLabels) + { + size_t nbLabels{0}; + ifs >> nbLabels; + m_ClassDictionary.resize(nbLabels); + for(size_t i=0; i<nbLabels; ++i) + { + unsigned int label; + ifs >> label; + m_ClassDictionary[i]=label; + } + } shark::TextInArchive ia( ifs ); m_RFModel.load( ia, 0 ); } diff --git a/Modules/Learning/Supervised/include/otbSharkRandomForestsMachineLearningModelFactory.h b/Modules/Learning/Supervised/include/otbSharkRandomForestsMachineLearningModelFactory.h index 313d9db9a1a581f0c6e7e9064f21cad3f20c4d74..756d5102a129921f31e9cb4f371307e631abd3d3 100644 --- a/Modules/Learning/Supervised/include/otbSharkRandomForestsMachineLearningModelFactory.h +++ b/Modules/Learning/Supervised/include/otbSharkRandomForestsMachineLearningModelFactory.h @@ -42,8 +42,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - virtual const char* GetITKSourceVersion(void) const; - virtual const char* GetDescription(void) const; + virtual const char* GetITKSourceVersion(void) const override; + virtual const char* GetDescription(void) const override; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); diff --git a/Modules/Learning/Supervised/src/CMakeLists.txt b/Modules/Learning/Supervised/src/CMakeLists.txt index 7a3c77b3a7e2992216d16f444178abb697424dc0..45e881904bbbf61bec7bb8a158f8661806d64896 100644 --- a/Modules/Learning/Supervised/src/CMakeLists.txt +++ b/Modules/Learning/Supervised/src/CMakeLists.txt @@ -19,7 +19,6 @@ # set(OTBSupervised_SRC - otbMachineLearningModelFactoryBase.cxx otbExhaustiveExponentialOptimizer.cxx ) @@ -33,6 +32,7 @@ target_link_libraries(OTBSupervised ${OTBLibSVM_LIBRARIES} ${OTBOpenCV_LIBRARIES} ${OTBShark_LIBRARIES} + ${OTBLearningBase_LIBRARIES} ) otb_module_target(OTBSupervised) diff --git a/Modules/Learning/Supervised/test/otbExhaustiveExponentialOptimizerTest.cxx b/Modules/Learning/Supervised/test/otbExhaustiveExponentialOptimizerTest.cxx index c818411586fcb2f092249eabceaadb4f7e46704f..1b0dec3f6343262b31da825a4a75728d057dc23a 100644 --- a/Modules/Learning/Supervised/test/otbExhaustiveExponentialOptimizerTest.cxx +++ b/Modules/Learning/Supervised/test/otbExhaustiveExponentialOptimizerTest.cxx @@ -72,7 +72,7 @@ public: }; /** \return The accuracy value corresponding the parameters */ - MeasureType GetValue(const ParametersType& parameters) const ITK_OVERRIDE + MeasureType GetValue(const ParametersType& parameters) const override { return static_cast<MeasureType> ( m_FunctionInternalParameters.GetElement(0) * parameters.GetElement(0) * parameters.GetElement(0) + m_FunctionInternalParameters.GetElement(1) * parameters.GetElement(1) * parameters.GetElement(1) + @@ -83,10 +83,10 @@ public: }; /** \return the number of parameters to optimize */ - unsigned int GetNumberOfParameters(void) const ITK_OVERRIDE {return 2; }; + unsigned int GetNumberOfParameters(void) const override {return 2; }; /** \return The accuracy derivative corresponding to the parameters */ - void GetDerivative(const ParametersType& itkNotUsed(parameters), DerivativeType& itkNotUsed(derivative)) const ITK_OVERRIDE {}; + void GetDerivative(const ParametersType& itkNotUsed(parameters), DerivativeType& itkNotUsed(derivative)) const override {}; /// Constructor Quadratic2DCostFunction() @@ -95,7 +95,7 @@ public: m_FunctionInternalParameters.Fill(0.0); }; /// Destructor - ~Quadratic2DCostFunction() ITK_OVERRIDE{}; + ~Quadratic2DCostFunction() override{}; private: Quadratic2DCostFunction(const Self &); //purposely not implemented diff --git a/Modules/Learning/Supervised/test/otbTrainMachineLearningModel.cxx b/Modules/Learning/Supervised/test/otbTrainMachineLearningModel.cxx index 0633cd0f53a7acbf991cf2d727b1e766c9a753a3..dd34b41b8b3a4f9711530f99892f5780515e2566 100644 --- a/Modules/Learning/Supervised/test/otbTrainMachineLearningModel.cxx +++ b/Modules/Learning/Supervised/test/otbTrainMachineLearningModel.cxx @@ -26,6 +26,8 @@ #include <otbMachineLearningModel.h> #include "otbConfusionMatrixCalculator.h" +#include "otbReadDataFile.h" + #include "otb_boost_string_header.h" typedef otb::MachineLearningModel<float,short> MachineLearningModelType; @@ -46,142 +48,6 @@ typedef MachineLearningModelRegressionType::TargetListSampleType TargetListSampl typedef otb::ConfusionMatrixCalculator<TargetListSampleType, TargetListSampleType> ConfusionMatrixCalculatorType; -bool ReadDataFile(const std::string & infname, InputListSampleType * samples, TargetListSampleType * labels) -{ - std::ifstream ifs; - ifs.open(infname.c_str()); - - if(!ifs) - { - std::cout<<"Could not read file "<<infname<<std::endl; - return false; - } - - unsigned int nbfeatures = 0; - - while (!ifs.eof()) - { - std::string line; - std::getline(ifs, line); - boost::algorithm::trim(line); - - if(nbfeatures == 0) - { - nbfeatures = std::count(line.begin(),line.end(),' '); - } - - if(line.size()>1) - { - InputSampleType sample(nbfeatures); - sample.Fill(0); - - std::string::size_type pos = line.find_first_of(" ", 0); - - // Parse label - TargetSampleType label; - label[0] = atoi(line.substr(0, pos).c_str()); - - bool endOfLine = false; - unsigned int id = 0; - - while(!endOfLine) - { - std::string::size_type nextpos = line.find_first_of(" ", pos+1); - - if(pos == std::string::npos) - { - endOfLine = true; - nextpos = line.size()-1; - } - else - { - std::string feature = line.substr(pos,nextpos-pos); - std::string::size_type semicolonpos = feature.find_first_of(":"); - id = atoi(feature.substr(0,semicolonpos).c_str()); - sample[id - 1] = atof(feature.substr(semicolonpos+1,feature.size()-semicolonpos).c_str()); - pos = nextpos; - } - - } - samples->SetMeasurementVectorSize(itk::NumericTraits<InputSampleType>::GetLength(sample)); - samples->PushBack(sample); - labels->PushBack(label); - } - } - - //std::cout<<"Retrieved "<<samples->Size()<<" samples"<<std::endl; - ifs.close(); - return true; -} - -bool ReadDataRegressionFile(const std::string & infname, InputListSampleRegressionType * samples, TargetListSampleRegressionType * labels) -{ - std::ifstream ifs; - ifs.open(infname.c_str()); - - if(!ifs) - { - std::cout<<"Could not read file "<<infname<<std::endl; - return false; - } - - unsigned int nbfeatures = 0; - - while (!ifs.eof()) - { - std::string line; - std::getline(ifs, line); - - if(nbfeatures == 0) - { - nbfeatures = std::count(line.begin(),line.end(),' ')-1; - //std::cout<<"Found "<<nbfeatures<<" features per samples"<<std::endl; - } - - if(line.size()>1) - { - InputSampleRegressionType sample(nbfeatures); - sample.Fill(0); - - std::string::size_type pos = line.find_first_of(" ", 0); - - // Parse label - TargetSampleRegressionType label; - label[0] = atof(line.substr(0, pos).c_str()); - - bool endOfLine = false; - unsigned int id = 0; - - while(!endOfLine) - { - std::string::size_type nextpos = line.find_first_of(" ", pos+1); - - if(nextpos == std::string::npos) - { - endOfLine = true; - nextpos = line.size()-1; - } - else - { - std::string feature = line.substr(pos,nextpos-pos); - std::string::size_type semicolonpos = feature.find_first_of(":"); - id = atoi(feature.substr(0,semicolonpos).c_str()); - sample[id - 1] = atof(feature.substr(semicolonpos+1,feature.size()-semicolonpos).c_str()); - pos = nextpos; - } - - } - samples->SetMeasurementVectorSize(itk::NumericTraits<InputSampleRegressionType>::GetLength(sample)); - samples->PushBack(sample); - labels->PushBack(label); - } - } - - //std::cout<<"Retrieved "<<samples->Size()<<" samples"<<std::endl; - ifs.close(); - return true; -} - #ifdef OTB_USE_LIBSVM #include "otbLibSVMMachineLearningModel.h" int otbLibSVMMachineLearningModelNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) @@ -205,7 +71,7 @@ int otbLibSVMMachineLearningModel(int argc, char * argv[]) InputListSampleType::Pointer samples = InputListSampleType::New(); TargetListSampleType::Pointer labels = TargetListSampleType::New(); - if (!ReadDataFile(argv[1], samples, labels)) + if (!otb::ReadDataFile(argv[1], samples, labels)) { std::cout << "Failed to read samples file " << argv[1] << std::endl; return EXIT_FAILURE; @@ -294,7 +160,7 @@ int otbSVMMachineLearningModel(int argc, char * argv[]) InputListSampleType::Pointer samples = InputListSampleType::New(); TargetListSampleType::Pointer labels = TargetListSampleType::New(); - if(!ReadDataFile(argv[1],samples,labels)) + if(!otb::ReadDataFile(argv[1],samples,labels)) { std::cout<<"Failed to read samples file "<<argv[1]<<std::endl; return EXIT_FAILURE; @@ -364,7 +230,7 @@ int otbSVMMachineLearningRegressionModel(int argc, char * argv[]) InputListSampleRegressionType::Pointer samples = InputListSampleRegressionType::New(); TargetListSampleRegressionType::Pointer labels = TargetListSampleRegressionType::New(); - if(!ReadDataRegressionFile(argv[1],samples,labels)) + if(!otb::ReadDataFile(argv[1],samples,labels)) { std::cout<<"Failed to read samples file "<<argv[1]<<std::endl; return EXIT_FAILURE; @@ -439,7 +305,7 @@ int otbKNearestNeighborsMachineLearningModel(int argc, char * argv[]) InputListSampleType::Pointer samples = InputListSampleType::New(); TargetListSampleType::Pointer labels = TargetListSampleType::New(); - if(!ReadDataFile(argv[1],samples,labels)) + if(!otb::ReadDataFile(argv[1],samples,labels)) { std::cout<<"Failed to read samples file "<<argv[1]<<std::endl; return EXIT_FAILURE; @@ -516,7 +382,7 @@ int otbRandomForestsMachineLearningModel(int argc, char * argv[]) InputListSampleType::Pointer samples = InputListSampleType::New(); TargetListSampleType::Pointer labels = TargetListSampleType::New(); - if(!ReadDataFile(argv[1],samples,labels)) + if(!otb::ReadDataFile(argv[1],samples,labels)) { std::cout<<"Failed to read samples file "<<argv[1]<<std::endl; return EXIT_FAILURE; @@ -603,7 +469,7 @@ int otbBoostMachineLearningModel(int argc, char * argv[]) InputListSampleType::Pointer samples = InputListSampleType::New(); TargetListSampleType::Pointer labels = TargetListSampleType::New(); - if(!ReadDataFile(argv[1],samples,labels)) + if(!otb::ReadDataFile(argv[1],samples,labels)) { std::cout<<"Failed to read samples file "<<argv[1]<<std::endl; return EXIT_FAILURE; @@ -689,7 +555,7 @@ int otbANNMachineLearningModel(int argc, char * argv[]) InputListSampleType::Pointer samples = InputListSampleType::New(); TargetListSampleType::Pointer labels = TargetListSampleType::New(); - if (!ReadDataFile(argv[1], samples, labels)) + if (!otb::ReadDataFile(argv[1], samples, labels)) { std::cout << "Failed to read samples file " << argv[1] << std::endl; return EXIT_FAILURE; @@ -779,7 +645,7 @@ int otbNormalBayesMachineLearningModel(int argc, char * argv[]) InputListSampleType::Pointer samples = InputListSampleType::New(); TargetListSampleType::Pointer labels = TargetListSampleType::New(); - if(!ReadDataFile(argv[1],samples,labels)) + if(!otb::ReadDataFile(argv[1],samples,labels)) { std::cout<<"Failed to read samples file "<<argv[1]<<std::endl; return EXIT_FAILURE; @@ -856,7 +722,7 @@ int otbDecisionTreeMachineLearningModel(int argc, char * argv[]) InputListSampleType::Pointer samples = InputListSampleType::New(); TargetListSampleType::Pointer labels = TargetListSampleType::New(); - if(!ReadDataFile(argv[1],samples,labels)) + if(!otb::ReadDataFile(argv[1],samples,labels)) { std::cout<<"Failed to read samples file "<<argv[1]<<std::endl; return EXIT_FAILURE; @@ -934,7 +800,7 @@ int otbGradientBoostedTreeMachineLearningModel(int argc, char * argv[]) InputListSampleType::Pointer samples = InputListSampleType::New(); TargetListSampleType::Pointer labels = TargetListSampleType::New(); - if(!ReadDataFile(argv[1],samples,labels)) + if(!otb::ReadDataFile(argv[1],samples,labels)) { std::cout<<"Failed to read samples file "<<argv[1]<<std::endl; return EXIT_FAILURE; @@ -995,139 +861,6 @@ int otbGradientBoostedTreeMachineLearningModel(int argc, char * argv[]) #ifdef OTB_USE_SHARK #include <chrono> // If shark is on, then we are using c++11 -bool SharkReadDataFile(const std::string & infname, InputListSampleType * samples, TargetListSampleType * labels) -{ - std::ifstream ifs(infname.c_str()); - - if(!ifs) - { - std::cout<<"Could not read file "<<infname<<std::endl; - return false; - } - - unsigned int nbfeatures = 0; - - std::string line; - while (std::getline(ifs, line)) - { - boost::algorithm::trim(line); - - if(nbfeatures == 0) - { - nbfeatures = std::count(line.begin(),line.end(),' '); - } - - if(line.size()>1) - { - InputSampleType sample(nbfeatures); - sample.Fill(0); - - std::string::size_type pos = line.find_first_of(" ", 0); - - // Parse label - TargetSampleType label; - label[0] = std::stoi(line.substr(0, pos).c_str()); - - bool endOfLine = false; - unsigned int id = 0; - - while(!endOfLine) - { - std::string::size_type nextpos = line.find_first_of(" ", pos+1); - - if(pos == std::string::npos) - { - endOfLine = true; - nextpos = line.size()-1; - } - else - { - std::string feature = line.substr(pos,nextpos-pos); - std::string::size_type semicolonpos = feature.find_first_of(":"); - id = std::stoi(feature.substr(0,semicolonpos).c_str()); - sample[id - 1] = atof(feature.substr(semicolonpos+1,feature.size()-semicolonpos).c_str()); - pos = nextpos; - } - - } - samples->SetMeasurementVectorSize(itk::NumericTraits<InputSampleType>::GetLength(sample)); - samples->PushBack(sample); - labels->PushBack(label); - } - } - - //std::cout<<"Retrieved "<<samples->Size()<<" samples"<<std::endl; - ifs.close(); - return true; -} - -bool SharkReadDataRegressionFile(const std::string & infname, InputListSampleRegressionType * samples, TargetListSampleRegressionType * labels) -{ - std::ifstream ifs(infname.c_str()); - if(!ifs) - { - std::cout<<"Could not read file "<<infname<<std::endl; - return false; - } - - unsigned int nbfeatures = 0; - - while (!ifs.eof()) - { - std::string line; - std::getline(ifs, line); - - if(nbfeatures == 0) - { - nbfeatures = std::count(line.begin(),line.end(),' ')-1; - //std::cout<<"Found "<<nbfeatures<<" features per samples"<<std::endl; - } - - if(line.size()>1) - { - InputSampleRegressionType sample(nbfeatures); - sample.Fill(0); - - std::string::size_type pos = line.find_first_of(" ", 0); - - // Parse label - TargetSampleRegressionType label; - label[0] = atof(line.substr(0, pos).c_str()); - - bool endOfLine = false; - unsigned int id = 0; - - while(!endOfLine) - { - std::string::size_type nextpos = line.find_first_of(" ", pos+1); - - if(nextpos == std::string::npos) - { - endOfLine = true; - nextpos = line.size()-1; - } - else - { - std::string feature = line.substr(pos,nextpos-pos); - std::string::size_type semicolonpos = feature.find_first_of(":"); - id = std::stoi(feature.substr(0,semicolonpos).c_str()); - sample[id - 1] = atof(feature.substr(semicolonpos+1,feature.size()-semicolonpos).c_str()); - pos = nextpos; - } - - } - samples->SetMeasurementVectorSize(itk::NumericTraits<InputSampleRegressionType>::GetLength(sample)); - samples->PushBack(sample); - labels->PushBack(label); - } - } - - //std::cout<<"Retrieved "<<samples->Size()<<" samples"<<std::endl; - ifs.close(); - return true; -} - - #include "otbSharkRandomForestsMachineLearningModel.h" int otbSharkRFMachineLearningModelNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { @@ -1149,7 +882,7 @@ int otbSharkRFMachineLearningModel(int argc, char * argv[]) InputListSampleType::Pointer samples = InputListSampleType::New(); TargetListSampleType::Pointer labels = TargetListSampleType::New(); - if(!SharkReadDataFile(argv[1],samples,labels)) + if(!otb::ReadDataFile(argv[1],samples,labels)) { std::cout<<"Failed to read samples file "<<argv[1]<<std::endl; return EXIT_FAILURE; diff --git a/Modules/Learning/Supervised/test/tests-libsvm.cmake b/Modules/Learning/Supervised/test/tests-libsvm.cmake index bbf6647ab09866b3074d840a84e301f9956bc48f..03b5118cd9ffb9eb538df0efe8452ccd0fff30cc 100644 --- a/Modules/Learning/Supervised/test/tests-libsvm.cmake +++ b/Modules/Learning/Supervised/test/tests-libsvm.cmake @@ -20,7 +20,7 @@ otb_add_test(NAME leTvLibSVMMachineLearningModel COMMAND otbSupervisedTestDriver otbLibSVMMachineLearningModel - ${INPUTDATA}/letter.scale + ${INPUTDATA}/letter_light.scale ${TEMP}/libsvm_model.txt ) otb_add_test(NAME leTuLibSVMMachineLearningModelNew COMMAND otbSupervisedTestDriver diff --git a/Modules/Learning/Supervised/test/tests-opencv.cmake b/Modules/Learning/Supervised/test/tests-opencv.cmake index a309c341dc2b06f83d53b4a4aeab2305b9cf68a1..f898971f56ffc964adf8f1a352a3628fc7ba6990 100644 --- a/Modules/Learning/Supervised/test/tests-opencv.cmake +++ b/Modules/Learning/Supervised/test/tests-opencv.cmake @@ -26,7 +26,7 @@ otb_add_test(NAME leTuRandomForestsMachineLearningModelNew COMMAND otbSupervised otb_add_test(NAME leTvANNMachineLearningModel COMMAND otbSupervisedTestDriver otbANNMachineLearningModel - ${INPUTDATA}/letter.scale + ${INPUTDATA}/letter_light.scale ${TEMP}/ann_model.txt ) @@ -74,7 +74,7 @@ otb_add_test(NAME leTvSVMMachineLearningRegressionModel COMMAND otbSupervisedTes otb_add_test(NAME leTvSVMMachineLearningModel COMMAND otbSupervisedTestDriver otbSVMMachineLearningModel - ${INPUTDATA}/letter.scale + ${INPUTDATA}/letter_light.scale ${TEMP}/svm_model.txt ) @@ -83,14 +83,14 @@ otb_add_test(NAME leTuBoostMachineLearningModelNew COMMAND otbSupervisedTestDriv otb_add_test(NAME leTvNormalBayesMachineLearningModel COMMAND otbSupervisedTestDriver otbNormalBayesMachineLearningModel - ${INPUTDATA}/letter.scale + ${INPUTDATA}/letter_light.scale ${TEMP}/normalbayes_model.txt ) if(NOT OTB_OPENCV_3) otb_add_test(NAME leTvGradientBoostedTreeMachineLearningModel COMMAND otbSupervisedTestDriver otbGradientBoostedTreeMachineLearningModel - ${INPUTDATA}/letter.scale + ${INPUTDATA}/letter_light.scale ${TEMP}/gbt_model.txt ) otb_add_test(NAME leTuGradientBoostedTreeMachineLearningModelNew COMMAND otbSupervisedTestDriver @@ -99,7 +99,7 @@ endif() otb_add_test(NAME leTvRandomForestsMachineLearningModel COMMAND otbSupervisedTestDriver otbRandomForestsMachineLearningModel - ${INPUTDATA}/letter.scale + ${INPUTDATA}/letter_light.scale ${TEMP}/rf_model.txt ) @@ -108,19 +108,19 @@ otb_add_test(NAME leTuANNMachineLearningModelNew COMMAND otbSupervisedTestDriver otb_add_test(NAME leTvKNearestNeighborsMachineLearningModel COMMAND otbSupervisedTestDriver otbKNearestNeighborsMachineLearningModel - ${INPUTDATA}/letter.scale + ${INPUTDATA}/letter_light.scale ${TEMP}/knn_model.txt ) otb_add_test(NAME leTvDecisionTreeMachineLearningModel COMMAND otbSupervisedTestDriver otbDecisionTreeMachineLearningModel - ${INPUTDATA}/letter.scale + ${INPUTDATA}/letter_light.scale ${TEMP}/decisiontree_model.txt ) otb_add_test(NAME leTvBoostMachineLearningModel COMMAND otbSupervisedTestDriver otbBoostMachineLearningModel - ${INPUTDATA}/letter.scale + ${INPUTDATA}/letter_light.scale ${TEMP}/boost_model.txt ) diff --git a/Modules/Learning/Supervised/test/tests-shark.cmake b/Modules/Learning/Supervised/test/tests-shark.cmake index eeda8fff3f9f1413dcffe868c3fb5f8cb4f8f6d0..546e826043b31d284840fc3bed69250b82ad6dfb 100644 --- a/Modules/Learning/Supervised/test/tests-shark.cmake +++ b/Modules/Learning/Supervised/test/tests-shark.cmake @@ -23,7 +23,7 @@ otb_add_test(NAME leTuSharkRFMachineLearningModelNew COMMAND otbSupervisedTestDr otb_add_test(NAME leTvSharkRFMachineLearningModel COMMAND otbSupervisedTestDriver otbSharkRFMachineLearningModel - ${INPUTDATA}/letter.scale + ${INPUTDATA}/letter_light.scale ${TEMP}/shark_rf_model.txt ) diff --git a/Modules/Learning/Unsupervised/include/otbContingencyTable.h b/Modules/Learning/Unsupervised/include/otbContingencyTable.h index b27436a03c3f23f876e1324fdad04735dcdc5daa..f7d1b101834fcd4bc8a0275259953f7ce875e597 100644 --- a/Modules/Learning/Unsupervised/include/otbContingencyTable.h +++ b/Modules/Learning/Unsupervised/include/otbContingencyTable.h @@ -137,8 +137,8 @@ protected: { SetLabels(LabelList(), LabelList()); } - ~ContingencyTable() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent itkNotUsed(indent)) const ITK_OVERRIDE + ~ContingencyTable() override {} + void PrintSelf(std::ostream& os, itk::Indent itkNotUsed(indent)) const override { os << *this; } diff --git a/Modules/Learning/Unsupervised/include/otbContingencyTableCalculator.h b/Modules/Learning/Unsupervised/include/otbContingencyTableCalculator.h index b8d8d924af49ed402c70cad906854560f0f4e9db..614146a8ee97413693fedc04d19efd10e89bfd12 100644 --- a/Modules/Learning/Unsupervised/include/otbContingencyTableCalculator.h +++ b/Modules/Learning/Unsupervised/include/otbContingencyTableCalculator.h @@ -83,8 +83,8 @@ public: protected: ContingencyTableCalculator(); - ~ContingencyTableCalculator() ITK_OVERRIDE {} - //void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~ContingencyTableCalculator() override {} + //void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: ContingencyTableCalculator(const Self &); //purposely not implemented diff --git a/Modules/Learning/Unsupervised/include/otbSharkKMeansMachineLearningModel.h b/Modules/Learning/Unsupervised/include/otbSharkKMeansMachineLearningModel.h index ef74d52f4063a3cca332312c14bb4cbac0c95d57..a060046c61a269f2775ddce6de1b61e829fb47d3 100644 --- a/Modules/Learning/Unsupervised/include/otbSharkKMeansMachineLearningModel.h +++ b/Modules/Learning/Unsupervised/include/otbSharkKMeansMachineLearningModel.h @@ -90,21 +90,21 @@ public: itkTypeMacro( SharkKMeansMachineLearningModel, MachineLearningModel ); /** Train the machine learning model */ - virtual void Train() ITK_OVERRIDE; + virtual void Train() override; /** Save the model to file */ - virtual void Save(const std::string &filename, const std::string &name = "") ITK_OVERRIDE; + virtual void Save(const std::string &filename, const std::string &name = "") override; /** Load the model from file */ - virtual void Load(const std::string &filename, const std::string &name = "") ITK_OVERRIDE; + virtual void Load(const std::string &filename, const std::string &name = "") override; /**\name Classification model file compatibility tests */ //@{ /** Is the input model file readable and compatible with the corresponding classifier ? */ - virtual bool CanReadFile(const std::string &) ITK_OVERRIDE; + virtual bool CanReadFile(const std::string &) override; /** Is the input model file writable and compatible with the corresponding classifier ? */ - virtual bool CanWriteFile(const std::string &) ITK_OVERRIDE; + virtual bool CanWriteFile(const std::string &) override; //@} /** Get the maximum number of iteration for the kMeans algorithm.*/ @@ -130,17 +130,17 @@ protected: /** Predict values using the model */ virtual TargetSampleType - DoPredict(const InputSampleType &input, ConfidenceValueType *quality = ITK_NULLPTR) const ITK_OVERRIDE; + DoPredict(const InputSampleType &input, ConfidenceValueType *quality = ITK_NULLPTR) const override; virtual void DoPredictBatch(const InputListSampleType *, const unsigned int &startIndex, const unsigned int &size, - TargetListSampleType *, ConfidenceListSampleType * = ITK_NULLPTR) const ITK_OVERRIDE; + TargetListSampleType *, ConfidenceListSampleType * = ITK_NULLPTR) const override; template<typename DataType> DataType NormalizeData(const DataType &data) const; /** PrintSelf method */ - void PrintSelf(std::ostream &os, itk::Indent indent) const; + void PrintSelf(std::ostream &os, itk::Indent indent) const override; private: SharkKMeansMachineLearningModel(const Self &); //purposely not implemented diff --git a/Modules/Learning/Unsupervised/include/otbSharkKMeansMachineLearningModel.txx b/Modules/Learning/Unsupervised/include/otbSharkKMeansMachineLearningModel.txx index 9dd43948a719c9305dace0a6366ebfd40e4b3e24..1b08d538c943001279d9401f314d51e21e8dbf88 100644 --- a/Modules/Learning/Unsupervised/include/otbSharkKMeansMachineLearningModel.txx +++ b/Modules/Learning/Unsupervised/include/otbSharkKMeansMachineLearningModel.txx @@ -55,6 +55,7 @@ SharkKMeansMachineLearningModel<TInputValue, TOutputValue> m_Normalized( false ), m_K(2), m_MaximumNumberOfIterations( 10 ) { // Default set HardClusteringModel + this->m_ConfidenceIndex = true; m_ClusteringModel = boost::make_shared<ClusteringModelType>( &m_Centroids ); } @@ -174,7 +175,7 @@ SharkKMeansMachineLearningModel<TInputValue, TOutputValue> // Change quality measurement only if SoftClustering or other clustering method is used. if( quality != ITK_NULLPTR ) { - for( unsigned int qid = startIndex; qid < size; ++qid ) + for( unsigned int qid = startIndex; qid < startIndex+size; ++qid ) { quality->SetMeasurementVector( qid, static_cast<ConfidenceValueType>(1.) ); } diff --git a/Modules/Learning/Unsupervised/include/otbSharkKMeansMachineLearningModelFactory.h b/Modules/Learning/Unsupervised/include/otbSharkKMeansMachineLearningModelFactory.h index a072d5d71921f24cc483e0193d3f0d04a4ab41d2..05365b8ff757c959d6a83be96cb6447b9082aca1 100644 --- a/Modules/Learning/Unsupervised/include/otbSharkKMeansMachineLearningModelFactory.h +++ b/Modules/Learning/Unsupervised/include/otbSharkKMeansMachineLearningModelFactory.h @@ -41,8 +41,8 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - virtual const char* GetITKSourceVersion(void) const; - virtual const char* GetDescription(void) const; + virtual const char* GetITKSourceVersion(void) const override; + virtual const char* GetDescription(void) const override; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); diff --git a/Modules/MPI/MPIConfig/CMakeLists.txt b/Modules/MPI/MPIConfig/CMakeLists.txt index ed0784dadc1e4d75f10b36a63995c0a1c44dea7b..dabc7a26acee81f883b8ec0a853fe959f3f38b97 100644 --- a/Modules/MPI/MPIConfig/CMakeLists.txt +++ b/Modules/MPI/MPIConfig/CMakeLists.txt @@ -19,9 +19,6 @@ # project(MPIConfig) -set(MPIConfig_LIBRARIES MPIConfig) - set(OTBMPIConfig_LIBRARIES OTBMPIConfig) otb_module_impl() - diff --git a/Modules/MPI/MPIConfig/README b/Modules/MPI/MPIConfig/README deleted file mode 100644 index e30ca8bb5c45886310a7eb0a9205db01e831b3b8..0000000000000000000000000000000000000000 --- a/Modules/MPI/MPIConfig/README +++ /dev/null @@ -1,71 +0,0 @@ -General -======= - -This is a template module for the ORFEO -Toolbox(https://www.orfeo-toolbox.org/). It is designed to work with OTBv5 -modular system and to be places in OTB/Module/Remote. - -This module is empty it is just a template to be used as a starting point for a -module with actual content. It contains the template for sources (src folder), -test (test folder) and application (app folder). - -Getting Started -=============== - -The official OTB Wiki documentation on adding an external module is here: -http://wiki.orfeo-toolbox.org/index.php/How_to_write_a_remote_module - -Remote Module -------------- - -After a module has been created as a git repository it can be included -as a remote module, which enables automatic fetching. Add a file in -"OTB/Modules/Remote" called "YourModule.remote.cmake", for this module -it would be "ExternalExample.remote.cmake" with the followlowing contents: - -otb_fetch_module(ExternalTemplate - "A template for a module." - GIT_REPOSITORY https://github.com/orfeotoolbox/otbExternalModuleTemplate - GIT_TAG master - ) - -Editing -======= - -The CMakeLists.txt and otb-modules need to be modified with the name of the -module, something along the following: - -sed 's/ExternalTemplate/MyModule/g' CMakeLists.txt otb-module.cmake - -There is the inplace option to sed, but it's not portable, so do this change by -hand or look up the option in sed. - -Then hack away at you code in include, src, test and app folders. - -License -======= - -This software is distributed under the Apache License. Please see LICENSE for -details. - -Author -====== - -Manuel Grizonnet - -Thanks -====== - -It is a fork of the ITK template module provided by Bradley Lowekamp -(https://github.com/blowekamp/itkExternalTemplate.git) which was adapted for the -ORFEO ToolBox. - -Compilation des tests -===================== -module load cmake/3.4.3 openmpi/1.10.2 otb/develop -cd build -rm -rf * -cmake -DCMAKE_CXX_FLAGS="-Wno-unused-local-typedefs -std=c++11" .. -make -ctest - diff --git a/Modules/MPI/MPITiffWriter/include/otbSimpleParallelTiffWriter.h b/Modules/MPI/MPITiffWriter/include/otbSimpleParallelTiffWriter.h index c404d25d5025001edf111dbcd91a003a1f76c493..a7c413064a46a9afdd5f07ae2ca614ebc37b09d2 100644 --- a/Modules/MPI/MPITiffWriter/include/otbSimpleParallelTiffWriter.h +++ b/Modules/MPI/MPITiffWriter/include/otbSimpleParallelTiffWriter.h @@ -31,6 +31,7 @@ #include "itkImageFileWriter.h" #include "itkObjectFactoryBase.h" +#include "itkFastMutexLock.h" #include "itkImageRegionMultidimensionalSplitter.h" #include "otbImageIOFactory.h" @@ -214,7 +215,7 @@ public: const InputImageType* GetInput(); /** Does the real work. */ - virtual void Update(); + virtual void Update() override; /** SimpleParallelTiffWriter Methods */ virtual void SetFileName(const char* extendedFileName); @@ -252,10 +253,15 @@ public: itkSetMacro(TiffTiledMode, bool); itkGetMacro(TiffTiledMode, bool); + /** This override doesn't return a const ref on the actual boolean */ + const bool & GetAbortGenerateData() const override; + + void SetAbortGenerateData(bool val) override; + protected: SimpleParallelTiffWriter(); virtual ~SimpleParallelTiffWriter(); - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: SimpleParallelTiffWriter(const SimpleParallelTiffWriter &); //purposely not implemented @@ -325,6 +331,9 @@ private: bool m_Verbose; bool m_VirtualMode; bool m_TiffTiledMode; + + /** Lock to ensure thread-safety (added for the AbortGenerateData flag) */ + itk::SimpleFastMutexLock m_Lock; }; diff --git a/Modules/MPI/MPITiffWriter/include/otbSimpleParallelTiffWriter.txx b/Modules/MPI/MPITiffWriter/include/otbSimpleParallelTiffWriter.txx index 96cbf7120c497f340b31f7657e7161bbeafd2d63..4292ad0f8460c3811e541e25a793711f59caec43 100644 --- a/Modules/MPI/MPITiffWriter/include/otbSimpleParallelTiffWriter.txx +++ b/Modules/MPI/MPITiffWriter/include/otbSimpleParallelTiffWriter.txx @@ -23,6 +23,7 @@ #include "otbSimpleParallelTiffWriter.h" #include "otbStopwatch.h" +#include "otbUtils.h" using std::vector; @@ -315,11 +316,16 @@ SimpleParallelTiffWriter<TInputImage> sizemode = m_FilenameHelper->GetStreamingSizeMode(); } - double sizevalue = 0.; - + unsigned int sizevalue = 0; + // Save the DefaultRAM value for later + unsigned int oldDefaultRAM = m_StreamingManager->GetDefaultRAM(); + if (sizemode == "auto") + { + sizevalue = oldDefaultRAM; + } if(m_FilenameHelper->StreamingSizeValueIsSet()) { - sizevalue = m_FilenameHelper->GetStreamingSizeValue(); + sizevalue = static_cast<unsigned int>(m_FilenameHelper->GetStreamingSizeValue()); } if(type == "auto") @@ -328,7 +334,7 @@ SimpleParallelTiffWriter<TInputImage> { itkWarningMacro(<<"In auto streaming type, the sizemode option will be ignored."); } - if(sizevalue == 0.) + if(sizevalue == 0) { itkWarningMacro("sizemode is auto but sizevalue is 0. Value will be fetched from configuration file if any, or from cmake configuration otherwise."); } @@ -338,7 +344,7 @@ SimpleParallelTiffWriter<TInputImage> { if(sizemode == "auto") { - if(sizevalue == 0.) + if(sizevalue == 0) { itkWarningMacro("sizemode is auto but sizevalue is 0. Value will be fetched from configuration file if any, or from cmake configuration otherwise."); } @@ -346,27 +352,27 @@ SimpleParallelTiffWriter<TInputImage> } else if(sizemode == "nbsplits") { - if(sizevalue == 0.) + if(sizevalue == 0) { itkWarningMacro("Streaming sizemode is set to nbsplits but sizevalue is 0. This will result in upredicted behaviour. Please consider setting the sizevalue by using &streaming:sizevalue=x."); } - this->SetNumberOfDivisionsTiledStreaming(static_cast<unsigned int>(sizevalue)); + this->SetNumberOfDivisionsTiledStreaming(sizevalue); } else if(sizemode == "height") { - if(sizevalue == 0.) + if(sizevalue == 0) { itkWarningMacro("Streaming sizemode is set to height but sizevalue is 0. This will result in upredicted behaviour. Please consider setting the sizevalue by using &streaming:sizevalue=x."); } - this->SetTileDimensionTiledStreaming(static_cast<unsigned int>(sizevalue)); + this->SetTileDimensionTiledStreaming(sizevalue); } } else if(type == "stripped") { if(sizemode == "auto") { - if(sizevalue == 0.) + if(sizevalue == 0) { itkWarningMacro("sizemode is auto but sizevalue is 0. Value will be fetched from configuration file if any, or from cmake configuration otherwise."); } @@ -375,30 +381,34 @@ SimpleParallelTiffWriter<TInputImage> } else if(sizemode == "nbsplits") { - if(sizevalue == 0.) + if(sizevalue == 0) { itkWarningMacro("Streaming sizemode is set to nbsplits but sizevalue is 0. This will result in upredicted behaviour. Please consider setting the sizevalue by using &streaming:sizevalue=x."); } - this->SetNumberOfDivisionsStrippedStreaming(static_cast<unsigned int>(sizevalue)); + this->SetNumberOfDivisionsStrippedStreaming(sizevalue); } else if(sizemode == "height") { - if(sizevalue == 0.) + if(sizevalue == 0) { itkWarningMacro("Streaming sizemode is set to height but sizevalue is 0. This will result in upredicted behaviour. Please consider setting the sizevalue by using &streaming:sizevalue=x."); } - this->SetNumberOfLinesStrippedStreaming(static_cast<unsigned int>(sizevalue)); + this->SetNumberOfLinesStrippedStreaming(sizevalue); } } else if (type == "none") { - if(sizemode!="" || sizevalue!=0.) + if(sizemode!="" || sizevalue!=0) { itkWarningMacro("Streaming is explicitly disabled, sizemode and sizevalue will be ignored."); } this->SetNumberOfDivisionsTiledStreaming(0); } + + // since we change the m_StreamingManager under the hood, we copy the DefaultRAM + // value to the new streamingManager. + m_StreamingManager->SetDefaultRAM(oldDefaultRAM); } else { @@ -458,6 +468,7 @@ SimpleParallelTiffWriter<TInputImage> */ inputPtr->UpdateOutputInformation(); InputImageRegionType inputRegion = inputPtr->GetLargestPossibleRegion(); + typename InputImageType::PointType origin = inputPtr->GetOrigin(); /** Parse region size modes */ if(m_FilenameHelper->BoxIsSet()) @@ -497,6 +508,9 @@ SimpleParallelTiffWriter<TInputImage> throw e; } otbMsgDevMacro(<< "inputRegion " << inputRegion); + + // Update the origin + inputPtr->TransformIndexToPhysicalPoint(inputRegion.GetIndex(), origin); } // Get number of bands & pixel data type @@ -538,7 +552,7 @@ SimpleParallelTiffWriter<TInputImage> else { // When mode is not tiled (i.e. striped) - block_size_x = inputPtr->GetLargestPossibleRegion().GetSize()[0]; + block_size_x = inputRegion.GetSize()[0]; } // Master process (Rank 0) is responsible for the creation of the output raster. @@ -546,10 +560,10 @@ SimpleParallelTiffWriter<TInputImage> { // Set geotransform double geotransform[6]; - geotransform[0] = inputPtr->GetOrigin()[0] - 0.5*inputPtr->GetSignedSpacing()[0]; + geotransform[0] = origin[0] - 0.5*inputPtr->GetSignedSpacing()[0]; geotransform[1] = inputPtr->GetSignedSpacing()[0]; geotransform[2] = 0.0; - geotransform[3] = inputPtr->GetOrigin()[1] - 0.5*inputPtr->GetSignedSpacing()[1]; + geotransform[3] = origin[1] - 0.5*inputPtr->GetSignedSpacing()[1]; geotransform[4] = 0.0; geotransform[5] = inputPtr->GetSignedSpacing()[1]; @@ -557,8 +571,8 @@ SimpleParallelTiffWriter<TInputImage> if(!m_TiffTiledMode) { SPTW_ERROR sperr = sptw::create_raster(m_FileName, - inputPtr->GetLargestPossibleRegion().GetSize()[0], - inputPtr->GetLargestPossibleRegion().GetSize()[1], + inputRegion.GetSize()[0], + inputRegion.GetSize()[1], nBands, dataType, geotransform, @@ -573,8 +587,8 @@ SimpleParallelTiffWriter<TInputImage> else { SPTW_ERROR sperr = sptw::create_tiled_raster(m_FileName, - inputPtr->GetLargestPossibleRegion().GetSize()[0], - inputPtr->GetLargestPossibleRegion().GetSize()[1], + inputRegion.GetSize()[0], + inputRegion.GetSize()[1], nBands, dataType, geotransform, @@ -716,6 +730,16 @@ SimpleParallelTiffWriter<TInputImage> } } + // abort case + if (this->GetAbortGenerateData()) + { + itk::ProcessAborted e(__FILE__, __LINE__); + e.SetLocation(ITK_LOCATION); + e.SetDescription("Image writing has been aborted"); + throw e; + otb::MPIConfig::Instance()->abort(EXIT_FAILURE); + } + // Clean up close_raster(output_raster); output_raster = NULL; @@ -824,5 +848,27 @@ SimpleParallelTiffWriter<TInputImage> return this->m_FilenameHelper->GetSimpleFileName(); } +template <class TInputImage> +const bool & +SimpleParallelTiffWriter<TInputImage> +::GetAbortGenerateData() const +{ + m_Lock.Lock(); + bool ret = Superclass::GetAbortGenerateData(); + m_Lock.Unlock(); + if (ret) return otb::Utils::TrueConstant; + return otb::Utils::FalseConstant; +} + +template <class TInputImage> +void +SimpleParallelTiffWriter<TInputImage> +::SetAbortGenerateData(bool val) +{ + m_Lock.Lock(); + Superclass::SetAbortGenerateData(val); + m_Lock.Unlock(); +} + } #endif diff --git a/Modules/MPI/MPIVrtWriter/include/otbMPIVrtWriter.h b/Modules/MPI/MPIVrtWriter/include/otbMPIVrtWriter.h index ecec379e6d0cdaab2a6b39817b61ccd1a533c524..1800dc62ae4a170c70f0039906c79f2b2093e40d 100644 --- a/Modules/MPI/MPIVrtWriter/include/otbMPIVrtWriter.h +++ b/Modules/MPI/MPIVrtWriter/include/otbMPIVrtWriter.h @@ -47,232 +47,102 @@ namespace otb { /** - *\brief Write image data to multiple files with MPI processus and add a VRT file. + * \class MPIVrtWriter * - * The image is divided into several pieces. - * Each pieces is distributed to a MPI processus. - * Each MPI processus write their pieces into a separate - * file. - * The master processus writes a VRT file (optional). + * \brief Write each tile of an image into a separate Tiff file and join them in a VRT * - *\param img Image - *\param output Output Filename - *\param availableRAM Available memory for streaming - *\param writeVRTFile Activate the VRT file writing + * \ingroup OTBMPIVrtWriter */ -template <typename TImage> void WriteMPI(TImage *img, const std::string &output, unsigned int availableRAM = 0, bool writeVRTFile=true) +template <typename TImage> +class MPIVrtWriter: public itk::ProcessObject { - typename otb::MPIConfig::Pointer mpiConfig = otb::MPIConfig::Instance(); - - unsigned int myRank = mpiConfig->GetMyRank(); - unsigned int nbProcs = mpiConfig->GetNbProcs(); - - typedef otb::ImageFileWriter<TImage> WriterType; - typedef otb::NumberOfDivisionsTiledStreamingManager<TImage> StreamingManagerType; - typedef itk::RegionOfInterestImageFilter<TImage, TImage> ExtractFilterType; - - // First, update infomration from image to write - img->UpdateOutputInformation(); - - // Configure streaming manager - typename StreamingManagerType::Pointer streamingManager = StreamingManagerType::New(); - streamingManager->SetNumberOfDivisions(nbProcs); - streamingManager->PrepareStreaming(img,img->GetLargestPossibleRegion()); - unsigned int numberOfSplits = streamingManager->GetNumberOfSplits(); - - // This vector will hold all regions to write for current rank - std::vector<typename TImage::RegionType> regionsToWrite; - - // Handle both cases when there are much more (resp. less) region to - // write than NbProcs - if(myRank < numberOfSplits) - { - unsigned int splitIdx = myRank; - while(splitIdx < numberOfSplits) - { - typename TImage::RegionType currentRegion = streamingManager->GetSplit(splitIdx); - regionsToWrite.push_back(currentRegion); - splitIdx+=nbProcs; - } - } - - // Output prefix - std::string extension = itksys::SystemTools::GetFilenameExtension(output); - if (extension != ".vrt") - { - - // TODO: Maybe remove this - if (extension == "") - { - // Missing extension - mpiConfig->logInfo("Filename has no extension. Adding <.vrt> extension."); - } - else - { - // Bad extension - mpiConfig->logError("Filename must have .vrt extension!"); - mpiConfig->abort(EXIT_FAILURE); - } - } - std::vector<std::string> joins; - joins.push_back(itksys::SystemTools::GetFilenamePath(output).append("/")); - joins.push_back(itksys::SystemTools::GetFilenameWithoutExtension(output)); - std::string prefix = itksys::SystemTools::JoinPath(joins); - +public: + /** Standard class typedefs. */ + typedef MPIVrtWriter Self; + typedef itk::ProcessObject Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; - // Data type - std::string dataTypeStr = "Float32"; - GDALImageIO::Pointer gdalImageIO; + typedef TImage InputImageType; - // Now write all the regions - for(typename std::vector<typename TImage::RegionType>::const_iterator it = regionsToWrite.begin(); - it!=regionsToWrite.end();++it) - { - typename ExtractFilterType::Pointer extractFilter = ExtractFilterType::New(); - extractFilter->SetInput(img); - extractFilter->SetRegionOfInterest(*it); - // Writer - // Output Filename - std::stringstream ss; - ss<<prefix<<"_"<<it->GetIndex()[0]<<"_"<<it->GetIndex()[1]<<"_"<<it->GetSize()[0]<<"_"<<it->GetSize()[1]<<".tif"; - typename WriterType::Pointer writer = WriterType::New(); - writer->SetFileName(ss.str()); - writer->SetInput(extractFilter->GetOutput()); - // Datatype - gdalImageIO = dynamic_cast<GDALImageIO *>(writer->GetImageIO()); - if(gdalImageIO.IsNotNull()) - { - dataTypeStr = gdalImageIO->GetGdalPixelTypeAsString(); - } + /** Method for creation through the object factory. */ + itkNewMacro(Self); - if (!availableRAM) - { - writer->SetNumberOfDivisionsTiledStreaming(0); - } - else - { - writer->SetAutomaticAdaptativeStreaming(availableRAM); - } + /** Run-time type information (and related methods). */ + itkTypeMacro(MPIVrtWriter, itk::ProcessObject); - // Pipeline execution - try - { - writer->Update(); - } - catch (itk::ExceptionObject& err) - { - std::stringstream message; - message << "ExceptionObject caught: " << err << std::endl; - mpiConfig->logError(message.str()); - mpiConfig->abort(EXIT_FAILURE); - } - } + using Superclass::SetInput; + virtual void SetInput(const InputImageType *input); - // MPI process synchronization - mpiConfig->barrier(); + /** Get writer only input */ + const InputImageType* GetInput(); - // Write VRT file - try - { - if (writeVRTFile && (myRank == 0)) - { - // VRT Filename - std::stringstream vrtfOut; - vrtfOut<< prefix << ".vrt"; + /** Does the real work. */ + virtual void Update() override; - // Data type - GDALDataType dataType; - dataType = GDALGetDataTypeByName(dataTypeStr.c_str()); + /** SimpleParallelTiffWriter Methods */ + virtual void SetFileName(const char* extendedFileName); + virtual void SetFileName(std::string extendedFileName); + virtual const char* GetFileName () const; - int imageSizeY = img->GetLargestPossibleRegion().GetSize()[1]; - int imageSizeX = img->GetLargestPossibleRegion().GetSize()[0]; - const unsigned int nbBands = img->GetNumberOfComponentsPerPixel(); + /** Specify the region to write. If left NULL, then the whole image + * is written. */ + void SetIORegion(const itk::ImageIORegion& region); + itkGetConstReferenceMacro(IORegion, itk::ImageIORegion); - // Get VRT driver - GDALAllRegister(); - GDALDriver *driver = GetGDALDriverManager()->GetDriverByName("VRT"); - if (driver == NULL) { - mpiConfig->logError("Error opening VRT driver."); - mpiConfig->abort(EXIT_FAILURE); - } + itkSetMacro(WriteVRT, bool); + itkGetMacro(WriteVRT, bool); - // Create output raster - GDALDataset *VRTOutput = driver->Create(vrtfOut.str().c_str(), - imageSizeX, - imageSizeY, - 0, - dataType, - NULL); // No options - if (VRTOutput == NULL) { - mpiConfig->logError("driver->Create call failed.\n"); - mpiConfig->abort(EXIT_FAILURE); - } + itkSetMacro(AvailableRAM, unsigned int); + itkGetMacro(AvailableRAM, unsigned int); - // Set GeoTransform - double gt[6]; - gt[0] = img->GetOrigin()[0] - 0.5*img->GetSignedSpacing()[0]; - gt[1] = img->GetSignedSpacing()[0]; - gt[2] = 0.0; - gt[3] = img->GetOrigin()[1] - 0.5*img->GetSignedSpacing()[1]; - gt[4] = 0.0; - gt[5] = img->GetSignedSpacing()[1]; - VRTOutput->SetGeoTransform(gt); +protected: + MPIVrtWriter(); + virtual ~MPIVrtWriter(); + void PrintSelf(std::ostream& os, itk::Indent indent) const override; - // Set projection - OGRSpatialReference out_sr; - char *wkt = NULL; - out_sr.SetFromUserInput(img->GetProjectionRef().c_str()); - out_sr.exportToWkt(&wkt); - VRTOutput->SetProjection(wkt); +private: + MPIVrtWriter(const MPIVrtWriter &) = delete; + void operator =(const MPIVrtWriter&) = delete; - for(unsigned int band = 1; band<=nbBands;++band) - { - VRTOutput->AddBand(dataType, NULL); + unsigned int m_AvailableRAM; - typename TImage::RegionType currentRegion; - for(unsigned int id=0; id < numberOfSplits; ++id) - { - currentRegion = streamingManager->GetSplit(id); - int tileSizeX = currentRegion.GetSize()[0]; - int tileSizeY = currentRegion.GetSize()[1]; - int tileIndexX = currentRegion.GetIndex()[0]; - int tileIndexY = currentRegion.GetIndex()[1]; - std::stringstream tileFileName; - tileFileName <<prefix<<"_"<<tileIndexX<<"_"<<tileIndexY<<"_"<<tileSizeX<<"_"<<tileSizeY<<".tif"; - std::cout<<tileFileName.str()<<std::endl; + itk::ImageIORegion m_IORegion; - GDALDataset *dataset = (GDALDataset*) GDALOpen(tileFileName.str().c_str(), GA_ReadOnly); + std::string m_Filename; - VRTSourcedRasterBand *VRTBand = dynamic_cast<VRTSourcedRasterBand*> (VRTOutput->GetRasterBand(band)); - VRTBand->AddSimpleSource(dataset->GetRasterBand(band), - 0, //xOffSrc - 0, //yOffSrc - tileSizeX, //xSizeSrc - tileSizeY, //ySizeSrc - tileIndexX, //xOffDest - tileIndexY, //yOffDest - tileSizeX, //xSizeDest - tileSizeY, //ySizeDest - "near", - VRT_NODATA_UNSET); - } + bool m_WriteVRT; - } - - // Close - CPLFree(wkt); - GDALClose(VRTOutput); - } - } - catch (itk::ExceptionObject& err) - { - std::stringstream message; - message << "ExceptionObject caught: " << err << std::endl; - mpiConfig->logError(message.str()); - mpiConfig->abort(EXIT_FAILURE); - } +}; +/** + *\brief Write image data to multiple files with MPI processus and add a VRT file. + * + * The image is divided into several pieces. + * Each pieces is distributed to a MPI processus. + * Each MPI processus write their pieces into a separate + * file. + * The master processus writes a VRT file (optional). + * + *\param img Image + *\param output Output Filename + *\param availableRAM Available memory for streaming + *\param writeVRTFile Activate the VRT file writing + */ +template <typename TImage> void WriteMPI(TImage *img, const std::string &output, unsigned int availableRAM = 0, bool writeVRTFile=true) +{ + typename MPIVrtWriter<TImage>::Pointer writer = MPIVrtWriter<TImage>::New(); + writer->SetInput(img); + writer->SetFileName(output); + writer->SetAvailableRAM(availableRAM); + writer->SetWriteVRT(writeVRTFile); + writer->Update(); } } // End namespace otb + +#ifndef OTB_MANUAL_INSTANTIATION +#include "otbMPIVrtWriter.txx" +#endif + #endif //__otbMPIVrtWriter_h diff --git a/Modules/MPI/MPIVrtWriter/include/otbMPIVrtWriter.txx b/Modules/MPI/MPIVrtWriter/include/otbMPIVrtWriter.txx new file mode 100644 index 0000000000000000000000000000000000000000..b57518ed73d613b37e33b86c59ba732ed0e44cc2 --- /dev/null +++ b/Modules/MPI/MPIVrtWriter/include/otbMPIVrtWriter.txx @@ -0,0 +1,327 @@ +/* + * 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 otbMPIVrtWriter_txx +#define otbMPIVrtWriter_txx + +#include "otbMPIVrtWriter.h" +#include "otbMacro.h" + +namespace otb +{ + +template <typename TImage> +MPIVrtWriter<TImage>::MPIVrtWriter() + : m_AvailableRAM(0) + , m_IORegion() + , m_Filename("") + , m_WriteVRT(true) +{ +} + +template <typename TImage> +MPIVrtWriter<TImage>::~MPIVrtWriter() +{ +} + +template <typename TImage> +void +MPIVrtWriter<TImage>::SetInput(const InputImageType *input) +{ + this->ProcessObject::SetNthInput(0,const_cast<InputImageType*>(input)); +} + +template <typename TImage> +const TImage* +MPIVrtWriter<TImage>::GetInput() +{ + if (this->GetNumberOfInputs() < 1) + { + return 0; + } + return static_cast<const InputImageType*>(this->ProcessObject::GetInput(0)); +} + +template <typename TImage> +void +MPIVrtWriter<TImage>::SetFileName(const char* extendedFileName) +{ + if (m_Filename.compare(extendedFileName) != 0 ) + { + m_Filename = std::string(extendedFileName); + this->Modified(); + } +} + +template <typename TImage> +void +MPIVrtWriter<TImage>::SetFileName(std::string extendedFileName) +{ + this->SetFileName(extendedFileName.c_str()); +} + +template <typename TImage> +const char* +MPIVrtWriter<TImage>::GetFileName () const +{ + return m_Filename.c_str(); +} + +template <typename TImage> +void +MPIVrtWriter<TImage>::SetIORegion(const itk::ImageIORegion& region) +{ + if (m_IORegion != region) + { + m_IORegion = region; + this->Modified(); + } +} + +template <typename TImage> +void +MPIVrtWriter<TImage>::PrintSelf(std::ostream& os, itk::Indent indent) const +{ + Superclass::PrintSelf(os, indent); + os << indent << "File Name: "<< m_Filename << std::endl; + os << indent << "Available RAM: "<< m_AvailableRAM << std::endl; + os << indent << "Write VRT: "<< m_WriteVRT << std::endl; +} + +template <typename TImage> +void +MPIVrtWriter<TImage>::Update() +{ + typename otb::MPIConfig::Pointer mpiConfig = otb::MPIConfig::Instance(); + + unsigned int myRank = mpiConfig->GetMyRank(); + unsigned int nbProcs = mpiConfig->GetNbProcs(); + + typedef otb::ImageFileWriter<TImage> WriterType; + typedef otb::NumberOfDivisionsTiledStreamingManager<TImage> StreamingManagerType; + typedef itk::RegionOfInterestImageFilter<TImage, TImage> ExtractFilterType; + + // First, update infomration from image to write + UpdateOutputInformation(); + InputImageType* img = const_cast<InputImageType*>(GetInput()); + std::string output = GetFileName(); + + // Configure streaming manager + typename StreamingManagerType::Pointer streamingManager = StreamingManagerType::New(); + streamingManager->SetNumberOfDivisions(nbProcs); + streamingManager->PrepareStreaming(img,img->GetLargestPossibleRegion()); + unsigned int numberOfSplits = streamingManager->GetNumberOfSplits(); + + // This vector will hold all regions to write for current rank + std::vector<typename TImage::RegionType> regionsToWrite; + + // Handle both cases when there are much more (resp. less) region to + // write than NbProcs + if(myRank < numberOfSplits) + { + unsigned int splitIdx = myRank; + while(splitIdx < numberOfSplits) + { + typename TImage::RegionType currentRegion = streamingManager->GetSplit(splitIdx); + regionsToWrite.push_back(currentRegion); + splitIdx+=nbProcs; + } + } + + // Output prefix + std::string extension = itksys::SystemTools::GetFilenameExtension(output); + if (extension != ".vrt") + { + + // TODO: Maybe remove this + if (extension == "") + { + // Missing extension + mpiConfig->logInfo("Filename has no extension. Adding <.vrt> extension."); + } + else + { + // Bad extension + mpiConfig->logError("Filename must have .vrt extension!"); + mpiConfig->abort(EXIT_FAILURE); + } + } + std::vector<std::string> joins; + itksys::SystemTools::SplitPath(output, joins); + joins.back() = itksys::SystemTools::GetFilenameWithoutExtension(output); + std::string prefix = itksys::SystemTools::JoinPath(joins); + + // Data type + std::string dataTypeStr = "Float32"; + GDALImageIO::Pointer gdalImageIO; + + // Now write all the regions + for(typename std::vector<typename TImage::RegionType>::const_iterator it = regionsToWrite.begin(); + it!=regionsToWrite.end();++it) + { + typename ExtractFilterType::Pointer extractFilter = ExtractFilterType::New(); + extractFilter->SetInput(img); + extractFilter->SetRegionOfInterest(*it); + // Writer + // Output Filename + std::stringstream ss; + ss<<prefix<<"_"<<it->GetIndex()[0]<<"_"<<it->GetIndex()[1]<<"_"<<it->GetSize()[0]<<"_"<<it->GetSize()[1]<<".tif"; + typename WriterType::Pointer writer = WriterType::New(); + writer->SetFileName(ss.str()); + writer->SetInput(extractFilter->GetOutput()); + // Datatype + gdalImageIO = dynamic_cast<GDALImageIO *>(writer->GetImageIO()); + if(gdalImageIO.IsNotNull()) + { + dataTypeStr = gdalImageIO->GetGdalPixelTypeAsString(); + } + + if (!m_AvailableRAM) + { + writer->SetNumberOfDivisionsTiledStreaming(0); + } + else + { + writer->SetAutomaticAdaptativeStreaming(m_AvailableRAM); + } + + // Pipeline execution + try + { + writer->Update(); + } + catch (itk::ExceptionObject& err) + { + std::stringstream message; + message << "ExceptionObject caught: " << err << std::endl; + mpiConfig->logError(message.str()); + mpiConfig->abort(EXIT_FAILURE); + } + } + + // MPI process synchronization + mpiConfig->barrier(); + + // Write VRT file + try + { + if (m_WriteVRT && (myRank == 0)) + { + // VRT Filename + std::stringstream vrtfOut; + vrtfOut<< prefix << ".vrt"; + + // Data type + GDALDataType dataType; + dataType = GDALGetDataTypeByName(dataTypeStr.c_str()); + + int imageSizeY = img->GetLargestPossibleRegion().GetSize()[1]; + int imageSizeX = img->GetLargestPossibleRegion().GetSize()[0]; + const unsigned int nbBands = img->GetNumberOfComponentsPerPixel(); + + // Get VRT driver + GDALAllRegister(); + GDALDriver *driver = GetGDALDriverManager()->GetDriverByName("VRT"); + if (driver == NULL) { + mpiConfig->logError("Error opening VRT driver."); + mpiConfig->abort(EXIT_FAILURE); + } + + // Create output raster + GDALDataset *VRTOutput = driver->Create(vrtfOut.str().c_str(), + imageSizeX, + imageSizeY, + 0, + dataType, + NULL); // No options + if (VRTOutput == NULL) { + mpiConfig->logError("driver->Create call failed.\n"); + mpiConfig->abort(EXIT_FAILURE); + } + + // Set GeoTransform + double gt[6]; + gt[0] = img->GetOrigin()[0] - 0.5*img->GetSignedSpacing()[0]; + gt[1] = img->GetSignedSpacing()[0]; + gt[2] = 0.0; + gt[3] = img->GetOrigin()[1] - 0.5*img->GetSignedSpacing()[1]; + gt[4] = 0.0; + gt[5] = img->GetSignedSpacing()[1]; + VRTOutput->SetGeoTransform(gt); + + // Set projection + OGRSpatialReference out_sr; + char *wkt = NULL; + out_sr.SetFromUserInput(img->GetProjectionRef().c_str()); + out_sr.exportToWkt(&wkt); + VRTOutput->SetProjection(wkt); + + for(unsigned int band = 1; band<=nbBands;++band) + { + VRTOutput->AddBand(dataType, NULL); + + typename TImage::RegionType currentRegion; + for(unsigned int id=0; id < numberOfSplits; ++id) + { + currentRegion = streamingManager->GetSplit(id); + int tileSizeX = currentRegion.GetSize()[0]; + int tileSizeY = currentRegion.GetSize()[1]; + int tileIndexX = currentRegion.GetIndex()[0]; + int tileIndexY = currentRegion.GetIndex()[1]; + std::stringstream tileFileName; + tileFileName <<prefix<<"_"<<tileIndexX<<"_"<<tileIndexY<<"_"<<tileSizeX<<"_"<<tileSizeY<<".tif"; + otbDebugMacro(<<tileFileName.str()); + + GDALDataset *dataset = (GDALDataset*) GDALOpen(tileFileName.str().c_str(), GA_ReadOnly); + + VRTSourcedRasterBand *VRTBand = dynamic_cast<VRTSourcedRasterBand*> (VRTOutput->GetRasterBand(band)); + VRTBand->AddSimpleSource(dataset->GetRasterBand(band), + 0, //xOffSrc + 0, //yOffSrc + tileSizeX, //xSizeSrc + tileSizeY, //ySizeSrc + tileIndexX, //xOffDest + tileIndexY, //yOffDest + tileSizeX, //xSizeDest + tileSizeY, //ySizeDest + "near", + VRT_NODATA_UNSET); + } + + } + + // Close + CPLFree(wkt); + GDALClose(VRTOutput); + } + } + catch (itk::ExceptionObject& err) + { + std::stringstream message; + message << "ExceptionObject caught: " << err << std::endl; + mpiConfig->logError(message.str()); + mpiConfig->abort(EXIT_FAILURE); + } +} + + +} // end of namespace otb + +#endif diff --git a/Modules/MPI/MPIVrtWriter/otb-module.cmake b/Modules/MPI/MPIVrtWriter/otb-module.cmake index 0e95d97f7cbe02b27ba37be548a0106b3d70ea9e..f98ab957d207a9bf02f6f13c27002ad054582897 100644 --- a/Modules/MPI/MPIVrtWriter/otb-module.cmake +++ b/Modules/MPI/MPIVrtWriter/otb-module.cmake @@ -22,8 +22,9 @@ set(DOCUMENTATION "Provides a template function for MPI writing to a VRT file") otb_module(OTBMPIVrtWriter DEPENDS - OTBMPIConfig - OTBPanSharpening + OTBCommon + OTBMPIConfig +# OTBPanSharpening OTBProjection OTBInterpolation OTBTestKernel diff --git a/Modules/OBIA/RCC8/include/otbImageListToRCC8GraphFilter.h b/Modules/OBIA/RCC8/include/otbImageListToRCC8GraphFilter.h index e14f374ca460b3b9e4e9663d7244c0e38784e9c8..2a31c34c090029160be7dd9699af03f7064d0f64 100644 --- a/Modules/OBIA/RCC8/include/otbImageListToRCC8GraphFilter.h +++ b/Modules/OBIA/RCC8/include/otbImageListToRCC8GraphFilter.h @@ -73,9 +73,9 @@ protected: /** Constructor */ ImageListToRCC8GraphFilter(); /** Destructor */ - ~ImageListToRCC8GraphFilter() ITK_OVERRIDE {} + ~ImageListToRCC8GraphFilter() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: ImageListToRCC8GraphFilter(const Self &); //purposely not implemented diff --git a/Modules/OBIA/RCC8/include/otbImageMultiSegmentationToRCC8GraphFilter.h b/Modules/OBIA/RCC8/include/otbImageMultiSegmentationToRCC8GraphFilter.h index 345de1067adb8c82f885d82b42fb5d9e24754c03..16e7b2196077732e056fd8852eee4c97c90e26be 100644 --- a/Modules/OBIA/RCC8/include/otbImageMultiSegmentationToRCC8GraphFilter.h +++ b/Modules/OBIA/RCC8/include/otbImageMultiSegmentationToRCC8GraphFilter.h @@ -84,11 +84,11 @@ protected: /** Constructor */ ImageMultiSegmentationToRCC8GraphFilter(); /** Destructor */ - ~ImageMultiSegmentationToRCC8GraphFilter() ITK_OVERRIDE; + ~ImageMultiSegmentationToRCC8GraphFilter() override; /** Main computation method */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** * Get the composition knowledge. * \param r1 First RCC8 relation value, diff --git a/Modules/OBIA/RCC8/include/otbImageToImageRCC8Calculator.h b/Modules/OBIA/RCC8/include/otbImageToImageRCC8Calculator.h index c1778371ffac67684a0a6453de193ba322f7c3ad..7e074277a8fbebcaf41d6019a9a2e3862761d8f4 100644 --- a/Modules/OBIA/RCC8/include/otbImageToImageRCC8Calculator.h +++ b/Modules/OBIA/RCC8/include/otbImageToImageRCC8Calculator.h @@ -118,7 +118,7 @@ protected: /** Constructor */ ImageToImageRCC8Calculator(); /** Destructor */ - ~ImageToImageRCC8Calculator() ITK_OVERRIDE {} + ~ImageToImageRCC8Calculator() override {} /** * Compute the minimal image region required. * \return The minimal region required. @@ -173,9 +173,9 @@ protected: */ BoolImagePointerType ConvertToBoolImage(ImagePointerType image, PixelType insideValue); /** Main computation method */ - void GenerateData(void) ITK_OVERRIDE; + void GenerateData(void) override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: /** The RCC8 relation value */ diff --git a/Modules/OBIA/RCC8/include/otbPolygonListToRCC8GraphFilter.h b/Modules/OBIA/RCC8/include/otbPolygonListToRCC8GraphFilter.h index aab4a679ccebe9f4a579fe7ff2216a5b67ae19b3..2dd119d9468bd6dca88f7628522be09f9b30d1fb 100644 --- a/Modules/OBIA/RCC8/include/otbPolygonListToRCC8GraphFilter.h +++ b/Modules/OBIA/RCC8/include/otbPolygonListToRCC8GraphFilter.h @@ -123,9 +123,9 @@ protected: /** Constructor */ PolygonListToRCC8GraphFilter(); /** Destructor */ - ~PolygonListToRCC8GraphFilter() ITK_OVERRIDE; + ~PolygonListToRCC8GraphFilter() override; /** Main computation method */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** Multi-threading implementation */ @@ -151,7 +151,7 @@ protected: /** End Multi-threading implementation */ /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** * Get the composition knowledge. * \param r1 First RCC8 relation value, diff --git a/Modules/OBIA/RCC8/include/otbPolygonToPolygonRCC8Calculator.h b/Modules/OBIA/RCC8/include/otbPolygonToPolygonRCC8Calculator.h index 5c27c5f8d27d38c758fec6e41809d13d1c2fa7b1..4f81008a0805c8209d4d1102b46a9e24c731a35c 100644 --- a/Modules/OBIA/RCC8/include/otbPolygonToPolygonRCC8Calculator.h +++ b/Modules/OBIA/RCC8/include/otbPolygonToPolygonRCC8Calculator.h @@ -109,9 +109,9 @@ protected: /** Constructor */ PolygonToPolygonRCC8Calculator(); /** Destructor */ - ~PolygonToPolygonRCC8Calculator() ITK_OVERRIDE {} + ~PolygonToPolygonRCC8Calculator() override {} /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: /** The RCC8 relation value */ diff --git a/Modules/OBIA/RCC8/include/otbRCC8Edge.h b/Modules/OBIA/RCC8/include/otbRCC8Edge.h index 9dfb9005dd62f515d1920417b68a2da614d323ca..58490e89c5e8802e4daa925bd93dd9eb19c784b2 100644 --- a/Modules/OBIA/RCC8/include/otbRCC8Edge.h +++ b/Modules/OBIA/RCC8/include/otbRCC8Edge.h @@ -56,9 +56,9 @@ protected: /** Constructor */ RCC8Edge(); /** Desctructor */ - ~RCC8Edge() ITK_OVERRIDE {} + ~RCC8Edge() override {} /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: /** The RCC8 value */ diff --git a/Modules/OBIA/RCC8/include/otbRCC8Graph.h b/Modules/OBIA/RCC8/include/otbRCC8Graph.h index 4130636425a910746b0b4db13a1071afb47be85c..fc1f7f965f24d5faf6b300ce7674508896efeb8b 100644 --- a/Modules/OBIA/RCC8/include/otbRCC8Graph.h +++ b/Modules/OBIA/RCC8/include/otbRCC8Graph.h @@ -127,9 +127,9 @@ protected: /** Constructor */ RCC8Graph(); /** Destructor */ - ~RCC8Graph() ITK_OVERRIDE {} + ~RCC8Graph() override {} /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** * Initialize a range of vertex. * \param num The index of the last vertices to initialize. diff --git a/Modules/OBIA/RCC8/include/otbRCC8GraphFileReader.h b/Modules/OBIA/RCC8/include/otbRCC8GraphFileReader.h index 08d8bf3a1e8ac1751f75a86d4d170e862a7028f6..31879d4809a74994ce2b32d390a8dd26e632f678 100644 --- a/Modules/OBIA/RCC8/include/otbRCC8GraphFileReader.h +++ b/Modules/OBIA/RCC8/include/otbRCC8GraphFileReader.h @@ -92,9 +92,9 @@ protected: /** Constructor */ RCC8GraphFileReader(); /** Destructor */ - ~RCC8GraphFileReader() ITK_OVERRIDE; + ~RCC8GraphFileReader() override; /** Main computation method */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** * Parse edge information from a given line. * \param line The line to parse. @@ -107,7 +107,7 @@ protected: void ParseVertex(const std::string& line); /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: /** File name */ diff --git a/Modules/OBIA/RCC8/include/otbRCC8GraphFileWriter.h b/Modules/OBIA/RCC8/include/otbRCC8GraphFileWriter.h index 010e42fe0ad0fdfe89900bd3333044e4bd737b32..f9c893cb519a32412e46e24add0f690760ca973b 100644 --- a/Modules/OBIA/RCC8/include/otbRCC8GraphFileWriter.h +++ b/Modules/OBIA/RCC8/include/otbRCC8GraphFileWriter.h @@ -107,17 +107,17 @@ public: /** * Update method. */ - void Update(void) ITK_OVERRIDE; + void Update(void) override; protected: /** Constructor */ RCC8GraphFileWriter(); /** Destructor */ - ~RCC8GraphFileWriter() ITK_OVERRIDE; + ~RCC8GraphFileWriter() override; /** * Main computation method. */ - void GenerateData(void) ITK_OVERRIDE; + void GenerateData(void) override; /** * Write Method. * Performs checkings and invoke GenerateData(). @@ -143,7 +143,7 @@ protected: /** * PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: /** Filename of the graph file to write */ diff --git a/Modules/OBIA/RCC8/include/otbRCC8GraphSource.h b/Modules/OBIA/RCC8/include/otbRCC8GraphSource.h index 0c4acf40b0ca0d4f474b6a89efdbfddddcc3ec32..a70f4bcf6a9a3656073ed48bff4636060cba74fb 100644 --- a/Modules/OBIA/RCC8/include/otbRCC8GraphSource.h +++ b/Modules/OBIA/RCC8/include/otbRCC8GraphSource.h @@ -57,9 +57,9 @@ protected: /** Constructor */ RCC8GraphSource(); /** Destructor */ - ~RCC8GraphSource() ITK_OVERRIDE {} + ~RCC8GraphSource() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: RCC8GraphSource(const Self &); //purposely not implemented diff --git a/Modules/OBIA/RCC8/include/otbRCC8VertexBase.h b/Modules/OBIA/RCC8/include/otbRCC8VertexBase.h index a7c02a152d52842770c23fdce32d68d6ad13e767..b432ded5499cfa3ae0ea36a07d4ae0c34a91b359 100644 --- a/Modules/OBIA/RCC8/include/otbRCC8VertexBase.h +++ b/Modules/OBIA/RCC8/include/otbRCC8VertexBase.h @@ -82,9 +82,9 @@ protected: /** Constructor */ RCC8VertexBase(); /** Desctructor */ - ~RCC8VertexBase() ITK_OVERRIDE {} + ~RCC8VertexBase() override {} /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: /** The segmentation level */ diff --git a/Modules/OBIA/RCC8/include/otbRCC8VertexWithCompacity.h b/Modules/OBIA/RCC8/include/otbRCC8VertexWithCompacity.h index c1dc5299746b717a45968e7b25a33d13a9f499f3..c9695fb2e3f89247f1662b6ce73d91a14ec53624 100644 --- a/Modules/OBIA/RCC8/include/otbRCC8VertexWithCompacity.h +++ b/Modules/OBIA/RCC8/include/otbRCC8VertexWithCompacity.h @@ -61,20 +61,20 @@ public: * Set the VertexWithCompacity attributes from the attributes vector. * \param attributes The vector containing the parsed attributes. */ - void SetAttributesMap(AttributesMapType attributes) ITK_OVERRIDE; + void SetAttributesMap(AttributesMapType attributes) override; /** * Get an attributes vector representing the VertexWithCompacity attributes. * \return The attributes vector */ - AttributesMapType GetAttributesMap(void) ITK_OVERRIDE; + AttributesMapType GetAttributesMap(void) override; protected: /** Constructor */ RCC8VertexWithCompacity(); /** Desctructor */ - ~RCC8VertexWithCompacity() ITK_OVERRIDE {} + ~RCC8VertexWithCompacity() override {} /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: /** The compacity */ diff --git a/Modules/Radiometry/Indices/include/otbBuiltUpIndicesFunctor.h b/Modules/Radiometry/Indices/include/otbBuiltUpIndicesFunctor.h index dbf78a9c4a93e69e4b258af214ae03734d5ff3ec..6b8ca2c517690d4c2f4ce1b404a74e5bb8d5619e 100644 --- a/Modules/Radiometry/Indices/include/otbBuiltUpIndicesFunctor.h +++ b/Modules/Radiometry/Indices/include/otbBuiltUpIndicesFunctor.h @@ -151,7 +151,7 @@ class NDBI : public TM4AndTM5IndexBase<TInput1, TInput2, TOutput> { public: /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "NDBI"; } @@ -159,10 +159,10 @@ public: /// Constructor NDBI() {} /// Desctructor - ~NDBI() ITK_OVERRIDE {} + ~NDBI() override {} // Operator on r and nir single pixel values protected: - inline TOutput Evaluate(const TInput1& pTM4, const TInput2& pTM5) const ITK_OVERRIDE + inline TOutput Evaluate(const TInput1& pTM4, const TInput2& pTM5) const override { double dTM4 = static_cast<double>(pTM4); double dTM5 = static_cast<double>(pTM5); @@ -190,7 +190,7 @@ class ISU : public RAndNIRIndexBase<TInput1, TInput2, TOutput> { public: /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "ISU"; } @@ -198,7 +198,7 @@ public: /// Constructor ISU() : m_A(100.), m_B(25.) {} /// Desctructor - ~ISU() ITK_OVERRIDE {} + ~ISU() override {} /** Set/Get A correction */ void SetA(const double pA) @@ -220,7 +220,7 @@ public: } protected: - inline TOutput Evaluate(const TInput1& pRed, const TInput2& pNIR) const ITK_OVERRIDE + inline TOutput Evaluate(const TInput1& pRed, const TInput2& pNIR) const override { double dRed = static_cast<double>(pRed); double dNIR = static_cast<double>(pNIR); diff --git a/Modules/Radiometry/Indices/include/otbGAndRIndexImageFilter.h b/Modules/Radiometry/Indices/include/otbGAndRIndexImageFilter.h index 829d3c4f48a88369441e5abea75602a7b5df8766..000fd046233b2d7362515c596f55a78013329dfc 100644 --- a/Modules/Radiometry/Indices/include/otbGAndRIndexImageFilter.h +++ b/Modules/Radiometry/Indices/include/otbGAndRIndexImageFilter.h @@ -72,9 +72,9 @@ public: protected: GAndRIndexImageFilter(); - ~GAndRIndexImageFilter() ITK_OVERRIDE {} + ~GAndRIndexImageFilter() override {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /* void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId ); diff --git a/Modules/Radiometry/Indices/include/otbLandsatTMIndices.h b/Modules/Radiometry/Indices/include/otbLandsatTMIndices.h index fd586c9474c5fce467957e2e4f68fea269f89b50..a94a63f162ed28374dd3a2bf37d713d0fc21d83c 100644 --- a/Modules/Radiometry/Indices/include/otbLandsatTMIndices.h +++ b/Modules/Radiometry/Indices/include/otbLandsatTMIndices.h @@ -343,7 +343,7 @@ public: virtual std::string GetName() const = 0; LandsatTMIndex() {} - ~LandsatTMIndex() ITK_OVERRIDE {} + ~LandsatTMIndex() override {} }; @@ -370,13 +370,13 @@ class Bright : public LandsatTMIndex<TInput, TOutput> { public: /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "Bright"; } Bright() {} - ~Bright() ITK_OVERRIDE {} + ~Bright() override {} inline TOutput operator ()(const TInput& inputPixel) { @@ -411,13 +411,13 @@ class Vis : public LandsatTMIndex<TInput, TOutput> { public: /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "Vis"; } Vis() {} - ~Vis() ITK_OVERRIDE {} + ~Vis() override {} inline TOutput operator ()(const TInput& inputPixel) { @@ -444,13 +444,13 @@ class NIR : public LandsatTMIndex<TInput, TOutput> { public: /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "NIR"; } NIR() {} - ~NIR() ITK_OVERRIDE {} + ~NIR() override {} inline TOutput operator ()(const TInput& inputPixel) { @@ -476,13 +476,13 @@ class MIR1 : public LandsatTMIndex<TInput, TOutput> { public: /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "MIR1"; } MIR1() {} - ~MIR1() ITK_OVERRIDE {} + ~MIR1() override {} inline TOutput operator ()(const TInput& inputPixel) { @@ -508,13 +508,13 @@ class MIR2 : public LandsatTMIndex<TInput, TOutput> { public: /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "MIR2"; } MIR2() {} - ~MIR2() ITK_OVERRIDE {} + ~MIR2() override {} inline TOutput operator ()(const TInput& inputPixel) { @@ -540,13 +540,13 @@ class TIR : public LandsatTMIndex<TInput, TOutput> { public: /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "TIR"; } TIR() {} - ~TIR() ITK_OVERRIDE {} + ~TIR() override {} inline TOutput operator ()(const TInput& inputPixel) { @@ -586,13 +586,13 @@ class MIRTIR : public LandsatTMIndex<TInput, TOutput> { public: /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "MIRTIR"; } MIRTIR() {} - ~MIRTIR() ITK_OVERRIDE {} + ~MIRTIR() override {} inline TOutput operator ()(const TInput& inputPixel) { @@ -626,13 +626,13 @@ class NDVI : public LandsatTMIndex<TInput, TOutput> { public: /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "NDVI"; } NDVI() {} - ~NDVI() ITK_OVERRIDE {} + ~NDVI() override {} inline TOutput operator ()(const TInput& inputPixel) { @@ -673,13 +673,13 @@ class NDBSI : public LandsatTMIndex<TInput, TOutput> { public: /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "NDBSI"; } NDBSI() {} - ~NDBSI() ITK_OVERRIDE {} + ~NDBSI() override {} inline TOutput operator ()(const TInput& inputPixel) { @@ -716,13 +716,13 @@ class BIO : public LandsatTMIndex<TInput, TOutput> { public: /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "BIO"; } BIO() {} - ~BIO() ITK_OVERRIDE {} + ~BIO() override {} inline TOutput operator ()(const TInput& inputPixel) { @@ -762,13 +762,13 @@ class NDSI : public LandsatTMIndex<TInput, TOutput> { public: /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "NDSI"; } NDSI() {} - ~NDSI() ITK_OVERRIDE {} + ~NDSI() override {} inline TOutput operator ()(const TInput& inputPixel) { @@ -819,13 +819,13 @@ class NDSIVis : public LandsatTMIndex<TInput, TOutput> { public: /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "NDSIVis"; } NDSIVis() {} - ~NDSIVis() ITK_OVERRIDE {} + ~NDSIVis() override {} inline TOutput operator ()(const TInput& inputPixel) { @@ -864,13 +864,13 @@ class NDBBBI : public LandsatTMIndex<TInput, TOutput> { public: /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "NDBBBI"; } NDBBBI() {} - ~NDBBBI() ITK_OVERRIDE {} + ~NDBBBI() override {} inline TOutput operator ()(const TInput& inputPixel) { @@ -984,7 +984,7 @@ public: m_FvNDBSI->SetMembership(Medium, -0.20, -0.20, 0.0, 0.0); m_FvNDBSI->SetMembership(High, 0.0, 0.0, maximumValue, maximumValue); } - ~LinguisticVariables() ITK_OVERRIDE {} + ~LinguisticVariables() override {} inline itk::FixedArray<unsigned int, 11> operator ()(const TInput& inputPixel) { @@ -1068,7 +1068,7 @@ public: } KernelSpectralRule() : m_TV1(0.7), m_TV2(0.5) { } - ~KernelSpectralRule() ITK_OVERRIDE {} + ~KernelSpectralRule() override {} void SetTV1(PrecisionType tv1) { @@ -1163,13 +1163,13 @@ public: typedef bool OutputPixelType; /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "LandsatTM ThickCloudsSpectralRule"; } ThickCloudsSpectralRule() { } - ~ThickCloudsSpectralRule() ITK_OVERRIDE {} + ~ThickCloudsSpectralRule() override {} inline TOutput operator ()(const TInput& inputPixel) { @@ -1221,13 +1221,13 @@ public: typedef bool OutputPixelType; /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "LandsatTM ThinCloudsSpectralRule"; } ThinCloudsSpectralRule() { } - ~ThinCloudsSpectralRule() ITK_OVERRIDE {} + ~ThinCloudsSpectralRule() override {} inline TOutput operator ()(const TInput& inputPixel) { @@ -1282,13 +1282,13 @@ public: typedef bool OutputPixelType; /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "LandsatTM SnowOrIceSpectralRule"; } SnowOrIceSpectralRule() { } - ~SnowOrIceSpectralRule() ITK_OVERRIDE {} + ~SnowOrIceSpectralRule() override {} inline TOutput operator ()(const TInput& inputPixel) { @@ -1341,13 +1341,13 @@ public: typedef bool OutputPixelType; /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "LandsatTM WaterOrShadowSpectralRule"; } WaterOrShadowSpectralRule() { } - ~WaterOrShadowSpectralRule() ITK_OVERRIDE {} + ~WaterOrShadowSpectralRule() override {} inline TOutput operator ()(const TInput& inputPixel) { @@ -1388,13 +1388,13 @@ public: typedef bool OutputPixelType; /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "LandsatTM PitbogOrGreenhouseSpectralRule"; } PitbogOrGreenhouseSpectralRule() { } - ~PitbogOrGreenhouseSpectralRule() ITK_OVERRIDE {} + ~PitbogOrGreenhouseSpectralRule() override {} inline TOutput operator ()(const TInput& inputPixel) { @@ -1446,13 +1446,13 @@ public: typedef bool OutputPixelType; /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "LandsatTM DominantBlueSpectralRule"; } DominantBlueSpectralRule() { } - ~DominantBlueSpectralRule() ITK_OVERRIDE {} + ~DominantBlueSpectralRule() override {} inline TOutput operator ()(const TInput& inputPixel) { @@ -1494,13 +1494,13 @@ public: typedef bool OutputPixelType; /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "LandsatTM VegetationSpectralRule"; } VegetationSpectralRule() { } - ~VegetationSpectralRule() ITK_OVERRIDE {} + ~VegetationSpectralRule() override {} inline TOutput operator ()(const TInput& inputPixel) { @@ -1554,13 +1554,13 @@ public: typedef bool OutputPixelType; /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "LandsatTM RangelandSpectralRule"; } RangelandSpectralRule() { } - ~RangelandSpectralRule() ITK_OVERRIDE {} + ~RangelandSpectralRule() override {} inline TOutput operator ()(const TInput& inputPixel) { @@ -1615,13 +1615,13 @@ public: typedef bool OutputPixelType; /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "LandsatTM BarrenLandOrBuiltUpOrCloudsSpectralRule"; } BarrenLandOrBuiltUpOrCloudsSpectralRule() { } - ~BarrenLandOrBuiltUpOrCloudsSpectralRule() ITK_OVERRIDE {} + ~BarrenLandOrBuiltUpOrCloudsSpectralRule() override {} inline TOutput operator ()(const TInput& inputPixel) { @@ -1673,13 +1673,13 @@ public: typedef bool OutputPixelType; /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "LandsatTM FlatResponseBarrenLandOrBuiltUpSpectralRule"; } FlatResponseBarrenLandOrBuiltUpSpectralRule() { } - ~FlatResponseBarrenLandOrBuiltUpSpectralRule() ITK_OVERRIDE {} + ~FlatResponseBarrenLandOrBuiltUpSpectralRule() override {} inline TOutput operator ()(const TInput& inputPixel) { @@ -1727,13 +1727,13 @@ public: typedef bool OutputPixelType; /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "LandsatTM ShadowWithBarrenLandSpectralRule"; } ShadowWithBarrenLandSpectralRule() { } - ~ShadowWithBarrenLandSpectralRule() ITK_OVERRIDE {} + ~ShadowWithBarrenLandSpectralRule() override {} inline TOutput operator ()(const TInput& inputPixel) { @@ -1774,13 +1774,13 @@ public: typedef bool OutputPixelType; /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "LandsatTM ShadowWithVegetationSpectralRule"; } ShadowWithVegetationSpectralRule() { } - ~ShadowWithVegetationSpectralRule() ITK_OVERRIDE {} + ~ShadowWithVegetationSpectralRule() override {} inline TOutput operator ()(const TInput& inputPixel) { @@ -1822,13 +1822,13 @@ public: typedef bool OutputPixelType; /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "LandsatTM ShadowCloudOrSnowSpectralRule"; } ShadowCloudOrSnowSpectralRule() { } - ~ShadowCloudOrSnowSpectralRule() ITK_OVERRIDE {} + ~ShadowCloudOrSnowSpectralRule() override {} inline TOutput operator ()(const TInput& inputPixel) { @@ -1877,13 +1877,13 @@ public: typedef bool OutputPixelType; /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "LandsatTM WetlandSpectralRule"; } WetlandSpectralRule() { } - ~WetlandSpectralRule() ITK_OVERRIDE {} + ~WetlandSpectralRule() override {} inline TOutput operator ()(const TInput& inputPixel) { diff --git a/Modules/Radiometry/Indices/include/otbMultiChannelGAndRIndexImageFilter.h b/Modules/Radiometry/Indices/include/otbMultiChannelGAndRIndexImageFilter.h index d6a1b16768e8bde558bd42fb6c36e0a38165aced..3a230c4a10293617babdb3dda655d9043582fc62 100644 --- a/Modules/Radiometry/Indices/include/otbMultiChannelGAndRIndexImageFilter.h +++ b/Modules/Radiometry/Indices/include/otbMultiChannelGAndRIndexImageFilter.h @@ -98,9 +98,9 @@ protected: /// Constructor MultiChannelGAndRIndexImageFilter() : m_GreenIndex(1), m_RedIndex(2) {}; /// Destructor - ~MultiChannelGAndRIndexImageFilter() ITK_OVERRIDE {} + ~MultiChannelGAndRIndexImageFilter() override {} /// Before generating data, set functor parameters - void BeforeThreadedGenerateData() ITK_OVERRIDE + void BeforeThreadedGenerateData() override { unsigned int lNbChan = this->GetInput()->GetNumberOfComponentsPerPixel(); if (m_GreenIndex < 1 || m_RedIndex < 1 || @@ -112,7 +112,7 @@ protected: this->GetFunctor().SetRedIndex(m_RedIndex); } /// PrintSelf Method - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + void PrintSelf(std::ostream& os, itk::Indent indent) const override { this->Superclass::PrintSelf(os, indent); os << indent << "Green index: " << m_GreenIndex << std::endl; diff --git a/Modules/Radiometry/Indices/include/otbMultiChannelRAndBAndNIRIndexImageFilter.h b/Modules/Radiometry/Indices/include/otbMultiChannelRAndBAndNIRIndexImageFilter.h index f01f00d11b28845c260c48803c0b21f9ee571f56..8094f66ac43e282c6df4562836c705ecc6b2ec63 100644 --- a/Modules/Radiometry/Indices/include/otbMultiChannelRAndBAndNIRIndexImageFilter.h +++ b/Modules/Radiometry/Indices/include/otbMultiChannelRAndBAndNIRIndexImageFilter.h @@ -110,9 +110,9 @@ protected: /// Constructor MultiChannelRAndBAndNIRIndexImageFilter() : m_RedIndex(3), m_BlueIndex(1), m_NIRIndex(4) {}; /// Destructor - ~MultiChannelRAndBAndNIRIndexImageFilter() ITK_OVERRIDE {} + ~MultiChannelRAndBAndNIRIndexImageFilter() override {} /// Before generating data, set functor parameters - void BeforeThreadedGenerateData() ITK_OVERRIDE + void BeforeThreadedGenerateData() override { unsigned int lNbChan = this->GetInput()->GetNumberOfComponentsPerPixel(); if (m_RedIndex < 1 || m_BlueIndex < 1 || m_NIRIndex < 1 || @@ -125,7 +125,7 @@ protected: this->GetFunctor().SetNIRIndex(m_NIRIndex); } /// PrintSelf - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + void PrintSelf(std::ostream& os, itk::Indent indent) const override { this->Superclass::PrintSelf(os, indent); os << indent << "Red index: " << m_RedIndex << std::endl; diff --git a/Modules/Radiometry/Indices/include/otbMultiChannelRAndGAndNIRIndexImageFilter.h b/Modules/Radiometry/Indices/include/otbMultiChannelRAndGAndNIRIndexImageFilter.h index bdd0cb1045b9c5adafadb3bdbb216022d6833598..6b8daf81ed96d751b3870a785c59f2e48648594f 100644 --- a/Modules/Radiometry/Indices/include/otbMultiChannelRAndGAndNIRIndexImageFilter.h +++ b/Modules/Radiometry/Indices/include/otbMultiChannelRAndGAndNIRIndexImageFilter.h @@ -110,9 +110,9 @@ protected: /// Constructor MultiChannelRAndGAndNIRIndexImageFilter() : m_RedIndex(3), m_GreenIndex(2), m_NIRIndex(4) {}; /// Destructor - ~MultiChannelRAndGAndNIRIndexImageFilter() ITK_OVERRIDE {} + ~MultiChannelRAndGAndNIRIndexImageFilter() override {} /// Before generating data, set functor parameters - void BeforeThreadedGenerateData() ITK_OVERRIDE + void BeforeThreadedGenerateData() override { unsigned int lNbChan = this->GetInput()->GetNumberOfComponentsPerPixel(); @@ -126,7 +126,7 @@ protected: this->GetFunctor().SetNIRIndex(m_NIRIndex); } /// PrintSelf - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + void PrintSelf(std::ostream& os, itk::Indent indent) const override { this->Superclass::PrintSelf(os, indent); os << indent << "Red index: " << m_RedIndex << std::endl; diff --git a/Modules/Radiometry/Indices/include/otbMultiChannelRAndNIRIndexImageFilter.h b/Modules/Radiometry/Indices/include/otbMultiChannelRAndNIRIndexImageFilter.h index 3bc1c49d727846bfb8fe2a7a4a68219b8b6bb533..7b07d757d81796b82ea5acc1d142958efe7341ac 100644 --- a/Modules/Radiometry/Indices/include/otbMultiChannelRAndNIRIndexImageFilter.h +++ b/Modules/Radiometry/Indices/include/otbMultiChannelRAndNIRIndexImageFilter.h @@ -98,9 +98,9 @@ protected: /// Constructor MultiChannelRAndNIRIndexImageFilter() : m_RedIndex(3), m_NIRIndex(4) {}; /// Destructor - ~MultiChannelRAndNIRIndexImageFilter() ITK_OVERRIDE {} + ~MultiChannelRAndNIRIndexImageFilter() override {} /// Before generating data, set functor parameters - void BeforeThreadedGenerateData() ITK_OVERRIDE + void BeforeThreadedGenerateData() override { unsigned int lNbChan = this->GetInput()->GetNumberOfComponentsPerPixel(); if (m_RedIndex < 1 || m_NIRIndex < 1 || @@ -112,7 +112,7 @@ protected: this->GetFunctor().SetNIRIndex(m_NIRIndex); } /// PrintSelf Method - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + void PrintSelf(std::ostream& os, itk::Indent indent) const override { this->Superclass::PrintSelf(os, indent); os << indent << "Red index: " << m_RedIndex << std::endl; diff --git a/Modules/Radiometry/Indices/include/otbNDVIDataNodeFeatureFunction.h b/Modules/Radiometry/Indices/include/otbNDVIDataNodeFeatureFunction.h index f3e704d08cb0544d83c773b56556bd4245a6b9f4..028adb1623ac2afe53e9c1b34fc91b043beecfa3 100644 --- a/Modules/Radiometry/Indices/include/otbNDVIDataNodeFeatureFunction.h +++ b/Modules/Radiometry/Indices/include/otbNDVIDataNodeFeatureFunction.h @@ -88,7 +88,7 @@ public: typedef std::vector<PrecisionType> OutputType; - OutputType Evaluate( const DataNodeType& node ) const ITK_OVERRIDE; + OutputType Evaluate( const DataNodeType& node ) const override; /** Set/Get methods */ itkGetConstMacro(NDVIThreshold, PrecisionType); @@ -117,8 +117,8 @@ public: protected: NDVIDataNodeFeatureFunction(); - ~NDVIDataNodeFeatureFunction() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~NDVIDataNodeFeatureFunction() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: NDVIDataNodeFeatureFunction(const Self&); //purposely not implemented diff --git a/Modules/Radiometry/Indices/include/otbRAndBAndNIRIndexImageFilter.h b/Modules/Radiometry/Indices/include/otbRAndBAndNIRIndexImageFilter.h index 04646b1f1878e5857a2d78c2722e43b77d327bc7..ad01b1b2c65642a7202fcfd9108421779e9555e2 100644 --- a/Modules/Radiometry/Indices/include/otbRAndBAndNIRIndexImageFilter.h +++ b/Modules/Radiometry/Indices/include/otbRAndBAndNIRIndexImageFilter.h @@ -74,9 +74,9 @@ public: protected: RAndBAndNIRIndexImageFilter(); - ~RAndBAndNIRIndexImageFilter() ITK_OVERRIDE {} + ~RAndBAndNIRIndexImageFilter() override {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: RAndBAndNIRIndexImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Radiometry/Indices/include/otbRAndGAndNIRIndexImageFilter.h b/Modules/Radiometry/Indices/include/otbRAndGAndNIRIndexImageFilter.h index 5a721b67461ba565bdc30727d069eba2bcba3550..26cb6eb0a45093c43e49059eda861db12329425c 100644 --- a/Modules/Radiometry/Indices/include/otbRAndGAndNIRIndexImageFilter.h +++ b/Modules/Radiometry/Indices/include/otbRAndGAndNIRIndexImageFilter.h @@ -74,9 +74,9 @@ public: protected: RAndGAndNIRIndexImageFilter(); - ~RAndGAndNIRIndexImageFilter() ITK_OVERRIDE {} + ~RAndGAndNIRIndexImageFilter() override {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: RAndGAndNIRIndexImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Radiometry/Indices/include/otbRAndNIRIndexImageFilter.h b/Modules/Radiometry/Indices/include/otbRAndNIRIndexImageFilter.h index fc118fb663cd2e271ab3241a625d44892770ef6c..c93b6df863f094aa2280bfc0ab9167ff4c9a2b48 100644 --- a/Modules/Radiometry/Indices/include/otbRAndNIRIndexImageFilter.h +++ b/Modules/Radiometry/Indices/include/otbRAndNIRIndexImageFilter.h @@ -71,9 +71,9 @@ public: protected: RAndNIRIndexImageFilter(); - ~RAndNIRIndexImageFilter() ITK_OVERRIDE {} + ~RAndNIRIndexImageFilter() override {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /* void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId ); diff --git a/Modules/Radiometry/Indices/include/otbSoilIndicesFunctor.h b/Modules/Radiometry/Indices/include/otbSoilIndicesFunctor.h index 57d2179871008e4bab01b9a64ed25eec7ffcf9c3..6ed1b201c05e31eaab18124c409fb96e12584688 100644 --- a/Modules/Radiometry/Indices/include/otbSoilIndicesFunctor.h +++ b/Modules/Radiometry/Indices/include/otbSoilIndicesFunctor.h @@ -287,7 +287,7 @@ class IR : public GAndRIndexBase<TInput1, TInput2, TOutput> { public: /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "IR"; } @@ -295,10 +295,10 @@ public: /// Constructor IR() {} /// Desctructor - ~IR() ITK_OVERRIDE {} + ~IR() override {} // Operator on r and nir single pixel values protected: - inline TOutput Evaluate(const TInput1& pGreen, const TInput2& pRed) const ITK_OVERRIDE + inline TOutput Evaluate(const TInput1& pGreen, const TInput2& pRed) const override { double dGreen = static_cast<double>(pGreen); double dRed = static_cast<double>(pRed); @@ -330,7 +330,7 @@ class IC : public GAndRIndexBase<TInput1, TInput2, TOutput> { public: /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "IC"; } @@ -338,10 +338,10 @@ public: /// Constructor IC() {} /// Desctructor - ~IC() ITK_OVERRIDE {} + ~IC() override {} // Operator on r and nir single pixel values protected: - inline TOutput Evaluate(const TInput1& pGreen, const TInput2& pRed) const ITK_OVERRIDE + inline TOutput Evaluate(const TInput1& pGreen, const TInput2& pRed) const override { double dGreen = static_cast<double>(pGreen); double dRed = static_cast<double>(pRed); @@ -369,7 +369,7 @@ class IB : public GAndRIndexBase<TInput1, TInput2, TOutput> { public: /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "IB"; } @@ -377,10 +377,10 @@ public: /// Constructor IB() {} /// Desctructor - ~IB() ITK_OVERRIDE {} + ~IB() override {} // Operator on r and nir single pixel values protected: - inline TOutput Evaluate(const TInput1& pGreen, const TInput2& pRed) const ITK_OVERRIDE + inline TOutput Evaluate(const TInput1& pGreen, const TInput2& pRed) const override { double dGreen = static_cast<double>(pGreen); double dRed = static_cast<double>(pRed); @@ -404,7 +404,7 @@ class IB2 : public GAndRAndNirIndexBase<TInput1, TInput2, TInput3, TOutput> { public: /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "IB2"; } @@ -412,10 +412,10 @@ public: /// Constructor IB2() {} /// Desctructor - ~IB2() ITK_OVERRIDE {} + ~IB2() override {} // Operator on r and nir single pixel values protected: - inline TOutput Evaluate(const TInput1& pGreen, const TInput2& pRed, const TInput2& pNir) const ITK_OVERRIDE + inline TOutput Evaluate(const TInput1& pGreen, const TInput2& pRed, const TInput2& pNir) const override { double dGreen = static_cast<double>(pGreen); double dRed = static_cast<double>(pRed); diff --git a/Modules/Radiometry/Indices/include/otbVegetationIndicesFunctor.h b/Modules/Radiometry/Indices/include/otbVegetationIndicesFunctor.h index 48b3402d8ff05540abf9121d96abe9ce6def44b2..a83cc354d7278a46128f7e9e99f9081f0a62b999 100644 --- a/Modules/Radiometry/Indices/include/otbVegetationIndicesFunctor.h +++ b/Modules/Radiometry/Indices/include/otbVegetationIndicesFunctor.h @@ -414,7 +414,7 @@ class NDVI : public RAndNIRIndexBase<TInput1, TInput2, TOutput> public: /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "NDVI"; } @@ -422,10 +422,10 @@ public: /// Constructor NDVI() {} /// Desctructor - ~NDVI() ITK_OVERRIDE {} + ~NDVI() override {} // Operator on r and nir single pixel values protected: - inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const ITK_OVERRIDE + inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const override { double dr = static_cast<double>(r); double dnir = static_cast<double>(nir); @@ -454,15 +454,15 @@ class RVI : public RAndNIRIndexBase<TInput1, TInput2, TOutput> public: /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "RVI"; } RVI() {} - ~RVI() ITK_OVERRIDE {} + ~RVI() override {} protected: - inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const ITK_OVERRIDE + inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const override { double dr = static_cast<double>(r); double dnir = static_cast<double>(nir); @@ -493,13 +493,13 @@ class PVI : public RAndNIRIndexBase<TInput1, TInput2, TOutput> { public: /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "PVI"; } PVI() : m_A(0.90893), m_B(7.46216), m_Coeff(0.74) {} - ~PVI() ITK_OVERRIDE {} + ~PVI() override {} /** Set/Get A and B parameters */ void SetA(const double A) { @@ -519,7 +519,7 @@ public: return (m_B); } protected: - inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const ITK_OVERRIDE + inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const override { double dnir = static_cast<double>(nir); double dr = static_cast<double>(r); @@ -552,13 +552,13 @@ class SAVI : public RAndNIRIndexBase<TInput1, TInput2, TOutput> public: /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "SAVI"; } SAVI() : m_L(0.5) {} - ~SAVI() ITK_OVERRIDE {} + ~SAVI() override {} /** Set/Get L correction */ void SetL(const double L) @@ -571,7 +571,7 @@ public: } protected: - inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const ITK_OVERRIDE + inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const override { double dnir = static_cast<double>(nir); double dr = static_cast<double>(r); @@ -606,13 +606,13 @@ class TSAVI : public RAndNIRIndexBase<TInput1, TInput2, TOutput> public: /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "TSAVI"; } TSAVI() : m_A(0.7), m_S(0.9), m_X(0.08) {} - ~TSAVI() ITK_OVERRIDE {} + ~TSAVI() override {} /** Set/Get S and A parameters */ void SetS(const double S) @@ -642,7 +642,7 @@ public: } protected: - inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const ITK_OVERRIDE + inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const override { double dnir = static_cast<double>(nir); double dr = static_cast<double>(r); @@ -679,7 +679,7 @@ class WDVI : public RAndNIRIndexBase<TInput1, TInput2, TOutput> { public: /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "WDVI"; } @@ -687,7 +687,7 @@ public: /// Constructor WDVI() : m_S(0.4) {} /// Desctructor - ~WDVI() ITK_OVERRIDE {} + ~WDVI() override {} // Operator on r and nir single pixel values /** Set/Get Slop of soil line */ void SetS(const double s) @@ -699,7 +699,7 @@ public: return (m_S); } protected: - inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const ITK_OVERRIDE + inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const override { double dr = static_cast<double>(r); double dnir = static_cast<double>(nir); @@ -727,7 +727,7 @@ class MSAVI : public RAndNIRIndexBase<TInput1, TInput2, TOutput> { public: /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "MSAVI"; } @@ -739,7 +739,7 @@ public: { m_WDVIfunctor.SetS(m_S); } - ~MSAVI() ITK_OVERRIDE {} + ~MSAVI() override {} /** Set/Get Slop of soil line */ void SetS(const double s) { @@ -760,7 +760,7 @@ public: } protected: - inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const ITK_OVERRIDE + inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const override { double dnir = static_cast<double>(nir); double dr = static_cast<double>(r); @@ -802,16 +802,16 @@ class MSAVI2 : public RAndNIRIndexBase<TInput1, TInput2, TOutput> { public: /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "MSAVI2"; } MSAVI2() {} - ~MSAVI2() ITK_OVERRIDE {} + ~MSAVI2() override {} protected: - inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const ITK_OVERRIDE + inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const override { double dnir = static_cast<double>(nir); double dr = static_cast<double>(r); @@ -840,16 +840,16 @@ class GEMI : public RAndNIRIndexBase<TInput1, TInput2, TOutput> { public: /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "GEMI"; } GEMI() {} - ~GEMI() ITK_OVERRIDE {} + ~GEMI() override {} protected: - inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const ITK_OVERRIDE + inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const override { double dnir = static_cast<double>(nir); double dr = static_cast<double>(r); @@ -894,13 +894,13 @@ class AVI : public RAndGAndNIRIndexBase<TInput1, TInput2, TInput3, TOutput> { public: /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "AVI"; } AVI() : m_LambdaG(560.), m_LambdaR(660.), m_LambdaNir(830.) {} - ~AVI() ITK_OVERRIDE {} + ~AVI() override {} /** Set/Get Lambda red parameter*/ void SetLambdaR(const double lr) { @@ -929,7 +929,7 @@ public: return (m_LambdaNir); } protected: - inline TOutput Evaluate(const TInput1& r, const TInput2& g, const TInput3& nir) const ITK_OVERRIDE + inline TOutput Evaluate(const TInput1& r, const TInput2& g, const TInput3& nir) const override { double dr = static_cast<double>(r); double dg = static_cast<double>(g); @@ -989,13 +989,13 @@ class ARVI : public RAndBAndNIRIndexBase<TInput1, TInput2, TInput3, TOutput> { public: /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "ARVI"; } ARVI() : m_Gamma(0.5) {} - ~ARVI() ITK_OVERRIDE {} + ~ARVI() override {} /** Set/Get Gamma parameter */ void SetGamma(const double gamma) @@ -1008,7 +1008,7 @@ public: } protected: - inline TOutput Evaluate(const TInput1& r, const TInput2& b, const TInput3& nir) const ITK_OVERRIDE + inline TOutput Evaluate(const TInput1& r, const TInput2& b, const TInput3& nir) const override { double dr = static_cast<double>(r); double db = static_cast<double>(b); @@ -1043,13 +1043,13 @@ class TSARVI : public RAndBAndNIRIndexBase<TInput1, TInput2, TInput3, TOutput> { public: /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "TSARVI"; } TSARVI() : m_A(0.0), m_B(0.0), m_X(0.08), m_Gamma(0.5) {} - ~TSARVI() ITK_OVERRIDE {} + ~TSARVI() override {} /** Set/Get A and B parameters */ void SetA(const double A) @@ -1088,7 +1088,7 @@ public: } protected: - inline TOutput Evaluate(const TInput1& r, const TInput2& b, const TInput3& nir) const ITK_OVERRIDE + inline TOutput Evaluate(const TInput1& r, const TInput2& b, const TInput3& nir) const override { double dr = static_cast<double>(r); double db = static_cast<double>(b); @@ -1131,13 +1131,13 @@ class EVI : public RAndBAndNIRIndexBase<TInput1, TInput2, TInput3, TOutput> { public: /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "EVI"; } EVI() : m_G(2.5), m_C1(6.0), m_C2(7.5), m_L(1.0) {} - ~EVI() ITK_OVERRIDE {} + ~EVI() override {} /** Set/Get G parameter */ void SetG(const double g) { @@ -1175,7 +1175,7 @@ public: return (m_L); } protected: - inline TOutput Evaluate(const TInput1& r, const TInput2& b, const TInput3& nir) const ITK_OVERRIDE + inline TOutput Evaluate(const TInput1& r, const TInput2& b, const TInput3& nir) const override { double dr = static_cast<double>(r); double db = static_cast<double>(b); @@ -1218,16 +1218,16 @@ class IPVI : public RAndNIRIndexBase<TInput1, TInput2, TOutput> { public: /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "IPVI"; } IPVI() {} - ~IPVI() ITK_OVERRIDE {} + ~IPVI() override {} protected: - inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const ITK_OVERRIDE + inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const override { double dr = static_cast<double>(r); double dnir = static_cast<double>(nir); @@ -1257,14 +1257,14 @@ class TNDVI : public RAndNIRIndexBase<TInput1, TInput2, TOutput> { public: /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "TNDVI"; } typedef NDVI<TInput1, TInput2, TOutput> NDVIFunctorType; TNDVI() {} - ~TNDVI() ITK_OVERRIDE {} + ~TNDVI() override {} NDVIFunctorType GetNDVI(void) const { @@ -1272,7 +1272,7 @@ public: } protected: - inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const ITK_OVERRIDE + inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const override { double dval = this->GetNDVI() (r, nir) + 0.5; if (dval < 0) @@ -1309,14 +1309,14 @@ class LAIFromNDVILogarithmic : public RAndNIRIndexBase<TInput1, TInput2, TOutput { public: /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "LAIFromNDVILogarithmic"; } typedef NDVI<TInput1, TInput2, TOutput> NDVIFunctorType; LAIFromNDVILogarithmic() : m_NdviSoil(0.10), m_NdviInf(0.89), m_ExtinctionCoefficient(0.71) {} - ~LAIFromNDVILogarithmic() ITK_OVERRIDE {} + ~LAIFromNDVILogarithmic() override {} NDVIFunctorType GetNDVI(void) const { @@ -1351,7 +1351,7 @@ public: } protected: - inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const ITK_OVERRIDE + inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const override { double dval = this->GetNDVI() (r, nir); if (dval < 0) @@ -1395,14 +1395,14 @@ class LAIFromReflectancesLinear : public RAndNIRIndexBase<TInput1, TInput2, TOut { public: /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "LAIFromReflectancesLinear"; } typedef NDVI<TInput1, TInput2, TOutput> NDVIFunctorType; LAIFromReflectancesLinear() : m_RedCoef(-17.91), m_NirCoef(12.26) {} - ~LAIFromReflectancesLinear() ITK_OVERRIDE {} + ~LAIFromReflectancesLinear() override {} NDVIFunctorType GetReflectances(void) const { @@ -1428,7 +1428,7 @@ public: } protected: - inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const ITK_OVERRIDE + inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const override { return (static_cast<TOutput>(m_RedCoef*r+m_NirCoef*nir)); } @@ -1464,7 +1464,7 @@ private: public: /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "LAIFromNDVIFormosat2Functor"; } @@ -1472,10 +1472,10 @@ private: /// Constructor LAIFromNDVIFormosat2Functor() {} /// Desctructor - ~LAIFromNDVIFormosat2Functor() ITK_OVERRIDE {} + ~LAIFromNDVIFormosat2Functor() override {} // Operator on r and nir single pixel values protected: - inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const ITK_OVERRIDE + inline TOutput Evaluate(const TInput1& r, const TInput2& nir) const override { double a = 0.1519; double b = 3.9443; diff --git a/Modules/Radiometry/Indices/include/otbWaterIndicesFunctor.h b/Modules/Radiometry/Indices/include/otbWaterIndicesFunctor.h index 10f11fa3a8d2fd836b952996fe9bf67d747b8a0e..feb14fc3c9c02a64c8a6b94ad32b47da0d1ebc27 100644 --- a/Modules/Radiometry/Indices/include/otbWaterIndicesFunctor.h +++ b/Modules/Radiometry/Indices/include/otbWaterIndicesFunctor.h @@ -126,15 +126,15 @@ class WaterIndexFunctor : public WaterIndexBase<TInput1, TInput2, TOutput> { public: /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "WaterIndexFunctor"; } WaterIndexFunctor() {} - ~WaterIndexFunctor() ITK_OVERRIDE {} + ~WaterIndexFunctor() override {} protected: - inline TOutput Evaluate(const TInput1& id1, const TInput2& id2) const ITK_OVERRIDE + inline TOutput Evaluate(const TInput1& id1, const TInput2& id2) const override { double dindex1 = static_cast<double>(id1); double dindex2 = static_cast<double>(id2); @@ -202,7 +202,7 @@ class NDWI : public WaterIndexBase<TInput1, TInput2, TOutput> { public: /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "NDWI"; } @@ -211,7 +211,7 @@ public: /// Constructor NDWI() {} /// Desctructor - ~NDWI() ITK_OVERRIDE {} + ~NDWI() override {} WIFunctorType GetWIFunctor(void) const { return (m_WIFunctor); @@ -263,7 +263,7 @@ public: } protected: - inline TOutput Evaluate(const TInput1& nir, const TInput2& mir) const ITK_OVERRIDE + inline TOutput Evaluate(const TInput1& nir, const TInput2& mir) const override { return (static_cast<TOutput>(GetWIFunctor() (nir, mir))); } @@ -287,7 +287,7 @@ class NDWI2 : public WaterIndexBase<TInput1, TInput2, TOutput> { public: /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "NDWI2"; } @@ -296,7 +296,7 @@ public: /// Constructor NDWI2() {} /// Desctructor - ~NDWI2() ITK_OVERRIDE {} + ~NDWI2() override {} WIFunctorType GetWIFunctor(void) const { return (m_WIFunctor); @@ -348,7 +348,7 @@ public: } protected: - inline TOutput Evaluate(const TInput1& g, const TInput2& nir) const ITK_OVERRIDE + inline TOutput Evaluate(const TInput1& g, const TInput2& nir) const override { return (static_cast<TOutput>(GetWIFunctor() (g, nir))); } @@ -650,7 +650,7 @@ public: reference[0] = 136.0; reference[1] = 132.0; reference[2] = 47.0; reference[3] = 24.0; this->SetReferenceWaterPixel(reference); } - ~WaterSqrtSpectralAngleFunctor() ITK_OVERRIDE {} + ~WaterSqrtSpectralAngleFunctor() override {} /** Set Reference Pixel */ void SetReferenceWaterPixel(InputVectorPixelType ref) @@ -742,7 +742,7 @@ public: } protected: - inline TOutputPixel Evaluate(const TInputVectorPixel& inPix) const ITK_OVERRIDE + inline TOutputPixel Evaluate(const TInputVectorPixel& inPix) const override { return static_cast<TOutputPixel>(Superclass::Evaluate(inPix)); } diff --git a/Modules/Radiometry/Indices/include/otbWaterSqrtSpectralAngleImageFilter.h b/Modules/Radiometry/Indices/include/otbWaterSqrtSpectralAngleImageFilter.h index d90d827fd4da8254459ac0aef11ece3a09c5bdca..0ad1616833a671942b3ccadd6a37702754b441b5 100644 --- a/Modules/Radiometry/Indices/include/otbWaterSqrtSpectralAngleImageFilter.h +++ b/Modules/Radiometry/Indices/include/otbWaterSqrtSpectralAngleImageFilter.h @@ -73,7 +73,7 @@ public: protected: WaterSqrtSpectralAngleImageFilter() {} - ~WaterSqrtSpectralAngleImageFilter() ITK_OVERRIDE {} + ~WaterSqrtSpectralAngleImageFilter() override {} private: WaterSqrtSpectralAngleImageFilter(Self &); // purposely not implemented diff --git a/Modules/Radiometry/LandSatClassifier/include/otbLandsatTMSpectralRuleBasedClassifier.h b/Modules/Radiometry/LandSatClassifier/include/otbLandsatTMSpectralRuleBasedClassifier.h index 284312d81909ff7409e02284f27a3ff8132cfe39..f3bc34584916b874455e6a81c7838935d420404e 100644 --- a/Modules/Radiometry/LandSatClassifier/include/otbLandsatTMSpectralRuleBasedClassifier.h +++ b/Modules/Radiometry/LandSatClassifier/include/otbLandsatTMSpectralRuleBasedClassifier.h @@ -183,13 +183,13 @@ public: typedef bool OutputPixelType; /** Return the index name */ - std::string GetName() const ITK_OVERRIDE + std::string GetName() const override { return "LandsatTM SpectralRuleBasedClassifier"; } SpectralRuleBasedClassifier() { } - ~SpectralRuleBasedClassifier() ITK_OVERRIDE {} + ~SpectralRuleBasedClassifier() override {} inline TOutput operator ()(const TInput& inputPixel) { diff --git a/Modules/Radiometry/OpticalCalibration/include/otbAeronetData.h b/Modules/Radiometry/OpticalCalibration/include/otbAeronetData.h index 801554d15732e75a5c823385215918ba6ce8d940..20adbd6e39c275d9add6193dd394d0faccab2690 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbAeronetData.h +++ b/Modules/Radiometry/OpticalCalibration/include/otbAeronetData.h @@ -87,9 +87,9 @@ protected: /** Constructor */ AeronetData(); /** Destructor */ - ~AeronetData() ITK_OVERRIDE {} + ~AeronetData() override {} /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: /** Angstrom coefficient */ diff --git a/Modules/Radiometry/OpticalCalibration/include/otbAeronetFileReader.h b/Modules/Radiometry/OpticalCalibration/include/otbAeronetFileReader.h index 93b16a797967fd376eaec31a624b749619b15e4c..74a514a465424efe794aa28014f7eec1d5ae106a 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbAeronetFileReader.h +++ b/Modules/Radiometry/OpticalCalibration/include/otbAeronetFileReader.h @@ -126,12 +126,12 @@ protected: /** Constructor */ AeronetFileReader(); /** Destructor */ - ~AeronetFileReader() ITK_OVERRIDE; + ~AeronetFileReader() override; /** Main computation method */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: diff --git a/Modules/Radiometry/OpticalCalibration/include/otbAtmosphericCorrectionParameters.h b/Modules/Radiometry/OpticalCalibration/include/otbAtmosphericCorrectionParameters.h index 56f45de702acfb510599375252d05974961518cd..f1516e26efb033a9cc7b2add0fee3683d9594c23 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbAtmosphericCorrectionParameters.h +++ b/Modules/Radiometry/OpticalCalibration/include/otbAtmosphericCorrectionParameters.h @@ -137,12 +137,12 @@ public: /** Constructor */ AtmosphericCorrectionParameters(); /** Destructor */ - ~AtmosphericCorrectionParameters() ITK_OVERRIDE {} + ~AtmosphericCorrectionParameters() override {} protected: /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: AtmosphericCorrectionParameters(const Self &); //purposely not implemented diff --git a/Modules/Radiometry/OpticalCalibration/include/otbAtmosphericRadiativeTerms.h b/Modules/Radiometry/OpticalCalibration/include/otbAtmosphericRadiativeTerms.h index b219982e7902c8ceb2264f153069f52a845a5c8a..5daf902b5a73d8c3b87425145944f55d3f7d9fb8 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbAtmosphericRadiativeTerms.h +++ b/Modules/Radiometry/OpticalCalibration/include/otbAtmosphericRadiativeTerms.h @@ -119,9 +119,9 @@ protected: /** Constructor */ AtmosphericRadiativeTermsSingleChannel(); /** Destructor */ - ~AtmosphericRadiativeTermsSingleChannel() ITK_OVERRIDE {} + ~AtmosphericRadiativeTermsSingleChannel() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: AtmosphericRadiativeTermsSingleChannel(const Self &); //purposely not implemented @@ -266,9 +266,9 @@ protected: /** Constructor */ AtmosphericRadiativeTerms(); /** Destructor */ - ~AtmosphericRadiativeTerms() ITK_OVERRIDE {} + ~AtmosphericRadiativeTerms() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: AtmosphericRadiativeTerms(const Self &); //purposely not implemented diff --git a/Modules/Radiometry/OpticalCalibration/include/otbImageMetadataCorrectionParameters.h b/Modules/Radiometry/OpticalCalibration/include/otbImageMetadataCorrectionParameters.h index 6bcb770447952822d799c5f1933599e4fdbbf8d5..3a1b75de08914b827685231c2aa2b9be11804002 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbImageMetadataCorrectionParameters.h +++ b/Modules/Radiometry/OpticalCalibration/include/otbImageMetadataCorrectionParameters.h @@ -145,12 +145,12 @@ public: /** Constructor */ ImageMetadataCorrectionParameters(); /** Destructor */ - ~ImageMetadataCorrectionParameters() ITK_OVERRIDE {} + ~ImageMetadataCorrectionParameters() override {} protected: /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: ImageMetadataCorrectionParameters(const Self &); //purposely not implemented diff --git a/Modules/Radiometry/OpticalCalibration/include/otbImageToRadianceImageFilter.h b/Modules/Radiometry/OpticalCalibration/include/otbImageToRadianceImageFilter.h index fc8b7c3bbde428c1907ead63b869c77bd6707a78..695bdf33e113b6a8863e82ac9b4cb43e6c5dc290 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbImageToRadianceImageFilter.h +++ b/Modules/Radiometry/OpticalCalibration/include/otbImageToRadianceImageFilter.h @@ -171,10 +171,10 @@ protected: }; /** Destructor */ - ~ImageToRadianceImageFilter() ITK_OVERRIDE {} + ~ImageToRadianceImageFilter() override {} /** Update the functor list and input parameters */ - void BeforeThreadedGenerateData(void) ITK_OVERRIDE + void BeforeThreadedGenerateData(void) override { OpticalImageMetadataInterface::Pointer imageMetadataInterface = OpticalImageMetadataInterfaceFactory::CreateIMI( this->GetInput()->GetMetaDataDictionary()); diff --git a/Modules/Radiometry/OpticalCalibration/include/otbImageToReflectanceImageFilter.h b/Modules/Radiometry/OpticalCalibration/include/otbImageToReflectanceImageFilter.h index 6dbc688a7f1e0861f4624e0a14d2fab256a49293..8bca51abee384877da358abbf966502471f57767 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbImageToReflectanceImageFilter.h +++ b/Modules/Radiometry/OpticalCalibration/include/otbImageToReflectanceImageFilter.h @@ -251,10 +251,10 @@ protected: }; /** Destructor */ - ~ImageToReflectanceImageFilter() ITK_OVERRIDE {} + ~ImageToReflectanceImageFilter() override {} /** Update the functor list and input parameters */ - void BeforeThreadedGenerateData(void) ITK_OVERRIDE + void BeforeThreadedGenerateData(void) override { OpticalImageMetadataInterface::Pointer imageMetadataInterface = OpticalImageMetadataInterfaceFactory::CreateIMI( diff --git a/Modules/Radiometry/OpticalCalibration/include/otbRadianceToImageImageFilter.h b/Modules/Radiometry/OpticalCalibration/include/otbRadianceToImageImageFilter.h index b52793fb4817d27d510d91d31580225eb093808f..b7585dbfff57a6f9fdf383edb5592e7437c2b543 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbRadianceToImageImageFilter.h +++ b/Modules/Radiometry/OpticalCalibration/include/otbRadianceToImageImageFilter.h @@ -172,10 +172,10 @@ protected: }; /** Destructor */ - ~RadianceToImageImageFilter() ITK_OVERRIDE {} + ~RadianceToImageImageFilter() override {} /** Update the functor list and input parameters */ - void BeforeThreadedGenerateData(void) ITK_OVERRIDE + void BeforeThreadedGenerateData(void) override { OpticalImageMetadataInterface::Pointer imageMetadataInterface = OpticalImageMetadataInterfaceFactory::CreateIMI( this->GetInput()->GetMetaDataDictionary()); diff --git a/Modules/Radiometry/OpticalCalibration/include/otbRadianceToReflectanceImageFilter.h b/Modules/Radiometry/OpticalCalibration/include/otbRadianceToReflectanceImageFilter.h index 9e4d667b5edaa63752e2ff746b7fad97e2e4c3bf..07c6de1dac81368360768ec97d057c8cb8638431 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbRadianceToReflectanceImageFilter.h +++ b/Modules/Radiometry/OpticalCalibration/include/otbRadianceToReflectanceImageFilter.h @@ -247,10 +247,10 @@ protected: }; /** Destructor */ - ~RadianceToReflectanceImageFilter() ITK_OVERRIDE {} + ~RadianceToReflectanceImageFilter() override {} /** Update the functor list and input parameters */ - void BeforeThreadedGenerateData(void) ITK_OVERRIDE + void BeforeThreadedGenerateData(void) override { OpticalImageMetadataInterface::Pointer imageMetadataInterface = OpticalImageMetadataInterfaceFactory::CreateIMI( this->GetInput()->GetMetaDataDictionary()); diff --git a/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToImageImageFilter.h b/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToImageImageFilter.h index 6050d66777077a99b24d82a1baf04496947a2f1b..cba938f79dc85dbd76f1541a01dc3b8bd9422fdb 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToImageImageFilter.h +++ b/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToImageImageFilter.h @@ -237,10 +237,10 @@ protected: }; /** Destructor */ - ~ReflectanceToImageImageFilter() ITK_OVERRIDE {} + ~ReflectanceToImageImageFilter() override {} /** Update the functor list and input parameters */ - void BeforeThreadedGenerateData(void) ITK_OVERRIDE + void BeforeThreadedGenerateData(void) override { OpticalImageMetadataInterface::Pointer imageMetadataInterface = OpticalImageMetadataInterfaceFactory::CreateIMI( diff --git a/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToRadianceImageFilter.h b/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToRadianceImageFilter.h index 69352382feae6b50c9679f93586b71cedb6366d0..64e72fa0cdd714539a4f0abfa3857b265f8653d8 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToRadianceImageFilter.h +++ b/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToRadianceImageFilter.h @@ -231,10 +231,10 @@ protected: }; /** Destructor */ - ~ReflectanceToRadianceImageFilter() ITK_OVERRIDE {} + ~ReflectanceToRadianceImageFilter() override {} /** Update the functor list and input parameters */ - void BeforeThreadedGenerateData(void) ITK_OVERRIDE + void BeforeThreadedGenerateData(void) override { OpticalImageMetadataInterface::Pointer imageMetadataInterface = OpticalImageMetadataInterfaceFactory::CreateIMI( this->GetInput()->GetMetaDataDictionary()); diff --git a/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToSurfaceReflectanceImageFilter.h b/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToSurfaceReflectanceImageFilter.h index 7fc9c223503f3d4f51da64949e15efb3f3297740..df71735c0f7a329aab7e1a7bf25d280e95567766 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToSurfaceReflectanceImageFilter.h +++ b/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToSurfaceReflectanceImageFilter.h @@ -240,18 +240,18 @@ protected: /** Constructor */ ReflectanceToSurfaceReflectanceImageFilter(); /** Destructor */ - ~ReflectanceToSurfaceReflectanceImageFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~ReflectanceToSurfaceReflectanceImageFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Initialize the parameters of the functor before the threads run. */ - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; /** Fill AtmosphericRadiativeTerms using image metadata*/ void UpdateAtmosphericRadiativeTerms(); /** Update Functors parameters */ void UpdateFunctors(); /** If modified, we need to compute the functor parameters again */ - void Modified() const ITK_OVERRIDE; + void Modified() const override; private: diff --git a/Modules/Radiometry/OpticalCalibration/include/otbSpectralSensitivityReader.h b/Modules/Radiometry/OpticalCalibration/include/otbSpectralSensitivityReader.h index f1cb28992a6ea2dc9070bfba6dc65d5648ad540d..ddd04f0ef5e1ca30a18d72e4477de221c199503b 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbSpectralSensitivityReader.h +++ b/Modules/Radiometry/OpticalCalibration/include/otbSpectralSensitivityReader.h @@ -79,16 +79,16 @@ public: protected: SpectralSensitivityReader(); - ~SpectralSensitivityReader() ITK_OVERRIDE; + ~SpectralSensitivityReader() override; /** Main computation method */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** Find the filename using image metadata */ void FindFileName(); /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Struct use to remove multiple spaces in file */ struct BothAre diff --git a/Modules/Radiometry/OpticalCalibration/include/otbSurfaceAdjacencyEffectCorrectionSchemeFilter.h b/Modules/Radiometry/OpticalCalibration/include/otbSurfaceAdjacencyEffectCorrectionSchemeFilter.h index 435a88c0010cfda9bc07c3d16a3367c0e0a04874..8b1290f976ae0e97d9de3fb1ecdac91122fec471 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbSurfaceAdjacencyEffectCorrectionSchemeFilter.h +++ b/Modules/Radiometry/OpticalCalibration/include/otbSurfaceAdjacencyEffectCorrectionSchemeFilter.h @@ -267,11 +267,11 @@ public: protected: SurfaceAdjacencyEffectCorrectionSchemeFilter(); - ~SurfaceAdjacencyEffectCorrectionSchemeFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~SurfaceAdjacencyEffectCorrectionSchemeFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Initialize the parameters of the functor before the threads run. */ - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; /** Fill AtmosphericRadiativeTerms using image metadata*/ void UpdateAtmosphericRadiativeTerms(); @@ -280,7 +280,7 @@ protected: void UpdateFunctors(); /** If modified, we need to compute the functor parameters again */ - void Modified() const ITK_OVERRIDE; + void Modified() const override; private: diff --git a/Modules/Radiometry/OpticalCalibration/include/otbWavelengthSpectralBands.h b/Modules/Radiometry/OpticalCalibration/include/otbWavelengthSpectralBands.h index 94d5afcb8b27bcdd71a99ac1e2740519f756ff1c..444e811611fa3e56acd2b927d05c69d918c0772b 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbWavelengthSpectralBands.h +++ b/Modules/Radiometry/OpticalCalibration/include/otbWavelengthSpectralBands.h @@ -63,10 +63,10 @@ protected: /** Constructor */ WavelengthSpectralBands(); /** Destructor */ - ~WavelengthSpectralBands() ITK_OVERRIDE {} + ~WavelengthSpectralBands() override {} /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: WavelengthSpectralBands(const Self &); //purposely not implemented diff --git a/Modules/Radiometry/SARCalibration/include/otbSarBrightnessFunction.h b/Modules/Radiometry/SARCalibration/include/otbSarBrightnessFunction.h index 6284aba4f72f139b628a91bf6ea243c862ed0ca3..2b4ae21d3f926324984cda4ea767479a2056560e 100644 --- a/Modules/Radiometry/SARCalibration/include/otbSarBrightnessFunction.h +++ b/Modules/Radiometry/SARCalibration/include/otbSarBrightnessFunction.h @@ -85,17 +85,17 @@ public: typedef typename ParametricFunctionType::ConstPointer ParametricFunctionConstPointer; /** Evalulate the function at specified index */ - OutputType EvaluateAtIndex(const IndexType& index) const ITK_OVERRIDE; + OutputType EvaluateAtIndex(const IndexType& index) const override; /** Evaluate the function at non-integer positions */ - OutputType Evaluate(const PointType& point) const ITK_OVERRIDE + OutputType Evaluate(const PointType& point) const override { IndexType index; this->ConvertPointToNearestIndex(point, index); return this->EvaluateAtIndex(index); } OutputType EvaluateAtContinuousIndex( - const ContinuousIndexType& cindex) const ITK_OVERRIDE + const ContinuousIndexType& cindex) const override { IndexType index; this->ConvertContinuousIndexToNearestIndex(cindex, index); @@ -106,7 +106,7 @@ public: * \warning this method caches BufferedRegion information. * If the BufferedRegion has changed, user must call * SetInputImage again to update cached values. */ - void SetInputImage( const InputImageType * ptr ) ITK_OVERRIDE; + void SetInputImage( const InputImageType * ptr ) override; /** Get/Set the Scale value */ @@ -140,8 +140,8 @@ public: protected: SarBrightnessFunction(); - ~SarBrightnessFunction() ITK_OVERRIDE{} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~SarBrightnessFunction() override{} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: SarBrightnessFunction(const Self &); //purposely not implemented diff --git a/Modules/Radiometry/SARCalibration/include/otbSarBrightnessToImageFilter.h b/Modules/Radiometry/SARCalibration/include/otbSarBrightnessToImageFilter.h index 7fa55f16c2ae663ed54441589e769c551bf01d39..f7587b4130238b99ae729961fa45ec3e695af344 100644 --- a/Modules/Radiometry/SARCalibration/include/otbSarBrightnessToImageFilter.h +++ b/Modules/Radiometry/SARCalibration/include/otbSarBrightnessToImageFilter.h @@ -84,12 +84,12 @@ public: protected: SarBrightnessToImageFilter(); - ~SarBrightnessToImageFilter() ITK_OVERRIDE {} + ~SarBrightnessToImageFilter() override {} /** Update the function list and input parameters*/ - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: SarBrightnessToImageFilter(const Self &); //purposely not implemented void operator =(const Self&); //purposely not implemented diff --git a/Modules/Radiometry/SARCalibration/include/otbSarDeburstImageFilter.h b/Modules/Radiometry/SARCalibration/include/otbSarDeburstImageFilter.h index 9733b50c1d57761afcaf309c61fb76011bcc6cdd..e65b7e680939eb0c266c963e4ee10e41df2f3190 100644 --- a/Modules/Radiometry/SARCalibration/include/otbSarDeburstImageFilter.h +++ b/Modules/Radiometry/SARCalibration/include/otbSarDeburstImageFilter.h @@ -70,16 +70,16 @@ protected: SarDeburstImageFilter(); // Destructor - virtual ~SarDeburstImageFilter() ITK_OVERRIDE {}; + virtual ~SarDeburstImageFilter() override {}; // Needs to be re-implemented since size of output is modified - virtual void GenerateOutputInformation() ITK_OVERRIDE; + virtual void GenerateOutputInformation() override; // Needs to be re-implemented since size of output is modified - virtual void GenerateInputRequestedRegion() ITK_OVERRIDE; + virtual void GenerateInputRequestedRegion() override; // Actual processing - virtual void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + virtual void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId) override; RegionType OutputRegionToInputRegion(const RegionType& outputRegion) const; diff --git a/Modules/Radiometry/SARCalibration/include/otbSarParametricMapFunction.h b/Modules/Radiometry/SARCalibration/include/otbSarParametricMapFunction.h index 0ce4d69bb9e78f0597f941c19129766ecca00241..17dd6372fd197980ade38c4e755251063b1aefb5 100644 --- a/Modules/Radiometry/SARCalibration/include/otbSarParametricMapFunction.h +++ b/Modules/Radiometry/SARCalibration/include/otbSarParametricMapFunction.h @@ -79,10 +79,10 @@ public: typedef typename itk::NumericTraits<InputPixelType>::ScalarRealType RealType; /** Evaluate the function at specific positions */ - RealType Evaluate(const PointType& point) const ITK_OVERRIDE; + RealType Evaluate(const PointType& point) const override; /** Evalulate the function at specified index */ - RealType EvaluateAtIndex(const IndexType& index) const ITK_OVERRIDE + RealType EvaluateAtIndex(const IndexType& index) const override { PointType point; point[0] = static_cast<typename PointType::ValueType>(index[0]); @@ -91,7 +91,7 @@ public: } RealType EvaluateAtContinuousIndex( - const ContinuousIndexType& cindex) const ITK_OVERRIDE + const ContinuousIndexType& cindex) const override { IndexType index; this->ConvertContinuousIndexToNearestIndex(cindex, index); @@ -127,8 +127,8 @@ public: protected: SarParametricMapFunction(); - ~SarParametricMapFunction() ITK_OVERRIDE{} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~SarParametricMapFunction() override{} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: SarParametricMapFunction(const Self &); //purposely not implemented diff --git a/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationFunction.h b/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationFunction.h index eb78e1d76542fd6dd48d94b14addd69a5d416ab9..3fb6463376aa78d5fa1915af16ed6d469217e3b3 100644 --- a/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationFunction.h +++ b/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationFunction.h @@ -82,17 +82,17 @@ public: typedef typename ParametricFunctionType::ConstPointer ParametricFunctionConstPointer; /** Evalulate the function at specified index */ - OutputType EvaluateAtIndex(const IndexType& index) const ITK_OVERRIDE; + OutputType EvaluateAtIndex(const IndexType& index) const override; /** Evaluate the function at non-integer positions */ - OutputType Evaluate(const PointType& point) const ITK_OVERRIDE + OutputType Evaluate(const PointType& point) const override { IndexType index; this->ConvertPointToNearestIndex(point, index); return this->EvaluateAtIndex(index); } - OutputType EvaluateAtContinuousIndex(const ContinuousIndexType& cindex) const ITK_OVERRIDE + OutputType EvaluateAtContinuousIndex(const ContinuousIndexType& cindex) const override { IndexType index; this->ConvertContinuousIndexToNearestIndex(cindex, index); @@ -103,7 +103,7 @@ public: * \warning this method caches BufferedRegion information. * If the BufferedRegion has changed, user must call * SetInputImage again to update cached values. */ - void SetInputImage( const InputImageType * ptr ) ITK_OVERRIDE; + void SetInputImage( const InputImageType * ptr ) override; /** Get/Set the Scale value */ @@ -172,10 +172,10 @@ protected: SarRadiometricCalibrationFunction(); /** default, empty, virtual dtor */ - ~SarRadiometricCalibrationFunction() ITK_OVERRIDE{} + ~SarRadiometricCalibrationFunction() override{} /** print method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Flags to indicate if these values needs to be applied in calibration*/ diff --git a/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationToImageFilter.h b/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationToImageFilter.h index 9910ddf76ee7f964f0d729fb8a5d6871677a9004..19e49832d819f9bb1f9819a20e14a2051028da89 100644 --- a/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationToImageFilter.h +++ b/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationToImageFilter.h @@ -112,13 +112,13 @@ protected: SarRadiometricCalibrationToImageFilter(); /** Empty, default virtual dtor */ - ~SarRadiometricCalibrationToImageFilter() ITK_OVERRIDE {} + ~SarRadiometricCalibrationToImageFilter() override {} /** Generate output information */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; /** Update the function list and input parameters*/ - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; private: diff --git a/Modules/Radiometry/SARCalibration/include/otbTerraSarBrightnessImageFilter.h b/Modules/Radiometry/SARCalibration/include/otbTerraSarBrightnessImageFilter.h index 0fe02d2e356009e24335abc1993fb66e03e0f3a9..ca65a82c4938273efca8667fcdace633f33404e4 100644 --- a/Modules/Radiometry/SARCalibration/include/otbTerraSarBrightnessImageFilter.h +++ b/Modules/Radiometry/SARCalibration/include/otbTerraSarBrightnessImageFilter.h @@ -143,10 +143,10 @@ protected: /** Constructor */ TerraSarBrightnessImageFilter(){}; /** Destructor */ - ~TerraSarBrightnessImageFilter() ITK_OVERRIDE {} + ~TerraSarBrightnessImageFilter() override {} /** Initialize the functor vector */ - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; private: TerraSarBrightnessImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Radiometry/Simulation/include/otbAtmosphericEffects.h b/Modules/Radiometry/Simulation/include/otbAtmosphericEffects.h index 1ed84cf295867d5cc916a16f27aac64211c63c59..bf33680f8621474107c737066808ed821a50114a 100644 --- a/Modules/Radiometry/Simulation/include/otbAtmosphericEffects.h +++ b/Modules/Radiometry/Simulation/include/otbAtmosphericEffects.h @@ -96,7 +96,7 @@ class AtmosphericEffects /** Constructor from a ASCII file */ //AtmosphericEffects( const std::string & filename ); /** Destructor */ - ~AtmosphericEffects() ITK_OVERRIDE {}; + ~AtmosphericEffects() override {}; /** PrintSelf method */ //void PrintSelf(std::ostream& os, itk::Indent indent) const; diff --git a/Modules/Radiometry/Simulation/include/otbImageSimulationMethod.h b/Modules/Radiometry/Simulation/include/otbImageSimulationMethod.h index 999d65aafebfbab7db9bbbf01e00c8e94fdf74e7..04973ed9a706ae8c6d47ecba03912103e3eb0903 100644 --- a/Modules/Radiometry/Simulation/include/otbImageSimulationMethod.h +++ b/Modules/Radiometry/Simulation/include/otbImageSimulationMethod.h @@ -166,13 +166,13 @@ public: protected: ImageSimulationMethod(); - ~ImageSimulationMethod() ITK_OVERRIDE + ~ImageSimulationMethod() override { } - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; // virtual void GenerateData(); - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; private: ImageSimulationMethod(const Self &); //purposely not implemented diff --git a/Modules/Radiometry/Simulation/include/otbLabelMapToSimulatedImageFilter.h b/Modules/Radiometry/Simulation/include/otbLabelMapToSimulatedImageFilter.h index 2bbed5e700aa682638e0755ebc2f5083a5b94868..c8dd54ea8907ee4db0456af153023fd8791294b7 100644 --- a/Modules/Radiometry/Simulation/include/otbLabelMapToSimulatedImageFilter.h +++ b/Modules/Radiometry/Simulation/include/otbLabelMapToSimulatedImageFilter.h @@ -120,12 +120,12 @@ public: protected: LabelMapToSimulatedImageFilter(); - ~LabelMapToSimulatedImageFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~LabelMapToSimulatedImageFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; - void BeforeThreadedGenerateData() ITK_OVERRIDE; - void ThreadedProcessLabelObject( LabelObjectType * labelObject ) ITK_OVERRIDE; - void GenerateOutputInformation() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; + void ThreadedProcessLabelObject( LabelObjectType * labelObject ) override; + void GenerateOutputInformation() override; private: diff --git a/Modules/Radiometry/Simulation/include/otbLabelToProSailParameters.h b/Modules/Radiometry/Simulation/include/otbLabelToProSailParameters.h index a91fbae7931b6d145f4a30545ff502032726a6ab..a65f6998e4d6c843b1729ee4956888e42e728545 100644 --- a/Modules/Radiometry/Simulation/include/otbLabelToProSailParameters.h +++ b/Modules/Radiometry/Simulation/include/otbLabelToProSailParameters.h @@ -86,11 +86,11 @@ public: // virtual const ParametersType & GetStep1Parameters(); //virtual const ParametersType & GetStep2Parameters(); - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; protected: LabelToProSailParameters(); - ~LabelToProSailParameters() ITK_OVERRIDE {} + ~LabelToProSailParameters() override {} private: diff --git a/Modules/Radiometry/Simulation/include/otbLabelToSimulationParametersBase.h b/Modules/Radiometry/Simulation/include/otbLabelToSimulationParametersBase.h index 0b524971556245b04c773be3ec40ad484f25d4f5..db03b1bbe21ee95f09d61f7711b9e4c2f8bc33a5 100644 --- a/Modules/Radiometry/Simulation/include/otbLabelToSimulationParametersBase.h +++ b/Modules/Radiometry/Simulation/include/otbLabelToSimulationParametersBase.h @@ -93,7 +93,7 @@ public: protected: LabelToSimulationParametersBase(){}; - ~LabelToSimulationParametersBase() ITK_OVERRIDE {} + ~LabelToSimulationParametersBase() override {} private: diff --git a/Modules/Radiometry/Simulation/include/otbLeafParameters.h b/Modules/Radiometry/Simulation/include/otbLeafParameters.h index 1ed4e20a10d7be7c9798e39319b773628343e6d8..ed7af69394bd465918e24c681fc4088930d051d1 100644 --- a/Modules/Radiometry/Simulation/include/otbLeafParameters.h +++ b/Modules/Radiometry/Simulation/include/otbLeafParameters.h @@ -78,9 +78,9 @@ class OTBSimulation_EXPORT LeafParameters : public itk::DataObject /** Constructor */ LeafParameters(); /** Destructor */ - ~LeafParameters() ITK_OVERRIDE; + ~LeafParameters() override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: LeafParameters(const Self&); //purposely not implemented diff --git a/Modules/Radiometry/Simulation/include/otbProSailParameters.h b/Modules/Radiometry/Simulation/include/otbProSailParameters.h index ea021d2811178d4c2d55ffbdad044e00e60b2356..5790a66ed30b6c14da3db6f34c577077c6408142 100644 --- a/Modules/Radiometry/Simulation/include/otbProSailParameters.h +++ b/Modules/Radiometry/Simulation/include/otbProSailParameters.h @@ -115,7 +115,7 @@ class ITK_EXPORT ProSailParameters : public itk::DataObject /** Destructor */ virtual ~ProSailParameters() {}; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: diff --git a/Modules/Radiometry/Simulation/include/otbProspectModel.h b/Modules/Radiometry/Simulation/include/otbProspectModel.h index 7b7468068a8a35d9fac1cb6b9914b8eb47a4006c..668659c09dd08811036fdc774f0c2d538a3c96e1 100644 --- a/Modules/Radiometry/Simulation/include/otbProspectModel.h +++ b/Modules/Radiometry/Simulation/include/otbProspectModel.h @@ -66,21 +66,21 @@ class OTBSimulation_EXPORT ProspectModel : public SimulationStep1Base LeafParametersType * GetInput(); /** GenerateData */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** Get Output reflectance/transmittance*/ - SpectralResponseType * GetReflectance() ITK_OVERRIDE; - SpectralResponseType * GetTransmittance() ITK_OVERRIDE; + SpectralResponseType * GetReflectance() override; + SpectralResponseType * GetTransmittance() override; protected: /** Constructor */ ProspectModel(); /** Destructor */ - ~ProspectModel() ITK_OVERRIDE; + ~ProspectModel() override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; - DataObjectPointer MakeOutput(DataObjectPointerArraySizeType) ITK_OVERRIDE; + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType) override; using Superclass::MakeOutput; /** Compute Transmission of isotropic radiation across an interface between two dielectrics*/ diff --git a/Modules/Radiometry/Simulation/include/otbReduceSpectralResponse.h b/Modules/Radiometry/Simulation/include/otbReduceSpectralResponse.h index d9a944bf7d1c9f639b718d6aeee7e030f2fd8646..4a97b1ec994337aedb1f48d0ea5bf70598adda2b 100644 --- a/Modules/Radiometry/Simulation/include/otbReduceSpectralResponse.h +++ b/Modules/Radiometry/Simulation/include/otbReduceSpectralResponse.h @@ -113,7 +113,7 @@ public: virtual bool Clear(); /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** * \param PrecisionType @@ -135,7 +135,7 @@ protected: /** Constructor from a ASCII file */ //ReduceSpectralResponse( const std::string & filename ); /** Destructor */ - ~ReduceSpectralResponse() ITK_OVERRIDE + ~ReduceSpectralResponse() override { } ; diff --git a/Modules/Radiometry/Simulation/include/otbReduceSpectralResponseClassifierRAndNIR.h b/Modules/Radiometry/Simulation/include/otbReduceSpectralResponseClassifierRAndNIR.h index 7050b8c0a51e5c29e349fdf981b0f8827a3a0c25..c8e334ae5ec59c6c94140ad88406557b675994a7 100644 --- a/Modules/Radiometry/Simulation/include/otbReduceSpectralResponseClassifierRAndNIR.h +++ b/Modules/Radiometry/Simulation/include/otbReduceSpectralResponseClassifierRAndNIR.h @@ -109,7 +109,7 @@ namespace otb /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** @@ -125,7 +125,7 @@ namespace otb /** Constructor from a ASCII file */ //ReduceSpectralResponseClassifierRAndNIR( const std::string & filename ); /** Destructor */ - ~ReduceSpectralResponseClassifierRAndNIR() ITK_OVERRIDE {}; + ~ReduceSpectralResponseClassifierRAndNIR() override {}; /** PrintSelf method */ //void PrintSelf(std::ostream& os, itk::Indent indent) const; diff --git a/Modules/Radiometry/Simulation/include/otbSatelliteRSR.h b/Modules/Radiometry/Simulation/include/otbSatelliteRSR.h index 4cc13e159852eda76206b12bb8759ed77f868f9d..2fde7522dfb442ac29b5237a588e337b2d3a391e 100644 --- a/Modules/Radiometry/Simulation/include/otbSatelliteRSR.h +++ b/Modules/Radiometry/Simulation/include/otbSatelliteRSR.h @@ -127,7 +127,7 @@ public: inline ValuePrecisionType operator()(const PrecisionType & lambda, const unsigned int numBand); /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** get vector of RSR */ RSRVectorType & GetRSR() @@ -147,7 +147,7 @@ protected: /** Constructor from a ASCII file */ //SatelliteRSR( const std::string & filename ); /** Destructor */ - ~SatelliteRSR() ITK_OVERRIDE + ~SatelliteRSR() override { } ; diff --git a/Modules/Radiometry/Simulation/include/otbSimulationStep1Base.h b/Modules/Radiometry/Simulation/include/otbSimulationStep1Base.h index 9bb396188b725ef75ed88ce5c35f45b702b52684..ecf5472ab0d109796d5d9c533fd3cd819ee2417f 100644 --- a/Modules/Radiometry/Simulation/include/otbSimulationStep1Base.h +++ b/Modules/Radiometry/Simulation/include/otbSimulationStep1Base.h @@ -69,7 +69,7 @@ public: protected: SimulationStep1Base(){}; - ~SimulationStep1Base() ITK_OVERRIDE {} + ~SimulationStep1Base() override {} private: diff --git a/Modules/Radiometry/Simulation/include/otbSimulationStep2Base.h b/Modules/Radiometry/Simulation/include/otbSimulationStep2Base.h index 10db201a365a101d201a36ab36770106ba7d03f1..5aed410ef77c42c6074acbbadac90c4ac837e6fc 100644 --- a/Modules/Radiometry/Simulation/include/otbSimulationStep2Base.h +++ b/Modules/Radiometry/Simulation/include/otbSimulationStep2Base.h @@ -70,7 +70,7 @@ protected: { } ; - ~SimulationStep2Base() ITK_OVERRIDE + ~SimulationStep2Base() override { } diff --git a/Modules/Radiometry/Simulation/include/otbSpatialisationFilter.h b/Modules/Radiometry/Simulation/include/otbSpatialisationFilter.h index 3009be20fea4452f4c868713b84b4c5ae1011f50..7e5b72aa987d4be9408953f92b76804485c99434 100644 --- a/Modules/Radiometry/Simulation/include/otbSpatialisationFilter.h +++ b/Modules/Radiometry/Simulation/include/otbSpatialisationFilter.h @@ -112,12 +112,12 @@ public: protected: SpatialisationFilter(); - ~SpatialisationFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~SpatialisationFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; virtual void ProcessObject(unsigned int obj); - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; private: SpatialisationFilter(const Self &); //purposely not implemented diff --git a/Modules/Radiometry/Simulation/include/otbSpectralResponse.h b/Modules/Radiometry/Simulation/include/otbSpectralResponse.h index 5ccd1fa935d3a2ccb7bc31041013b9989dfba4b4..789924e4f5948b5182087744c9a442c37f78aacf 100644 --- a/Modules/Radiometry/Simulation/include/otbSpectralResponse.h +++ b/Modules/Radiometry/Simulation/include/otbSpectralResponse.h @@ -104,7 +104,7 @@ public: void Load(const std::string & filename, ValuePrecisionType coefNormalization = 1.0); /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** get vector of spectral responses */ VectorPairType & GetResponse() @@ -163,7 +163,7 @@ protected: /** Constructor from a ASCII file */ //SpectralResponse( const std::string & filename ); /** Destructor */ - ~SpectralResponse() ITK_OVERRIDE + ~SpectralResponse() override { } ; diff --git a/Modules/Radiometry/Simulation/include/otbSurfaceReflectanceToReflectanceFilter.h b/Modules/Radiometry/Simulation/include/otbSurfaceReflectanceToReflectanceFilter.h index c07fbd4c97638e0154b88e1d2c2a4df8d614ecda..840f880dbef325d0cb7596a95f49ec331edb975b 100644 --- a/Modules/Radiometry/Simulation/include/otbSurfaceReflectanceToReflectanceFilter.h +++ b/Modules/Radiometry/Simulation/include/otbSurfaceReflectanceToReflectanceFilter.h @@ -263,18 +263,18 @@ protected: /** Constructor */ SurfaceReflectanceToReflectanceFilter(); /** Destructor */ - ~SurfaceReflectanceToReflectanceFilter() ITK_OVERRIDE {}; + ~SurfaceReflectanceToReflectanceFilter() override {}; /** Initialize the functor vector */ - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; /** Fill AtmosphericRadiativeTerms using image metadata*/ void UpdateAtmosphericRadiativeTerms(); /** Update Functors parameters */ void UpdateFunctors(); /** If modified, we need to compute the functor parameters again */ - void Modified() const ITK_OVERRIDE; + void Modified() const override; private: diff --git a/Modules/Registration/DisparityMap/include/otbDisparityMapEstimationMethod.h b/Modules/Registration/DisparityMap/include/otbDisparityMapEstimationMethod.h index 0ace44f23c6c1ec8d0c74b0ec51e800067d700c0..56a89eeccb9a26a7e10ea2a9aeb600ff214f73b7 100644 --- a/Modules/Registration/DisparityMap/include/otbDisparityMapEstimationMethod.h +++ b/Modules/Registration/DisparityMap/include/otbDisparityMapEstimationMethod.h @@ -184,15 +184,15 @@ protected: /** * Destructor. */ - ~DisparityMapEstimationMethod() ITK_OVERRIDE; + ~DisparityMapEstimationMethod() override; /** * Standard PrintSelf method. */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** * Main computation method. */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; private: DisparityMapEstimationMethod(const Self &); //purposely not implemented diff --git a/Modules/Registration/DisparityMap/include/otbDisparityMapMedianFilter.h b/Modules/Registration/DisparityMap/include/otbDisparityMapMedianFilter.h index 3c8b7d22e79364fa686590d9fb00df83a0f1e547..1031f95bbf3738b890c538dab55d7c0deeb447dc 100644 --- a/Modules/Registration/DisparityMap/include/otbDisparityMapMedianFilter.h +++ b/Modules/Registration/DisparityMap/include/otbDisparityMapMedianFilter.h @@ -151,8 +151,8 @@ public: protected: DisparityMapMedianFilter(); - ~DisparityMapMedianFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~DisparityMapMedianFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** MedianImageFilter needs a larger input requested region than * the output requested region. As such, MedianImageFilter needs @@ -160,13 +160,13 @@ protected: * in order to inform the pipeline execution model. * * \sa ImageToImageFilter::GenerateInputRequestedRegion() */ - void GenerateInputRequestedRegion() throw(itk::InvalidRequestedRegionError) ITK_OVERRIDE; + void GenerateInputRequestedRegion() throw(itk::InvalidRequestedRegionError) override; /** Generate output information */ - void GenerateOutputInformation(void) ITK_OVERRIDE; + void GenerateOutputInformation(void) override; /** apply median filter */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; private: DisparityMapMedianFilter(const Self&); //purposely not implemented diff --git a/Modules/Registration/DisparityMap/include/otbDisparityMapTo3DFilter.h b/Modules/Registration/DisparityMap/include/otbDisparityMapTo3DFilter.h index eb505e58dd0cf555431190cdc5208e912907a033..1558f7592f33bf0232b3813064dc20e82cd81eaf 100644 --- a/Modules/Registration/DisparityMap/include/otbDisparityMapTo3DFilter.h +++ b/Modules/Registration/DisparityMap/include/otbDisparityMapTo3DFilter.h @@ -144,26 +144,26 @@ protected: DisparityMapTo3DFilter(); /** Destructor */ - ~DisparityMapTo3DFilter() ITK_OVERRIDE; + ~DisparityMapTo3DFilter() override; /** Generate output information */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; /** Generate input requested region */ - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; /** Before threaded generate data */ - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; /** Threaded generate data */ - void ThreadedGenerateData(const RegionType & outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void ThreadedGenerateData(const RegionType & outputRegionForThread, itk::ThreadIdType threadId) override; /** Override VerifyInputInformation() since this filter's inputs do * not need to occupy the same physical space. * * \sa ProcessObject::VerifyInputInformation */ - void VerifyInputInformation() ITK_OVERRIDE {} + void VerifyInputInformation() override {} private: diff --git a/Modules/Registration/DisparityMap/include/otbDisparityMapToDEMFilter.h b/Modules/Registration/DisparityMap/include/otbDisparityMapToDEMFilter.h index 0e3bb5905db48d59b37efdb28a5d320db0afdfcb..7ed891c1f2b5d84822138dbf0360741e76f0588a 100644 --- a/Modules/Registration/DisparityMap/include/otbDisparityMapToDEMFilter.h +++ b/Modules/Registration/DisparityMap/include/otbDisparityMapToDEMFilter.h @@ -149,29 +149,29 @@ protected: DisparityMapToDEMFilter(); /** Destructor */ - ~DisparityMapToDEMFilter() ITK_OVERRIDE; + ~DisparityMapToDEMFilter() override; /** Generate output information */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; /** Generate input requested region */ - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; /** Before threaded generate data */ - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; /** Threaded generate data */ - void ThreadedGenerateData(const RegionType & outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void ThreadedGenerateData(const RegionType & outputRegionForThread, itk::ThreadIdType threadId) override; /** After threaded generate data : sum up temporary DEMs */ - void AfterThreadedGenerateData() ITK_OVERRIDE; + void AfterThreadedGenerateData() override; /** Override VerifyInputInformation() since this filter's inputs do * not need to occupy the same physical space. * * \sa ProcessObject::VerifyInputInformation */ - void VerifyInputInformation() ITK_OVERRIDE {} + void VerifyInputInformation() override {} private: diff --git a/Modules/Registration/DisparityMap/include/otbDisparityTranslateFilter.h b/Modules/Registration/DisparityMap/include/otbDisparityTranslateFilter.h index fb811e230f5a89d1a46e8a4c620cfddb9e27373a..92133ed381d638932c898f104b12de92d945f195 100644 --- a/Modules/Registration/DisparityMap/include/otbDisparityTranslateFilter.h +++ b/Modules/Registration/DisparityMap/include/otbDisparityTranslateFilter.h @@ -119,23 +119,23 @@ protected: DisparityTranslateFilter(); /** Destructor */ - ~DisparityTranslateFilter() ITK_OVERRIDE{}; + ~DisparityTranslateFilter() override{}; /** Generate output information */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; /** Generate input requested region */ - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; /** Threaded generate data */ - void ThreadedGenerateData(const RegionType & outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void ThreadedGenerateData(const RegionType & outputRegionForThread, itk::ThreadIdType threadId) override; /** Override VerifyInputInformation() since this filter's inputs do * not need to occupy the same physical space. * * \sa ProcessObject::VerifyInputInformation */ - void VerifyInputInformation() ITK_OVERRIDE {} + void VerifyInputInformation() override {} private: diff --git a/Modules/Registration/DisparityMap/include/otbFineRegistrationImageFilter.h b/Modules/Registration/DisparityMap/include/otbFineRegistrationImageFilter.h index 18bd032b64624cede4b264b2041035f534e80e74..5d909dd2796ac87abfc43360be6596c0b1e1e11d 100644 --- a/Modules/Registration/DisparityMap/include/otbFineRegistrationImageFilter.h +++ b/Modules/Registration/DisparityMap/include/otbFineRegistrationImageFilter.h @@ -189,16 +189,16 @@ protected: /** Constructor */ FineRegistrationImageFilter(); /** Destructor */ - ~FineRegistrationImageFilter() ITK_OVERRIDE {}; + ~FineRegistrationImageFilter() override {}; /** Threaded generate data */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** Generate the input requested regions */ - void GenerateInputRequestedRegion(void) ITK_OVERRIDE; + void GenerateInputRequestedRegion(void) override; /** Generate output information */ - void GenerateOutputInformation(void) ITK_OVERRIDE; + void GenerateOutputInformation(void) override; private: FineRegistrationImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Registration/DisparityMap/include/otbMultiDisparityMapTo3DFilter.h b/Modules/Registration/DisparityMap/include/otbMultiDisparityMapTo3DFilter.h index c6cdc5f21146b862ad478a4793a1a486ce56abe5..94a28101d54851c3ffa473979700068aa0c7ddc6 100644 --- a/Modules/Registration/DisparityMap/include/otbMultiDisparityMapTo3DFilter.h +++ b/Modules/Registration/DisparityMap/include/otbMultiDisparityMapTo3DFilter.h @@ -157,19 +157,19 @@ protected: MultiDisparityMapTo3DFilter(); /** Destructor */ - ~MultiDisparityMapTo3DFilter() ITK_OVERRIDE; + ~MultiDisparityMapTo3DFilter() override; /** Generate output information */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; /** Generate input requested region */ - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; /** Before threaded generate data */ - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; /** Threaded generate data */ - void ThreadedGenerateData(const RegionType & outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void ThreadedGenerateData(const RegionType & outputRegionForThread, itk::ThreadIdType threadId) override; private: MultiDisparityMapTo3DFilter(const Self&); //purposely not implemented diff --git a/Modules/Registration/DisparityMap/include/otbNCCRegistrationFilter.h b/Modules/Registration/DisparityMap/include/otbNCCRegistrationFilter.h index c33bb1791455a120a8689b5ef66e7cdad6f9983a..b7b7a724364125700428b40cc76954b6a6aac361 100644 --- a/Modules/Registration/DisparityMap/include/otbNCCRegistrationFilter.h +++ b/Modules/Registration/DisparityMap/include/otbNCCRegistrationFilter.h @@ -137,18 +137,18 @@ public: protected: NCCRegistrationFilter(); - ~NCCRegistrationFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~NCCRegistrationFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Initialize the state of filter and equation before each iteration. */ - void InitializeIteration() ITK_OVERRIDE; + void InitializeIteration() override; /** Apply update. */ using Superclass::ApplyUpdate; virtual void ApplyUpdate(TimeStepType dt); /** Update the Input requested region. */ - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; private: NCCRegistrationFilter(const Self &); //purposely not implemented diff --git a/Modules/Registration/DisparityMap/include/otbNCCRegistrationFunction.h b/Modules/Registration/DisparityMap/include/otbNCCRegistrationFunction.h index 352ea6d16c776ada443004b1799203b6cdd26301..ac5580ab6fdd3f2ed536d5608be5bebd8f9afb77 100644 --- a/Modules/Registration/DisparityMap/include/otbNCCRegistrationFunction.h +++ b/Modules/Registration/DisparityMap/include/otbNCCRegistrationFunction.h @@ -120,38 +120,38 @@ public: } /** This class uses a constant timestep of 1. */ - TimeStepType ComputeGlobalTimeStep(void * itkNotUsed(GlobalData)) const ITK_OVERRIDE + TimeStepType ComputeGlobalTimeStep(void * itkNotUsed(GlobalData)) const override { return m_TimeStep; } /** Return a pointer to a global data structure that is passed to * this object from the solver at each calculation. */ - void *GetGlobalDataPointer() const ITK_OVERRIDE + void *GetGlobalDataPointer() const override { GlobalDataStruct *global = new GlobalDataStruct(); return global; } /** Release memory for global data structure. */ - void ReleaseGlobalDataPointer(void *GlobalData) const ITK_OVERRIDE + void ReleaseGlobalDataPointer(void *GlobalData) const override { delete (GlobalDataStruct *) GlobalData; } /** Set the object's state before each iteration. */ - void InitializeIteration() ITK_OVERRIDE; + void InitializeIteration() override; /** This method is called by a finite difference solver image filter at * each pixel that does not lie on a data set boundary */ PixelType ComputeUpdate(const NeighborhoodType& neighborhood, void *globalData, - const FloatOffsetType& offset = FloatOffsetType(0.0)) ITK_OVERRIDE; + const FloatOffsetType& offset = FloatOffsetType(0.0)) override; protected: NCCRegistrationFunction(); - ~NCCRegistrationFunction() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~NCCRegistrationFunction() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** FixedImage image neighborhood iterator type. */ typedef itk::ConstNeighborhoodIterator<FixedImageType> FixedImageNeighborhoodIteratorType; diff --git a/Modules/Registration/DisparityMap/include/otbPixelWiseBlockMatchingImageFilter.h b/Modules/Registration/DisparityMap/include/otbPixelWiseBlockMatchingImageFilter.h index 824e65da5db61fb5f2d6e9156daf1a39a24ad990..496ee3a4236231104d0b550a7a78e956d676073b 100644 --- a/Modules/Registration/DisparityMap/include/otbPixelWiseBlockMatchingImageFilter.h +++ b/Modules/Registration/DisparityMap/include/otbPixelWiseBlockMatchingImageFilter.h @@ -418,10 +418,10 @@ public: return m_Functor; } - /** Set initial horizontal disparity field (optional, ITK_OVERRIDE m_InitHorizontalDisparity) */ + /** Set initial horizontal disparity field (optional, override m_InitHorizontalDisparity) */ void SetHorizontalDisparityInput( const TOutputDisparityImage * hfield); - /** Set initial vertical disparity field (optional, ITK_OVERRIDE m_InitVerticalDisparity) */ + /** Set initial vertical disparity field (optional, override m_InitVerticalDisparity) */ void SetVerticalDisparityInput( const TOutputDisparityImage * vfield); /** Get the initial disparity fields */ @@ -447,19 +447,19 @@ protected: PixelWiseBlockMatchingImageFilter(); /** Destructor */ - ~PixelWiseBlockMatchingImageFilter() ITK_OVERRIDE; + ~PixelWiseBlockMatchingImageFilter() override; /** Generate output information */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; /** Generate input requested region */ - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; /** Before threaded generate data */ - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; /** Threaded generate data */ - void ThreadedGenerateData(const RegionType & outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void ThreadedGenerateData(const RegionType & outputRegionForThread, itk::ThreadIdType threadId) override; private: PixelWiseBlockMatchingImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Registration/DisparityMap/include/otbSubPixelDisparityImageFilter.h b/Modules/Registration/DisparityMap/include/otbSubPixelDisparityImageFilter.h index 316930a2aa8c5692a101904fa973b4f835079a74..c5489f78ead9381e379944fb49554ba28b5d9870 100644 --- a/Modules/Registration/DisparityMap/include/otbSubPixelDisparityImageFilter.h +++ b/Modules/Registration/DisparityMap/include/otbSubPixelDisparityImageFilter.h @@ -210,29 +210,29 @@ protected: SubPixelDisparityImageFilter(); /** Destructor */ - ~SubPixelDisparityImageFilter() ITK_OVERRIDE; + ~SubPixelDisparityImageFilter() override; /** \brief Verify that the input images are compatible * * This method needs to be re-implemented from ImageToImageFilter since * the initial images and disparity maps may not have the same size */ - void VerifyInputInformation() ITK_OVERRIDE; + void VerifyInputInformation() override; /** Generate output information */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; /** Generate input requested region */ - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; /** Before threaded generate data */ - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; /** Threaded generate data */ - void ThreadedGenerateData(const RegionType & outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void ThreadedGenerateData(const RegionType & outputRegionForThread, itk::ThreadIdType threadId) override; /** After threaded generate data */ - void AfterThreadedGenerateData() ITK_OVERRIDE; + void AfterThreadedGenerateData() override; private: SubPixelDisparityImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Registration/DisplacementField/include/otbBSplinesInterpolateDisplacementFieldGenerator.h b/Modules/Registration/DisplacementField/include/otbBSplinesInterpolateDisplacementFieldGenerator.h index 8f89e6315535ad4831eef88c6301db3e3fc9def0..93d440ead4c2ebc9760434f8f08757134b270239 100644 --- a/Modules/Registration/DisplacementField/include/otbBSplinesInterpolateDisplacementFieldGenerator.h +++ b/Modules/Registration/DisplacementField/include/otbBSplinesInterpolateDisplacementFieldGenerator.h @@ -66,11 +66,11 @@ protected: /** Constructor */ BSplinesInterpolateDisplacementFieldGenerator() {}; /** Destructor */ - ~BSplinesInterpolateDisplacementFieldGenerator() ITK_OVERRIDE {} + ~BSplinesInterpolateDisplacementFieldGenerator() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Main computation method */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; private: BSplinesInterpolateDisplacementFieldGenerator(const Self &); //purposely not implemented diff --git a/Modules/Registration/DisplacementField/include/otbBSplinesInterpolateTransformDisplacementFieldGenerator.h b/Modules/Registration/DisplacementField/include/otbBSplinesInterpolateTransformDisplacementFieldGenerator.h index 4af2d2a82ee54a8ebd4cbb1387950a72ca8c5c75..8ead3ebe92f3a9d8dc70cb6d9719742c45def90e 100644 --- a/Modules/Registration/DisplacementField/include/otbBSplinesInterpolateTransformDisplacementFieldGenerator.h +++ b/Modules/Registration/DisplacementField/include/otbBSplinesInterpolateTransformDisplacementFieldGenerator.h @@ -106,13 +106,13 @@ protected: /** Constructor */ BSplinesInterpolateTransformDisplacementFieldGenerator(); /** Destructor */ - ~BSplinesInterpolateTransformDisplacementFieldGenerator() ITK_OVERRIDE {} + ~BSplinesInterpolateTransformDisplacementFieldGenerator() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Main computation method */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; /** * Test whether a parameter is angular or not. diff --git a/Modules/Registration/DisplacementField/include/otbNNearestPointsLinearInterpolateDisplacementFieldGenerator.h b/Modules/Registration/DisplacementField/include/otbNNearestPointsLinearInterpolateDisplacementFieldGenerator.h index 341499979f7085c17c33458cd52dad4228fada03..0aaa57fcca326196526f7abc554db57b8aa505f1 100644 --- a/Modules/Registration/DisplacementField/include/otbNNearestPointsLinearInterpolateDisplacementFieldGenerator.h +++ b/Modules/Registration/DisplacementField/include/otbNNearestPointsLinearInterpolateDisplacementFieldGenerator.h @@ -67,11 +67,11 @@ protected: /** Constructor */ NNearestPointsLinearInterpolateDisplacementFieldGenerator() {}; /** Destructor */ - ~NNearestPointsLinearInterpolateDisplacementFieldGenerator() ITK_OVERRIDE {} + ~NNearestPointsLinearInterpolateDisplacementFieldGenerator() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Main computation method */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; private: NNearestPointsLinearInterpolateDisplacementFieldGenerator(const Self &); //purposely not implemented diff --git a/Modules/Registration/DisplacementField/include/otbNNearestTransformsLinearInterpolateDisplacementFieldGenerator.h b/Modules/Registration/DisplacementField/include/otbNNearestTransformsLinearInterpolateDisplacementFieldGenerator.h index e83a3675615afe02cf5daaa4b3fb68da63320fed..a3f307fb40ae1336c1b8e769f5cd682d867fad60 100644 --- a/Modules/Registration/DisplacementField/include/otbNNearestTransformsLinearInterpolateDisplacementFieldGenerator.h +++ b/Modules/Registration/DisplacementField/include/otbNNearestTransformsLinearInterpolateDisplacementFieldGenerator.h @@ -74,11 +74,11 @@ protected: /** Constructor */ NNearestTransformsLinearInterpolateDisplacementFieldGenerator() {}; /** Destructor */ - ~NNearestTransformsLinearInterpolateDisplacementFieldGenerator() ITK_OVERRIDE {} + ~NNearestTransformsLinearInterpolateDisplacementFieldGenerator() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Main computation method */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; private: NNearestTransformsLinearInterpolateDisplacementFieldGenerator(const Self &); //purposely not implemented diff --git a/Modules/Registration/DisplacementField/include/otbNearestPointDisplacementFieldGenerator.h b/Modules/Registration/DisplacementField/include/otbNearestPointDisplacementFieldGenerator.h index cfe80219b10e2581f73672db12f5a89164d415a3..b52405d6c10cd9fbac9c4a66e2bc70dbf7e72bf7 100644 --- a/Modules/Registration/DisplacementField/include/otbNearestPointDisplacementFieldGenerator.h +++ b/Modules/Registration/DisplacementField/include/otbNearestPointDisplacementFieldGenerator.h @@ -64,11 +64,11 @@ protected: /** Constructor */ NearestPointDisplacementFieldGenerator() {}; /** Destructor */ - ~NearestPointDisplacementFieldGenerator() ITK_OVERRIDE {} + ~NearestPointDisplacementFieldGenerator() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Main computation method */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; private: NearestPointDisplacementFieldGenerator(const Self &); //purposely not implemented diff --git a/Modules/Registration/DisplacementField/include/otbNearestTransformDisplacementFieldGenerator.h b/Modules/Registration/DisplacementField/include/otbNearestTransformDisplacementFieldGenerator.h index 0ddae1eb841225158f8aa3657d82a2f2f93dd4d7..cda52183223b97a8f8756c6fd7dade9722c1e2ff 100644 --- a/Modules/Registration/DisplacementField/include/otbNearestTransformDisplacementFieldGenerator.h +++ b/Modules/Registration/DisplacementField/include/otbNearestTransformDisplacementFieldGenerator.h @@ -67,11 +67,11 @@ protected: /** Constructor */ NearestTransformDisplacementFieldGenerator() {}; /** Destructor */ - ~NearestTransformDisplacementFieldGenerator() ITK_OVERRIDE {} + ~NearestTransformDisplacementFieldGenerator() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Main computation method */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; private: NearestTransformDisplacementFieldGenerator(const Self &); //purposely not implemented diff --git a/Modules/Registration/DisplacementField/include/otbPointSetToDisplacementFieldGenerator.h b/Modules/Registration/DisplacementField/include/otbPointSetToDisplacementFieldGenerator.h index 77028b48b4b169e2844943282a1f69ca66f912f5..bbd237cb10ea0a11cefad72488bd4ac63afaeb22 100644 --- a/Modules/Registration/DisplacementField/include/otbPointSetToDisplacementFieldGenerator.h +++ b/Modules/Registration/DisplacementField/include/otbPointSetToDisplacementFieldGenerator.h @@ -125,11 +125,11 @@ protected: /** Constructor */ PointSetToDisplacementFieldGenerator(); /** Destructor */ - ~PointSetToDisplacementFieldGenerator() ITK_OVERRIDE {} + ~PointSetToDisplacementFieldGenerator() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Generate output information */ - void GenerateOutputInformation(void) ITK_OVERRIDE; + void GenerateOutputInformation(void) override; /** * Generate the n nearest valid point in point set, where a valid point has a sufficient metric value. * \param index The index of the pixel to compute. diff --git a/Modules/Registration/DisplacementField/include/otbPointSetWithTransformToDisplacementFieldGenerator.h b/Modules/Registration/DisplacementField/include/otbPointSetWithTransformToDisplacementFieldGenerator.h index 998c1f57c288fad58eb6789a73b96857213cbe70..7618deceb6201ecf1baa9c22cb96d4d7f0ec482d 100644 --- a/Modules/Registration/DisplacementField/include/otbPointSetWithTransformToDisplacementFieldGenerator.h +++ b/Modules/Registration/DisplacementField/include/otbPointSetWithTransformToDisplacementFieldGenerator.h @@ -84,9 +84,9 @@ protected: /** Constructor */ PointSetWithTransformToDisplacementFieldGenerator(); /** Destructor */ - ~PointSetWithTransformToDisplacementFieldGenerator() ITK_OVERRIDE {} + ~PointSetWithTransformToDisplacementFieldGenerator() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: PointSetWithTransformToDisplacementFieldGenerator(const Self &); //purposely not implemented diff --git a/Modules/Registration/Stereo/include/otbAdhesionCorrectionFilter.h b/Modules/Registration/Stereo/include/otbAdhesionCorrectionFilter.h index 1f3e48d17784320ee721ce579741af0ce79e3e6d..9e6542dfd2932364a070999e83a8cb04922ee632 100644 --- a/Modules/Registration/Stereo/include/otbAdhesionCorrectionFilter.h +++ b/Modules/Registration/Stereo/include/otbAdhesionCorrectionFilter.h @@ -151,16 +151,16 @@ protected: /** Constructor */ AdhesionCorrectionFilter(); /** Destructor */ - ~AdhesionCorrectionFilter() ITK_OVERRIDE {}; + ~AdhesionCorrectionFilter() override {}; /** Threaded generate data */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** Generate the input requested regions */ - void GenerateInputRequestedRegion(void) ITK_OVERRIDE; + void GenerateInputRequestedRegion(void) override; /** Generate output information */ - void GenerateOutputInformation(void) ITK_OVERRIDE; + void GenerateOutputInformation(void) override; private: AdhesionCorrectionFilter(const Self&); //purposely not implemented diff --git a/Modules/Registration/Stereo/include/otbBijectionCoherencyFilter.h b/Modules/Registration/Stereo/include/otbBijectionCoherencyFilter.h index a9f620fbc24ebc3ca2db2efef4b0b682ba266218..07cd1703d74e6eb809e5e08561cae2e3197a0b2e 100644 --- a/Modules/Registration/Stereo/include/otbBijectionCoherencyFilter.h +++ b/Modules/Registration/Stereo/include/otbBijectionCoherencyFilter.h @@ -114,16 +114,16 @@ protected: BijectionCoherencyFilter(); /** Destructor */ - ~BijectionCoherencyFilter() ITK_OVERRIDE{}; + ~BijectionCoherencyFilter() override{}; /** Generate output information */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; /** Generate input requested region */ - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; /** Threaded generate data */ - void ThreadedGenerateData(const OutputRegionType & outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void ThreadedGenerateData(const OutputRegionType & outputRegionForThread, itk::ThreadIdType threadId) override; private: BijectionCoherencyFilter(const Self&); //purposely not implemented diff --git a/Modules/Registration/Stereo/include/otbLineOfSightOptimizer.h b/Modules/Registration/Stereo/include/otbLineOfSightOptimizer.h index 419381bc19d3f8c6c0cd22d6edd581e2ba663a77..c7e96cbb106cb9dde235f121a03781bbcc99542f 100644 --- a/Modules/Registration/Stereo/include/otbLineOfSightOptimizer.h +++ b/Modules/Registration/Stereo/include/otbLineOfSightOptimizer.h @@ -87,7 +87,7 @@ protected: LineOfSightOptimizer(); /** Destructor */ - ~LineOfSightOptimizer() ITK_OVERRIDE{}; + ~LineOfSightOptimizer() override{}; private: diff --git a/Modules/Registration/Stereo/include/otbMulti3DMapToDEMFilter.h b/Modules/Registration/Stereo/include/otbMulti3DMapToDEMFilter.h index 21e8287b64695538db359950de0d079d6ab743e8..6dc2c0e1a943957b8fa947e7c61e9709794dde90 100644 --- a/Modules/Registration/Stereo/include/otbMulti3DMapToDEMFilter.h +++ b/Modules/Registration/Stereo/include/otbMulti3DMapToDEMFilter.h @@ -232,29 +232,29 @@ protected: Multi3DMapToDEMFilter(); /** Destructor */ - ~Multi3DMapToDEMFilter() ITK_OVERRIDE; + ~Multi3DMapToDEMFilter() override; /** Generate output information */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; /** Generate input requested region */ - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; /** Before threaded generate data */ - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; /** Threaded generate data */ - void ThreadedGenerateData(const RegionType & outputRegionForThread, itk::ThreadIdType threadId) ITK_OVERRIDE; + void ThreadedGenerateData(const RegionType & outputRegionForThread, itk::ThreadIdType threadId) override; /** After threaded generate data */ - void AfterThreadedGenerateData() ITK_OVERRIDE; + void AfterThreadedGenerateData() override; /** Override VerifyInputInformation() since this filter's inputs do * not need to occupy the same physical space. * * \sa ProcessObject::VerifyInputInformation */ - void VerifyInputInformation() ITK_OVERRIDE {} + void VerifyInputInformation() override {} private: diff --git a/Modules/Registration/Stereo/include/otbStereoSensorModelToElevationMapFilter.h b/Modules/Registration/Stereo/include/otbStereoSensorModelToElevationMapFilter.h index 8a5137c4f662ce0aee315573f403199a363424a7..40d1423006d9aed543b6a6305ffea9ab4a74ecbf 100644 --- a/Modules/Registration/Stereo/include/otbStereoSensorModelToElevationMapFilter.h +++ b/Modules/Registration/Stereo/include/otbStereoSensorModelToElevationMapFilter.h @@ -190,24 +190,24 @@ protected: StereoSensorModelToElevationFilter(); /** Destructor */ - ~StereoSensorModelToElevationFilter() ITK_OVERRIDE; + ~StereoSensorModelToElevationFilter() override; /** Threaded generate data */ void ThreadedGenerateData(const OutputRegionType& outputRegionForThread, - itk::ThreadIdType threadId) ITK_OVERRIDE; + itk::ThreadIdType threadId) override; /** Generate the input requested regions */ - void GenerateInputRequestedRegion(void) ITK_OVERRIDE; + void GenerateInputRequestedRegion(void) override; /** Things to do before the threaded generate-data */ - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; /** Override VerifyInputInformation() since this filter's inputs do * not need to occupy the same physical space. * * \sa ProcessObject::VerifyInputInformation */ - void VerifyInputInformation() ITK_OVERRIDE {} + void VerifyInputInformation() override {} private: diff --git a/Modules/Registration/Stereo/include/otbStereorectificationDisplacementFieldSource.h b/Modules/Registration/Stereo/include/otbStereorectificationDisplacementFieldSource.h index 8fe1adc44f7e3d3de212df479d9ba885ad79a0a7..efd6ed38cfa2315f8ebb039e3c9950037b013c03 100644 --- a/Modules/Registration/Stereo/include/otbStereorectificationDisplacementFieldSource.h +++ b/Modules/Registration/Stereo/include/otbStereorectificationDisplacementFieldSource.h @@ -166,19 +166,19 @@ protected: StereorectificationDisplacementFieldSource( void ); /** Destructor */ - ~StereorectificationDisplacementFieldSource( void ) ITK_OVERRIDE {}; + ~StereorectificationDisplacementFieldSource( void ) override {}; /** Generate output images information */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; /** Enlarge output requested region (no streaming) */ - void EnlargeOutputRequestedRegion(itk::DataObject * itkNotUsed(output)) ITK_OVERRIDE; + void EnlargeOutputRequestedRegion(itk::DataObject * itkNotUsed(output)) override; /** Compute the deformation field */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** PrintSelf method */ - void PrintSelf( std::ostream& os, itk::Indent indent ) const ITK_OVERRIDE; + void PrintSelf( std::ostream& os, itk::Indent indent ) const override; private: StereorectificationDisplacementFieldSource( const Self& ); // purposely diff --git a/Modules/Remote/otb-bv.remote.cmake b/Modules/Remote/otb-bv.remote.cmake index 06e067e6586cc345fed2d1f6aade487cf08350b3..739f46126b5c658ce1eb11dcd0d07879dfbbcc8d 100644 --- a/Modules/Remote/otb-bv.remote.cmake +++ b/Modules/Remote/otb-bv.remote.cmake @@ -22,8 +22,8 @@ otb_fetch_module(OTBBioVars "Biophysical variable estimation from remote sensing imagery. A more detailed description can be found on the project website: -http://tully.ups-tlse.fr/jordi/otb-bv +https://gitlab.orfeo-toolbox.org/jinglada/otb-bv " - GIT_REPOSITORY http://tully.ups-tlse.fr/jordi/otb-bv.git + GIT_REPOSITORY https://gitlab.orfeo-toolbox.org/jinglada/otb-bv.git GIT_TAG 0e56e487aebc4a493e25223960560e9ef0ca27ec ) diff --git a/Modules/Remote/phenotb.remote.cmake b/Modules/Remote/phenotb.remote.cmake index aa9e9a8ead204e1b3a4f8492e16825c838da95d7..74d83a9d96d04bd545ee5b02d4790fcac6ab6e3e 100644 --- a/Modules/Remote/phenotb.remote.cmake +++ b/Modules/Remote/phenotb.remote.cmake @@ -24,8 +24,8 @@ otb_fetch_module(OTBPhenology information from time profiles. These time profiles should represent vegetation status as for instance NDVI, LAI, etc. A more detailed description can be found on the project website: -http://tully.ups-tlse.fr/jordi/phenotb +https://gitlab.orfeo-toolbox.org/jinglada/phenotb " - GIT_REPOSITORY http://tully.ups-tlse.fr/jordi/phenotb.git + GIT_REPOSITORY https://gitlab.orfeo-toolbox.org/jinglada/phenotb.git GIT_TAG c9349eb89a652a18b28a40dfb3fa352b76388527 ) diff --git a/Modules/Remote/temporal-gapfilling.remote.cmake b/Modules/Remote/temporal-gapfilling.remote.cmake index 469a857fb8119f1564de992b6d0481f82920e61b..2dd788d21391a19390f40ac90ff3af1b5271311b 100644 --- a/Modules/Remote/temporal-gapfilling.remote.cmake +++ b/Modules/Remote/temporal-gapfilling.remote.cmake @@ -23,9 +23,9 @@ otb_fetch_module(OTBTemporalGapFilling "Gapfilling for time series replaces invalid pixels (as designated by a mask) by an interpolation using the valid dates of the series. A more detailed description can be found on the project website: -http://tully.ups-tlse.fr/jordi/temporalgapfilling +https://gitlab.orfeo-toolbox.org/jinglada/temporalgapfilling " - GIT_REPOSITORY http://tully.ups-tlse.fr/jordi/temporalgapfilling.git + GIT_REPOSITORY https://gitlab.orfeo-toolbox.org/jinglada/temporalgapfilling.git # Commit on develop branch which includes patches for Windows support GIT_TAG 4fc4a71acf7b9b051cda5a3b950de2cdb9d26287 ) diff --git a/Modules/Segmentation/CCOBIA/include/otbLabelObjectOpeningMuParserFilter.h b/Modules/Segmentation/CCOBIA/include/otbLabelObjectOpeningMuParserFilter.h index 867b94ec407c8e1b6073df37d91433776f61a235..b5bf076015771e81b74418113437a3b85880c9ef 100644 --- a/Modules/Segmentation/CCOBIA/include/otbLabelObjectOpeningMuParserFilter.h +++ b/Modules/Segmentation/CCOBIA/include/otbLabelObjectOpeningMuParserFilter.h @@ -111,18 +111,18 @@ public: /** return list of Mu Parser functions**/ Parser::FunctionMapType GetFunList() const; - void AllocateOutputs() ITK_OVERRIDE; + void AllocateOutputs() override; - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; - void EnlargeOutputRequestedRegion(itk::DataObject *) ITK_OVERRIDE {} + void EnlargeOutputRequestedRegion(itk::DataObject *) override {} - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; protected: LabelObjectOpeningMuParserFilter(); - ~LabelObjectOpeningMuParserFilter() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~LabelObjectOpeningMuParserFilter() override; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: LabelObjectOpeningMuParserFilter(const Self&); //purposely not implemented diff --git a/Modules/Segmentation/CCOBIA/include/otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h b/Modules/Segmentation/CCOBIA/include/otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h index a33dd9d86c6ac02e3e44c8c139df4fb8e4ad223d..047c0efafcd055e944d92f233f74ab77bacd47e2 100644 --- a/Modules/Segmentation/CCOBIA/include/otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h +++ b/Modules/Segmentation/CCOBIA/include/otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h @@ -181,9 +181,9 @@ public: protected: PersistentConnectedComponentSegmentationOBIAToVectorDataFilter(); - ~PersistentConnectedComponentSegmentationOBIAToVectorDataFilter() ITK_OVERRIDE; + ~PersistentConnectedComponentSegmentationOBIAToVectorDataFilter() override; - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; private: ObjectSizeType m_MinimumObjectSize; @@ -199,7 +199,7 @@ private: bool m_ComputeFeretDiameter; bool m_ComputePerimeter; - VectorDataPointerType ProcessTile() ITK_OVERRIDE; + VectorDataPointerType ProcessTile() override; }; /** \class StreamingConnectedComponentSegmentationOBIAToVectorDataFilter diff --git a/Modules/Segmentation/Conversion/include/otbLabelImageRegionMergingFilter.h b/Modules/Segmentation/Conversion/include/otbLabelImageRegionMergingFilter.h index b3781f7237a8740dac4eb43c0e70fcbc135a3533..0664c20e2792139d7863fb0be055e32fefbc9e05 100644 --- a/Modules/Segmentation/Conversion/include/otbLabelImageRegionMergingFilter.h +++ b/Modules/Segmentation/Conversion/include/otbLabelImageRegionMergingFilter.h @@ -115,20 +115,20 @@ public: InputSpectralImageType * GetInputSpectralImage(); protected: - void EnlargeOutputRequestedRegion( itk::DataObject *output ) ITK_OVERRIDE; + void EnlargeOutputRequestedRegion( itk::DataObject *output ) override; - void GenerateOutputInformation(void) ITK_OVERRIDE; + void GenerateOutputInformation(void) override; - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** Constructor */ LabelImageRegionMergingFilter(); /** Destructor */ - ~LabelImageRegionMergingFilter() ITK_OVERRIDE; + ~LabelImageRegionMergingFilter() override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Method to build a map of adjacent regions */ RegionAdjacencyMapType LabelImageToRegionAdjacencyMap(typename OutputLabelImageType::Pointer inputLabelImage); diff --git a/Modules/Segmentation/Conversion/include/otbLabelImageRegionPruningFilter.h b/Modules/Segmentation/Conversion/include/otbLabelImageRegionPruningFilter.h index b881185a7651e6f89bfe1248ecf36257b41f5b63..932d64309ae3cd62aed1df6437eafef73074ca89 100644 --- a/Modules/Segmentation/Conversion/include/otbLabelImageRegionPruningFilter.h +++ b/Modules/Segmentation/Conversion/include/otbLabelImageRegionPruningFilter.h @@ -114,20 +114,20 @@ public: InputSpectralImageType * GetInputSpectralImage(); protected: - void EnlargeOutputRequestedRegion( itk::DataObject *output ) ITK_OVERRIDE; + void EnlargeOutputRequestedRegion( itk::DataObject *output ) override; - void GenerateOutputInformation(void) ITK_OVERRIDE; + void GenerateOutputInformation(void) override; - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** Constructor */ LabelImageRegionPruningFilter(); /** Destructor */ - ~LabelImageRegionPruningFilter() ITK_OVERRIDE; + ~LabelImageRegionPruningFilter() override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Method to build a map of adjacent regions */ RegionAdjacencyMapType LabelImageToRegionAdjacencyMap(typename OutputLabelImageType::Pointer inputLabelImage); diff --git a/Modules/Segmentation/Conversion/include/otbLabelImageToOGRDataSourceFilter.h b/Modules/Segmentation/Conversion/include/otbLabelImageToOGRDataSourceFilter.h index eef1020ad71e1dac2084f8179d41122d5fd57842..9e0202ef81990a9b72f59b09b95d3260ae57a825 100644 --- a/Modules/Segmentation/Conversion/include/otbLabelImageToOGRDataSourceFilter.h +++ b/Modules/Segmentation/Conversion/include/otbLabelImageToOGRDataSourceFilter.h @@ -114,17 +114,17 @@ public: protected: LabelImageToOGRDataSourceFilter(); - ~LabelImageToOGRDataSourceFilter() ITK_OVERRIDE {} + ~LabelImageToOGRDataSourceFilter() override {} - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; /** Generate Data method*/ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** DataObject pointer */ typedef itk::DataObject::Pointer DataObjectPointer; - DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override; using Superclass::MakeOutput; private: diff --git a/Modules/Segmentation/Conversion/include/otbLabelImageToVectorDataFilter.h b/Modules/Segmentation/Conversion/include/otbLabelImageToVectorDataFilter.h index a72ae77386e5433cb8f4af1b5537b82739c375bb..6d1b189be323c92235abf44187ebf528d6643ff8 100644 --- a/Modules/Segmentation/Conversion/include/otbLabelImageToVectorDataFilter.h +++ b/Modules/Segmentation/Conversion/include/otbLabelImageToVectorDataFilter.h @@ -104,12 +104,12 @@ public: protected: LabelImageToVectorDataFilter(); - ~LabelImageToVectorDataFilter() ITK_OVERRIDE {} + ~LabelImageToVectorDataFilter() override {} - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; /** Generate Data method*/ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; private: LabelImageToVectorDataFilter(const Self &); //purposely not implemented diff --git a/Modules/Segmentation/Conversion/include/otbLabelMapToVectorDataFilter.h b/Modules/Segmentation/Conversion/include/otbLabelMapToVectorDataFilter.h index 8b81e0365317e6b4cc74bd6e3bb155e327b0d970..3e17c8983fac86b18aa6b352802a1c63b9f634cf 100644 --- a/Modules/Segmentation/Conversion/include/otbLabelMapToVectorDataFilter.h +++ b/Modules/Segmentation/Conversion/include/otbLabelMapToVectorDataFilter.h @@ -115,9 +115,9 @@ public: protected: LabelMapToVectorDataFilter(); - ~LabelMapToVectorDataFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - void GenerateData() ITK_OVERRIDE; + ~LabelMapToVectorDataFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; + void GenerateData() override; private: LabelMapToVectorDataFilter(const Self &); //purposely not implemented diff --git a/Modules/Segmentation/Conversion/include/otbOGRDataSourceToLabelImageFilter.h b/Modules/Segmentation/Conversion/include/otbOGRDataSourceToLabelImageFilter.h index 421075334f14fb41a2ebc4b9f4a826f4f44e8e82..bec0926d8d85c83e4e1d8408d3710c89cd72b708 100644 --- a/Modules/Segmentation/Conversion/include/otbOGRDataSourceToLabelImageFilter.h +++ b/Modules/Segmentation/Conversion/include/otbOGRDataSourceToLabelImageFilter.h @@ -140,14 +140,14 @@ public: void SetOutputParametersFromImage(const ImageBaseType * image); protected: - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; OGRDataSourceToLabelImageFilter(); - ~OGRDataSourceToLabelImageFilter() ITK_OVERRIDE {} + ~OGRDataSourceToLabelImageFilter() override {} - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: OGRDataSourceToLabelImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Segmentation/Conversion/include/otbPersistentImageToOGRLayerFilter.h b/Modules/Segmentation/Conversion/include/otbPersistentImageToOGRLayerFilter.h index 433917b811ba7eb60340e25584f97942972e3910..98c5760c62587acb166c418b4807d07f946d55be 100644 --- a/Modules/Segmentation/Conversion/include/otbPersistentImageToOGRLayerFilter.h +++ b/Modules/Segmentation/Conversion/include/otbPersistentImageToOGRLayerFilter.h @@ -74,9 +74,9 @@ public: typedef ogr::Layer OGRLayerType; typedef ogr::Feature OGRFeatureType; - void AllocateOutputs() ITK_OVERRIDE; - void Reset(void) ITK_OVERRIDE; - void Synthetize(void) ITK_OVERRIDE; + void AllocateOutputs() override; + void Reset(void) override; + void Synthetize(void) override; /** This method creates the output layer in the OGRLayer set by the user. * \note This methode must be called before the call of Update . @@ -96,11 +96,11 @@ public: protected: PersistentImageToOGRLayerFilter(); - ~PersistentImageToOGRLayerFilter() ITK_OVERRIDE; + ~PersistentImageToOGRLayerFilter() override; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; private: diff --git a/Modules/Segmentation/Conversion/include/otbPersistentImageToVectorDataFilter.h b/Modules/Segmentation/Conversion/include/otbPersistentImageToVectorDataFilter.h index e5f1aef4611538cbb815886f53b3e86e09ba15ca..3b49caaa61c3558bc6e5c95aee58a22290947eee 100644 --- a/Modules/Segmentation/Conversion/include/otbPersistentImageToVectorDataFilter.h +++ b/Modules/Segmentation/Conversion/include/otbPersistentImageToVectorDataFilter.h @@ -86,11 +86,11 @@ public: OutputVectorDataType* GetOutputVectorData() const; - void AllocateOutputs() ITK_OVERRIDE; + void AllocateOutputs() override; - void Reset(void) ITK_OVERRIDE; + void Reset(void) override; - void Synthetize(void) ITK_OVERRIDE; + void Synthetize(void) override; /** Specify the name of the output shapefile to write. */ itkSetStringMacro(FileName); @@ -98,11 +98,11 @@ public: protected: PersistentImageToVectorDataFilter(); - ~PersistentImageToVectorDataFilter() ITK_OVERRIDE {} + ~PersistentImageToVectorDataFilter() override {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; ExtractImageFilterPointerType m_ExtractFilter; diff --git a/Modules/Segmentation/Conversion/include/otbRasterizeVectorDataFilter.h b/Modules/Segmentation/Conversion/include/otbRasterizeVectorDataFilter.h index be354efbb68e1f0871f25335a8647fa0497dd3e5..eb197d050f6bc85f0884a5e8cffddea3c4e106eb 100644 --- a/Modules/Segmentation/Conversion/include/otbRasterizeVectorDataFilter.h +++ b/Modules/Segmentation/Conversion/include/otbRasterizeVectorDataFilter.h @@ -136,10 +136,10 @@ public: } protected: - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; RasterizeVectorDataFilter(); - ~RasterizeVectorDataFilter() ITK_OVERRIDE + ~RasterizeVectorDataFilter() override { if (m_OGRDataSourcePointer != ITK_NULLPTR) { @@ -147,9 +147,9 @@ protected: } } - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: RasterizeVectorDataFilter(const Self&); //purposely not implemented diff --git a/Modules/Segmentation/Conversion/include/otbVectorDataToLabelImageFilter.h b/Modules/Segmentation/Conversion/include/otbVectorDataToLabelImageFilter.h index c7a0627250ab9516d93412d7e55fd81e0e5e1cb6..d240df3fc7ce8b0bd37cf2a203249c78f199b586 100644 --- a/Modules/Segmentation/Conversion/include/otbVectorDataToLabelImageFilter.h +++ b/Modules/Segmentation/Conversion/include/otbVectorDataToLabelImageFilter.h @@ -124,10 +124,10 @@ public: void SetOutputParametersFromImage(const ImageBaseType * image); protected: - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; VectorDataToLabelImageFilter(); - ~VectorDataToLabelImageFilter() ITK_OVERRIDE + ~VectorDataToLabelImageFilter() override { // Destroy the geometries stored for (unsigned int idx = 0; idx < m_SrcDataSetGeometries.size(); ++idx) @@ -141,9 +141,9 @@ protected: } } - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: VectorDataToLabelImageFilter(const Self&); //purposely not implemented diff --git a/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapFilter.h b/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapFilter.h index 924b6ff894961d86f2153036444bf8baf3f42fae..9c3656dd3497e577346b46ce0446f28cf139a06d 100644 --- a/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapFilter.h +++ b/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapFilter.h @@ -161,18 +161,18 @@ public: const InputVectorDataType * GetInput(void); const InputVectorDataType * GetInput(unsigned int idx); - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; protected: VectorDataToLabelMapFilter(); - ~VectorDataToLabelMapFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~VectorDataToLabelMapFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** * Standard pipeline method. */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** VectorDataToLabelMapFilter needs the entire input. Therefore * it must provide an implementation GenerateInputRequestedRegion(). diff --git a/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapWithAttributesFilter.h b/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapWithAttributesFilter.h index acedfcebebbc1093331c8be85a22ec28bab0b596..28a2baec1efa69722ba524e90edb1b8b9d4da564 100644 --- a/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapWithAttributesFilter.h +++ b/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapWithAttributesFilter.h @@ -187,20 +187,20 @@ public: ; itkGetMacro(InitialLabel, LabelType) ; - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; protected: VectorDataToLabelMapWithAttributesFilter(); - ~VectorDataToLabelMapWithAttributesFilter() ITK_OVERRIDE + ~VectorDataToLabelMapWithAttributesFilter() override { } - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** * Standard pipeline method. */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** VectorDataToLabelMapWithAttributesFilter needs the entire input. Therefore * it must provide an implementation GenerateInputRequestedRegion(). diff --git a/Modules/Segmentation/Labelling/include/otbLabelToBoundaryImageFilter.h b/Modules/Segmentation/Labelling/include/otbLabelToBoundaryImageFilter.h index b1a67e420087fb0ec6fda1ed95a80a436b12435c..4e34052d2133a5c9c2b91a3f74191bc9e3485e50 100644 --- a/Modules/Segmentation/Labelling/include/otbLabelToBoundaryImageFilter.h +++ b/Modules/Segmentation/Labelling/include/otbLabelToBoundaryImageFilter.h @@ -98,7 +98,7 @@ protected: { this->SetRadius(1); } - ~LabelToBoundaryImageFilter() ITK_OVERRIDE { } + ~LabelToBoundaryImageFilter() override { } private: LabelToBoundaryImageFilter( const Self & ); // Not implemented diff --git a/Modules/Segmentation/Labelling/include/otbLabelizeConfidenceConnectedImageFilter.h b/Modules/Segmentation/Labelling/include/otbLabelizeConfidenceConnectedImageFilter.h index 3e8c27e0929212856a281c1650e21dcb2c334d11..be83bcb2a2e2fcbf785af1dfb607f9bb4f67edc6 100644 --- a/Modules/Segmentation/Labelling/include/otbLabelizeConfidenceConnectedImageFilter.h +++ b/Modules/Segmentation/Labelling/include/otbLabelizeConfidenceConnectedImageFilter.h @@ -109,11 +109,11 @@ public: protected: LabelizeConfidenceConnectedImageFilter(); - ~LabelizeConfidenceConnectedImageFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~LabelizeConfidenceConnectedImageFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Region growing */ - void RegionGrowing(const IndexType indexSeed) ITK_OVERRIDE; + void RegionGrowing(const IndexType indexSeed) override; private: LabelizeConfidenceConnectedImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Segmentation/Labelling/include/otbLabelizeConnectedThresholdImageFilter.h b/Modules/Segmentation/Labelling/include/otbLabelizeConnectedThresholdImageFilter.h index 37ce1dfd747f748fe5a8265f2904b1f182a9cf5b..018f343997092ea5c1c1a100f586754235a7679d 100644 --- a/Modules/Segmentation/Labelling/include/otbLabelizeConnectedThresholdImageFilter.h +++ b/Modules/Segmentation/Labelling/include/otbLabelizeConnectedThresholdImageFilter.h @@ -82,11 +82,11 @@ public: protected: LabelizeConnectedThresholdImageFilter(); - ~LabelizeConnectedThresholdImageFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~LabelizeConnectedThresholdImageFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Region growing */ - void RegionGrowing(const IndexType indexSeed) ITK_OVERRIDE; + void RegionGrowing(const IndexType indexSeed) override; private: LabelizeConnectedThresholdImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Segmentation/Labelling/include/otbLabelizeImageFilterBase.h b/Modules/Segmentation/Labelling/include/otbLabelizeImageFilterBase.h index d817bb3f6b90f6b1e2b1cddab5235022023501a9..1f8b5305bd7d44965f25e767825d5e802d49a790 100644 --- a/Modules/Segmentation/Labelling/include/otbLabelizeImageFilterBase.h +++ b/Modules/Segmentation/Labelling/include/otbLabelizeImageFilterBase.h @@ -96,11 +96,11 @@ public: protected: LabelizeImageFilterBase(); - ~LabelizeImageFilterBase() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~LabelizeImageFilterBase() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Main computation method */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** Region growing */ virtual void RegionGrowing(const IndexType itkNotUsed(indexSeed)) {} diff --git a/Modules/Segmentation/Labelling/include/otbLabelizeNeighborhoodConnectedImageFilter.h b/Modules/Segmentation/Labelling/include/otbLabelizeNeighborhoodConnectedImageFilter.h index 768377f48c04b08df610b95312322d6d7bf68702..9264ba669ed5b34dae874951ec7bcbbc9d478508 100644 --- a/Modules/Segmentation/Labelling/include/otbLabelizeNeighborhoodConnectedImageFilter.h +++ b/Modules/Segmentation/Labelling/include/otbLabelizeNeighborhoodConnectedImageFilter.h @@ -104,11 +104,11 @@ public: protected: LabelizeNeighborhoodConnectedImageFilter(); - ~LabelizeNeighborhoodConnectedImageFilter() ITK_OVERRIDE {} - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + ~LabelizeNeighborhoodConnectedImageFilter() override {} + void PrintSelf(std::ostream& os, itk::Indent indent) const override; /** Region growing */ - void RegionGrowing(const IndexType indexSeed) ITK_OVERRIDE; + void RegionGrowing(const IndexType indexSeed) override; private: LabelizeNeighborhoodConnectedImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Segmentation/MeanShift/include/otbMeanShiftConnectedComponentSegmentationFilter.h b/Modules/Segmentation/MeanShift/include/otbMeanShiftConnectedComponentSegmentationFilter.h index c02dd8e432c2bf56ae85c88fe27272a6c329a108..b065125bc7645c25002fa760a8584cb2f3b47e3c 100644 --- a/Modules/Segmentation/MeanShift/include/otbMeanShiftConnectedComponentSegmentationFilter.h +++ b/Modules/Segmentation/MeanShift/include/otbMeanShiftConnectedComponentSegmentationFilter.h @@ -130,10 +130,10 @@ public: protected: MeanShiftConnectedComponentSegmentationFilter(); - ~MeanShiftConnectedComponentSegmentationFilter() ITK_OVERRIDE; + ~MeanShiftConnectedComponentSegmentationFilter() override; - void GenerateInputRequestedRegion() ITK_OVERRIDE; - void GenerateData() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; + void GenerateData() override; private: diff --git a/Modules/Segmentation/MeanShift/include/otbMeanShiftSegmentationFilter.h b/Modules/Segmentation/MeanShift/include/otbMeanShiftSegmentationFilter.h index 5f33cefe4a20053b9553ebb0b5ce65a28522819c..03c19157eb33ca0d7b2877cd021cae320ed5e7f2 100644 --- a/Modules/Segmentation/MeanShift/include/otbMeanShiftSegmentationFilter.h +++ b/Modules/Segmentation/MeanShift/include/otbMeanShiftSegmentationFilter.h @@ -173,11 +173,11 @@ public: protected: MeanShiftSegmentationFilter(); - ~MeanShiftSegmentationFilter() ITK_OVERRIDE; + ~MeanShiftSegmentationFilter() override; // virtual void GenerateOutputInformation(void); - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; private: diff --git a/Modules/Segmentation/Metrics/include/otbHooverInstanceFilter.h b/Modules/Segmentation/Metrics/include/otbHooverInstanceFilter.h index fa71ec68ab63532c05ad067d75f8dc59a30ef8ca..cae56e1625c5fd66abee1d008eb745f7fe1228a2 100644 --- a/Modules/Segmentation/Metrics/include/otbHooverInstanceFilter.h +++ b/Modules/Segmentation/Metrics/include/otbHooverInstanceFilter.h @@ -210,30 +210,30 @@ public: protected: HooverInstanceFilter(); - ~HooverInstanceFilter() ITK_OVERRIDE {}; + ~HooverInstanceFilter() override {}; /** Re implement the allocate output method to handle the second output correctly */ - void AllocateOutputs() ITK_OVERRIDE; + void AllocateOutputs() override; /** Re implement the release input method to handle the second input correctly */ - void ReleaseInputs() ITK_OVERRIDE; + void ReleaseInputs() override; /** Actions : * - Fill cardinalities of GT regions */ - void ThreadedProcessLabelObject( LabelObjectType * labelObject ) ITK_OVERRIDE; + void ThreadedProcessLabelObject( LabelObjectType * labelObject ) override; /** Actions: * - Check matrix size * - Init cardinalities lists * - Fill cardinalities list for MS (GT is done by ThreadedProcessLabelObject) */ - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; /** Actions : * - Compute Hoover instances */ - void AfterThreadedGenerateData() ITK_OVERRIDE; + void AfterThreadedGenerateData() override; private: diff --git a/Modules/Segmentation/Metrics/include/otbHooverMatrixFilter.h b/Modules/Segmentation/Metrics/include/otbHooverMatrixFilter.h index 2daca45480d6589659aabdc5547fe01a3427d6ed..efedebd57f8f0f921f122d49a9221e9b08fa47b0 100644 --- a/Modules/Segmentation/Metrics/include/otbHooverMatrixFilter.h +++ b/Modules/Segmentation/Metrics/include/otbHooverMatrixFilter.h @@ -89,16 +89,16 @@ protected: /** Constructor */ HooverMatrixFilter(); - ~HooverMatrixFilter() ITK_OVERRIDE {}; + ~HooverMatrixFilter() override {}; /** Action : Resize the matrix */ - void BeforeThreadedGenerateData() ITK_OVERRIDE; + void BeforeThreadedGenerateData() override; /** Action : fill the line of the confusion matrix corresponding to * the given label object */ - void ThreadedProcessLabelObject( LabelObjectType * labelObject ) ITK_OVERRIDE; + void ThreadedProcessLabelObject( LabelObjectType * labelObject ) override; private: diff --git a/Modules/Segmentation/MorphologicalProfiles/include/otbClosingOpeningMorphologicalFilter.h b/Modules/Segmentation/MorphologicalProfiles/include/otbClosingOpeningMorphologicalFilter.h index c3639adf0a51d1ec2fdeaf8c5bf7975f97924aaa..f1d5e29ae6308534d6f28c2b495f0e757b563e80 100644 --- a/Modules/Segmentation/MorphologicalProfiles/include/otbClosingOpeningMorphologicalFilter.h +++ b/Modules/Segmentation/MorphologicalProfiles/include/otbClosingOpeningMorphologicalFilter.h @@ -79,15 +79,15 @@ protected: /** Constructor */ ClosingOpeningMorphologicalFilter(); /** Destructor */ - ~ClosingOpeningMorphologicalFilter() ITK_OVERRIDE {} + ~ClosingOpeningMorphologicalFilter() override {} /* void GenerateInputRequestedRegion(); */ /* void EnlargeOutputRequestedRegion(itk::DataObject *itkNotUsed(output)); */ /** Main computation method */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: ClosingOpeningMorphologicalFilter(const Self &); //purposely not implemented diff --git a/Modules/Segmentation/MorphologicalProfiles/include/otbConvexOrConcaveClassificationFilter.h b/Modules/Segmentation/MorphologicalProfiles/include/otbConvexOrConcaveClassificationFilter.h index f409881fcb6defb14682415772edfb8d09bf7e7f..dcd0f39432d20ed63eacebd195b66f15a148a663 100644 --- a/Modules/Segmentation/MorphologicalProfiles/include/otbConvexOrConcaveClassificationFilter.h +++ b/Modules/Segmentation/MorphologicalProfiles/include/otbConvexOrConcaveClassificationFilter.h @@ -215,7 +215,7 @@ public: * */ using Superclass::SetInput; - void SetInput(const TInputImage * image) ITK_OVERRIDE + void SetInput(const TInputImage * image) override { this->SetInput1(image); } @@ -242,7 +242,7 @@ public: itkGetMacro(Sigma, double); /** Set the functor parameters before calling the ThreadedGenerateData() */ - void BeforeThreadedGenerateData(void) ITK_OVERRIDE + void BeforeThreadedGenerateData(void) override { this->GetFunctor().SetConvexLabel(m_ConvexLabel); this->GetFunctor().SetConcaveLabel(m_ConcaveLabel); @@ -260,9 +260,9 @@ protected: m_Sigma = 0.0; }; /** Destructor */ - ~ConvexOrConcaveClassificationFilter() ITK_OVERRIDE {} + ~ConvexOrConcaveClassificationFilter() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + void PrintSelf(std::ostream& os, itk::Indent indent) const override { Superclass::PrintSelf(os, indent); os << indent << "ConvexLabel: " << m_ConvexLabel << std::endl; diff --git a/Modules/Segmentation/MorphologicalProfiles/include/otbGeodesicMorphologyDecompositionImageFilter.h b/Modules/Segmentation/MorphologicalProfiles/include/otbGeodesicMorphologyDecompositionImageFilter.h index 6c2174532a5609f606cf7dadd128761b5d73d8db..d2e77b8772ce329b6de7fc23246f2ea157e1f68d 100644 --- a/Modules/Segmentation/MorphologicalProfiles/include/otbGeodesicMorphologyDecompositionImageFilter.h +++ b/Modules/Segmentation/MorphologicalProfiles/include/otbGeodesicMorphologyDecompositionImageFilter.h @@ -149,13 +149,13 @@ public: protected: /** GenerateData */ - void GenerateData(void) ITK_OVERRIDE; + void GenerateData(void) override; /** Constructor */ GeodesicMorphologyDecompositionImageFilter(); /** Destructor */ - ~GeodesicMorphologyDecompositionImageFilter() ITK_OVERRIDE {} + ~GeodesicMorphologyDecompositionImageFilter() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: GeodesicMorphologyDecompositionImageFilter(const Self &); //purposely not implemented diff --git a/Modules/Segmentation/MorphologicalProfiles/include/otbGeodesicMorphologyIterativeDecompositionImageFilter.h b/Modules/Segmentation/MorphologicalProfiles/include/otbGeodesicMorphologyIterativeDecompositionImageFilter.h index 92cfb85df6bfd3acbb2b1ecbad2ca9d1f049d46b..91d51758e82ac7764a21ed27cd01fae2ef13cea9 100644 --- a/Modules/Segmentation/MorphologicalProfiles/include/otbGeodesicMorphologyIterativeDecompositionImageFilter.h +++ b/Modules/Segmentation/MorphologicalProfiles/include/otbGeodesicMorphologyIterativeDecompositionImageFilter.h @@ -116,7 +116,7 @@ public: * Get The leveling images for each scale. * \return The leveling images for each scale. */ - OutputImageListType* GetOutput(void) ITK_OVERRIDE; + OutputImageListType* GetOutput(void) override; /** * Get convex membership function for each scale * \return The convex membership function for each scale. @@ -132,15 +132,15 @@ protected: /** Constructor */ GeodesicMorphologyIterativeDecompositionImageFilter(); /** Destructor */ - ~GeodesicMorphologyIterativeDecompositionImageFilter() ITK_OVERRIDE {} + ~GeodesicMorphologyIterativeDecompositionImageFilter() override {} /** Generate output information */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; /** Generate input requested region */ - void GenerateInputRequestedRegion() ITK_OVERRIDE; + void GenerateInputRequestedRegion() override; /** Main computation method */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** Printself method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: /** The step for the scale analysis */ diff --git a/Modules/Segmentation/MorphologicalProfiles/include/otbGeodesicMorphologyLevelingFilter.h b/Modules/Segmentation/MorphologicalProfiles/include/otbGeodesicMorphologyLevelingFilter.h index 3c7a16920d4ad09dfb894b726a866db797125ba2..6211c5969706c1c279ce6ed286474b462b79138b 100644 --- a/Modules/Segmentation/MorphologicalProfiles/include/otbGeodesicMorphologyLevelingFilter.h +++ b/Modules/Segmentation/MorphologicalProfiles/include/otbGeodesicMorphologyLevelingFilter.h @@ -117,7 +117,7 @@ public: * Set the original input image */ using Superclass::SetInput; - void SetInput(const TInputImage * input) ITK_OVERRIDE + void SetInput(const TInputImage * input) override { this->SetInput1(input); } @@ -126,9 +126,9 @@ protected: /** Constructor */ GeodesicMorphologyLevelingFilter() {}; /** Destructor */ - ~GeodesicMorphologyLevelingFilter() ITK_OVERRIDE {} + ~GeodesicMorphologyLevelingFilter() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + void PrintSelf(std::ostream& os, itk::Indent indent) const override { Superclass::PrintSelf(os, indent); } diff --git a/Modules/Segmentation/MorphologicalProfiles/include/otbImageToProfileFilter.h b/Modules/Segmentation/MorphologicalProfiles/include/otbImageToProfileFilter.h index 0c6a3f66040efec4353929fca69e763591044a5a..85223e736c8942959b079c2791740bde2ac57cdc 100644 --- a/Modules/Segmentation/MorphologicalProfiles/include/otbImageToProfileFilter.h +++ b/Modules/Segmentation/MorphologicalProfiles/include/otbImageToProfileFilter.h @@ -91,17 +91,17 @@ protected: /** Get the pointer to the filter */ itkGetObjectMacro(Filter, FilterType); /** GenerateData method */ - void GenerateData(void) ITK_OVERRIDE; + void GenerateData(void) override; /** GenerateOutputInformation method */ - void GenerateOutputInformation(void) ITK_OVERRIDE; + void GenerateOutputInformation(void) override; /** Generate input requested region */ - void GenerateInputRequestedRegion(void) ITK_OVERRIDE; + void GenerateInputRequestedRegion(void) override; /** Constructor */ ImageToProfileFilter(); /** Destructor */ - ~ImageToProfileFilter() ITK_OVERRIDE {} + ~ImageToProfileFilter() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: ImageToProfileFilter(const Self &); //purposely not implemented diff --git a/Modules/Segmentation/MorphologicalProfiles/include/otbMorphologicalClosingProfileFilter.h b/Modules/Segmentation/MorphologicalProfiles/include/otbMorphologicalClosingProfileFilter.h index f3d08451e3334c9fca02db5fd190a8a3b688ff13..a5af9642872343166e61db758688da098673e6bc 100644 --- a/Modules/Segmentation/MorphologicalProfiles/include/otbMorphologicalClosingProfileFilter.h +++ b/Modules/Segmentation/MorphologicalProfiles/include/otbMorphologicalClosingProfileFilter.h @@ -77,7 +77,7 @@ public: protected: /** Set the profile parameter */ - void SetProfileParameter(ParameterType param) ITK_OVERRIDE + void SetProfileParameter(ParameterType param) override { StructuringElementType se; se.SetRadius(param); @@ -87,9 +87,9 @@ protected: /** Constructor */ MorphologicalClosingProfileFilter() {}; /** Destructor */ - ~MorphologicalClosingProfileFilter() ITK_OVERRIDE {} + ~MorphologicalClosingProfileFilter() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + void PrintSelf(std::ostream& os, itk::Indent indent) const override { Superclass::PrintSelf(os, indent); } diff --git a/Modules/Segmentation/MorphologicalProfiles/include/otbMorphologicalOpeningProfileFilter.h b/Modules/Segmentation/MorphologicalProfiles/include/otbMorphologicalOpeningProfileFilter.h index 83fde0a9f8c0c7f5f886083b7817550cc6fa64a7..2c8d5bdbbf248ebf42fb77cfc16b971e5c13b62d 100644 --- a/Modules/Segmentation/MorphologicalProfiles/include/otbMorphologicalOpeningProfileFilter.h +++ b/Modules/Segmentation/MorphologicalProfiles/include/otbMorphologicalOpeningProfileFilter.h @@ -77,7 +77,7 @@ public: protected: /** Set the profile parameter */ - void SetProfileParameter(ParameterType param) ITK_OVERRIDE + void SetProfileParameter(ParameterType param) override { StructuringElementType se; se.SetRadius(param); @@ -87,9 +87,9 @@ protected: /** Constructor */ MorphologicalOpeningProfileFilter() {}; /** Destructor */ - ~MorphologicalOpeningProfileFilter() ITK_OVERRIDE {} + ~MorphologicalOpeningProfileFilter() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + void PrintSelf(std::ostream& os, itk::Indent indent) const override { Superclass::PrintSelf(os, indent); } diff --git a/Modules/Segmentation/MorphologicalProfiles/include/otbMorphologicalProfilesSegmentationFilter.h b/Modules/Segmentation/MorphologicalProfiles/include/otbMorphologicalProfilesSegmentationFilter.h index 401c3fde2301604337b51993f8dc5e5bf88e141b..f61f87fc82bb53b93113a258d8af4305d343ac10 100644 --- a/Modules/Segmentation/MorphologicalProfiles/include/otbMorphologicalProfilesSegmentationFilter.h +++ b/Modules/Segmentation/MorphologicalProfiles/include/otbMorphologicalProfilesSegmentationFilter.h @@ -106,9 +106,9 @@ itkGetConstReferenceMacro(Sigma,double); protected: MorphologicalProfilesSegmentationFilter(); -~MorphologicalProfilesSegmentationFilter() ITK_OVERRIDE; +~MorphologicalProfilesSegmentationFilter() override; -void GenerateData() ITK_OVERRIDE; +void GenerateData() override; private: typename OpeningProfileFilterType::Pointer m_OpeningProfile; diff --git a/Modules/Segmentation/MorphologicalProfiles/include/otbMultiScaleConvexOrConcaveClassificationFilter.h b/Modules/Segmentation/MorphologicalProfiles/include/otbMultiScaleConvexOrConcaveClassificationFilter.h index 5bf49f3356420c54093d087aed16a93b77992269..bcb21040a6b3d55234c2964bb220066cbfe51496 100644 --- a/Modules/Segmentation/MorphologicalProfiles/include/otbMultiScaleConvexOrConcaveClassificationFilter.h +++ b/Modules/Segmentation/MorphologicalProfiles/include/otbMultiScaleConvexOrConcaveClassificationFilter.h @@ -222,7 +222,7 @@ public: itkGetMacro(LabelSeparator, LabelType); /** Set the functor parameters before calling the ThreadedGenerateData() */ - void BeforeThreadedGenerateData(void) ITK_OVERRIDE + void BeforeThreadedGenerateData(void) override { this->GetFunctor().SetLabelSeparator(m_LabelSeparator); this->GetFunctor().SetSigma(m_Sigma); @@ -236,9 +236,9 @@ protected: m_Sigma = 0.0; }; /** Destructor */ - ~MultiScaleConvexOrConcaveClassificationFilter() ITK_OVERRIDE {} + ~MultiScaleConvexOrConcaveClassificationFilter() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE + void PrintSelf(std::ostream& os, itk::Indent indent) const override { Superclass::PrintSelf(os, indent); os << indent << "LabelSeparator: " << m_LabelSeparator << std::endl; diff --git a/Modules/Segmentation/MorphologicalProfiles/include/otbOpeningClosingMorphologicalFilter.h b/Modules/Segmentation/MorphologicalProfiles/include/otbOpeningClosingMorphologicalFilter.h index d434913a51b68b982efb360447fb3f420dbc9341..4e690115084feb3c39938368db6b7d264470168b 100644 --- a/Modules/Segmentation/MorphologicalProfiles/include/otbOpeningClosingMorphologicalFilter.h +++ b/Modules/Segmentation/MorphologicalProfiles/include/otbOpeningClosingMorphologicalFilter.h @@ -79,15 +79,15 @@ protected: /** Constructor */ OpeningClosingMorphologicalFilter(); /** Destructor */ - ~OpeningClosingMorphologicalFilter() ITK_OVERRIDE {} + ~OpeningClosingMorphologicalFilter() override {} /* void GenerateInputRequestedRegion(); */ /* void EnlargeOutputRequestedRegion(itk::DataObject *itkNotUsed(output)); */ /** Main computation method */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: OpeningClosingMorphologicalFilter(const Self &); //purposely not implemented diff --git a/Modules/Segmentation/MorphologicalProfiles/include/otbProfileDerivativeToMultiScaleCharacteristicsFilter.h b/Modules/Segmentation/MorphologicalProfiles/include/otbProfileDerivativeToMultiScaleCharacteristicsFilter.h index 64ed396fa0ed5fa366457954af5ad8f5ec1546c1..805070251d18d61b004832c504f65bc12ddf7d68 100644 --- a/Modules/Segmentation/MorphologicalProfiles/include/otbProfileDerivativeToMultiScaleCharacteristicsFilter.h +++ b/Modules/Segmentation/MorphologicalProfiles/include/otbProfileDerivativeToMultiScaleCharacteristicsFilter.h @@ -86,26 +86,26 @@ public: protected: /** Main computation method */ - void GenerateData(void) ITK_OVERRIDE; + void GenerateData(void) override; /** GenerateOutputInformation * Set the number of bands of the output. * Copy information from the first image of the list if existing. **/ - void GenerateOutputInformation(void) ITK_OVERRIDE; + void GenerateOutputInformation(void) override; /** * GenerateInputRequestedRegion * Set the requested region of each image in the list. */ - void GenerateInputRequestedRegion(void) ITK_OVERRIDE; + void GenerateInputRequestedRegion(void) override; /** Constructor */ ProfileDerivativeToMultiScaleCharacteristicsFilter(); /** Destructor */ - ~ProfileDerivativeToMultiScaleCharacteristicsFilter() ITK_OVERRIDE {} + ~ProfileDerivativeToMultiScaleCharacteristicsFilter() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: ProfileDerivativeToMultiScaleCharacteristicsFilter(const Self &); //purposely not implemented diff --git a/Modules/Segmentation/MorphologicalProfiles/include/otbProfileToProfileDerivativeFilter.h b/Modules/Segmentation/MorphologicalProfiles/include/otbProfileToProfileDerivativeFilter.h index f71b7c5536172f3e409f3e51319ff138692f9aa8..cef78cc730bb3ff6bc4d4a8b9e6d1c262994b38f 100644 --- a/Modules/Segmentation/MorphologicalProfiles/include/otbProfileToProfileDerivativeFilter.h +++ b/Modules/Segmentation/MorphologicalProfiles/include/otbProfileToProfileDerivativeFilter.h @@ -78,20 +78,20 @@ public: /** Generate output information for the ImageList and for each image in the list. */ - void GenerateOutputInformation(void) ITK_OVERRIDE; + void GenerateOutputInformation(void) override; /** Generate input requested region for each image in the list. */ - void GenerateInputRequestedRegion(void) ITK_OVERRIDE; + void GenerateInputRequestedRegion(void) override; protected: /** Main computation method */ - void GenerateData(void) ITK_OVERRIDE; + void GenerateData(void) override; /** Constructor */ ProfileToProfileDerivativeFilter(); /** Destructor */ - ~ProfileToProfileDerivativeFilter() ITK_OVERRIDE {} + ~ProfileToProfileDerivativeFilter() override {} /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream& os, itk::Indent indent) const override; private: ProfileToProfileDerivativeFilter(const Self &); //purposely not implemented diff --git a/Modules/Segmentation/OGRProcessing/include/otbOGRLayerStreamStitchingFilter.h b/Modules/Segmentation/OGRProcessing/include/otbOGRLayerStreamStitchingFilter.h index 9f111d292a71f4df9ba00a1563f93be1e603e537..9149fbf21391820a8a18685822a822da6b145949 100644 --- a/Modules/Segmentation/OGRProcessing/include/otbOGRLayerStreamStitchingFilter.h +++ b/Modules/Segmentation/OGRProcessing/include/otbOGRLayerStreamStitchingFilter.h @@ -106,11 +106,11 @@ public: itkGetMacro(StreamSize, SizeType); /** Generate Data method. This method must be called explicitly (not through the \c Update method). */ - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; protected: OGRLayerStreamStitchingFilter(); - ~OGRLayerStreamStitchingFilter() ITK_OVERRIDE {} + ~OGRLayerStreamStitchingFilter() override {} struct FusionStruct { diff --git a/Modules/Segmentation/OGRProcessing/include/otbStreamingImageToOGRLayerSegmentationFilter.h b/Modules/Segmentation/OGRProcessing/include/otbStreamingImageToOGRLayerSegmentationFilter.h index a64db1a245dbe16bd05c9a649f3ba6bd4e9b1edf..f797bafee24f1c6c6ece5dea80e487b8a5f86d14 100644 --- a/Modules/Segmentation/OGRProcessing/include/otbStreamingImageToOGRLayerSegmentationFilter.h +++ b/Modules/Segmentation/OGRProcessing/include/otbStreamingImageToOGRLayerSegmentationFilter.h @@ -144,14 +144,14 @@ public: protected: PersistentImageToOGRLayerSegmentationFilter(); - ~PersistentImageToOGRLayerSegmentationFilter() ITK_OVERRIDE; + ~PersistentImageToOGRLayerSegmentationFilter() override; private: PersistentImageToOGRLayerSegmentationFilter(const Self &); //purposely not implemented void operator =(const Self&); //purposely not implemented - OGRDataSourcePointerType ProcessTile() ITK_OVERRIDE; + OGRDataSourcePointerType ProcessTile() override; int m_TileMaxLabel; @@ -349,7 +349,7 @@ protected: /** Constructor */ StreamingImageToOGRLayerSegmentationFilter() {} /** Destructor */ - ~StreamingImageToOGRLayerSegmentationFilter() ITK_OVERRIDE {} + ~StreamingImageToOGRLayerSegmentationFilter() override {} private: StreamingImageToOGRLayerSegmentationFilter(const Self &); //purposely not implemented diff --git a/Modules/Segmentation/Watersheds/include/otbWatershedSegmentationFilter.h b/Modules/Segmentation/Watersheds/include/otbWatershedSegmentationFilter.h index 9d35385b121b9037247d54ba578d4488b491cc5d..32239f115ac77d4bb0fb96e75acaa1d4b4049d16 100644 --- a/Modules/Segmentation/Watersheds/include/otbWatershedSegmentationFilter.h +++ b/Modules/Segmentation/Watersheds/include/otbWatershedSegmentationFilter.h @@ -84,9 +84,9 @@ public: protected: WatershedSegmentationFilter(); - ~WatershedSegmentationFilter() ITK_OVERRIDE; + ~WatershedSegmentationFilter() override; - void GenerateData() ITK_OVERRIDE; + void GenerateData() override; private: typename CastImageFilterType::Pointer m_CastFilter; diff --git a/Modules/ThirdParty/Boost/otb-module-init.cmake b/Modules/ThirdParty/Boost/otb-module-init.cmake index a5f58041fb0bf5001d123ff2e0f772a26cff6d34..0a07bdfdbc7a9d33a03464925c95667a036bea59 100644 --- a/Modules/ThirdParty/Boost/otb-module-init.cmake +++ b/Modules/ThirdParty/Boost/otb-module-init.cmake @@ -31,3 +31,8 @@ if (BUILD_TESTING) message(STATUS "Found Boost components: unit_test_framework") endif() endif() #BUILD_TESTING + +if(WIN32) + # disable autolinking in boost + add_definitions( -DBOOST_ALL_NO_LIB ) +endif() diff --git a/Modules/ThirdParty/ITK/include/itkImageRegionSplitter.h b/Modules/ThirdParty/ITK/include/itkImageRegionSplitter.h index f9304f511be6b9ced53feb28a66ebd830ee54e53..13fc872f8623b7c72699c98ea4f9470dc45f5ef1 100644 --- a/Modules/ThirdParty/ITK/include/itkImageRegionSplitter.h +++ b/Modules/ThirdParty/ITK/include/itkImageRegionSplitter.h @@ -121,12 +121,12 @@ public: protected: ImageRegionSplitter() {} - ~ImageRegionSplitter() ITK_OVERRIDE {} + ~ImageRegionSplitter() override {} unsigned int GetNumberOfSplitsInternal(unsigned int, const IndexValueType regionIndex[], const SizeValueType regionSize[], - unsigned int requestedNumber) const ITK_OVERRIDE + unsigned int requestedNumber) const override { // this function adapts the legecy method, defined in this class // be used by the ImageRegionSplitterBase. @@ -145,7 +145,7 @@ protected: unsigned int i, unsigned int numberOfPieces, IndexValueType regionIndex[], - SizeValueType regionSize[]) const ITK_OVERRIDE + SizeValueType regionSize[]) const override { // this function adapts the legecy method, defined in this class // be used by the ImageRegionSplitterBase. @@ -166,7 +166,7 @@ protected: return numberOfPieces; } - void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream & os, Indent indent) const override; private: ImageRegionSplitter(const ImageRegionSplitter &); //purposely not implemented diff --git a/Modules/ThirdParty/ITK/include/itkTransformToDisplacementFieldSource.h b/Modules/ThirdParty/ITK/include/itkTransformToDisplacementFieldSource.h index ecdc5a421aaab662c7258731f11619c0c45d3665..2a9b77c3947c9757ba8fadc43f3d11feb789cfef 100644 --- a/Modules/ThirdParty/ITK/include/itkTransformToDisplacementFieldSource.h +++ b/Modules/ThirdParty/ITK/include/itkTransformToDisplacementFieldSource.h @@ -37,9 +37,9 @@ namespace itk * spacing, origin and direction of the reference image will be used. * * Since this filter produces an image which is a different size than - * its input, it needs to ITK_OVERRIDE several of the methods defined + * its input, it needs to override several of the methods defined * in ProcessObject in order to properly manage the pipeline execution model. - * In particular, this filter ITK_OVERRIDEs + * In particular, this filter overrides * ProcessObject::GenerateInputRequestedRegion() and * ProcessObject::GenerateOutputInformation(). * @@ -154,13 +154,13 @@ public: void SetOutputParametersFromImage(const ImageBaseType *image); /** DisplacementFieldImageFilter produces a vector image. */ - void GenerateOutputInformation(void) ITK_OVERRIDE; + void GenerateOutputInformation(void) override; /** Just checking if transform is set. */ - void BeforeThreadedGenerateData(void) ITK_OVERRIDE; + void BeforeThreadedGenerateData(void) override; /** Compute the Modified Time based on changes to the components. */ - ModifiedTimeType GetMTime(void) const ITK_OVERRIDE; + ModifiedTimeType GetMTime(void) const override; #ifdef ITK_USE_CONCEPT_CHECKING /** Begin concept checking */ @@ -173,16 +173,16 @@ public: protected: TransformToDisplacementFieldSource(void); - ~TransformToDisplacementFieldSource(void) ITK_OVERRIDE {} + ~TransformToDisplacementFieldSource(void) override {} - void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream & os, Indent indent) const override; /** TransformToDisplacementFieldSource can be implemented as a multithreaded * filter. */ void ThreadedGenerateData( const OutputImageRegionType & outputRegionForThread, - ThreadIdType threadId) ITK_OVERRIDE; + ThreadIdType threadId) override; /** Default implementation for resampling that works for any * transformation type. diff --git a/Modules/ThirdParty/ITK/include/itkUnaryFunctorImageFilter.h b/Modules/ThirdParty/ITK/include/itkUnaryFunctorImageFilter.h index a47d8cf82a4c318d3d6a977fa6659f298c04845d..8e268752d5f889131ade395ca86dd8d546d630f6 100644 --- a/Modules/ThirdParty/ITK/include/itkUnaryFunctorImageFilter.h +++ b/Modules/ThirdParty/ITK/include/itkUnaryFunctorImageFilter.h @@ -102,7 +102,7 @@ public: protected: UnaryFunctorImageFilter(); - ~UnaryFunctorImageFilter() ITK_OVERRIDE {} + ~UnaryFunctorImageFilter() override {} /** UnaryFunctorImageFilter can produce an image which is a different * resolution than its input image. As such, UnaryFunctorImageFilter @@ -112,7 +112,7 @@ protected: * below. * * \sa ProcessObject::GenerateOutputInformaton() */ - void GenerateOutputInformation() ITK_OVERRIDE; + void GenerateOutputInformation() override; /** UnaryFunctorImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine @@ -125,7 +125,7 @@ protected: * \sa ImageToImageFilter::ThreadedGenerateData(), * ImageToImageFilter::GenerateData() */ void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread, - ThreadIdType threadId) ITK_OVERRIDE; + ThreadIdType threadId) override; private: UnaryFunctorImageFilter(const Self &); //purposely not implemented diff --git a/Modules/ThirdParty/OssimPlugins/include/ossim/ossimSarSensorModel.h b/Modules/ThirdParty/OssimPlugins/include/ossim/ossimSarSensorModel.h index d76968ecf1929a8f8034e016c8b13fa2d2ff3bfb..c1d0cb776145c4f322f25df99a3b2163b5322d8f 100644 --- a/Modules/ThirdParty/OssimPlugins/include/ossim/ossimSarSensorModel.h +++ b/Modules/ThirdParty/OssimPlugins/include/ossim/ossimSarSensorModel.h @@ -238,13 +238,36 @@ public: * \param[in] worldPoint World point to geocode * \param[out] azimuthTime Estimated zero-doppler azimuth time * \param[out] rangeTime Estimated range time + * \param[out] interpSensorPos interpolated ECEF sensor position + * \param[out] interpSensorVel interpolated ECEF sensor velocity * \return True if success, false otherwise. In this case, * azimuthTime and rangeTime will not be modified. */ - /*virtual*/ bool worldToAzimuthRangeTime(const ossimGpt& worldPt, TimeType & azimuthTime, double & rangeTime) const; + /*virtual*/ bool worldToAzimuthRangeTime(const ossimGpt& worldPt, TimeType & azimuthTime, double & rangeTime, ossimEcefPoint & interpSensorPos, ossimEcefVector & interpSensorVel) const; - // TODO: document me - /*virtual*/ void lineSampleToAzimuthRangeTime(const ossimDpt & imPt, TimeType & azimuthTime, double & rangeTime) const; + /** + * This method implement inverse sar geolocation similar to + * worldToLineSample, except that it also returns (y,z) + * coordinates, defined as follows: + * Let n = |sensorPos|, + * ps2 = scalar_product(sensorPos,worldPoint) + * d = distance(sensorPos,worldPoint) + * + * z = n - ps2/n + * y = sqrt(d*d - z*z) + * + * sign of y is furher adapted to be inverted if sensor is left or + * right looking + * + * \param[in] worldPoint World point to geocode + * \param[out] imPt Corresponding estimated image point + * \param[out] y + * \param[out] z + * \return True if success, false otherwise. In this case, + */ + void worldToLineSampleYZ(const ossimGpt& worldPt, ossimDpt& imPt, double & y, double & z) const; + + void lineSampleToAzimuthRangeTime(const ossimDpt & imPt, TimeType & azimuthTime, double & rangeTime) const; // TODO: document me bool autovalidateInverseModelFromGCPs(const double & xtol = 1, const double & ytol = 1, const double azTimeTol = 500, const double &rangeTimeTo=0.0000000001) const; @@ -253,7 +276,7 @@ public: bool autovalidateForwardModelFromGCPs(double resTol = 25); //Pure virtual in base class - bool useForward() const; + bool useForward() const override; void optimizeTimeOffsetsFromGcps(); @@ -313,7 +336,7 @@ public: virtual std::ostream& print(std::ostream& out) const override; protected: - TYPE_DATA; + TYPE_DATA /** * Compute range and doppler frequency from an input point, sensor @@ -419,7 +442,8 @@ protected: ProductType theProductType; // GRD/SLC DurationType theAzimuthTimeOffset; // Offset computed double theRangeTimeOffset; // Offset in seconds, computed - + bool theRightLookingFlag; + static const double C; static const unsigned int thePluginVersion; // version of the SarSensorModel plugin diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSarSensorModel.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSarSensorModel.cpp index ac695a2a4b790ebce7671fc7e27c62a954e91098..61e85f63c090b292f148b0019ddef1ac3ec59689 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSarSensorModel.cpp +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSarSensorModel.cpp @@ -12,7 +12,7 @@ * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -137,7 +137,8 @@ namespace ossimplugins theRangeResolution(0.), theBistaticCorrectionNeeded(false), theAzimuthTimeOffset(seconds(0)), - theRangeTimeOffset(0.) + theRangeTimeOffset(0.), + theRightLookingFlag(true) {} ossimSarSensorModel::GCPRecordType const& @@ -220,7 +221,58 @@ namespace ossimplugins TimeType azimuthTime; double rangeTime; - const bool success = worldToAzimuthRangeTime(worldPt, azimuthTime, rangeTime); + ossimEcefPoint sensorPos; + ossimEcefVector sensorVel; + + const bool success = worldToAzimuthRangeTime(worldPt, azimuthTime, rangeTime, sensorPos, sensorVel); + + if(!success) + { + imPt.makeNan(); + return; + } + // std::clog << "AzimuthTime: " << azimuthTime << "\n"; + // std::clog << "RangeTime: " << rangeTime << "\n"; + // std::clog << "GRD: " << isGRD() << "\n"; + + // Convert azimuth time to line + azimuthTimeToLine(azimuthTime,imPt.y); + + if(isGRD()) + { + // GRD case + double groundRange(0); + slantRangeToGroundRange(rangeTime*C/2,azimuthTime,groundRange); + // std::clog << "GroundRange: " << groundRange << "\n"; + // std::clog << "TheRangeResolution: " << theRangeResolution << "\n"; + + // Eq 32 p. 31 + // TODO: possible micro-optimization: precompute 1/theRangeResolution, and + // use * + imPt.x = groundRange/theRangeResolution; + } + else + { + // std::clog << "TheNearRangeTime: " << theNearRangeTime << "\n"; + // std::clog << "TheRangeSamplingRate: " << theRangeSamplingRate << "\n"; + // SLC case + // Eq 23 and 24 p. 28 + imPt.x = (rangeTime - theNearRangeTime)*theRangeSamplingRate; + } + } + +void ossimSarSensorModel::worldToLineSampleYZ(const ossimGpt& worldPt, ossimDpt & imPt, double & y, double & z) const + { + // std::clog << "ossimSarSensorModel::worldToLineSample()\n"; + assert(theRangeResolution>0&&"theRangeResolution is null."); + + // First compute azimuth and range time + TimeType azimuthTime; + double rangeTime; + ossimEcefPoint sensorPos; + ossimEcefVector sensorVel; + + const bool success = worldToAzimuthRangeTime(worldPt, azimuthTime, rangeTime,sensorPos,sensorVel); if(!success) { @@ -255,9 +307,35 @@ namespace ossimplugins // Eq 23 and 24 p. 28 imPt.x = (rangeTime - theNearRangeTime)*theRangeSamplingRate; } + + // Now computes Y and Z + ossimEcefPoint inputPt(worldPt); + double NormeS = sqrt(sensorPos[0]*sensorPos[0] + sensorPos[1]*sensorPos[1] + sensorPos[2]*sensorPos[2]); /* distance du radar */ + double PS2 = inputPt[0]*sensorPos[0] + inputPt[1]*sensorPos[1] + inputPt[2]*sensorPos[2]; + + // TODO check for small NormesS to avoid division by zero ? + // Should never happen ... + assert(NormeS>1e-6); + z = NormeS - PS2/NormeS; + + double distance = sqrt((sensorPos[0]-inputPt[0])*(sensorPos[0]-inputPt[0]) + + (sensorPos[1]-inputPt[1])*(sensorPos[1]-inputPt[1]) + + (sensorPos[2]-inputPt[2])*(sensorPos[2]-inputPt[2])); + + y = sqrt(distance*distance - z*z); + + // Check view side and change sign of Y accordingly + if ( (( sensorVel[0] * (sensorPos[1]* inputPt[2] - sensorPos[2]* inputPt[1]) + + sensorVel[1] * (sensorPos[2]* inputPt[0] - sensorPos[0]* inputPt[2]) + + sensorVel[2] * (sensorPos[0]* inputPt[1] - sensorPos[1]* inputPt[0])) > 0) ^ theRightLookingFlag ) + { + y = -y; + } } - bool ossimSarSensorModel::worldToAzimuthRangeTime(const ossimGpt& worldPt, TimeType & azimuthTime, double & rangeTime) const + + +bool ossimSarSensorModel::worldToAzimuthRangeTime(const ossimGpt& worldPt, TimeType & azimuthTime, double & rangeTime, ossimEcefPoint & interpSensorPos, ossimEcefVector & interpSensorVel) const { // std::clog << "ossimSarSensorModel::worldToAzimuthRangeTime()\n"; // First convert lat/lon to ECEF @@ -265,8 +343,6 @@ namespace ossimplugins // Compute zero doppler time TimeType interpTime; - ossimEcefPoint interpSensorPos; - ossimEcefVector interpSensorVel; const bool success = zeroDopplerLookup(inputPt,azimuthTime,interpSensorPos,interpSensorVel); @@ -857,7 +933,9 @@ namespace ossimplugins double estimatedRangeTime; // Estimate times - const bool s1 = this->worldToAzimuthRangeTime(gcpIt->worldPt,estimatedAzimuthTime,estimatedRangeTime); + ossimEcefPoint sensorPos; + ossimEcefVector sensorVel; + const bool s1 = this->worldToAzimuthRangeTime(gcpIt->worldPt,estimatedAzimuthTime,estimatedRangeTime,sensorPos, sensorVel); this->worldToLineSample(gcpIt->worldPt,estimatedImPt); const bool thisSuccess @@ -964,8 +1042,10 @@ namespace ossimplugins TimeType estimatedAzimuthTime; double estimatedRangeTime; + ossimEcefPoint sensorPos; + ossimEcefVector sensorVel; // Estimate times - const bool s1 = this->worldToAzimuthRangeTime(gcpIt->worldPt,estimatedAzimuthTime,estimatedRangeTime); + const bool s1 = this->worldToAzimuthRangeTime(gcpIt->worldPt,estimatedAzimuthTime,estimatedRangeTime, sensorPos, sensorVel); if(s1) { @@ -985,8 +1065,11 @@ namespace ossimplugins TimeType estimatedAzimuthTime; double estimatedRangeTime; + ossimEcefPoint sensorPos; + ossimEcefVector sensorVel; + // Estimate times - const bool s1 = this->worldToAzimuthRangeTime(gcpIt->worldPt,estimatedAzimuthTime,estimatedRangeTime); + const bool s1 = this->worldToAzimuthRangeTime(gcpIt->worldPt,estimatedAzimuthTime,estimatedRangeTime, sensorPos, sensorVel); if(s1) { diff --git a/Modules/ThirdParty/Qt/CMakeLists.txt b/Modules/ThirdParty/Qt/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..8234ae1e18c964ece67a63e392bea10f08c76620 --- /dev/null +++ b/Modules/ThirdParty/Qt/CMakeLists.txt @@ -0,0 +1,34 @@ +# +# 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( OTBQt ) + +set( OTBQt_LIBRARIES ${Qt5Widgets_LIBRARIES} ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5OpenGL_LIBRARIES}) +set( OTBQt_SYSTEM_INCLUDE_DIRS ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Core_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5OpenGL_INCLUDE_DIRS} ) +set( OTBQt_EXPORT_CODE_BUILD +"find_package(Qt5Core REQUIRED HINTS ${Qt5Core_DIR}) +find_package(Qt5Gui REQUIRED HINTS ${Qt5Gui_DIR}) +find_package(Qt5Widgets REQUIRED HINTS ${Qt5Widgets_DIR}) +find_package(Qt5OpenGL REQUIRED HINTS ${Qt5OpenGL_DIR}) +find_package(Qt5LinguistTools HINTS ${Qt5LinguistTools_DIR}) +") +set( OTBQt_EXPORT_CODE_INSTALL ${OTBQt_EXPORT_CODE_BUILD}) + +otb_module_impl() diff --git a/Modules/ThirdParty/Qt4/otb-module-init.cmake b/Modules/ThirdParty/Qt/otb-module-init.cmake similarity index 82% rename from Modules/ThirdParty/Qt4/otb-module-init.cmake rename to Modules/ThirdParty/Qt/otb-module-init.cmake index 951a96171c3e9701d6556c8ddfe8b013248960a5..9a325d7d948a0cc8e1d00aaf63bb0c02612816cd 100644 --- a/Modules/ThirdParty/Qt4/otb-module-init.cmake +++ b/Modules/ThirdParty/Qt/otb-module-init.cmake @@ -18,7 +18,9 @@ # limitations under the License. # -find_package( Qt4 REQUIRED QtCore QtGui QtOpenGL) # QtXml ) +find_package(Qt5Core REQUIRED) +find_package(Qt5Gui REQUIRED) +find_package(Qt5Widgets REQUIRED) +find_package(Qt5OpenGL REQUIRED) +find_package(Qt5LinguistTools) mark_as_advanced( QT_QMAKE_EXECUTABLE ) -#set( QT_USE_QTXML 1 ) -include( ${QT_USE_FILE} ) diff --git a/Modules/ThirdParty/Qt4/otb-module.cmake b/Modules/ThirdParty/Qt/otb-module.cmake similarity index 84% rename from Modules/ThirdParty/Qt4/otb-module.cmake rename to Modules/ThirdParty/Qt/otb-module.cmake index 95dac5772da439e4716f13b5b68b5cfa8cf6fadb..d3962f0acb48afd06a00c3628b14d24d607a060c 100644 --- a/Modules/ThirdParty/Qt4/otb-module.cmake +++ b/Modules/ThirdParty/Qt/otb-module.cmake @@ -18,9 +18,9 @@ # limitations under the License. # -set(DOCUMENTATION "This module imports Qt4 to the build system") +set(DOCUMENTATION "This module imports Qt5 to the build system") -otb_module(OTBQt4 +otb_module(OTBQt DEPENDS TEST_DEPENDS @@ -29,4 +29,4 @@ otb_module(OTBQt4 "${DOCUMENTATION}" ) -otb_module_activation_option("Enable Qt4 dependent modules" OFF) +otb_module_activation_option("Enable Qt5 dependent modules" OFF) diff --git a/Modules/ThirdParty/Qwt/otb-module.cmake b/Modules/ThirdParty/Qwt/otb-module.cmake index f4e974be41593124ae479317109dff6cfb65716e..646b2a4fe0020ee92982fefbcf8bf2b4f46b6217 100644 --- a/Modules/ThirdParty/Qwt/otb-module.cmake +++ b/Modules/ThirdParty/Qwt/otb-module.cmake @@ -22,7 +22,7 @@ set(DOCUMENTATION "This module imports Qwt to the build system") otb_module(OTBQwt DEPENDS - OTBQt4 + OTBQt TEST_DEPENDS diff --git a/Modules/Learning/LearningBase/include/otbSharkUtils.h b/Modules/ThirdParty/Shark/include/otbSharkUtils.h similarity index 72% rename from Modules/Learning/LearningBase/include/otbSharkUtils.h rename to Modules/ThirdParty/Shark/include/otbSharkUtils.h index 9efcf948bdbbfd7e9a672068677f029ac10c7d39..04c57b6d4e7f5a022b0c4fafa86ac41b134f690c 100644 --- a/Modules/Learning/LearningBase/include/otbSharkUtils.h +++ b/Modules/ThirdParty/Shark/include/otbSharkUtils.h @@ -21,7 +21,9 @@ #ifndef otbSharkUtils_h #define otbSharkUtils_h -#include "itkMacro.h" +#include <stdexcept> +#include <string> +#include <unordered_map> #if defined(__GNUC__) || defined(__clang__) #pragma GCC diagnostic push @@ -41,11 +43,13 @@ namespace Shark { template <class T> void ListSampleRangeToSharkVector(const T * listSample, std::vector<shark::RealVector> & output, unsigned int start, unsigned int size) { - assert(listSample != ITK_NULLPTR); + assert(listSample != nullptr); if(start+size>listSample->Size()) { - itkGenericExceptionMacro(<<"Requested range ["<<start<<", "<<start+size<<"[ is out of bound for input list sample (range [0, "<<listSample->Size()<<"["); + std::out_of_range e_(std::string("otb::Shark::ListSampleRangeToSharkVector " + ": Requested range is out of list sample bounds")); + throw e_; } output.clear(); @@ -83,11 +87,13 @@ template <class T> void ListSampleRangeToSharkVector(const T * listSample, std:: template <class T> void ListSampleRangeToSharkVector(const T * listSample, std::vector<unsigned int> & output, unsigned int start, unsigned int size) { - assert(listSample != ITK_NULLPTR); + assert(listSample != nullptr); if(start+size>listSample->Size()) { - itkGenericExceptionMacro(<<"Requested range ["<<start<<", "<<start+size<<"[ is out of bound for input list sample (range [0, "<<listSample->Size()<<"["); + std::out_of_range e_(std::string("otb::Shark::ListSampleRangeToSharkVector " + ": Requested range is out of list sample bounds")); + throw e_; } output.clear(); @@ -113,15 +119,36 @@ template <class T> void ListSampleRangeToSharkVector(const T * listSample, std:: template <class T> void ListSampleToSharkVector(const T * listSample, std::vector<shark::RealVector> & output) { - assert(listSample != ITK_NULLPTR); + assert(listSample != nullptr); ListSampleRangeToSharkVector(listSample,output,0U,static_cast<unsigned int>(listSample->Size())); } template <class T> void ListSampleToSharkVector(const T * listSample, std::vector<unsigned int> & output) { - assert(listSample != ITK_NULLPTR); + assert(listSample != nullptr); ListSampleRangeToSharkVector(listSample,output,0, static_cast<unsigned int>(listSample->Size())); } + +/** Shark assumes that labels are 0 ... (nbClasses-1). This function modifies the labels contained in the input vector and returns a vector with size = nbClasses which allows the translation from the normalised labels to the new ones oldLabel = dictionary[newLabel]. +*/ +template <typename T> void NormalizeLabelsAndGetDictionary(std::vector<T>& labels, + std::vector<T>& dictionary) +{ + std::unordered_map<T, T> dictMap; + T labelCount{0}; + for(const auto& l : labels) + { + if(dictMap.find(l)==dictMap.end()) + dictMap.insert({l, labelCount++}); + } + dictionary.resize(labelCount); + for(auto& l : labels) + { + auto newLabel = dictMap[l]; + dictionary[newLabel] = l; + l = newLabel; + } +} } } diff --git a/Modules/ThirdParty/Shark/otb-module-init.cmake b/Modules/ThirdParty/Shark/otb-module-init.cmake index 6bdd8c6a31559d89eb7b56d8bb9b0295ed0c7c26..23ec6090c7031f09ffe821918d14e58de5fc764e 100644 --- a/Modules/ThirdParty/Shark/otb-module-init.cmake +++ b/Modules/ThirdParty/Shark/otb-module-init.cmake @@ -20,4 +20,8 @@ find_package ( Shark REQUIRED ) +if(SHARK_USE_OPENMP AND NOT OTB_USE_OPENMP) + message(WARNING "Shark library is built with OpenMP and you have OTB_USE_OPENMP set to OFF.") +endif() + mark_as_advanced( Shark_DIR ) diff --git a/Modules/Visualization/Ice/include/otbFragmentShader.h b/Modules/Visualization/Ice/include/otbFragmentShader.h index 99559dd163c90d73002f57d6a6ca1897b2d5a174..7b931c8699e46481a683d6085bc4fba6c6a42fd8 100644 --- a/Modules/Visualization/Ice/include/otbFragmentShader.h +++ b/Modules/Visualization/Ice/include/otbFragmentShader.h @@ -58,7 +58,7 @@ public: protected: FragmentShader(); - ~FragmentShader() ITK_OVERRIDE; + ~FragmentShader() override; void BuildShader(); diff --git a/Modules/Visualization/Ice/include/otbFragmentShaderRegistry.h b/Modules/Visualization/Ice/include/otbFragmentShaderRegistry.h index 6e5fc6e08f252cd23dc5bbd2bd319e88303bae95..f1aae8be0dc5e0b299c1937240a6fbd1dbac860d 100644 --- a/Modules/Visualization/Ice/include/otbFragmentShaderRegistry.h +++ b/Modules/Visualization/Ice/include/otbFragmentShaderRegistry.h @@ -55,7 +55,7 @@ public: protected: FragmentShaderRegistry(); - ~FragmentShaderRegistry() ITK_OVERRIDE; + ~FragmentShaderRegistry() override; private: typedef std::map<std::string, std::pair<unsigned int, unsigned int> > ShaderMapType; diff --git a/Modules/Visualization/Ice/include/otbGlActor.h b/Modules/Visualization/Ice/include/otbGlActor.h index 2c20ce7bc302cc753f0334dfcc71e2bc9baee2cf..d11a4ef3c1b29dfa49d1ea793c367a0f9a19078b 100644 --- a/Modules/Visualization/Ice/include/otbGlActor.h +++ b/Modules/Visualization/Ice/include/otbGlActor.h @@ -72,7 +72,7 @@ public: protected: GlActor(); - ~GlActor() ITK_OVERRIDE; + ~GlActor() override; private: // prevent implementation diff --git a/Modules/Visualization/Ice/include/otbGlImageActor.h b/Modules/Visualization/Ice/include/otbGlImageActor.h index b70ecc429bc33b6ee9d8b3cf8ba333d070326da7..9f2c4b7ac11414b231f19272f17fe647115fa5a9 100644 --- a/Modules/Visualization/Ice/include/otbGlImageActor.h +++ b/Modules/Visualization/Ice/include/otbGlImageActor.h @@ -80,16 +80,16 @@ public: void Initialize(const std::string & filename); // Retrieve the full extent of the actor - void GetExtent(double & ulx, double & uly, double & lrx, double & lry) const ITK_OVERRIDE; + void GetExtent(double & ulx, double & uly, double & lrx, double & lry) const override; // Update internal actor state with respect to ViewSettings - void ProcessViewSettings() ITK_OVERRIDE; + void ProcessViewSettings() override; // Heavy load/unload operations of data - void UpdateData() ITK_OVERRIDE; + void UpdateData() override; // Gl rendering of current state - void Render() ITK_OVERRIDE; + void Render() override; // Automatic color adjustment void AutoColorAdjustment( double & minRed, double & maxRed, @@ -101,15 +101,15 @@ public: const PointType & GetOrigin() const; - const GeoInterface::Spacing2 & GetSpacing() const ITK_OVERRIDE; + const GeoInterface::Spacing2 & GetSpacing() const override; - std::string GetWkt() const ITK_OVERRIDE; + std::string GetWkt() const override; ImageKeywordlistType GetKwl() const; - bool HasKwl() const ITK_OVERRIDE; + bool HasKwl() const override; - bool GetKwl( ImageKeywordlist & ) const ITK_OVERRIDE; + bool GetKwl( ImageKeywordlist & ) const override; MetaDataDictionaryType & GetMetaDataDictionary() const; @@ -191,11 +191,11 @@ public: bool TransformFromViewport( Point2d & out, const Point2d & in, - bool isPhysical = true ) const ITK_OVERRIDE; + bool isPhysical = true ) const override; bool TransformToViewport( Point2d & out, const Point2d & in, - bool isPhysical = true ) const ITK_OVERRIDE; + bool isPhysical = true ) const override; void UpdateTransforms(); @@ -203,7 +203,7 @@ public: protected: GlImageActor(); - ~GlImageActor() ITK_OVERRIDE; + ~GlImageActor() override; typedef ImageFileReader<VectorImageType> ReaderType; typedef MultiChannelExtractROI<float,float> ExtractROIFilterType; diff --git a/Modules/Visualization/Ice/include/otbGlROIActor.h b/Modules/Visualization/Ice/include/otbGlROIActor.h index 769bb414e8dcff9072f3f6ee1fc863925398c69e..907b424afcd15ff5f1c32f43380b54444253cde7 100644 --- a/Modules/Visualization/Ice/include/otbGlROIActor.h +++ b/Modules/Visualization/Ice/include/otbGlROIActor.h @@ -49,16 +49,16 @@ public: itkNewMacro(Self); // Retrieve the full extent of the actor - void GetExtent(double & ulx, double & uly, double & lrx, double & lry) const ITK_OVERRIDE; + void GetExtent(double & ulx, double & uly, double & lrx, double & lry) const override; // Update internal actor state with respect to ViewSettings - void ProcessViewSettings() ITK_OVERRIDE; + void ProcessViewSettings() override; // Heavy load/unload operations of data - void UpdateData() ITK_OVERRIDE; + void UpdateData() override; // Gl rendering of current state - void Render() ITK_OVERRIDE; + void Render() override; void SetUL( const PointType & ); @@ -87,7 +87,7 @@ public: protected: GlROIActor(); - ~GlROIActor() ITK_OVERRIDE; + ~GlROIActor() override; private: // prevent implementation diff --git a/Modules/Visualization/Ice/include/otbGlVectorActor.h b/Modules/Visualization/Ice/include/otbGlVectorActor.h index 3ab74c1ac788158ecda76b8ad6d0c55ec5293ff9..7c40b41ef98afea051cc235c2a9624d264098358 100644 --- a/Modules/Visualization/Ice/include/otbGlVectorActor.h +++ b/Modules/Visualization/Ice/include/otbGlVectorActor.h @@ -67,19 +67,19 @@ public: void SetCurrentLayer(const std::string & layername); // Retrieve the full extent of the actor - void GetExtent(double & ulx, double & uly, double & lrx, double & lry) const ITK_OVERRIDE; + void GetExtent(double & ulx, double & uly, double & lrx, double & lry) const override; // Return actor extent in its own geometry void GetBoundingBox(double & ulx, double & uly, double & lrx, double & lry) const; // Update internal actor state with respect to ViewSettings - void ProcessViewSettings() ITK_OVERRIDE; + void ProcessViewSettings() override; // Heavy load/unload operations of data - void UpdateData() ITK_OVERRIDE; + void UpdateData() override; // Gl rendering of current state - void Render() ITK_OVERRIDE; + void Render() override; PointType ViewportToVectorTransform(const PointType & point) const; @@ -106,7 +106,7 @@ public: itkSetMacro(LineWidth,double); itkGetConstReferenceMacro(LineWidth,double); - std::string GetWkt() const ITK_OVERRIDE; + std::string GetWkt() const override; // // otb::GlActor overloads. @@ -114,13 +114,13 @@ public: bool TransformFromViewport( Point2d & out, const Point2d & in, - bool isPhysical = true ) const ITK_OVERRIDE; + bool isPhysical = true ) const override; protected: GlVectorActor(); - ~GlVectorActor() ITK_OVERRIDE; + ~GlVectorActor() override; // Internal class to hold tiles diff --git a/Modules/Visualization/Ice/include/otbGlView.h b/Modules/Visualization/Ice/include/otbGlView.h index 58c2022941fc9e22dbcc0cfc960c53cc8c770de1..63c43a3753f809c4530bcc996860d8f60efa3eab 100644 --- a/Modules/Visualization/Ice/include/otbGlView.h +++ b/Modules/Visualization/Ice/include/otbGlView.h @@ -280,7 +280,7 @@ public: protected: GlView(); - ~GlView() ITK_OVERRIDE; + ~GlView() override; private: // prevent implementation diff --git a/Modules/Visualization/Ice/include/otbImageSettings.h b/Modules/Visualization/Ice/include/otbImageSettings.h index 5b026f0bf436c17bb556cf8266a377aa7ea14069..a530f454942bbf5ab8db9dc3cb7c2837d3c1d799 100644 --- a/Modules/Visualization/Ice/include/otbImageSettings.h +++ b/Modules/Visualization/Ice/include/otbImageSettings.h @@ -81,7 +81,7 @@ public: protected: ImageSettings(); - ~ImageSettings() ITK_OVERRIDE; + ~ImageSettings() override; private: diff --git a/Modules/Visualization/Ice/include/otbStandardShader.h b/Modules/Visualization/Ice/include/otbStandardShader.h index 1b3179302394f943a27856d9c4b4587649525f37..1553f39bd18332f636a44f663effeebe1dc32e0a 100644 --- a/Modules/Visualization/Ice/include/otbStandardShader.h +++ b/Modules/Visualization/Ice/include/otbStandardShader.h @@ -89,18 +89,18 @@ public: itkSetMacro(Center,PointType); itkGetConstReferenceMacro(Center,PointType); - void SetupShader() ITK_OVERRIDE; + void SetupShader() override; itkNewMacro(Self); protected: StandardShader(); - ~StandardShader() ITK_OVERRIDE; + ~StandardShader() override; - std::string GetSource() const ITK_OVERRIDE; + std::string GetSource() const override; - std::string GetName() const ITK_OVERRIDE; + std::string GetName() const override; private: // prevent implementation diff --git a/Modules/Visualization/Ice/include/otbViewSettings.h b/Modules/Visualization/Ice/include/otbViewSettings.h index 40637d0890cca5af3c0f4ed12df23aedd9f8f818..a29ea74d0222312c4c0d5736e5057bbfe0799227 100644 --- a/Modules/Visualization/Ice/include/otbViewSettings.h +++ b/Modules/Visualization/Ice/include/otbViewSettings.h @@ -148,7 +148,7 @@ public: protected: ViewSettings(); - ~ViewSettings() ITK_OVERRIDE; + ~ViewSettings() override; private: // prevent implementation diff --git a/Modules/Visualization/IceViewer/include/otbIceViewer.h b/Modules/Visualization/IceViewer/include/otbIceViewer.h index af409bdbabfda3b8c08492ba46b706f263b5eaea..75539f09794b56be9b946302dff2ffa570dff3ba 100644 --- a/Modules/Visualization/IceViewer/include/otbIceViewer.h +++ b/Modules/Visualization/IceViewer/include/otbIceViewer.h @@ -76,7 +76,7 @@ protected: IceViewer(); - ~IceViewer() ITK_OVERRIDE; + ~IceViewer() override; // Non-static callbacks virtual void scroll_callback(GLFWwindow * window, double xoffset, double yoffset); diff --git a/Modules/Visualization/Mapla/include/mvdMaplaApplication.h b/Modules/Visualization/Mapla/include/mvdMaplaApplication.h index c425d8feded759e0944b58886c4c7b28d6a673cb..dcb85aefea5d887bb3a963dacdaf2ed96e374b7f 100644 --- a/Modules/Visualization/Mapla/include/mvdMaplaApplication.h +++ b/Modules/Visualization/Mapla/include/mvdMaplaApplication.h @@ -100,7 +100,7 @@ public: MaplaApplication( QApplication* qtApp ); /** \brief Destructor. */ - ~MaplaApplication() ITK_OVERRIDE; + ~MaplaApplication() override; // // STATIC METHODS. @@ -143,7 +143,7 @@ protected: // Protected attributes. protected: - void virtual_InitializeCore() ITK_OVERRIDE; + void virtual_InitializeCore() override; /*-[ PRIVATE SECTION ]-----------------------------------------------------*/ diff --git a/Modules/Visualization/Mapla/include/mvdMaplaMainWindow.h b/Modules/Visualization/Mapla/include/mvdMaplaMainWindow.h index e66c4a9548198705afe74ea3d93f855bf07db372..7cbd9f66b2ed0b6872043d1119e1fe436e89e8e5 100644 --- a/Modules/Visualization/Mapla/include/mvdMaplaMainWindow.h +++ b/Modules/Visualization/Mapla/include/mvdMaplaMainWindow.h @@ -104,7 +104,7 @@ public: MaplaMainWindow( QWidget* Parent =0, Qt::WindowFlags flags =0 ); /** \brief Destructor. */ - ~MaplaMainWindow() ITK_OVERRIDE; + ~MaplaMainWindow() override; /*-[ SIGNALS SECTION ]-----------------------------------------------------*/ @@ -121,7 +121,7 @@ protected: // // QMainWindow methods. - void closeEvent( QCloseEvent* event ) ITK_OVERRIDE; + void closeEvent( QCloseEvent* event ) override; // // Protected attributes. @@ -135,11 +135,11 @@ protected slots: /** */ - void OnAboutToChangeModel( const AbstractModel* ) ITK_OVERRIDE; + void OnAboutToChangeModel( const AbstractModel* ) override; /** */ - void OnModelChanged( AbstractModel* ) ITK_OVERRIDE; + void OnModelChanged( AbstractModel* ) override; /** */ @@ -178,9 +178,9 @@ private: // // I18nMainWindow methods. - void virtual_SetupUI() ITK_OVERRIDE; + void virtual_SetupUI() override; - void virtual_ConnectUI() ITK_OVERRIDE; + void virtual_ConnectUI() override; // // Private attributes. @@ -190,7 +190,7 @@ private: */ Ui::MaplaMainWindow* m_UI; -#ifdef OTB_USE_QT4 +#ifdef OTB_USE_QT /** * \brief OTB-applications tool-box controller. */ diff --git a/Modules/Visualization/Mapla/otb-module.cmake b/Modules/Visualization/Mapla/otb-module.cmake index 9ea66db3b77e733c24f9afd024e8ff855b2f028a..dd844644a43a03f015556d8554011ef2e4ed621e 100644 --- a/Modules/Visualization/Mapla/otb-module.cmake +++ b/Modules/Visualization/Mapla/otb-module.cmake @@ -27,7 +27,7 @@ otb_module( OTBMapla DEPENDS OTBMonteverdiCore OTBMonteverdiGUI - OTBQt4 + OTBQt OPTIONAL_DEPENDS diff --git a/Modules/Visualization/Mapla/src/CMakeLists.txt b/Modules/Visualization/Mapla/src/CMakeLists.txt index 491e26857b7958a9a9447c7bfcf1fac7d8213ad1..f6d02273ee06b69dab8a6909784b96ad29d06b7c 100644 --- a/Modules/Visualization/Mapla/src/CMakeLists.txt +++ b/Modules/Visualization/Mapla/src/CMakeLists.txt @@ -61,14 +61,14 @@ if (WIN32) endif() ############################################################################# -qt4_wrap_cpp( OTBMapla_SRC_MOC ${OTBMapla_HEADERS_MOC} ) -qt4_wrap_ui( OTBMapla_FORMS_HEADERS ${OTBMapla_FORMS} ) -qt4_add_resources( OTBMapla_RESOURCES_RCC ${OTBMapla_RESOURCES} OPTIONS "-no-compress") +qt5_wrap_cpp( OTBMapla_SRC_MOC ${OTBMapla_HEADERS_MOC} ) +qt5_wrap_ui( OTBMapla_FORMS_HEADERS ${OTBMapla_FORMS} ) +qt5_add_resources( OTBMapla_RESOURCES_RCC ${OTBMapla_RESOURCES} OPTIONS "-no-compress") ############################################################################# -add_to_qt4_i18n_sources( ${OTBMapla_SRCS} ) -add_to_qt4_i18n_headers( "../include" ${OTBMapla_SRCS} ) -add_to_qt4_i18n_forms( ${OTBMapla_FORMS} ) +add_to_qt_i18n_sources( ${OTBMapla_SRCS} ) +add_to_qt_i18n_headers( "../include" ${OTBMapla_SRCS} ) +add_to_qt_i18n_forms( ${OTBMapla_FORMS} ) ##########################[Mapla library]#################################### add_library( OTBMapla @@ -79,7 +79,7 @@ add_library( OTBMapla target_link_libraries( OTBMapla ${OTBMonteverdiCore_LIBRARIES} ${OTBMonteverdiGUI_LIBRARIES} - ${OTBQt4_LIBRARIES} + ${OTBQt_LIBRARIES} ) otb_module_target( OTBMapla ) diff --git a/Modules/Visualization/Mapla/src/mvdMaplaApplication.cxx b/Modules/Visualization/Mapla/src/mvdMaplaApplication.cxx index c5f7d22a3cd55592379d6cd289cacd0626362aa0..bb3d1d3f61c3849de39cc7c8c3a8e4830b40cba8 100644 --- a/Modules/Visualization/Mapla/src/mvdMaplaApplication.cxx +++ b/Modules/Visualization/Mapla/src/mvdMaplaApplication.cxx @@ -39,7 +39,7 @@ // Monteverdi includes (sorted by alphabetic order) // -#ifdef OTB_USE_QT4 +#ifdef OTB_USE_QT #include "mvdOTBApplicationsModel.h" #endif diff --git a/Modules/Visualization/Mapla/src/mvdMaplaMainWindow.cxx b/Modules/Visualization/Mapla/src/mvdMaplaMainWindow.cxx index 108ec7f1f35ddfc9f5ac89de9fb0ebd6d663acc6..dc4d2dd5d66e95235f37c987f3ad3ebfe5c5e796 100644 --- a/Modules/Visualization/Mapla/src/mvdMaplaMainWindow.cxx +++ b/Modules/Visualization/Mapla/src/mvdMaplaMainWindow.cxx @@ -29,7 +29,7 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. -#include <QtGui> +#include <QtWidgets> // // System includes (sorted by alphabetic order) @@ -42,7 +42,7 @@ // // Monteverdi includes (sorted by alphabetic order) -#ifdef OTB_USE_QT4 +#ifdef OTB_USE_QT # include "mvdApplicationLauncher.h" # include "mvdApplicationsToolBoxController.h" # include "mvdOTBApplicationsModel.h" @@ -86,7 +86,7 @@ MaplaMainWindow ::MaplaMainWindow( QWidget * p, Qt::WindowFlags flags ) : I18nMainWindow( p, flags ), m_UI( new mvd::Ui::MaplaMainWindow() ) -#ifdef OTB_USE_QT4 +#ifdef OTB_USE_QT , m_ApplicationsToolBoxController( NULL ) #endif @@ -110,7 +110,7 @@ MaplaMainWindow setObjectName( "Mapla" ); setWindowTitle( PROJECT_NAME " Application Launcher" ); -#ifdef OTB_USE_QT4 +#ifdef OTB_USE_QT assert( m_ApplicationsToolBoxController==NULL ); @@ -124,16 +124,16 @@ MaplaMainWindow setCentralWidget( m_ApplicationsToolBoxController->GetWidget() ); -#else // OTB_USE_QT4 +#else // OTB_USE_QT setCentralWidget( new QLabel( - tr( "Enable OTB_USE_QT4 preprocessor definition at compile time!" ), + tr( "Enable OTB_USE_QT preprocessor definition at compile time!" ), this ) ); -#endif // OTB_USE_QT4 +#endif // OTB_USE_QT if( !RestoreLayout( Monteverdi_UI_VERSION ) ) { @@ -148,7 +148,7 @@ MaplaMainWindow { // // OTB application support. -#ifdef OTB_USE_QT4 +#ifdef OTB_USE_QT QObject::connect( m_ApplicationsToolBoxController->GetWidget(), @@ -217,7 +217,7 @@ MaplaMainWindow ::OnApplicationToLaunchSelected( const QString & appName, const QString & ) { -#ifdef OTB_USE_QT4 +#ifdef OTB_USE_QT assert( MaplaApplication::ConstInstance()!=NULL ); assert( MaplaApplication::ConstInstance()->GetModel()!=NULL ); @@ -241,7 +241,7 @@ MaplaMainWindow appWindow->show(); -#endif // OTB_USE_QT4 +#endif // OTB_USE_QT } /*****************************************************************************/ diff --git a/Modules/Visualization/Monteverdi/include/mvdApplication.h b/Modules/Visualization/Monteverdi/include/mvdApplication.h index dff4eed963b648fd07cb08b00c66331d053c5f0e..c9cf8b6e87956f6147315bf2d0f6cf0f041f6692 100644 --- a/Modules/Visualization/Monteverdi/include/mvdApplication.h +++ b/Modules/Visualization/Monteverdi/include/mvdApplication.h @@ -99,7 +99,7 @@ public: Application( QApplication* qtApp ); /** \brief Destructor. */ - ~Application() ITK_OVERRIDE; + ~Application() override; /** * \return The number of outdated dataset-models present in the @@ -160,7 +160,7 @@ protected: // Protected attributes. protected: - void virtual_InitializeCore() ITK_OVERRIDE; + void virtual_InitializeCore() override; /*-[ PRIVATE SECTION ]-----------------------------------------------------*/ diff --git a/Modules/Visualization/Monteverdi/include/mvdMainWindow.h b/Modules/Visualization/Monteverdi/include/mvdMainWindow.h index f8523b7f5dd5fa4b303b778ca7308d76c559e61a..f19513a1cde73f7ae05ff8db69cab7fa147d28a0 100644 --- a/Modules/Visualization/Monteverdi/include/mvdMainWindow.h +++ b/Modules/Visualization/Monteverdi/include/mvdMainWindow.h @@ -125,7 +125,7 @@ public: MainWindow( QWidget* p =0, Qt::WindowFlags flags =0 ); /** \brief Destructor. */ - ~MainWindow() ITK_OVERRIDE; + ~MainWindow() override; /** */ @@ -150,7 +150,7 @@ public slots: /** */ - void ImportImages( const QStringList & filenames ); + void ImportImages( const QStringList & filenames, bool enableOverviews ); /*-[ SIGNALS SECTION ]-----------------------------------------------------*/ @@ -183,7 +183,7 @@ protected: // // QMainWindow methods. - void closeEvent( QCloseEvent* event ) ITK_OVERRIDE; + void closeEvent( QCloseEvent* event ) override; // // Protected attributes. @@ -197,11 +197,11 @@ protected slots: /** */ - void OnAboutToChangeModel( const AbstractModel * ) ITK_OVERRIDE; + void OnAboutToChangeModel( const AbstractModel * ) override; /** */ - void OnModelChanged( AbstractModel * ) ITK_OVERRIDE; + void OnModelChanged( AbstractModel * ) override; /** */ @@ -221,9 +221,9 @@ protected slots: /** */ -#if defined( OTB_USE_QT4 ) && USE_OTB_APPS +#if defined( OTB_USE_QT ) && USE_OTB_APPS void OnApplicationToLaunchSelected( const QString & appName, const QString & docName ); -#endif // defined( OTB_USE_QT4 ) && USE_OTB_APPS +#endif // defined( OTB_USE_QT ) && USE_OTB_APPS /** */ @@ -344,11 +344,11 @@ private: // // I18nMainWindow methods. - void virtual_SetupUI() ITK_OVERRIDE; + void virtual_SetupUI() override; - void virtual_ConnectUI() ITK_OVERRIDE; + void virtual_ConnectUI() override; - void virtual_InitializeUI() ITK_OVERRIDE; + void virtual_InitializeUI() override; // // Private attributes. @@ -396,7 +396,7 @@ private: QDockWidget* m_HistogramDock; -#ifdef OTB_USE_QT4 +#ifdef OTB_USE_QT /** * \brief OTB-applications browser dock-widget. */ diff --git a/Modules/Visualization/Monteverdi/include/mvdPreferencesDialog.h b/Modules/Visualization/Monteverdi/include/mvdPreferencesDialog.h index c33030849830653e08d1a0429444bf88452f038b..f25eacb4b4a8c133ab9a72eb2e11f586db623a97 100644 --- a/Modules/Visualization/Monteverdi/include/mvdPreferencesDialog.h +++ b/Modules/Visualization/Monteverdi/include/mvdPreferencesDialog.h @@ -33,7 +33,7 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. -#include <QtGui> +#include <QtWidgets> // // System includes (sorted by alphabetic order) @@ -92,7 +92,7 @@ public: PreferencesDialog( QWidget* p =NULL, Qt::WindowFlags flags =0 ); /** Destructor */ - ~PreferencesDialog() ITK_OVERRIDE; + ~PreferencesDialog() override; /*-[ SIGNALS SECTION ]-----------------------------------------------------*/ diff --git a/Modules/Visualization/Monteverdi/otb-module.cmake b/Modules/Visualization/Monteverdi/otb-module.cmake index ea0d985de38e8faa826ff121f68aab8e3536441d..82815d92df78ae54d0bc10e1ee6bfb6628a09625 100644 --- a/Modules/Visualization/Monteverdi/otb-module.cmake +++ b/Modules/Visualization/Monteverdi/otb-module.cmake @@ -27,7 +27,7 @@ otb_module( OTBMonteverdi DEPENDS OTBMonteverdiCore OTBMonteverdiGUI - OTBQt4 + OTBQt OTBQtAdapters OPTIONAL_DEPENDS diff --git a/Modules/Visualization/Monteverdi/src/CMakeLists.txt b/Modules/Visualization/Monteverdi/src/CMakeLists.txt index 87a9ffe6d36c1ae7a33b4d9be183603bcb8cd494..9952927df4f285bb515e5bafdb56426f55d94a0c 100644 --- a/Modules/Visualization/Monteverdi/src/CMakeLists.txt +++ b/Modules/Visualization/Monteverdi/src/CMakeLists.txt @@ -44,14 +44,14 @@ set( OTBMonteverdi_RESOURCES ) ############################################################################# -qt4_wrap_cpp( OTBMonteverdi_SRC_MOC ${OTBMonteverdi_HEADERS_MOC} ) -qt4_wrap_ui( OTBMonteverdi_FORMS_HEADERS ${OTBMonteverdi_FORMS} ) -qt4_add_resources( OTBMonteverdi_RESOURCES_RCC ${OTBMonteverdi_RESOURCES} OPTIONS "-no-compress") +qt5_wrap_cpp( OTBMonteverdi_SRC_MOC ${OTBMonteverdi_HEADERS_MOC} ) +qt5_wrap_ui( OTBMonteverdi_FORMS_HEADERS ${OTBMonteverdi_FORMS} ) +qt5_add_resources( OTBMonteverdi_RESOURCES_RCC ${OTBMonteverdi_RESOURCES} OPTIONS "-no-compress") ############################################################################# -add_to_qt4_i18n_sources( ${OTBMonteverdi_SRCS} ) -add_to_qt4_i18n_headers( "../include" ${OTBMonteverdi_SRCS} ) -add_to_qt4_i18n_forms( ${OTBMonteverdi_FORMS} ) +add_to_qt_i18n_sources( ${OTBMonteverdi_SRCS} ) +add_to_qt_i18n_headers( "../include" ${OTBMonteverdi_SRCS} ) +add_to_qt_i18n_forms( ${OTBMonteverdi_FORMS} ) ############################################################################# add_library( OTBMonteverdi @@ -62,7 +62,7 @@ add_library( OTBMonteverdi target_link_libraries( OTBMonteverdi ${OTBMonteverdiCore_LIBRARIES} ${OTBMonteverdiGUI_LIBRARIES} - ${OTBQt4_LIBRARIES} + ${OTBQt_LIBRARIES} ${OTBQtAdapters_LIBRARIES} ) otb_module_target( OTBMonteverdi ) diff --git a/Modules/Visualization/Monteverdi/src/main.cxx b/Modules/Visualization/Monteverdi/src/main.cxx index e44dbb8459d0b239c8bc5c5283d5c41a6412d7ef..1765c73bec64c6ba02f19ef8ba06187c1289cf66 100644 --- a/Modules/Visualization/Monteverdi/src/main.cxx +++ b/Modules/Visualization/Monteverdi/src/main.cxx @@ -1,5 +1,6 @@ /* * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) + * Copyright (C) 2017 CS Systemes d'Information (CS SI) * * This file is part of Orfeo Toolbox * @@ -31,6 +32,8 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. +#include <QCoreApplication> +#include <QFile> #include <QPixmap> #include <QSplashScreen> @@ -48,6 +51,7 @@ // // Monteverdi includes (sorted by alphabetic order) +#include "mvdAlgorithm.h" #include "mvdApplication.h" #include "mvdMainWindow.h" @@ -65,34 +69,39 @@ struct Flags { Flags() : loadOTBApplications( false ), - forceNoGLSL( false ) + forceNoGLSL( false ), + forceNoOverviews( false ) { } bool loadOTBApplications: 1; bool forceNoGLSL: 1; + bool forceNoOverviews: 1; }; /*****************************************************************************/ /* FUNCTIONS DECLARATION */ /*****************************************************************************/ +void +DisplayUsage( const char * ); +void +AppendFromTextFile( QStringList &, const QString & ); /*****************************************************************************/ /* MAIN */ /*****************************************************************************/ int -main( int argc, char* argv[] ) +main( int argc, char * argv[] ) { QApplication qtApp( argc, argv ); - Flags flags; // // 0. Splash-screen. #if USE_SPLASH_SCREEN - QPixmap pixmap(QLatin1String( ":/images/application_splash" )); - QSplashScreen splash(pixmap); + QPixmap pixmap( QLatin1String( ":/images/application_splash" ) ); + QSplashScreen splash( pixmap ); splash.show(); qtApp.processEvents();//This is used to accept a click on the screen so that user can cancel the screen #endif @@ -100,24 +109,16 @@ main( int argc, char* argv[] ) // // 0bis. Parse pre-initialization command-line arguments. QStringList args( qtApp.arguments() ); + Flags flags; { + QStringList filenames; + for( QStringList::iterator it( args.begin() ); it!=args.end(); ) if( it->compare( "-h" )==0 || it->compare( "--help" )==0 ) { - std::cout - << mvd::ToLocalStdString( - QCoreApplication::translate( - PROJECT_NAME, - "Usage: %1 [-h|--help] [-a|--applications] [<filename>...]\n" - " -n, --no-glsl force OpenGL 1.x compatible rendering." - " -a, --applications load OTB-applications from OTB_APPLICATIONS_PATH." - " -h, --help display this help message.\n" - ) - .arg( QFileInfo( argv[ 0 ] ).baseName() ) - ) - << std::endl; + DisplayUsage( argv[ 0 ] ); return ERROR_CODE_USAGE; } @@ -130,15 +131,44 @@ main( int argc, char* argv[] ) it = args.erase( it ); } - else if(it->compare( "-n" )==0 || + else if(it->compare( "-g" )==0 || it->compare( "--no-glsl" )==0 ) { flags.forceNoGLSL = true; it = args.erase( it ); } + + else if(it->compare( "-o" )==0 || + it->compare( "--no-overviews" )==0 ) + { + flags.forceNoOverviews = true; + + it = args.erase( it ); + } + + else if(it->compare( "-t" )==0 || + it->compare( "--txt-file" )==0 ) + { + it = args.erase( it ); + + if( it==args.end() || + it->startsWith( '-' ) ) + { + DisplayUsage( argv[ 0 ] ); + + return ERROR_CODE_USAGE; + } + + AppendFromTextFile( filenames, *it ); + + it = args.erase( it ); + } + else ++ it; + + args << filenames; } // @@ -205,14 +235,14 @@ main( int argc, char* argv[] ) #if USE_OTB_APPS mainWindow.SetupOTBApplications(); #else // USE_OTB_APPS - qWarning() << "OTB-applications support is not included in this build."; + qWarning() << "OTB-applications support is not included in this build."; #endif // USE_OTB_APPS // // 6. Load command-line filenames. args.pop_front(); - mainWindow.ImportImages( args ); + mainWindow.ImportImages( args, !flags.forceNoOverviews ); // // 6. Let's go: run the application and return exit code. @@ -232,3 +262,63 @@ main( int argc, char* argv[] ) /*****************************************************************************/ /* FUNCTIONS IMPLEMENTATION */ /*****************************************************************************/ +void +DisplayUsage( const char * argv0 ) +{ + std::cout + << mvd::ToLocalStdString( + QCoreApplication::translate( + PROJECT_NAME, + "Usage: %1 " + "[-h|--help] " + "[-a|--applications] " + "[-g|--no-glsl] " + "[-o|--no-overviews] " + "[-t|--txt-file <filename>] " + "[<filename>...]\n" + " -a, --applications load OTB-applications from OTB_APPLICATIONS_PATH.\n" +#if 0 + " -f, --file load Monteverdi project file.\n" +#endif + " -h, --help display this help message.\n" + " -g, --no-glsl force OpenGL 1.x compatible rendering.\n" + " -o, --no-overviews ignore build GDAL overviews step.\n" +#if 0 + " -O, --force-overviews force build GDAL overviews step.\n" +#endif + " -t, --txt-file read layer filenames from text file.\n" +#if 0 + " -c, --csv-file read layer filenames & settings from CSV file.\n" + " -x, --xml-file read layer filenames & settings from XML file.\n" +#endif + ) + .arg( QFileInfo( argv0 ).baseName() ) + ) + << std::endl; +} + +/*****************************************************************************/ +void +AppendFromTextFile( QStringList & strings, + const QString & filename ) +{ + QFile file( filename ); + + if( !file.open( QFile::ReadOnly | QFile::Text ) ) + throw mvd::SystemError( + mvd::ToStdString( + QCoreApplication::translate( "mvd::", "Failed to open '%1'" ) + .arg( filename ) + ) + ); + + QTextStream is( &file ); + + while( !is.atEnd() ) + { + QString line( is.readLine() ); + + if( !line.isNull() ) + strings << line; + } +} diff --git a/Modules/Visualization/Monteverdi/src/mvdApplication.cxx b/Modules/Visualization/Monteverdi/src/mvdApplication.cxx index eaa72e9cb1ae6e47c19b0c8f8574ebf34e53f4ef..dafaba30ac5c973c8d55e57879f15f3bf5688aaf 100644 --- a/Modules/Visualization/Monteverdi/src/mvdApplication.cxx +++ b/Modules/Visualization/Monteverdi/src/mvdApplication.cxx @@ -40,7 +40,7 @@ #include "mvdStackedLayerModel.h" // -#ifdef OTB_USE_QT4 +#ifdef OTB_USE_QT # include "mvdOTBApplicationsModel.h" #endif @@ -121,7 +121,7 @@ void Application ::OpenApplicationsBrowser() { -#ifdef OTB_USE_QT4 +#ifdef OTB_USE_QT m_OTBApplicationsModel = new OTBApplicationsModel( this ); m_OTBApplicationsModel->BuildModel(); diff --git a/Modules/Visualization/Monteverdi/src/mvdMainWindow.cxx b/Modules/Visualization/Monteverdi/src/mvdMainWindow.cxx index 6b1d92cf582d251cb2a3c6a7936f8842d73ee0a4..eed8b9d4730a7932afd5a4f4c95aeba265bda98f 100644 --- a/Modules/Visualization/Monteverdi/src/mvdMainWindow.cxx +++ b/Modules/Visualization/Monteverdi/src/mvdMainWindow.cxx @@ -1,5 +1,6 @@ /* * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) + * Copyright (C) 2017 CS Systemes d'Information (CS SI) * * This file is part of Orfeo Toolbox * @@ -29,7 +30,7 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. -#include <QtGui> +#include <QtWidgets> // // System includes (sorted by alphabetic order) @@ -43,7 +44,7 @@ // // Monteverdi includes (sorted by alphabetic order) -#if defined( OTB_USE_QT4 ) && USE_OTB_APPS +#if defined( OTB_USE_QT ) && USE_OTB_APPS # include "mvdApplicationLauncher.h" # include "mvdApplicationsToolBoxController.h" # include "mvdOTBApplicationsModel.h" @@ -131,7 +132,7 @@ MainWindow m_PixelDescriptionDock(NULL), #endif // USE_PIXEL_DESCRIPTION m_HistogramDock( NULL ), -#if defined( OTB_USE_QT4 ) && USE_OTB_APPS +#if defined( OTB_USE_QT ) && USE_OTB_APPS m_OtbApplicationsBrowserDock(NULL), #endif m_ImageView( NULL ), @@ -1362,7 +1363,7 @@ MainWindow /*****************************************************************************/ void MainWindow -::ImportImages( const QStringList & filenames ) +::ImportImages( const QStringList & filenames, bool enableOverviews ) { if( filenames.isEmpty() ) return; @@ -1376,7 +1377,8 @@ MainWindow ) ); - if( !( value.isValid() ? value.toBool() : OVERVIEWS_ENABLED_DEFAULT ) || + if( enableOverviews && + ( value.isValid() ? value.toBool() : OVERVIEWS_ENABLED_DEFAULT ) && !BuildGDALOverviews( filenames ) ) return; } @@ -1431,11 +1433,11 @@ MainWindow if( !( *it )->IsClosable() ) { - assert( !( *it )->GetApplication().IsNull() ); + assert( ( *it )->GetModel()->GetApplication() ); // qDebug() << "OTB-application:" << ( *it )->GetApplication()->GetDocName(); - names.push_back( ( *it )->GetApplication()->GetDocName() ); + names.push_back( ( *it )->GetModel()->GetApplication()->GetDocName() ); } } @@ -1809,7 +1811,8 @@ MainWindow // Select filename. QString caption(tr("Open file...")); ImportImages( - otb::GetOpenFileNames( this, caption ) + otb::GetOpenFilenames( this, caption ) , + true ); } @@ -2209,7 +2212,7 @@ MainWindow } /*****************************************************************************/ -#if defined( OTB_USE_QT4 ) && USE_OTB_APPS +#if defined( OTB_USE_QT ) && USE_OTB_APPS void MainWindow @@ -2294,7 +2297,7 @@ MainWindow ); } -#endif // defined( OTB_USE_QT4 ) && USE_OTB_APPS +#endif // defined( OTB_USE_QT ) && USE_OTB_APPS /*****************************************************************************/ #if USE_TABBED_VIEW @@ -2324,7 +2327,7 @@ MainWindow QWidget* appWidget = m_CentralTabWidget->widget( index ); assert( appWidget!=NULL ); -#if defined( OTB_USE_QT4 ) && USE_OTB_APPS +#if defined( OTB_USE_QT ) && USE_OTB_APPS assert( appWidget==qobject_cast< Wrapper::QtWidgetView* >( appWidget ) ); Wrapper::QtWidgetView* appWidgetView = diff --git a/Modules/Visualization/Monteverdi/src/mvdPreferencesDialog.cxx b/Modules/Visualization/Monteverdi/src/mvdPreferencesDialog.cxx index df61b5745cc0ad5769bc4fee78f1b8ffe697e506..0aa1c804a03b742019fac5c62030836ad820feea 100644 --- a/Modules/Visualization/Monteverdi/src/mvdPreferencesDialog.cxx +++ b/Modules/Visualization/Monteverdi/src/mvdPreferencesDialog.cxx @@ -454,7 +454,7 @@ PreferencesDialog ::on_geoidButton_clicked() { QString geoidFile( - otb::GetOpenFileName( + otb::GetOpenFilename( this, tr( "Select a geoid file." ) ) diff --git a/Modules/Visualization/MonteverdiCore/include/mvdAbstractImageModel.h b/Modules/Visualization/MonteverdiCore/include/mvdAbstractImageModel.h index 8eff3030ebf21d1ffe3400a46551b6ac09c513d4..d2e6723d4bc81c1d9556cea4bbe6a3b0f818268e 100644 --- a/Modules/Visualization/MonteverdiCore/include/mvdAbstractImageModel.h +++ b/Modules/Visualization/MonteverdiCore/include/mvdAbstractImageModel.h @@ -171,7 +171,7 @@ public: public: /** Destructor */ - ~AbstractImageModel() ITK_OVERRIDE; + ~AbstractImageModel() override; /** */ inline int GetId() const; @@ -322,7 +322,7 @@ protected: // // AbstractModel methods. - void virtual_BuildModel( void* context ) ITK_OVERRIDE; + void virtual_BuildModel( void* context ) override; // // Protected attributes. diff --git a/Modules/Visualization/MonteverdiCore/include/mvdAbstractLayerModel.h b/Modules/Visualization/MonteverdiCore/include/mvdAbstractLayerModel.h index ab4065a91b1882092f79319c6f0222d792b89037..e556edf4c40f5d07960f42e9b0aa197f94f71ad8 100644 --- a/Modules/Visualization/MonteverdiCore/include/mvdAbstractLayerModel.h +++ b/Modules/Visualization/MonteverdiCore/include/mvdAbstractLayerModel.h @@ -121,7 +121,7 @@ class OTBMonteverdiCore_EXPORT AbstractLayerModel : public: /** \brief Destructor. */ - ~AbstractLayerModel() ITK_OVERRIDE; + ~AbstractLayerModel() override; /** */ @@ -201,7 +201,7 @@ private: // // VisibleInterface overloads. - void virtual_SignalVisibilityChanged( bool ) ITK_OVERRIDE; + void virtual_SignalVisibilityChanged( bool ) override; // // Private attributes. diff --git a/Modules/Visualization/MonteverdiCore/include/mvdAbstractModel.h b/Modules/Visualization/MonteverdiCore/include/mvdAbstractModel.h index e6b9178c3c2cc5bf18f69fc0e0faf4788138ea82..f6f84f37825ee5100a0777b351e11f8aac438471 100644 --- a/Modules/Visualization/MonteverdiCore/include/mvdAbstractModel.h +++ b/Modules/Visualization/MonteverdiCore/include/mvdAbstractModel.h @@ -91,7 +91,7 @@ class OTBMonteverdiCore_EXPORT AbstractModel : public: /** Destructor */ - ~AbstractModel() ITK_OVERRIDE; + ~AbstractModel() override; /** */ template< typename TModel > diff --git a/Modules/Visualization/MonteverdiCore/include/mvdAbstractWorker.h b/Modules/Visualization/MonteverdiCore/include/mvdAbstractWorker.h index 800bbbc130690dbd316efb9e5ba6dfb7ee48d119..4ae16dc4ee42adcdd9d14f2369af60cb090f504f 100644 --- a/Modules/Visualization/MonteverdiCore/include/mvdAbstractWorker.h +++ b/Modules/Visualization/MonteverdiCore/include/mvdAbstractWorker.h @@ -91,7 +91,7 @@ class OTBMonteverdiCore_EXPORT AbstractWorker : public: /** \brief Destructor. */ - ~AbstractWorker() ITK_OVERRIDE; + ~AbstractWorker() override; /** */ diff --git a/Modules/Visualization/MonteverdiCore/include/mvdAlgorithm.h b/Modules/Visualization/MonteverdiCore/include/mvdAlgorithm.h index 54c878aaf1d8ab10fc9684d70269562d10e494e8..08dc0fb2af82c98839ec867f9f4e42afca47df7c 100644 --- a/Modules/Visualization/MonteverdiCore/include/mvdAlgorithm.h +++ b/Modules/Visualization/MonteverdiCore/include/mvdAlgorithm.h @@ -260,7 +260,7 @@ ToLocalString( const QString & ); /** * \brief Convert and copy a QString to a STL std::string. * - * The Unicode data is converted to 8-bit using the QString::toAscii() + * The Unicode data is converted to 8-bit using the QString::toLatin1() * method. * * \param str The Unicode string to convert. @@ -517,7 +517,7 @@ inline std::string ToStdString( const QString& str ) { - return std::string( str.toAscii().constData() ); + return std::string( str.toLatin1().constData() ); } /*******************************************************************************/ @@ -525,7 +525,7 @@ inline const char* ToString( const QString& str ) { - return str.toAscii().constData(); + return str.toLatin1().constData(); } /*******************************************************************************/ diff --git a/Modules/Visualization/MonteverdiCore/include/mvdApplicationsBrowser.h b/Modules/Visualization/MonteverdiCore/include/mvdApplicationsBrowser.h index 68956e666adbda53ddd15cd5c12d6398fb3e0db3..eeeb38fc12bfa1047e22c17b7b57b2cf82ebebec 100644 --- a/Modules/Visualization/MonteverdiCore/include/mvdApplicationsBrowser.h +++ b/Modules/Visualization/MonteverdiCore/include/mvdApplicationsBrowser.h @@ -112,7 +112,7 @@ public: ApplicationsBrowser( QObject* p =NULL ); /** \brief Destructor. */ - ~ApplicationsBrowser() ITK_OVERRIDE; + ~ApplicationsBrowser() override; /** set the path where to look for applications */ void SetAutoLoadPath(const std::string & itk_auto_load_path); diff --git a/Modules/Visualization/MonteverdiCore/include/mvdBackgroundTask.h b/Modules/Visualization/MonteverdiCore/include/mvdBackgroundTask.h index 3baa0ceed2d5e6879e44198350fdf0b70fbf8d6d..9fc780511497f0a5dbe777cfa2e53ab854afd631 100644 --- a/Modules/Visualization/MonteverdiCore/include/mvdBackgroundTask.h +++ b/Modules/Visualization/MonteverdiCore/include/mvdBackgroundTask.h @@ -100,7 +100,7 @@ public: /** * \brief Destructor. */ - ~BackgroundTask() ITK_OVERRIDE; + ~BackgroundTask() override; /** */ diff --git a/Modules/Visualization/MonteverdiCore/include/mvdHistogramModel.h b/Modules/Visualization/MonteverdiCore/include/mvdHistogramModel.h index 52d3b56043f6045a12b737dbc2c156a12dfa80f9..aa1aec03711073dd4a3279e886ef214d676076b2 100644 --- a/Modules/Visualization/MonteverdiCore/include/mvdHistogramModel.h +++ b/Modules/Visualization/MonteverdiCore/include/mvdHistogramModel.h @@ -175,7 +175,7 @@ public: HistogramModel( QObject* p =NULL ); /** \brief Destructor. */ - ~HistogramModel() ITK_OVERRIDE; + ~HistogramModel() override; /** */ @@ -234,7 +234,7 @@ protected: // AbstractModel methods. /** */ - void virtual_BuildModel( void* context =NULL ) ITK_OVERRIDE; + void virtual_BuildModel( void* context =NULL ) override; // // Protected attributes. @@ -276,9 +276,9 @@ private: // SerializableInterface methods. // - void virtual_Read( QIODevice* device ) ITK_OVERRIDE; + void virtual_Read( QIODevice* device ) override; - void virtual_Write( QIODevice& device ) const ITK_OVERRIDE; + void virtual_Write( QIODevice& device ) const override; // // Private attributes. diff --git a/Modules/Visualization/MonteverdiCore/include/mvdI18nCoreApplication.h b/Modules/Visualization/MonteverdiCore/include/mvdI18nCoreApplication.h index 52a2f263a7040279e14a2bade0c36bc2903e7c1e..b7cfcf33ab50458509ffc0a0b01a6b6ee61f318d 100644 --- a/Modules/Visualization/MonteverdiCore/include/mvdI18nCoreApplication.h +++ b/Modules/Visualization/MonteverdiCore/include/mvdI18nCoreApplication.h @@ -142,7 +142,7 @@ public: I18nCoreApplication( QCoreApplication* qtApp ); /** \brief Destructor. */ - ~I18nCoreApplication() ITK_OVERRIDE; + ~I18nCoreApplication() override; /** */ @@ -448,7 +448,11 @@ private: * \param type Type of caught message. * \param message Content of caught message. */ - static void HandleQtMessage( QtMsgType type, const char* message ); + static void HandleQtMessage( QtMsgType type, const QMessageLogContext & , const QString & message ); + /* Old function was + static void HandleQtMessage( QtMsgType type, const char * message ); + Qstring has a constructor QString(const char *str) but I have no idea + of the perf impact */ /** */ diff --git a/Modules/Visualization/MonteverdiCore/include/mvdImageImporter.h b/Modules/Visualization/MonteverdiCore/include/mvdImageImporter.h index ab735e5cc8c96fdfe457ce5bf4fe921964611063..00e574ff5ac9c01b04efc128bd214de8f1ffcaff 100644 --- a/Modules/Visualization/MonteverdiCore/include/mvdImageImporter.h +++ b/Modules/Visualization/MonteverdiCore/include/mvdImageImporter.h @@ -122,7 +122,7 @@ public: /** * \brief Destructor. */ - ~ImageImporter() ITK_OVERRIDE; + ~ImageImporter() override; /*-[ PUBLIC SLOTS SECTION ]------------------------------------------------*/ @@ -177,9 +177,9 @@ private: // // AbstractWorker oveloads. - QObject* virtual_Do() ITK_OVERRIDE; + QObject* virtual_Do() override; - QString virtual_GetFirstProgressText() const ITK_OVERRIDE; + QString virtual_GetFirstProgressText() const override; // diff --git a/Modules/Visualization/MonteverdiCore/include/mvdMyClass.h b/Modules/Visualization/MonteverdiCore/include/mvdMyClass.h index 854ebbb31ef55bd9d275120f67f0eecf8f48f342..2dcf415eb22dc1379c94e0fc64c2cc0ebbd43dbb 100644 --- a/Modules/Visualization/MonteverdiCore/include/mvdMyClass.h +++ b/Modules/Visualization/MonteverdiCore/include/mvdMyClass.h @@ -94,7 +94,7 @@ public: MyClass( QObject* p =NULL ); /** \brief Destructor. */ - ~MyClass() ITK_OVERRIDE; + ~MyClass() override; /*-[ PUBLIC SLOTS SECTION ]------------------------------------------------*/ diff --git a/Modules/Visualization/MonteverdiCore/include/mvdOverviewBuilder.h b/Modules/Visualization/MonteverdiCore/include/mvdOverviewBuilder.h index eb40330126e6d4098ff3857ba87db53a8de10e3f..a7cdbc3330021975debd5c1cf3fd296c494d2429 100644 --- a/Modules/Visualization/MonteverdiCore/include/mvdOverviewBuilder.h +++ b/Modules/Visualization/MonteverdiCore/include/mvdOverviewBuilder.h @@ -110,12 +110,12 @@ public: /** * \brief Destructor. */ - ~OverviewBuilder() ITK_OVERRIDE; + ~OverviewBuilder() override; // // ProgressInterface overloads. - void SetProgress( double ) ITK_OVERRIDE; + void SetProgress( double ) override; /*-[ PUBLIC SLOTS SECTION ]------------------------------------------------*/ @@ -166,9 +166,9 @@ private: // // AbstractWorker oveloads. - QObject * virtual_Do() ITK_OVERRIDE; + QObject * virtual_Do() override; - QString virtual_GetFirstProgressText() const ITK_OVERRIDE; + QString virtual_GetFirstProgressText() const override; // diff --git a/Modules/Visualization/MonteverdiCore/include/mvdProcessObjectObserver.h b/Modules/Visualization/MonteverdiCore/include/mvdProcessObjectObserver.h index b4468924cd1f00ca42bee7fbccec523d9bc94c77..207cec9d226ee3fc6d910eb47130cc55dde14be8 100644 --- a/Modules/Visualization/MonteverdiCore/include/mvdProcessObjectObserver.h +++ b/Modules/Visualization/MonteverdiCore/include/mvdProcessObjectObserver.h @@ -101,7 +101,7 @@ public: public: /** \brief Destructor. */ - ~ProcessObjectObserver() ITK_OVERRIDE; + ~ProcessObjectObserver() override; const ProgressInterface * GetProgressInterface() const; ProgressInterface * GetProgressInterface(); @@ -112,10 +112,10 @@ public: // itk::Command overloads. void Execute( itk::Object * caller, - const itk::EventObject & event ) ITK_OVERRIDE; + const itk::EventObject & event ) override; void Execute( const itk::Object * caller, - const itk::EventObject & event ) ITK_OVERRIDE; + const itk::EventObject & event ) override; /*-[ PUBLIC SLOTS SECTION ]------------------------------------------------*/ diff --git a/Modules/Visualization/MonteverdiCore/include/mvdQuicklookModel.h b/Modules/Visualization/MonteverdiCore/include/mvdQuicklookModel.h index e34adf8a50e8e1bdf71b3b22bb567d5c89daf0dd..1930cb73d9e92b52124eef72029f1f47cb9fc668 100644 --- a/Modules/Visualization/MonteverdiCore/include/mvdQuicklookModel.h +++ b/Modules/Visualization/MonteverdiCore/include/mvdQuicklookModel.h @@ -100,7 +100,7 @@ public: QuicklookModel( QObject* p =NULL ); /** Destructor */ - ~QuicklookModel() ITK_OVERRIDE; + ~QuicklookModel() override; /** * \brief Get the parent image-model of this quicklook image as an @@ -161,7 +161,7 @@ signals: protected: /** */ - void virtual_BuildModel( void* context =NULL ) ITK_OVERRIDE; + void virtual_BuildModel( void* context =NULL ) override; // // Protected attributes. diff --git a/Modules/Visualization/MonteverdiCore/include/mvdStackedLayerModel.h b/Modules/Visualization/MonteverdiCore/include/mvdStackedLayerModel.h index 035914cb210f692825e2bf440373f924f7062282..8291038e1582a193cf7bc3534ec0834c145a1c59 100644 --- a/Modules/Visualization/MonteverdiCore/include/mvdStackedLayerModel.h +++ b/Modules/Visualization/MonteverdiCore/include/mvdStackedLayerModel.h @@ -116,7 +116,7 @@ public: StackedLayerModel( QObject* p =NULL ); /** \brief Destructor. */ - ~StackedLayerModel() ITK_OVERRIDE; + ~StackedLayerModel() override; inline const AbstractLayerModel * operator[]( SizeType ) const; inline AbstractLayerModel * operator[]( SizeType ); diff --git a/Modules/Visualization/MonteverdiCore/include/mvdSystemError.h b/Modules/Visualization/MonteverdiCore/include/mvdSystemError.h index b14a1207f4bc2bea19213e37ac5039ca9dcb7f4b..6fe4b0329d584e331cbcf84cd57b964b7c4f2bb6 100644 --- a/Modules/Visualization/MonteverdiCore/include/mvdSystemError.h +++ b/Modules/Visualization/MonteverdiCore/include/mvdSystemError.h @@ -96,7 +96,7 @@ public: + ": " + message) {}; /** \brief Destructor. */ - ~SystemError() throw() ITK_OVERRIDE {}; + ~SystemError() throw() override {}; /*-[ PROTECTED SECTION ]---------------------------------------------------*/ diff --git a/Modules/Visualization/MonteverdiCore/include/mvdTypes.h b/Modules/Visualization/MonteverdiCore/include/mvdTypes.h index 7387f22f9ae04dc2c05711428c34b4c6ec7b49e2..1010fe94009a966c1a81c51fe427d97e2dcf78f8 100644 --- a/Modules/Visualization/MonteverdiCore/include/mvdTypes.h +++ b/Modules/Visualization/MonteverdiCore/include/mvdTypes.h @@ -37,7 +37,7 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. -#include <QtGui> +#include <QtWidgets> // // System includes (sorted by alphabetic order) diff --git a/Modules/Visualization/MonteverdiCore/include/mvdVectorImageModel.h b/Modules/Visualization/MonteverdiCore/include/mvdVectorImageModel.h index 29e9aba7e3b3bad315916646aeba67998793d79d..a54dfa0fe6f00f2cb5ec9fef447b86867c7acb2f 100644 --- a/Modules/Visualization/MonteverdiCore/include/mvdVectorImageModel.h +++ b/Modules/Visualization/MonteverdiCore/include/mvdVectorImageModel.h @@ -118,7 +118,7 @@ public: VectorImageModel( QObject* p =NULL ); /** Destructor */ - ~VectorImageModel() ITK_OVERRIDE; + ~VectorImageModel() override; /** */ static void EnsureValidImage( const QString& filename ); @@ -166,17 +166,17 @@ public: /** * Get the number of available LOD. */ - CountType GetNbLod() const ITK_OVERRIDE; + CountType GetNbLod() const override; /** * Get a smart-pointer to the current LOD image-base. */ - ImageBaseType::ConstPointer ToImageBase() const ITK_OVERRIDE; + ImageBaseType::ConstPointer ToImageBase() const override; /** * Get a smart-pointer to the current LOD image-base. */ - ImageBaseType::Pointer ToImageBase() ITK_OVERRIDE; + ImageBaseType::Pointer ToImageBase() override; /** * Get the placename from the center pixel @@ -186,9 +186,9 @@ public: // // AbstractModel methods. - bool IsModified() const ITK_OVERRIDE; + bool IsModified() const override; - void ClearModified() ITK_OVERRIDE; + void ClearModified() override; // get image size in byte std::streamoff GetImageSizeInBytes() @@ -242,7 +242,7 @@ protected: // // AbstractModel methods. - void virtual_BuildModel( void* context =NULL ) ITK_OVERRIDE; + void virtual_BuildModel( void* context =NULL ) override; // // AbstractImageModel methods. @@ -292,18 +292,18 @@ private: // // AbstractLayerModel methods. - std::string virtual_GetWkt() const ITK_OVERRIDE; - bool virtual_HasKwl() const ITK_OVERRIDE; + std::string virtual_GetWkt() const override; + bool virtual_HasKwl() const override; void virtual_ToWgs84( const PointType &, PointType &, - double & alt ) const ITK_OVERRIDE; + double & alt ) const override; // // AbstractImageModel methods. - void virtual_SetCurrentLod( CountType lod ) ITK_OVERRIDE; + void virtual_SetCurrentLod( CountType lod ) override; - void virtual_RefreshHistogram() ITK_OVERRIDE; + void virtual_RefreshHistogram() override; // // Private attributes. diff --git a/Modules/Visualization/MonteverdiCore/include/mvdVectorImageSettings.h b/Modules/Visualization/MonteverdiCore/include/mvdVectorImageSettings.h index 441ffdca5fe42a31fac08f3327b8e786f7bcfd43..01c78d04f660ef58d2b6eb997079099c99106f77 100644 --- a/Modules/Visualization/MonteverdiCore/include/mvdVectorImageSettings.h +++ b/Modules/Visualization/MonteverdiCore/include/mvdVectorImageSettings.h @@ -110,7 +110,7 @@ public: /** * \brief Destructor. */ - ~VectorImageSettings() ITK_OVERRIDE; + ~VectorImageSettings() override; /** * \brief Assignment operator. diff --git a/Modules/Visualization/MonteverdiCore/otb-module.cmake b/Modules/Visualization/MonteverdiCore/otb-module.cmake index 4e0a7cac7bca6e38df53c82d1f40996c1521c24b..43873bffb01dbfa43becfcd44131e3c541730612 100644 --- a/Modules/Visualization/MonteverdiCore/otb-module.cmake +++ b/Modules/Visualization/MonteverdiCore/otb-module.cmake @@ -36,7 +36,7 @@ otb_module( OTBMonteverdiCore OTBObjectList OTBOSSIMAdapters OTBProjection - OTBQt4 + OTBQt OTBStatistics OTBTransform diff --git a/Modules/Visualization/MonteverdiCore/src/CMakeLists.txt b/Modules/Visualization/MonteverdiCore/src/CMakeLists.txt index 78f8608c349d9157e2ebdb7593626d49024671e3..0525e9d28204399d7045efda29aa7850a08b7059 100644 --- a/Modules/Visualization/MonteverdiCore/src/CMakeLists.txt +++ b/Modules/Visualization/MonteverdiCore/src/CMakeLists.txt @@ -90,11 +90,11 @@ if( OTBApplicationEngine_ENABLED ) endif() ############################################################################# -add_to_qt4_i18n_sources( ${OTBMonteverdiCore_SRCS} ) -add_to_qt4_i18n_headers( "../include" ${OTBMonteverdiCore_SRCS} ) +add_to_qt_i18n_sources( ${OTBMonteverdiCore_SRCS} ) +add_to_qt_i18n_headers( "../include" ${OTBMonteverdiCore_SRCS} ) ############################################################################# -qt4_wrap_cpp( OTBMonteverdiCore_SRC_MOC ${OTBMonteverdiCore_HEADERS_MOC} ) +qt5_wrap_cpp( OTBMonteverdiCore_SRC_MOC ${OTBMonteverdiCore_HEADERS_MOC} ) add_library( OTBMonteverdiCore ${OTBMonteverdiCore_SRCS} ${OTBMonteverdiCore_SRC_MOC}) @@ -111,7 +111,7 @@ target_link_libraries( OTBMonteverdiCore ${OTBObjectList_LIBRARIES} ${OTBOSSIMAdapters_LIBRARIES} ${OTBProjection_LIBRARIES} - ${OTBQt4_LIBRARIES} + ${OTBQt_LIBRARIES} ${OTBStatistics_LIBRARIES} ${OTBTransform_LIBRARIES} ) diff --git a/Modules/Visualization/MonteverdiCore/src/mvdAbstractImageModel.cxx b/Modules/Visualization/MonteverdiCore/src/mvdAbstractImageModel.cxx index d74dad614ffcd13eb9a570a3204504d56b50b3e6..e1516508bb73754160c607fd472ec0c977605dd0 100644 --- a/Modules/Visualization/MonteverdiCore/src/mvdAbstractImageModel.cxx +++ b/Modules/Visualization/MonteverdiCore/src/mvdAbstractImageModel.cxx @@ -231,7 +231,7 @@ AbstractImageModel " (" + qApp->translate( "mvd::AbstractImageModel", - it2->toAscii().constData() + it2->toLatin1().constData() ) + ")" ); diff --git a/Modules/Visualization/MonteverdiCore/src/mvdI18nCoreApplication.cxx b/Modules/Visualization/MonteverdiCore/src/mvdI18nCoreApplication.cxx index 3031c06805d825cb00cf272d419fb6dad8080d02..fd92ac18fc4c143300ef26f1af6ebbde055b24db 100644 --- a/Modules/Visualization/MonteverdiCore/src/mvdI18nCoreApplication.cxx +++ b/Modules/Visualization/MonteverdiCore/src/mvdI18nCoreApplication.cxx @@ -160,7 +160,7 @@ I18nCoreApplication // get the md5 of the filename QByteArray result = - QCryptographicHash::hash( fileInfo.absoluteFilePath().toAscii(), + QCryptographicHash::hash( fileInfo.absoluteFilePath().toLatin1(), QCryptographicHash::Md5 ); // MD5 hash-code. @@ -258,8 +258,12 @@ I18nCoreApplication /*****************************************************************************/ void I18nCoreApplication -::HandleQtMessage( QtMsgType type, const char* message ) +::HandleQtMessage( QtMsgType type , + const QMessageLogContext & , + const QString & message ) { + std::string msg = ToStdString( message ); + switch( type ) { // @@ -267,13 +271,13 @@ I18nCoreApplication case QtDebugMsg: #if ECHO_QDEBUG || FORCE_QDEBUG #if _WIN32 - OutputDebugString( message ); + OutputDebugString( msg.c_str() ); OutputDebugString( "\n" ); #endif - fprintf( stderr, "%s\n", message ); + std::cerr << msg << std::endl; #endif #if LOG_QDEBUG - assert( false && "Not yet implemented!" ); + static_assert( false, "Not yet implemented!" ); #endif break; // @@ -282,13 +286,13 @@ I18nCoreApplication #if ECHO_QWARNING || FORCE_QWARNING #if _WIN32 OutputDebugString( "WARNG> " ); - OutputDebugString( message ); + OutputDebugString( msg.c_str() ); OutputDebugString( "\n" ); #endif - fprintf( stderr, tr( "WARNG> %s\n" ).toLatin1().constData(), message ); + std::cerr << "WARNG> " << msg << std::endl; #endif #if LOG_QWARNING - assert( false && "Not yet implemented!" ); + static_assert( false, "Not yet implemented!" ); #endif break; // @@ -297,13 +301,13 @@ I18nCoreApplication #if ECHO_QCRITICAL || FORCE_QCRITICAL #if _WIN32 OutputDebugString( "ERROR> " ); - OutputDebugString( message ); + OutputDebugString( qPrintable(message) ); OutputDebugString( "\n" ); #endif - fprintf( stderr, tr( "ERROR> %s\n" ).toLatin1().constData(), message ); + std::cerr << "ERROR> " << msg << std::endl; #endif #if LOG_QCRITICAL - assert( false && "Not yet implemented!" ); + static_assert( false, "Not yet implemented!" ); #endif #if THROW_QCRITICAL throw std::runtime_error( @@ -320,17 +324,13 @@ I18nCoreApplication #if ECHO_QFATAL || FORCE_QFATAL #if _WIN32 OutputDebugString( "FATAL> " ); - OutputDebugString( message ); + OutputDebugString( qPrintable(message) ); OutputDebugString( "\n" ); #endif - fprintf( - stderr, - tr( "FATAL> %s\n" ).toLatin1().constData(), - message - ); + std::cerr << "FATAL> " << msg << std::endl; #endif #if LOG_QFATAL - assert( false && "Not yet implemented!" ); + static_assert( false, "Not yet implemented!" ); #endif #if THROW_QFATAL throw std::runtime_error( @@ -378,7 +378,7 @@ I18nCoreApplication ); } - qInstallMsgHandler( I18nCoreApplication::HandleQtMessage ); + qInstallMessageHandler( I18nCoreApplication::HandleQtMessage ); m_Instance = this; } @@ -558,17 +558,22 @@ I18nCoreApplication // Literal strings to be translated are UTF-8 encoded because source // files are UTF-8 encoded. + /*/////////////////////////////// Warning ////////////////////// + we need to replace those lines with a function of Qt5 QTextCodec::setCodecForTr( QTextCodec::codecForName( "UTF-8" ) ); + //////////////////////////////////////////////////////////////////*/ // QTextCodec::setCodecForLocale( QTextCodec::codecForName("UTF-8") ); // QTextCodec::setCodecForCStrings( QTextCodec::codecForName("System") ); - + /*/////////////////////////////// Warning ////////////////////// + we need to replace those lines with a function of Qt5 qDebug() << "Codec for C-strings:" << ( QTextCodec::codecForCStrings()!=NULL - ? QTextCodec::codecForCStrings()->name() - : "none" ); + ? QTextCodec::codecForCStrings()->name() + : "none" ); + //////////////////////////////////////////////////////////////////*/ qDebug() << "Codec for Locale:" @@ -576,11 +581,14 @@ I18nCoreApplication ? QTextCodec::codecForLocale()->name() : "none" ); + /*/////////////////////////////// Warning ////////////////////// + we need to replace those lines with a function of Qt5 qDebug() << "Codec for Tr:" << ( QTextCodec::codecForTr()!=NULL - ? QTextCodec::codecForTr()->name() - : "none" ); + ? QTextCodec::codecForTr()->name() + : "none" ); + //////////////////////////////////////////////////////////////////*/ // // 1. default UI language is english (no translation). diff --git a/Modules/Visualization/MonteverdiGui/include/mvdAboutDialog.h b/Modules/Visualization/MonteverdiGui/include/mvdAboutDialog.h index b8ee19010e23026e9bef46ed1727ad33a3bca39f..3f15f73f5bfe5bca5563d1635041ffac40be44a5 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdAboutDialog.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdAboutDialog.h @@ -29,7 +29,7 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. -#include <QtGui> +#include <QtWidgets> // // System includes (sorted by alphabetic order) @@ -77,7 +77,7 @@ public: AboutDialog( QWidget* p =NULL, Qt::WindowFlags flags =0 ); /** Destructor */ - ~AboutDialog() ITK_OVERRIDE; + ~AboutDialog() override; // // SIGNALS. diff --git a/Modules/Visualization/MonteverdiGui/include/mvdAbstractDragAndDropEventFilter.h b/Modules/Visualization/MonteverdiGui/include/mvdAbstractDragAndDropEventFilter.h index babdc181454a67b26ec94d82dc34ff8ece513aeb..799f8d482485d6ef376ba1e74350f55371d18474 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdAbstractDragAndDropEventFilter.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdAbstractDragAndDropEventFilter.h @@ -33,7 +33,7 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. -#include <QtGui> +#include <QtWidgets> // // System includes (sorted by alphabetic order) @@ -90,7 +90,7 @@ class OTBMonteverdiGUI_EXPORT AbstractDragAndDropEventFilter : public: /** \brief Destructor. */ - ~AbstractDragAndDropEventFilter() ITK_OVERRIDE; + ~AbstractDragAndDropEventFilter() override; // // QObject overloads. @@ -98,7 +98,7 @@ public: /** * \see http://qt-project.org/doc/qt-4.8/qobject.html#eventFilter */ - bool eventFilter( QObject* watched, QEvent* event ) ITK_OVERRIDE; + bool eventFilter( QObject* watched, QEvent* event ) override; /*-[ PUBLIC SLOTS SECTION ]------------------------------------------------*/ diff --git a/Modules/Visualization/MonteverdiGui/include/mvdAbstractImageViewManipulator.h b/Modules/Visualization/MonteverdiGui/include/mvdAbstractImageViewManipulator.h index 3d34198cef3ab73d4cae145d8306fc8e8f0b4088..5609a7ca03601c2bc2a1de8c95e315bb9fcf4611 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdAbstractImageViewManipulator.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdAbstractImageViewManipulator.h @@ -34,7 +34,7 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. -#include <QtGui> +#include <QtWidgets> // // System includes (sorted by alphabetic order) @@ -90,7 +90,7 @@ class OTBMonteverdiGUI_EXPORT AbstractImageViewManipulator : public: /** \brief Destructor. */ - ~AbstractImageViewManipulator() ITK_OVERRIDE {}; + ~AbstractImageViewManipulator() override {}; // // Accessors diff --git a/Modules/Visualization/MonteverdiGui/include/mvdAbstractImageViewRenderer.h b/Modules/Visualization/MonteverdiGui/include/mvdAbstractImageViewRenderer.h index 28a6891f2c18a6dbc008fdecc744d21cf5b4feb4..eb0a0f26ba69922005cdcd7d3e1f12f04a9b20e9 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdAbstractImageViewRenderer.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdAbstractImageViewRenderer.h @@ -122,7 +122,7 @@ public: /** * Destructor. */ - ~AbstractImageViewRenderer() ITK_OVERRIDE{}; + ~AbstractImageViewRenderer() override{}; /** */ diff --git a/Modules/Visualization/MonteverdiGui/include/mvdAbstractModelController.h b/Modules/Visualization/MonteverdiGui/include/mvdAbstractModelController.h index fbefaee85832cb6a5c732f0dcee7f724145cfeb3..fe97859e0efbd2fe6e874fc21548817e82cba98b 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdAbstractModelController.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdAbstractModelController.h @@ -33,7 +33,7 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. -#include <QtGui> +#include <QtWidgets> // // System includes (sorted by alphabetic order) @@ -90,7 +90,7 @@ public: public: /** Destructor */ - ~AbstractModelController() ITK_OVERRIDE; + ~AbstractModelController() override; /** */ void SetModel( AbstractModel* ); diff --git a/Modules/Visualization/MonteverdiGui/include/mvdApplicationLauncher.h b/Modules/Visualization/MonteverdiGui/include/mvdApplicationLauncher.h index 8e5e155b3aa74571f6b6b38b7a23ec00c5954f2c..d7e148a9b4566c1a6bd48148ef5e181901c5374c 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdApplicationLauncher.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdApplicationLauncher.h @@ -35,7 +35,7 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. -#include <QtGui> +#include <QtWidgets> // // System includes (sorted by alphabetic order) @@ -96,7 +96,7 @@ public: ApplicationLauncher( QObject* p =NULL ); /** \brief Destructor. */ - ~ApplicationLauncher() ITK_OVERRIDE; + ~ApplicationLauncher() override; /** * \return A new instance of the automatically-generated widget of diff --git a/Modules/Visualization/MonteverdiGui/include/mvdApplicationsToolBox.h b/Modules/Visualization/MonteverdiGui/include/mvdApplicationsToolBox.h index 2cc6cc13e53d56e98a2d8d8d30d7b5763672fe77..270b6c6b8e9898f7ba93c143709ae6f4d1e3caa8 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdApplicationsToolBox.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdApplicationsToolBox.h @@ -33,7 +33,7 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. -#include <QtGui> +#include <QtWidgets> // // System includes (sorted by alphabetic order) @@ -99,7 +99,7 @@ public: ApplicationsToolBox( QWidget* p =NULL, Qt::WindowFlags flags =0 ); /** \brief Destructor. */ - ~ApplicationsToolBox() ITK_OVERRIDE; + ~ApplicationsToolBox() override; /** Get TreeWidget */ // QTreeWidget * GetAlgorithmsTree(); diff --git a/Modules/Visualization/MonteverdiGui/include/mvdApplicationsToolBoxController.h b/Modules/Visualization/MonteverdiGui/include/mvdApplicationsToolBoxController.h index b8f36d5db6eb99c9448f3d742b8ebb3f0c7f2042..2c9c3209c8e068c1be989f800350ac5ed5dbbb37 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdApplicationsToolBoxController.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdApplicationsToolBoxController.h @@ -105,7 +105,7 @@ public: /** * \brief Destructor. */ - ~ApplicationsToolBoxController() ITK_OVERRIDE; + ~ApplicationsToolBoxController() override; /** Get the seleceted application Gui */ // QWidget * GetSelectedApplicationWidget(const QString& appName); @@ -126,13 +126,13 @@ protected: // // AbstractModelController methods. - void Connect( AbstractModel* ) ITK_OVERRIDE; + void Connect( AbstractModel* ) override; - void ClearWidget() ITK_OVERRIDE; + void ClearWidget() override; - void virtual_ResetWidget( bool ) ITK_OVERRIDE; + void virtual_ResetWidget( bool ) override; - void Disconnect( AbstractModel* ) ITK_OVERRIDE; + void Disconnect( AbstractModel* ) override; // // Protected attributes. diff --git a/Modules/Visualization/MonteverdiGui/include/mvdColorBandDynamicsWidget.h b/Modules/Visualization/MonteverdiGui/include/mvdColorBandDynamicsWidget.h index 1130f1b10636f7e8e73042bd321e9b707673bef6..d02139dcdaf14672a07ee0ed3b9dd3112883ed79 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdColorBandDynamicsWidget.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdColorBandDynamicsWidget.h @@ -33,7 +33,7 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. -#include <QtGui> +#include <QtWidgets> // // System includes (sorted by alphabetic order) @@ -142,7 +142,7 @@ public: ColorBandDynamicsWidget( QWidget* p =NULL, Qt::WindowFlags flags =0 ); /** Destructor */ - ~ColorBandDynamicsWidget() ITK_OVERRIDE; + ~ColorBandDynamicsWidget() override; /** */ RgbwChannel GetChannelLabel() const; diff --git a/Modules/Visualization/MonteverdiGui/include/mvdColorDynamicsController.h b/Modules/Visualization/MonteverdiGui/include/mvdColorDynamicsController.h index 4acdf66eb8087d82e2fd82091825d27b76b6b116..2fe26daa7934a870e5b7e6ce6d729e5ab02322ba 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdColorDynamicsController.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdColorDynamicsController.h @@ -98,7 +98,7 @@ public: ColorDynamicsController( ColorDynamicsWidget* widget, QObject* p =NULL ); /** \brief Destructor. */ - ~ColorDynamicsController() ITK_OVERRIDE; + ~ColorDynamicsController() override; /*-[ PUBLIC SLOTS SECTION ]-----------------------------------------------**/ @@ -168,13 +168,13 @@ private: // // AbstractModelController methods. - void Connect( AbstractModel* ) ITK_OVERRIDE; + void Connect( AbstractModel* ) override; - void ClearWidget() ITK_OVERRIDE; + void ClearWidget() override; - void virtual_ResetWidget( bool ) ITK_OVERRIDE; + void virtual_ResetWidget( bool ) override; - void Disconnect( AbstractModel* ) ITK_OVERRIDE; + void Disconnect( AbstractModel* ) override; /** * \brief Reset intensity ranges to default values for given RGB diff --git a/Modules/Visualization/MonteverdiGui/include/mvdColorDynamicsWidget.h b/Modules/Visualization/MonteverdiGui/include/mvdColorDynamicsWidget.h index 4866fc70d570b662b1a77150361f20d44c0e50e4..a6842ccb21fd2448459291ed1e9241d5239250ac 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdColorDynamicsWidget.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdColorDynamicsWidget.h @@ -33,7 +33,7 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. -#include <QtGui> +#include <QtWidgets> // // System includes (sorted by alphabetic order) @@ -122,7 +122,7 @@ public: ColorDynamicsWidget( QWidget* p =NULL, Qt::WindowFlags flags =0 ); /** Destructor. */ - ~ColorDynamicsWidget() ITK_OVERRIDE; + ~ColorDynamicsWidget() override; /** */ diff --git a/Modules/Visualization/MonteverdiGui/include/mvdColorSetupController.h b/Modules/Visualization/MonteverdiGui/include/mvdColorSetupController.h index d9f6ff02d0c1a0486d04ec8fc969bf9ff4e4ca08..aadf7f39208e8e7d4be80814d22c567119fbcd2a 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdColorSetupController.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdColorSetupController.h @@ -100,7 +100,7 @@ public: /** * \brief Destructor. */ - ~ColorSetupController() ITK_OVERRIDE; + ~ColorSetupController() override; /*-[ SIGNALS SECTION ]-----------------------------------------------------*/ @@ -168,13 +168,13 @@ private: // // AbstractModelController methods. - void Connect( AbstractModel* ) ITK_OVERRIDE; + void Connect( AbstractModel* ) override; - void ClearWidget() ITK_OVERRIDE; + void ClearWidget() override; - void virtual_ResetWidget( bool ) ITK_OVERRIDE; + void virtual_ResetWidget( bool ) override; - void Disconnect( AbstractModel* ) ITK_OVERRIDE; + void Disconnect( AbstractModel* ) override; // // Private attributes. diff --git a/Modules/Visualization/MonteverdiGui/include/mvdColorSetupWidget.h b/Modules/Visualization/MonteverdiGui/include/mvdColorSetupWidget.h index 1a09ed3c101605927fb30f8d7bee5d27410732a4..fd9528d2cade54e8a4c809465f6298e9cb825d96 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdColorSetupWidget.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdColorSetupWidget.h @@ -29,7 +29,7 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. -#include <QtGui> +#include <QtWidgets> // // System includes (sorted by alphabetic order) @@ -89,7 +89,7 @@ public: ColorSetupWidget( QWidget* p =NULL, Qt::WindowFlags flags =0 ); /** \brief Destructor. */ - ~ColorSetupWidget() ITK_OVERRIDE; + ~ColorSetupWidget() override; /** * \brief Set the component-name list. diff --git a/Modules/Visualization/MonteverdiGui/include/mvdDoubleValidator.h b/Modules/Visualization/MonteverdiGui/include/mvdDoubleValidator.h index 8872a4ce906f3fc511a9fcad2a3741cb353952a8..cb4f73a69b3bb3dbb9931755bc540a40a2586def 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdDoubleValidator.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdDoubleValidator.h @@ -33,7 +33,7 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. -#include <QtGui> +#include <QtWidgets> // // System includes (sorted by alphabetic order) @@ -99,12 +99,12 @@ public: QObject *p = 0 ); /** \brief Destructor. */ - ~DoubleValidator() ITK_OVERRIDE; + ~DoubleValidator() override; // // QDoubleValidator overloads. - void fixup( QString& input ) const ITK_OVERRIDE; + void fixup( QString& input ) const override; /*-[ PUBLIC SLOTS SECTION ]------------------------------------------------*/ diff --git a/Modules/Visualization/MonteverdiGui/include/mvdDropLineEdit.h b/Modules/Visualization/MonteverdiGui/include/mvdDropLineEdit.h index 4c2a83be2519bfafe76214a69ba55f9f31e0a505..980c2496cb1c74284a8c514adc871f1e0390565c 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdDropLineEdit.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdDropLineEdit.h @@ -33,7 +33,7 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. -#include <QtGui> +#include <QtWidgets> // // System includes (sorted by alphabetic order) @@ -100,7 +100,7 @@ public: DropLineEdit( const QString& contents, QWidget* p =0 ); /** \brief Destructor. */ - ~DropLineEdit() ITK_OVERRIDE; + ~DropLineEdit() override; /*-[ PUBLIC SLOTS SECTION ]------------------------------------------------*/ @@ -120,9 +120,9 @@ signals: // Protected methods. protected: - void dragEnterEvent( QDragEnterEvent* event ) ITK_OVERRIDE; - void dragMoveEvent( QDragMoveEvent* event ) ITK_OVERRIDE; - void dropEvent( QDropEvent* event ) ITK_OVERRIDE; + void dragEnterEvent( QDragEnterEvent* event ) override; + void dragMoveEvent( QDragMoveEvent* event ) override; + void dropEvent( QDropEvent* event ) override; /*-[ PRIVATE SECTION ]-----------------------------------------------------*/ diff --git a/Modules/Visualization/MonteverdiGui/include/mvdFilenameDragAndDropEventFilter.h b/Modules/Visualization/MonteverdiGui/include/mvdFilenameDragAndDropEventFilter.h index 9595df1c0c33ffcfef2575246986778404580f6d..135238635a80036f4efad69aeb965f597a0190a0 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdFilenameDragAndDropEventFilter.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdFilenameDragAndDropEventFilter.h @@ -33,7 +33,7 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. -#include <QtGui> +#include <QtWidgets> // // System includes (sorted by alphabetic order) @@ -93,7 +93,7 @@ public: FilenameDragAndDropEventFilter( QObject* p =NULL ); /** \brief Destructor. */ - ~FilenameDragAndDropEventFilter() ITK_OVERRIDE; + ~FilenameDragAndDropEventFilter() override; /*-[ PUBLIC SLOTS SECTION ]------------------------------------------------*/ @@ -125,22 +125,22 @@ protected: /** * \see http://qt-project.org/doc/qt-4.8/qwidget.html#dragEnterEvent */ - bool DragEnterEvent( QObject* object, QDragEnterEvent* event ) ITK_OVERRIDE; + bool DragEnterEvent( QObject* object, QDragEnterEvent* event ) override; /** * \see http://qt-project.org/doc/qt-4.8/qwidget.html#dragLeaveEvent */ - bool DragLeaveEvent( QObject* object, QDragLeaveEvent* event ) ITK_OVERRIDE; + bool DragLeaveEvent( QObject* object, QDragLeaveEvent* event ) override; /** * \see http://qt-project.org/doc/qt-4.8/qwidget.html#dragMoveEvent */ - bool DragMoveEvent( QObject* object, QDragMoveEvent* event ) ITK_OVERRIDE; + bool DragMoveEvent( QObject* object, QDragMoveEvent* event ) override; /** * \see http://qt-project.org/doc/qt-4.8/qwidget.html#dropEvent */ - bool DropEvent( QObject* object, QDropEvent* event ) ITK_OVERRIDE; + bool DropEvent( QObject* object, QDropEvent* event ) override; // // Protected attributes. diff --git a/Modules/Visualization/MonteverdiGui/include/mvdHistogramController.h b/Modules/Visualization/MonteverdiGui/include/mvdHistogramController.h index a28ba38fe7410cd420588bb240c4dcd825bc0fdd..2416c58ddd464df74557969a61b880d086c0c5d2 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdHistogramController.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdHistogramController.h @@ -101,7 +101,7 @@ public: /** * \brief Destructor. */ - ~HistogramController() ITK_OVERRIDE; + ~HistogramController() override; /*-[ SIGNALS SECTION ]-----------------------------------------------------*/ @@ -134,13 +134,13 @@ private: // // AbstractModelController methods. - void Connect( AbstractModel* ) ITK_OVERRIDE; + void Connect( AbstractModel* ) override; - void ClearWidget() ITK_OVERRIDE; + void ClearWidget() override; - void virtual_ResetWidget( bool = false ) ITK_OVERRIDE; + void virtual_ResetWidget( bool = false ) override; - void Disconnect( AbstractModel* ) ITK_OVERRIDE; + void Disconnect( AbstractModel* ) override; // // Private attributes. diff --git a/Modules/Visualization/MonteverdiGui/include/mvdHistogramPlotPicker.h b/Modules/Visualization/MonteverdiGui/include/mvdHistogramPlotPicker.h index 0e58a1f5d8ee6f56b1477259b2276744685b0203..d7a3690c12a604ea6b6924f5fa2b97f55717881c 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdHistogramPlotPicker.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdHistogramPlotPicker.h @@ -123,7 +123,7 @@ public: QwtPlotCanvas* canvas ); /** \brief Destructor. */ - ~HistogramPlotPicker() ITK_OVERRIDE; + ~HistogramPlotPicker() override; /** */ @@ -136,7 +136,7 @@ public: // // QwtPlotPicker methods. - void drawRubberBand( QPainter* painter ) const ITK_OVERRIDE; + void drawRubberBand( QPainter* painter ) const override; /*-[ PUBLIC SLOTS SECTION ]------------------------------------------------*/ @@ -161,7 +161,7 @@ protected: using QwtPlotPicker::trackerText; - QwtText trackerTextF( const QPointF & ) const ITK_OVERRIDE; + QwtText trackerTextF( const QPointF & ) const override; // // Protected attributes. diff --git a/Modules/Visualization/MonteverdiGui/include/mvdHistogramWidget.h b/Modules/Visualization/MonteverdiGui/include/mvdHistogramWidget.h index cbda62ba086fe927f73952018657d3474de0c7f3..522dcd42311e8e7393af94b1e4e930cfc12d5650 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdHistogramWidget.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdHistogramWidget.h @@ -33,7 +33,7 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. -#include <QtGui> +#include <QtWidgets> // // Qwt includes. @@ -113,7 +113,7 @@ public: HistogramWidget( QWidget* p =NULL, Qt::WindowFlags flags =0 ); /** \brief Destructor. */ - ~HistogramWidget() ITK_OVERRIDE; + ~HistogramWidget() override; /** * \brief diff --git a/Modules/Visualization/MonteverdiGui/include/mvdI18nApplication.h b/Modules/Visualization/MonteverdiGui/include/mvdI18nApplication.h index 39e9b08f976f9ffe3bea5d319e7521d5c034c2a8..dcd7058ce80ecaec2c195a98469cf8c8a2d5e230 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdI18nApplication.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdI18nApplication.h @@ -34,7 +34,7 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. -#include <QtGui> +#include <QtWidgets> // // System includes (sorted by alphabetic order) @@ -105,7 +105,7 @@ public: I18nApplication( QApplication* qtApp ); /** \brief Destructor. */ - ~I18nApplication() ITK_OVERRIDE; + ~I18nApplication() override; // // APPLICATION SINGLETON. @@ -147,7 +147,7 @@ signals: // Protected methods. protected: - void virtual_InitializeCore() ITK_OVERRIDE; + void virtual_InitializeCore() override; // // Protected attributes. diff --git a/Modules/Visualization/MonteverdiGui/include/mvdI18nMainWindow.h b/Modules/Visualization/MonteverdiGui/include/mvdI18nMainWindow.h index e4414dfac52d3022268c66c0fb7b281e8e9d016a..fad00fa9b60fae73fb28ff0277b4601f1201ad1e 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdI18nMainWindow.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdI18nMainWindow.h @@ -33,7 +33,7 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. -#include <QtGui> +#include <QtWidgets> // // System includes (sorted by alphabetic order) @@ -103,7 +103,7 @@ public: // Public methods. public: /** \brief Destructor. */ - ~I18nMainWindow() ITK_OVERRIDE; + ~I18nMainWindow() override; /** */ @@ -194,7 +194,7 @@ protected: // // QMainWindow methods. - void closeEvent( QCloseEvent* event ) ITK_OVERRIDE; + void closeEvent( QCloseEvent* event ) override; // // Protected attributes. diff --git a/Modules/Visualization/MonteverdiGui/include/mvdImageViewManipulator.h b/Modules/Visualization/MonteverdiGui/include/mvdImageViewManipulator.h index 477e50206e5750a3b45e8182c0fc4b8f35e2e4ca..ed63a785f3d38cab1fb1101fee90a351ad10f722 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdImageViewManipulator.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdImageViewManipulator.h @@ -123,7 +123,7 @@ public: #endif // USE_VIEW_SETTINGS_SIDE_EFFECT /** \brief Destructor. */ - ~ImageViewManipulator() ITK_OVERRIDE; + ~ImageViewManipulator() override; // // AbstractImageViewManipulator overloads. @@ -132,29 +132,29 @@ public: // // Accessors. - void SetViewportSize( int width, int height ) ITK_OVERRIDE; + void SetViewportSize( int width, int height ) override; - SizeType GetViewportSize() const ITK_OVERRIDE; + SizeType GetViewportSize() const override; - void SetOrigin( const PointType& origin ) ITK_OVERRIDE; + void SetOrigin( const PointType& origin ) override; - PointType GetOrigin() const ITK_OVERRIDE; + PointType GetOrigin() const override; - void SetSpacing( const SpacingType& spacing ) ITK_OVERRIDE; + void SetSpacing( const SpacingType& spacing ) override; - SpacingType GetSpacing() const ITK_OVERRIDE; + SpacingType GetSpacing() const override; - void SetNativeSpacing( const SpacingType& ) ITK_OVERRIDE; + void SetNativeSpacing( const SpacingType& ) override; - void SetWkt( const std::string& wkt ) ITK_OVERRIDE; + void SetWkt( const std::string& wkt ) override; void SetKeywordList( const DefaultImageType::ImageKeywordlistType& kwl - ) ITK_OVERRIDE; + ) override; - PointType GetCenter() const ITK_OVERRIDE; + PointType GetCenter() const override; - ZoomType GetFixedZoomType() const ITK_OVERRIDE; + ZoomType GetFixedZoomType() const override; // // Controls. @@ -162,34 +162,34 @@ public: void SetupRenderingContext( - AbstractImageViewRenderer::RenderingContext * const ) const ITK_OVERRIDE; + AbstractImageViewRenderer::RenderingContext * const ) const override; - void ZoomIn() ITK_OVERRIDE; + void ZoomIn() override; - void ZoomOut() ITK_OVERRIDE; + void ZoomOut() override; - const PointType& Transform( PointType&, const QPoint& ) const ITK_OVERRIDE; + const PointType& Transform( PointType&, const QPoint& ) const override; - void ResetViewport() ITK_OVERRIDE; + void ResetViewport() override; // // Events. - void MouseMoveEvent( QMouseEvent* event ) ITK_OVERRIDE; + void MouseMoveEvent( QMouseEvent* event ) override; - void MousePressEvent( QMouseEvent* event ) ITK_OVERRIDE; + void MousePressEvent( QMouseEvent* event ) override; - void MouseReleaseEvent( QMouseEvent* event ) ITK_OVERRIDE; + void MouseReleaseEvent( QMouseEvent* event ) override; - void MouseDoubleClickEvent( QMouseEvent * ) ITK_OVERRIDE; + void MouseDoubleClickEvent( QMouseEvent * ) override; - void WheelEvent( QWheelEvent* event) ITK_OVERRIDE; + void WheelEvent( QWheelEvent* event) override; - void ResizeEvent( QResizeEvent* event ) ITK_OVERRIDE; + void ResizeEvent( QResizeEvent* event ) override; - void KeyPressEvent( QKeyEvent* event ) ITK_OVERRIDE; + void KeyPressEvent( QKeyEvent* event ) override; - void KeyReleaseEvent( QKeyEvent* event ) ITK_OVERRIDE; + void KeyReleaseEvent( QKeyEvent* event ) override; /*-[ PUBLIC SLOTS SECTION ]-----------------------------------------------**/ @@ -200,9 +200,9 @@ public slots: // // AbstractImageViewManipulator overloads. - void CenterOn( const PointType& point ) ITK_OVERRIDE; + void CenterOn( const PointType& point ) override; - void ZoomTo( double scale ) ITK_OVERRIDE; + void ZoomTo( double scale ) override; /*-[ SIGNALS SECTION ]-----------------------------------------------------*/ diff --git a/Modules/Visualization/MonteverdiGui/include/mvdImageViewRenderer.h b/Modules/Visualization/MonteverdiGui/include/mvdImageViewRenderer.h index c1d68cc82e4a6be1c2b94d16257d2ee48d744ca4..e8c3599d33591fe5074ea5cb35e12700e4104784 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdImageViewRenderer.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdImageViewRenderer.h @@ -111,7 +111,7 @@ public: /** */ - ~RenderingContext() ITK_OVERRIDE; + ~RenderingContext() override; /** */ @@ -136,11 +136,11 @@ public: ImageViewRenderer( QObject* p = NULL ); /** Destructor */ - ~ImageViewRenderer() ITK_OVERRIDE; + ~ImageViewRenderer() override; /** */ - bool CheckGLCapabilities( int * ) ITK_OVERRIDE; + bool CheckGLCapabilities( int * ) override; /** */ @@ -154,43 +154,43 @@ public: bool GetLayerDynamics( const StackedLayerModel::KeyType & key, ParametersType & params, - bool isGlobal ) const ITK_OVERRIDE; + bool isGlobal ) const override; - const AbstractLayerModel* GetReferenceModel() const ITK_OVERRIDE; + const AbstractLayerModel* GetReferenceModel() const override; - AbstractLayerModel * GetReferenceModel() ITK_OVERRIDE; + AbstractLayerModel * GetReferenceModel() override; void GetLayerExtent( const StackedLayerModel::KeyType & key, PointType& origin, - PointType& extent ) const ITK_OVERRIDE; + PointType& extent ) const override; void GetReferenceExtent( PointType& origin, - PointType& extent ) const ITK_OVERRIDE; + PointType& extent ) const override; void GetViewExtent( PointType& origin, - PointType& extent ) const ITK_OVERRIDE; + PointType& extent ) const override; - AbstractImageViewRenderer::RenderingContext* NewRenderingContext() const ITK_OVERRIDE; + AbstractImageViewRenderer::RenderingContext* NewRenderingContext() const override; - void InitializeGL() ITK_OVERRIDE; + void InitializeGL() override; - void ResizeGL( int width, int height ) ITK_OVERRIDE; + void ResizeGL( int width, int height ) override; - void PaintGL( const AbstractImageViewRenderer::RenderingContext* context ) ITK_OVERRIDE; + void PaintGL( const AbstractImageViewRenderer::RenderingContext* context ) override; void Pick( const PointType & view, - PixelInfo::Vector & pixels ) const ITK_OVERRIDE; + PixelInfo::Vector & pixels ) const override; - void GetResolutions( PixelInfo::Vector & pixels ) const ITK_OVERRIDE; + void GetResolutions( PixelInfo::Vector & pixels ) const override; bool TransformToView( PointType & point, const StackedLayerModel::KeyType &, const IndexType &, - bool isPhysical ) const ITK_OVERRIDE; + bool isPhysical ) const override; - void SaveScreenshot( const QString & ) const ITK_OVERRIDE; + void SaveScreenshot( const QString & ) const override; bool Reproject( PointType & center, @@ -198,7 +198,7 @@ public: const PointType & vcenter, const SpacingType & vspacing ) const; - bool IsEffectsEnabled() const ITK_OVERRIDE; + bool IsEffectsEnabled() const override; /*-[ PUBLIC SLOTS SECTION ]------------------------------------------------*/ @@ -206,7 +206,7 @@ public: public slots: void UpdatePixelInfo( const QPoint & screen, const PointType & view, - const PixelInfo::Vector & pixels ) ITK_OVERRIDE; + const PixelInfo::Vector & pixels ) override; /*-[ SIGNALS SECTION ]-----------------------------------------------------*/ @@ -271,24 +271,24 @@ private: // // AbstractImageViewRenderer overloads. - void virtual_ClearScene( bool ) ITK_OVERRIDE; - void virtual_UpdateScene() ITK_OVERRIDE; - void virtual_RefreshScene() ITK_OVERRIDE; + void virtual_ClearScene( bool ) override; + void virtual_UpdateScene() override; + void virtual_RefreshScene() override; bool virtual_ZoomToRegion( const PointType & origin, const PointType & extent, PointType & center, - SpacingType & spacing ) const ITK_OVERRIDE; + SpacingType & spacing ) const override; - bool virtual_ZoomToExtent( PointType & center, SpacingType & spacing ) const ITK_OVERRIDE; + bool virtual_ZoomToExtent( PointType & center, SpacingType & spacing ) const override; bool virtual_ZoomToLayer( const StackedLayerModel::KeyType & key, PointType & center, - SpacingType & spacing ) const ITK_OVERRIDE; + SpacingType & spacing ) const override; bool virtual_ZoomToFull( const StackedLayerModel::KeyType & key, PointType & center, - SpacingType & spacing ) const ITK_OVERRIDE; + SpacingType & spacing ) const override; // // Private attributes. diff --git a/Modules/Visualization/MonteverdiGui/include/mvdImageViewWidget.h b/Modules/Visualization/MonteverdiGui/include/mvdImageViewWidget.h index c32699f712f9c97cfe2af01fbb7fc1f47452002f..4c0dcd6d595b80ae25e1037c578c9066733b3a74 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdImageViewWidget.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdImageViewWidget.h @@ -31,7 +31,8 @@ // // Qt includes (sorted by alphabetic order) -#include <QtOpenGL> +#include <QGLWidget> +// #include <QtOpenGL> // // System includes (sorted by alphabetic order) @@ -117,7 +118,7 @@ public: Qt::WindowFlags f =0 ); /** \brief Destructor. */ - ~ImageViewWidget() ITK_OVERRIDE; + ~ImageViewWidget() override; /** */ @@ -255,21 +256,21 @@ protected: // // Qt overloads. - void initializeGL() ITK_OVERRIDE; - void resizeGL( int widgth, int height ) ITK_OVERRIDE; - void paintGL() ITK_OVERRIDE; + void initializeGL() override; + void resizeGL( int widgth, int height ) override; + void paintGL() override; - void mouseMoveEvent( QMouseEvent* event ) ITK_OVERRIDE; - void mouseReleaseEvent( QMouseEvent* event ) ITK_OVERRIDE; - void mousePressEvent( QMouseEvent* event ) ITK_OVERRIDE; - void mouseDoubleClickEvent( QMouseEvent * event ) ITK_OVERRIDE; + void mouseMoveEvent( QMouseEvent* event ) override; + void mouseReleaseEvent( QMouseEvent* event ) override; + void mousePressEvent( QMouseEvent* event ) override; + void mouseDoubleClickEvent( QMouseEvent * event ) override; - void wheelEvent( QWheelEvent* event) ITK_OVERRIDE; + void wheelEvent( QWheelEvent* event) override; - void keyPressEvent( QKeyEvent* event ) ITK_OVERRIDE; - void keyReleaseEvent( QKeyEvent* event ) ITK_OVERRIDE; + void keyPressEvent( QKeyEvent* event ) override; + void keyReleaseEvent( QKeyEvent* event ) override; - void resizeEvent( QResizeEvent* event ) ITK_OVERRIDE; + void resizeEvent( QResizeEvent* event ) override; // diff --git a/Modules/Visualization/MonteverdiGui/include/mvdImportImagesDialog.h b/Modules/Visualization/MonteverdiGui/include/mvdImportImagesDialog.h index 0441b49919e3de16614f9b25cb92f1f43e84d4ca..d6450b141def4cc667936c0de332a7e35b73c7b8 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdImportImagesDialog.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdImportImagesDialog.h @@ -33,7 +33,7 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. -#include <QtGui> +#include <QtWidgets> // // System includes (sorted by alphabetic order) @@ -105,7 +105,7 @@ public: Qt::WindowFlags flags =0 ); /** \brief Destructor. */ - ~ImportImagesDialog() ITK_OVERRIDE; + ~ImportImagesDialog() override; /** */ diff --git a/Modules/Visualization/MonteverdiGui/include/mvdImportSubDatasetDialog.h b/Modules/Visualization/MonteverdiGui/include/mvdImportSubDatasetDialog.h index e1fe0659cf7bbc08e39702e70e7dbe8c2ca4f27b..ddfeb63dffc11d746f3ef1ae28405ae901041969 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdImportSubDatasetDialog.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdImportSubDatasetDialog.h @@ -33,7 +33,7 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. -#include <QtGui> +#include <QtWidgets> // // System includes (sorted by alphabetic order) @@ -104,7 +104,7 @@ public: Qt::WindowFlags flags = 0 ); /** \brief Destructor. */ - ~ImportSubDatasetDialog() ITK_OVERRIDE; + ~ImportSubDatasetDialog() override; /** */ diff --git a/Modules/Visualization/MonteverdiGui/include/mvdKeymapDialog.h b/Modules/Visualization/MonteverdiGui/include/mvdKeymapDialog.h index 3d8400db1d29a6c9539bdf86d6312b6539845c14..75c930ceebefb1cc5cd3de5bd5c1ceef44aa2845 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdKeymapDialog.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdKeymapDialog.h @@ -29,7 +29,7 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. -#include <QtGui> +#include <QtWidgets> // // System includes (sorted by alphabetic order) @@ -77,7 +77,7 @@ public: KeymapDialog( QWidget* p =NULL, Qt::WindowFlags flags =0 ); /** Destructor */ - ~KeymapDialog() ITK_OVERRIDE; + ~KeymapDialog() override; // // SIGNALS. diff --git a/Modules/Visualization/MonteverdiGui/include/mvdLayerStackController.h b/Modules/Visualization/MonteverdiGui/include/mvdLayerStackController.h index 084945ebe44e4ed0f0dfba19ef226bf340aeda72..80af1a4f8ea1bb1a51c94e07c09cd2e10073f578 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdLayerStackController.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdLayerStackController.h @@ -93,7 +93,7 @@ public: LayerStackController( LayerStackWidget * widget, QObject * p =NULL ); /** \brief Destructor. */ - ~LayerStackController() ITK_OVERRIDE; + ~LayerStackController() override; /*-[ PUBLIC SLOTS SECTION ]------------------------------------------------*/ @@ -135,19 +135,19 @@ private: /** */ - void Connect( AbstractModel * ) ITK_OVERRIDE; + void Connect( AbstractModel * ) override; /** */ - void Disconnect( AbstractModel * ) ITK_OVERRIDE; + void Disconnect( AbstractModel * ) override; /** */ - void ClearWidget() ITK_OVERRIDE; + void ClearWidget() override; /** */ - void virtual_ResetWidget( bool ) ITK_OVERRIDE; + void virtual_ResetWidget( bool ) override; // diff --git a/Modules/Visualization/MonteverdiGui/include/mvdLayerStackItemModel.h b/Modules/Visualization/MonteverdiGui/include/mvdLayerStackItemModel.h index 97f096ad9f43ff41d8f2e26a77a0980dce7af9b8..44b557b5cd080058c59b5dc707935a6317fca577 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdLayerStackItemModel.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdLayerStackItemModel.h @@ -136,7 +136,7 @@ public: LayerStackItemModel( QObject* p =NULL ); /** \brief Destructor. */ - ~LayerStackItemModel() ITK_OVERRIDE; + ~LayerStackItemModel() override; /** */ @@ -152,13 +152,13 @@ public: /** * \see http://qt-project.org/doc/qt-4.8/qabstractitemmodel.html#columnCount */ - int columnCount( const QModelIndex & p = QModelIndex() ) const ITK_OVERRIDE; + int columnCount( const QModelIndex & p = QModelIndex() ) const override; /** * \see http://qt-project.org/doc/qt-4.8/qabstractitemmodel.html#data */ QVariant - data( const QModelIndex & index, int role = Qt::DisplayRole ) const ITK_OVERRIDE; + data( const QModelIndex & index, int role = Qt::DisplayRole ) const override; /** * \see http://qt-project.org/doc/qt-4.8/qabstractitemmodel.html#dropMimeData @@ -168,24 +168,24 @@ public: Qt::DropAction action, int row, int column, - const QModelIndex & p ) ITK_OVERRIDE; + const QModelIndex & p ) override; /** * \see http://qt-project.org/doc/qt-4.8/qabstractitemmodel.html#flags */ - Qt::ItemFlags flags( const QModelIndex & index ) const ITK_OVERRIDE; + Qt::ItemFlags flags( const QModelIndex & index ) const override; /** * \see http://qt-project.org/doc/qt-4.8/qabstractitemmodel.html#hasChildren */ - bool hasChildren( const QModelIndex & p = QModelIndex() ) const ITK_OVERRIDE; + bool hasChildren( const QModelIndex & p = QModelIndex() ) const override; /** * \see http://qt-project.org/doc/qt-4.8/qabstractitemmodel.html#headerData */ QVariant headerData( int section, Qt::Orientation orientation, - int role = Qt::DisplayRole ) const ITK_OVERRIDE; + int role = Qt::DisplayRole ) const override; /** * \see http://qt-project.org/doc/qt-4.8/qabstractitemmodel.html#index @@ -193,7 +193,7 @@ public: QModelIndex index( int row, int column, - const QModelIndex & p = QModelIndex() ) const ITK_OVERRIDE; + const QModelIndex & p = QModelIndex() ) const override; /** * \see http://qt-project.org/doc/qt-4.8/qabstractitemmodel.html#insertRows @@ -201,22 +201,22 @@ public: bool insertRows( int row, int count, - const QModelIndex & p = QModelIndex() ) ITK_OVERRIDE; + const QModelIndex & p = QModelIndex() ) override; /** * \see http://doc.qt.io/qt-4.8/qabstractitemmodel.html#mimeData */ - QMimeData * mimeData( const QModelIndexList & indexes ) const ITK_OVERRIDE; + QMimeData * mimeData( const QModelIndexList & indexes ) const override; /** * \see http://doc.qt.io/qt-4.8/qabstractitemmodel.html#mimeTypes */ - QStringList mimeTypes() const ITK_OVERRIDE; + QStringList mimeTypes() const override; /** * \see http://qt-project.org/doc/qt-4.8/qabstractitemmodel.html#parent */ - QModelIndex parent( const QModelIndex & index ) const ITK_OVERRIDE; + QModelIndex parent( const QModelIndex & index ) const override; /** * \see http://qt-project.org/doc/qt-4.8/qabstractitemmodel.html#removeRows @@ -224,12 +224,12 @@ public: bool removeRows( int row, int count, - const QModelIndex & p = QModelIndex() ) ITK_OVERRIDE; + const QModelIndex & p = QModelIndex() ) override; /** * \see http://qt-project.org/doc/qt-4.8/qabstractitemmodel.html#rowCount */ - int rowCount( const QModelIndex & p = QModelIndex() ) const ITK_OVERRIDE; + int rowCount( const QModelIndex & p = QModelIndex() ) const override; /** * \see http://qt-project.org/doc/qt-4.8/qabstractitemmodel.html#setData @@ -237,12 +237,12 @@ public: bool setData( const QModelIndex & index, const QVariant & value, - int role = Qt::EditRole ) ITK_OVERRIDE; + int role = Qt::EditRole ) override; /** * \see http://qt-project.org/doc/qt-4.8/qabstractitemmodel.html#supportedDropActions */ - Qt::DropActions supportedDropActions() const ITK_OVERRIDE; + Qt::DropActions supportedDropActions() const override; /*-[ PUBLIC SLOTS SECTION ]------------------------------------------------*/ diff --git a/Modules/Visualization/MonteverdiGui/include/mvdLayerStackWidget.h b/Modules/Visualization/MonteverdiGui/include/mvdLayerStackWidget.h index 25b402072c6c69b4b7b2142b15e11096b64bafc7..1bf94f8fd34f040bcd0c1bf03fd74d103b81666a 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdLayerStackWidget.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdLayerStackWidget.h @@ -33,7 +33,7 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. -#include <QtGui> +#include <QtWidgets> // // System includes (sorted by alphabetic order) @@ -99,7 +99,7 @@ public: LayerStackWidget( QWidget* p =NULL, Qt::WindowFlags flags =0 ); /** \brief Destructor. */ - ~LayerStackWidget() ITK_OVERRIDE; + ~LayerStackWidget() override; /** */ @@ -146,7 +146,7 @@ public: /** * \see http://qt-project.org/doc/qt-4.8/qobject.html#eventFilter */ - bool eventFilter( QObject * watched, QEvent * event ) ITK_OVERRIDE; + bool eventFilter( QObject * watched, QEvent * event ) override; /*-[ PUBLIC SLOTS SECTION ]------------------------------------------------*/ diff --git a/Modules/Visualization/MonteverdiGui/include/mvdMultiResolutionPyramidWidget.h b/Modules/Visualization/MonteverdiGui/include/mvdMultiResolutionPyramidWidget.h index 0ff225da38427e27d100a8c1c1ff5fe9ef644974..d26263e8273dfd6b497fa9e0f22e596415075150 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdMultiResolutionPyramidWidget.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdMultiResolutionPyramidWidget.h @@ -33,7 +33,7 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. -#include <QtGui> +#include <QtWidgets> // // System includes (sorted by alphabetic order) @@ -100,7 +100,7 @@ public: Qt::WindowFlags flags =0 ); /** \brief Destructor. */ - ~MultiResolutionPyramidWidget() ITK_OVERRIDE; + ~MultiResolutionPyramidWidget() override; /** */ diff --git a/Modules/Visualization/MonteverdiGui/include/mvdMyWidget.h b/Modules/Visualization/MonteverdiGui/include/mvdMyWidget.h index 64c3776536bda2c8b80fb9dc540a0f4f9f76cd81..7ee3f06b21374dfabcdb64297983eb841b7d0317 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdMyWidget.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdMyWidget.h @@ -33,7 +33,7 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. -#include <QtGui> +#include <QtWidgets> // // System includes (sorted by alphabetic order) diff --git a/Modules/Visualization/MonteverdiGui/include/mvdOTBApplicationsModel.h b/Modules/Visualization/MonteverdiGui/include/mvdOTBApplicationsModel.h index 25c96da09a3bc1242f8ec0c7eb1549d481142b19..89a0a785032b2385c25499b7f7d36744521417b9 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdOTBApplicationsModel.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdOTBApplicationsModel.h @@ -99,7 +99,7 @@ public: OTBApplicationsModel( QObject* p =NULL ); /** \brief Destructor. */ - ~OTBApplicationsModel() ITK_OVERRIDE; + ~OTBApplicationsModel() override; /** \brief Fill Widget Tree */ void FillTree(); @@ -135,7 +135,7 @@ protected: // // AbstractModel methods. - void virtual_BuildModel( void* context =NULL ) ITK_OVERRIDE; + void virtual_BuildModel( void* context =NULL ) override; // // Protected attributes. diff --git a/Modules/Visualization/MonteverdiGui/include/mvdPixelDescriptionWidget.h b/Modules/Visualization/MonteverdiGui/include/mvdPixelDescriptionWidget.h index 615ba575e1bed83d29c4eb352f95874150c002e5..f1489f85356d1b0fe3eb3c89c10534956df4a60c 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdPixelDescriptionWidget.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdPixelDescriptionWidget.h @@ -33,7 +33,7 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. -#include <QtGui> +#include <QtWidgets> // // System includes (sorted by alphabetic order) @@ -95,7 +95,7 @@ public: PixelDescriptionWidget( QWidget* p =NULL, Qt::WindowFlags flags =0 ); /** \brief Destructor. */ - ~PixelDescriptionWidget() ITK_OVERRIDE; + ~PixelDescriptionWidget() override; /** Get TreeWidget */ QTreeWidget * GetDescriptionTree(); diff --git a/Modules/Visualization/MonteverdiGui/include/mvdProjectionBarWidget.h b/Modules/Visualization/MonteverdiGui/include/mvdProjectionBarWidget.h index be92647e6135ad430e80e4c61f7d30de4f2070ee..6372ec867922babb7413c867df3a7120f09be37c 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdProjectionBarWidget.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdProjectionBarWidget.h @@ -35,7 +35,7 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. -#include <QtGui> +#include <QtWidgets> #include <qnamespace.h> // @@ -82,7 +82,7 @@ public: explicit ProjectionBarWidget(QWidget *p = NULL, Qt::WindowFlags flags = Qt::Widget ); /** \brief Destructor. */ - ~ProjectionBarWidget() ITK_OVERRIDE; + ~ProjectionBarWidget() override; public slots: void SetProjectionScale(double scale_x, double scale_y); diff --git a/Modules/Visualization/MonteverdiGui/include/mvdQtWidgetParameterInitializers.h b/Modules/Visualization/MonteverdiGui/include/mvdQtWidgetParameterInitializers.h index 8af787eb78f9dcf415b1b916f2cb4fe0557302e6..c280921ba05d1b3f51e0ed1e436e4999c4dd57cb 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdQtWidgetParameterInitializers.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdQtWidgetParameterInitializers.h @@ -35,7 +35,7 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. -#include <QtGui> +#include <QtWidgets> // // System includes (sorted by alphabetic order) diff --git a/Modules/Visualization/MonteverdiGui/include/mvdQtWidgetView.h b/Modules/Visualization/MonteverdiGui/include/mvdQtWidgetView.h index 9aba72c53accbe28e01941eeb81872f56f9a8633..bec337749cde39c263124905fd93663b9c70a18e 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdQtWidgetView.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdQtWidgetView.h @@ -34,19 +34,13 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. -#include <QtGui> +#include <QtWidgets> #include <QShortcut> -// -// System includes (sorted by alphabetic order) - -// -// ITK includes (sorted by alphabetic order) - // // OTB includes (sorted by alphabetic order) #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility -#include "otbWrapperApplication.h" +#include "otbWrapperQtWidgetView.h" #include "otbWrapperQtWidgetModel.h" #endif //tag=QT4-boost-compatibility #include "OTBMonteverdiGUIExport.h" @@ -57,18 +51,8 @@ #include "mvdTypes.h" #endif //tag=QT4-boost-compatibility -/*****************************************************************************/ -/* PRE-DECLARATION SECTION */ - -// -// External classes pre-declaration. -namespace -{ -} - namespace mvd { - namespace Wrapper { @@ -84,16 +68,12 @@ namespace Wrapper */ class OTBMonteverdiGUI_EXPORT QtWidgetView : - public QWidget + public otb::Wrapper::QtWidgetView { /*-[ QOBJECT SECTION ]-----------------------------------------------------*/ Q_OBJECT - Q_PROPERTY( bool isClosable - READ IsClosable - WRITE SetClosable ); - /*-[ PUBLIC SECTION ]------------------------------------------------------*/ // @@ -110,30 +90,7 @@ public: Qt::WindowFlags flags =0 ); /** \brief Destructor. */ - ~QtWidgetView() ITK_OVERRIDE; - - /** \brief Gui Creation. */ - void CreateGui(); - - /** \brief Model Accessor */ - inline otb::Wrapper::QtWidgetModel* GetModel() - { - return m_Model; - } - - /** - * \return The OTB-application pointer of this view. - */ - otb::Wrapper::Application::ConstPointer GetApplication() const - { - return otb::ConstCast< otb::Wrapper::Application >( - m_Application - ); - } - - /** - */ - inline bool IsClosable() const; + ~QtWidgetView() override; /*-[ PUBLIC SLOTS SECTION ]------------------------------------------------*/ @@ -146,12 +103,9 @@ public slots: // // Signals. signals: - void QuitSignal(); void OTBApplicationOutputImageChanged( const QString &, const QString &); - void ExecuteAndWriteOutput(); - void ExecutionDone( int nbOutputs ); /*-[ PROTECTED SECTION ]---------------------------------------------------*/ @@ -160,14 +114,16 @@ signals: // Protected methods. protected: - // - // QWidget overloads. + QWidget* CreateInputWidgets() override; - void closeEvent( QCloseEvent * event ) ITK_OVERRIDE; +protected slots: -// -// Protected attributes. -protected: + /** extend the behaviour of base class OnExecButtonClicked */ + void OnExecButtonClicked(); + + /** modify the behaviour of base class OnExceptionRaised + */ + void OnExceptionRaised( QString what ); /*-[ PRIVATE SECTION ]-----------------------------------------------------*/ @@ -178,12 +134,6 @@ private: QtWidgetView(const QtWidgetView&); //purposely not implemented void operator=(const QtWidgetView&); //purposely not implemented - QWidget* CreateFooter(); - - QWidget* CreateInputWidgets(); - - QWidget* CreateDoc(); - /** */ void SetupParameterWidgets( QWidget* widget ); @@ -192,21 +142,6 @@ private: */ void SetupFileSelectionWidget( QWidget * ); -// -// Private attributes. - -private: - - otb::Wrapper::Application::Pointer m_Application; - otb::Wrapper::QtWidgetModel* m_Model; - - QPushButton* m_ExecButton; - QPushButton* m_QuitButton; - QShortcut* m_QuitShortcut; - QLabel* m_Message; - - bool m_IsClosable : 1; - /*-[ PRIVATE SLOTS SECTION ]-----------------------------------------------*/ // @@ -218,30 +153,6 @@ private slots: // image filename{s} set by the user in this OTB application (if any). void OnApplicationExecutionDone( int ); - void UpdateMessageAfterApplicationReady(bool val); - - void UpdateMessageAfterExecution(int status); - - /** - */ - void OnExecButtonClicked(); - - /** - */ - inline void OnProgressReportBegin(); - - /** - */ - inline void OnProgressReportEnd( int status ); - - /** - */ - void OnExceptionRaised( QString what ); - - /** - */ - inline void SetClosable( bool ); - /** */ inline void OnFileSelectionWidgetAdded0( QWidget * ); @@ -264,47 +175,6 @@ namespace mvd namespace Wrapper { -/*****************************************************************************/ -inline -bool -QtWidgetView -::IsClosable() const -{ - return m_IsClosable; -} - -/*****************************************************************************/ -inline -void -QtWidgetView -::SetClosable( bool enabled ) -{ - m_IsClosable = enabled; - - setEnabled( true ); - - if( m_QuitButton!=NULL ) - m_QuitButton->setEnabled( m_IsClosable ); -} - -/*******************************************************************************/ -inline -void -QtWidgetView -::OnProgressReportBegin() -{ - SetClosable( false ); -} - -/*******************************************************************************/ -inline -void -QtWidgetView -::OnProgressReportEnd( int ) -{ - SetClosable( true ); -} - /*******************************************************************************/ inline void diff --git a/Modules/Visualization/MonteverdiGui/include/mvdQuicklookViewManipulator.h b/Modules/Visualization/MonteverdiGui/include/mvdQuicklookViewManipulator.h index 052a39a470d9d1fe380f0390c8ad84004ed88abf..92e9d7073534fd34f0b5aae7c53aa45c69b48e04 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdQuicklookViewManipulator.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdQuicklookViewManipulator.h @@ -34,7 +34,7 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. -#include <QtGui> +#include <QtWidgets> // // System includes (sorted by alphabetic order) @@ -98,36 +98,36 @@ public: #endif // USE_VIEW_SETTINGS_SIDE_EFFECT /** \brief Destructor. */ - ~QuicklookViewManipulator() ITK_OVERRIDE; + ~QuicklookViewManipulator() override; // // ImageViewManipulator overloads. - ZoomType GetFixedZoomType() const ITK_OVERRIDE; + ZoomType GetFixedZoomType() const override; void SetupRenderingContext( - AbstractImageViewRenderer::RenderingContext * const ) const ITK_OVERRIDE; + AbstractImageViewRenderer::RenderingContext * const ) const override; - void MousePressEvent( QMouseEvent* event ) ITK_OVERRIDE; + void MousePressEvent( QMouseEvent* event ) override; - void MouseMoveEvent( QMouseEvent* event ) ITK_OVERRIDE; + void MouseMoveEvent( QMouseEvent* event ) override; // virtual void MousePressEvent( QMouseEvent* event ); // virtual void MouseReleaseEvent( QMouseEvent* event ); - void MouseDoubleClickEvent( QMouseEvent * ) ITK_OVERRIDE {}; + void MouseDoubleClickEvent( QMouseEvent * ) override {}; - void WheelEvent( QWheelEvent* event) ITK_OVERRIDE; + void WheelEvent( QWheelEvent* event) override; - void ResizeEvent( QResizeEvent * event ) ITK_OVERRIDE; + void ResizeEvent( QResizeEvent * event ) override; - void KeyPressEvent( QKeyEvent* event ) ITK_OVERRIDE; + void KeyPressEvent( QKeyEvent* event ) override; - void KeyReleaseEvent( QKeyEvent* event ) ITK_OVERRIDE; + void KeyReleaseEvent( QKeyEvent* event ) override; /*-[ PUBLIC SLOTS SECTION ]-----------------------------------------------**/ diff --git a/Modules/Visualization/MonteverdiGui/include/mvdQuicklookViewRenderer.h b/Modules/Visualization/MonteverdiGui/include/mvdQuicklookViewRenderer.h index 5c86c1f943630f82124ae9af895ac780f36cb8d7..d0124848c2361cb59a1918b9c83a7a28ebb86b91 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdQuicklookViewRenderer.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdQuicklookViewRenderer.h @@ -108,7 +108,7 @@ public: m_RoiOrigin.Fill( 0 ); } - ~RenderingContext() ITK_OVERRIDE {} + ~RenderingContext() override {} PointType m_RoiOrigin; PointType m_RoiExtent; @@ -121,13 +121,13 @@ public: QuicklookViewRenderer( QObject* p = NULL ); /** Destructor */ - ~QuicklookViewRenderer() ITK_OVERRIDE; + ~QuicklookViewRenderer() override; // // ImageViewRenderer overloads. - AbstractImageViewRenderer::RenderingContext* NewRenderingContext() const ITK_OVERRIDE; + AbstractImageViewRenderer::RenderingContext* NewRenderingContext() const override; /*-[ PUBLIC SLOTS SECTION ]------------------------------------------------*/ @@ -150,7 +150,7 @@ protected: // ImageViewRenderer overloads. - void UpdateActors( const AbstractImageViewRenderer::RenderingContext* c ) ITK_OVERRIDE; + void UpdateActors( const AbstractImageViewRenderer::RenderingContext* c ) override; // // Protected attributes. @@ -170,13 +170,13 @@ private: // // ImageViewRenderer methods. - void virtual_SetProjection() ITK_OVERRIDE; - void virtual_UpdateProjection() ITK_OVERRIDE; + void virtual_SetProjection() override; + void virtual_UpdateProjection() override; // // AbstractImageViewRenderer overloads. // TODO: Move virtual_*Scene() methods to protected section. - void virtual_FinishScene() ITK_OVERRIDE; + void virtual_FinishScene() override; // // Private attributes. diff --git a/Modules/Visualization/MonteverdiGui/include/mvdSearchableTreeWidget.h b/Modules/Visualization/MonteverdiGui/include/mvdSearchableTreeWidget.h index cafadc9473d65ccc52de5cccfd713dbef3e61f22..d2df5a2a10943265561cc19a963966a26ae88b1a 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdSearchableTreeWidget.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdSearchableTreeWidget.h @@ -33,7 +33,7 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. -#include <QtGui> +#include <QtWidgets> // // System includes (sorted by alphabetic order) @@ -102,7 +102,7 @@ public: SearchableTreeWidget( QWidget* p =NULL, Qt::WindowFlags flags =0 ); /** \brief Destructor. */ - ~SearchableTreeWidget() ITK_OVERRIDE; + ~SearchableTreeWidget() override; /*-[ PUBLIC SLOTS SECTION ]------------------------------------------------*/ diff --git a/Modules/Visualization/MonteverdiGui/include/mvdShaderWidget.h b/Modules/Visualization/MonteverdiGui/include/mvdShaderWidget.h index 4d1b55c63ca5c478c313f5f497fd3c67c37f77d9..3f2b44dbb9736c43f9a799f94af81eaf63e9db61 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdShaderWidget.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdShaderWidget.h @@ -33,7 +33,7 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. -#include <QtGui> +#include <QtWidgets> // // System includes (sorted by alphabetic order) @@ -101,7 +101,7 @@ public: Qt::WindowFlags flags =0 ); /** \brief Destructor. */ - ~ShaderWidget() ITK_OVERRIDE; + ~ShaderWidget() override; /** */ @@ -144,7 +144,7 @@ private: void SetEffectVisible(const Effect & effect, bool visible); /** */ - void virtual_SetSettings( ImageSettings * ) ITK_OVERRIDE; + void virtual_SetSettings( ImageSettings * ) override; /** * Set the ComboBox effects item for the corresponding image settings. diff --git a/Modules/Visualization/MonteverdiGui/include/mvdStatusBarWidget.h b/Modules/Visualization/MonteverdiGui/include/mvdStatusBarWidget.h index 6ff51de45d94a3a60c3d4a89471e3d4d28f6ccd1..4306546e6fa57632a9cda124fab6956803fb7b78 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdStatusBarWidget.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdStatusBarWidget.h @@ -33,7 +33,7 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. -#include <QtGui> +#include <QtWidgets> // // System includes (sorted by alphabetic order) @@ -97,7 +97,7 @@ public: StatusBarWidget( QWidget* p =NULL, Qt::WindowFlags flags =0 ); /** \brief Destructor. */ - ~StatusBarWidget() ITK_OVERRIDE; + ~StatusBarWidget() override; /*-[ PUBLIC SLOTS SECTION ]------------------------------------------------*/ diff --git a/Modules/Visualization/MonteverdiGui/include/mvdTaskProgressDialog.h b/Modules/Visualization/MonteverdiGui/include/mvdTaskProgressDialog.h index 700399768f61c80e0ebe2d27635936b6ef515072..fd594b985f25bc920f0c1d831d3812b89314cfbc 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdTaskProgressDialog.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdTaskProgressDialog.h @@ -33,7 +33,7 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. -#include <QtGui> +#include <QtWidgets> // // System includes (sorted by alphabetic order) @@ -99,7 +99,7 @@ public: /** * \brief Destructor. */ - ~TaskProgressDialog() ITK_OVERRIDE; + ~TaskProgressDialog() override; /** */ diff --git a/Modules/Visualization/MonteverdiGui/include/mvdTreeWidget.h b/Modules/Visualization/MonteverdiGui/include/mvdTreeWidget.h index 7f4d0f0c40796186d1430ca1f6a9027bf1523880..f84e16d036dcc75b913950e81189f94524175efd 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdTreeWidget.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdTreeWidget.h @@ -33,7 +33,7 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. -#include <QtGui> +#include <QtWidgets> // // System includes (sorted by alphabetic order) @@ -124,7 +124,7 @@ public: TreeWidget( QWidget* p =NULL ); /** \brief Destructor. */ - ~TreeWidget() ITK_OVERRIDE; + ~TreeWidget() override; /*-[ PUBLIC SLOTS SECTION ]------------------------------------------------*/ @@ -151,17 +151,17 @@ protected: // // QTreeWidget overloads. - QStringList mimeTypes() const ITK_OVERRIDE; + QStringList mimeTypes() const override; - QMimeData* mimeData( const QList< QTreeWidgetItem* > items ) const ITK_OVERRIDE; + QMimeData* mimeData( const QList< QTreeWidgetItem* > items ) const override; - void dragEnterEvent( QDragEnterEvent* event ) ITK_OVERRIDE; - void dragMoveEvent( QDragMoveEvent* event ) ITK_OVERRIDE; - void dragLeaveEvent( QDragLeaveEvent* event ) ITK_OVERRIDE; - void dropEvent( QDropEvent* event ) ITK_OVERRIDE; + void dragEnterEvent( QDragEnterEvent* event ) override; + void dragMoveEvent( QDragMoveEvent* event ) override; + void dragLeaveEvent( QDragLeaveEvent* event ) override; + void dropEvent( QDropEvent* event ) override; - Qt::DropActions supportedDropActions() const ITK_OVERRIDE; - void startDrag( Qt::DropActions supportedActions ) ITK_OVERRIDE; + Qt::DropActions supportedDropActions() const override; + void startDrag( Qt::DropActions supportedActions ) override; // // Protected attributes. diff --git a/Modules/Visualization/MonteverdiGui/include/mvdTreeWidgetItem.h b/Modules/Visualization/MonteverdiGui/include/mvdTreeWidgetItem.h index 248c8314831ce0563703bb71d32e61c47764eb9d..2f4e6143726cf7054d666f6d20f19e73c7443436 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdTreeWidgetItem.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdTreeWidgetItem.h @@ -33,7 +33,7 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. -#include <QtGui> +#include <QtWidgets> // // System includes (sorted by alphabetic order) @@ -120,7 +120,7 @@ public: /** * \brief Destructor. */ - ~TreeWidgetItem() ITK_OVERRIDE; + ~TreeWidgetItem() override; /** */ @@ -145,7 +145,7 @@ public: /** * \see http://qt-project.org/doc/qt-4.8/qtreewidgetitem.html#clone */ - QTreeWidgetItem* clone() const ITK_OVERRIDE; + QTreeWidgetItem* clone() const override; /*-[ PUBLIC SLOTS SECTION ]------------------------------------------------*/ diff --git a/Modules/Visualization/MonteverdiGui/include/mvdTreeWidgetItemDragAndDropEventFilter.h b/Modules/Visualization/MonteverdiGui/include/mvdTreeWidgetItemDragAndDropEventFilter.h index b66b4e991ef224424936fc5eef3d00123fa0a4b9..0fbe35dbe51faa74db92ba3e5f5b8db312251ec3 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdTreeWidgetItemDragAndDropEventFilter.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdTreeWidgetItemDragAndDropEventFilter.h @@ -33,7 +33,7 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. -#include <QtGui> +#include <QtWidgets> // // System includes (sorted by alphabetic order) @@ -93,7 +93,7 @@ public: TreeWidgetItemDragAndDropEventFilter( QObject* p =NULL ); /** \brief Destructor. */ - ~TreeWidgetItemDragAndDropEventFilter() ITK_OVERRIDE; + ~TreeWidgetItemDragAndDropEventFilter() override; /*-[ PUBLIC SLOTS SECTION ]------------------------------------------------*/ @@ -121,22 +121,22 @@ protected: /** * \see http://qt-project.org/doc/qt-4.8/qwidget.html#dragEnterEvent */ - bool DragEnterEvent( QObject* object, QDragEnterEvent* event ) ITK_OVERRIDE; + bool DragEnterEvent( QObject* object, QDragEnterEvent* event ) override; /** * \see http://qt-project.org/doc/qt-4.8/qwidget.html#dragLeaveEvent */ - bool DragLeaveEvent( QObject* object, QDragLeaveEvent* event ) ITK_OVERRIDE; + bool DragLeaveEvent( QObject* object, QDragLeaveEvent* event ) override; /** * \see http://qt-project.org/doc/qt-4.8/qwidget.html#dragMoveEvent */ - bool DragMoveEvent( QObject* object, QDragMoveEvent* event ) ITK_OVERRIDE; + bool DragMoveEvent( QObject* object, QDragMoveEvent* event ) override; /** * \see http://qt-project.org/doc/qt-4.8/qwidget.html#dropEvent */ - bool DropEvent( QObject* object, QDropEvent* event ) ITK_OVERRIDE; + bool DropEvent( QObject* object, QDropEvent* event ) override; // // Protected attributes. diff --git a/Modules/Visualization/MonteverdiGui/otb-module.cmake b/Modules/Visualization/MonteverdiGui/otb-module.cmake index 394d815fd235795ad0f984abd8b9eca5b54b524e..ce62702963ff5e02ecabada50bb34744f58dbc34 100644 --- a/Modules/Visualization/MonteverdiGui/otb-module.cmake +++ b/Modules/Visualization/MonteverdiGui/otb-module.cmake @@ -29,7 +29,7 @@ otb_module( OTBMonteverdiGUI OTBIce OTBIOGDAL OTBMonteverdiCore - OTBQt4 + OTBQt OTBQwt OPTIONAL_DEPENDS diff --git a/Modules/Visualization/MonteverdiGui/src/CMakeLists.txt b/Modules/Visualization/MonteverdiGui/src/CMakeLists.txt index d06ac1720cb613741968f59c8ea14093c54aefad..e5d9c3016e522d6d24e7b8cead00987f6f959095 100644 --- a/Modules/Visualization/MonteverdiGui/src/CMakeLists.txt +++ b/Modules/Visualization/MonteverdiGui/src/CMakeLists.txt @@ -174,14 +174,14 @@ if( OTBQtWidget_ENABLED ) endif() ############################################################################# -qt4_wrap_cpp( OTBMonteverdiGUI_SRC_MOC ${OTBMonteverdiGUI_HEADERS_MOC} ) -qt4_wrap_ui( OTBMonteverdiGUI_FORMS_HEADERS ${OTBMonteverdiGUI_FORMS} ) -qt4_add_resources( OTBMonteverdiGUI_RESOURCES_RCC ${OTBMonteverdiGUI_RESOURCES} ) +qt5_wrap_cpp( OTBMonteverdiGUI_SRC_MOC ${OTBMonteverdiGUI_HEADERS_MOC} ) +qt5_wrap_ui( OTBMonteverdiGUI_FORMS_HEADERS ${OTBMonteverdiGUI_FORMS} ) +qt5_add_resources( OTBMonteverdiGUI_RESOURCES_RCC ${OTBMonteverdiGUI_RESOURCES} ) ############################################################################# -add_to_qt4_i18n_sources( ${OTBMonteverdiGUI_SRCS} ) -add_to_qt4_i18n_headers( "../include" ${OTBMonteverdiGUI_SRCS} ) -add_to_qt4_i18n_forms( ${OTBMonteverdiGUI_FORMS} ) +add_to_qt_i18n_sources( ${OTBMonteverdiGUI_SRCS} ) +add_to_qt_i18n_headers( "../include" ${OTBMonteverdiGUI_SRCS} ) +add_to_qt_i18n_forms( ${OTBMonteverdiGUI_FORMS} ) ############################################################################# add_library( OTBMonteverdiGUI diff --git a/Modules/Visualization/MonteverdiGui/src/mvdApplicationLauncher.cxx b/Modules/Visualization/MonteverdiGui/src/mvdApplicationLauncher.cxx index 7d571ff73bccdfba11819ccd01eafeb6e258439d..b3a28a432f839bb8e67921f440449a9ff9bee71e 100644 --- a/Modules/Visualization/MonteverdiGui/src/mvdApplicationLauncher.cxx +++ b/Modules/Visualization/MonteverdiGui/src/mvdApplicationLauncher.cxx @@ -217,13 +217,13 @@ ApplicationLauncher ApplicationLauncher::NewOtbApplicationWidget( appName, isStandalone ); assert( appWidget!=NULL ); - assert( appWidget->GetApplication() ); + assert( appWidget->GetModel()->GetApplication() ); QMainWindow * mainWindow = new QMainWindow( p, flags ); mainWindow->setWindowTitle( QString( "%1 (OTB-" OTB_VERSION_STRING ")" ) - .arg( appWidget->GetApplication()->GetDocName() ) + .arg( appWidget->GetModel()->GetApplication()->GetDocName() ) ); mainWindow->setWindowIcon( QIcon( ":/otb_small.png" ) ); @@ -251,11 +251,11 @@ ApplicationLauncher ); assert( appWidget!=NULL ); - assert( appWidget->GetApplication() ); + assert( appWidget->GetModel()->GetApplication() ); appWidget->setWindowTitle( QString( "%1 (OTB-" OTB_VERSION_STRING ")" ) - .arg( appWidget->GetApplication()->GetDocName() ) + .arg( appWidget->GetModel()->GetApplication()->GetDocName() ) ); appWidget->setWindowIcon( QIcon( ":/icons/process" ) ); diff --git a/Modules/Visualization/MonteverdiGui/src/mvdI18nMainWindow.cxx b/Modules/Visualization/MonteverdiGui/src/mvdI18nMainWindow.cxx index 1dc21b1725f0d8df8d6f4fe6926ed4e0d67b520c..8972459f4923b0472cf0fbb55ba168ce4cb52686 100644 --- a/Modules/Visualization/MonteverdiGui/src/mvdI18nMainWindow.cxx +++ b/Modules/Visualization/MonteverdiGui/src/mvdI18nMainWindow.cxx @@ -24,7 +24,7 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. -#include <QtGui> +#include <QtWidgets> // // System includes (sorted by alphabetic order) diff --git a/Modules/Visualization/MonteverdiGui/src/mvdImageViewRenderer.cxx b/Modules/Visualization/MonteverdiGui/src/mvdImageViewRenderer.cxx index 77dfca68164e256742b580e5bda7bcfaf7ff2776..5fc5b3669d63295a3ce1891193bf5f4b79706354 100644 --- a/Modules/Visualization/MonteverdiGui/src/mvdImageViewRenderer.cxx +++ b/Modules/Visualization/MonteverdiGui/src/mvdImageViewRenderer.cxx @@ -27,7 +27,8 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. -#include <QtOpenGL> +#include <QGLWidget> +// #include <QtOpenGL> // // System includes (sorted by alphabetic order) diff --git a/Modules/Visualization/MonteverdiGui/src/mvdQtWidgetView.cxx b/Modules/Visualization/MonteverdiGui/src/mvdQtWidgetView.cxx index 3c33015a5bde59b586340e7fc5155ed3166c4c84..252c6043797f53d43bfa40cbf5c8dde1abc3421c 100644 --- a/Modules/Visualization/MonteverdiGui/src/mvdQtWidgetView.cxx +++ b/Modules/Visualization/MonteverdiGui/src/mvdQtWidgetView.cxx @@ -23,28 +23,16 @@ /*****************************************************************************/ /* INCLUDE SECTION */ -// -// Qt includes (sorted by alphabetic order) -//// Must be included before system/custom includes. - // // System includes (sorted by alphabetic order) #include <functional> -// -// ITK includes (sorted by alphabetic order) - // // OTB includes (sorted by alphabetic order) #include "otbWrapperApplicationHtmlDocGenerator.h" -// #include "otbWrapperComplexOutputImageParameter.h" #include "otbWrapperOutputFilenameParameter.h" -// #include "otbWrapperOutputImageParameter.h" #include "otbWrapperOutputVectorDataParameter.h" -// #include "otbWrapperQtWidgetOutputImageParameter.h" -// #include "otbWrapperQtWidgetProgressReport.h" #include "otbWrapperQtWidgetSimpleProgressReport.h" -// #include "otbWrapperTypes.h" // // Monteverdi includes (sorted by alphabetic order) @@ -140,208 +128,43 @@ QtWidgetView ::QtWidgetView( const otb::Wrapper::Application::Pointer & otbApp, QWidget* p, Qt::WindowFlags flags ) : - QWidget( p, flags ), - m_Application( otbApp ), - m_Model( NULL ), - m_ExecButton( NULL ), - m_QuitButton( NULL ), - m_Message( NULL ), - m_IsClosable( true ) + otb::Wrapper::QtWidgetView( otbApp, p, flags ) { setObjectName( QtWidgetView::OBJECT_NAME ); - m_Model = new otb::Wrapper::QtWidgetModel( otbApp ); - m_QuitShortcut = new QShortcut(QKeySequence("Ctrl+Q"), this); - - QObject::connect( - m_Model, SIGNAL( SetProgressReportBegin() ), - this, SLOT( OnProgressReportBegin() ) - ); - - QObject::connect( - m_Model, SIGNAL( SetProgressReportDone( int ) ), - this, SLOT( OnProgressReportEnd( int ) ) - ); - - QObject::connect( - m_Model, SIGNAL( ExceptionRaised( QString ) ), - this, SLOT( OnExceptionRaised( QString ) ) - ); -} - -/*******************************************************************************/ -QtWidgetView -::~QtWidgetView() -{ - // m_Application is smart-pointed and will be automatically deleted. - - delete m_Model; - m_Model = NULL; -} - -/*******************************************************************************/ -void -QtWidgetView -::CreateGui() -{ - // Create a VBoxLayout with the header, the input widgets, and the footer - QVBoxLayout *mainLayout = new QVBoxLayout(); - QTabWidget *tab = new QTabWidget(); - tab->addTab(CreateInputWidgets(), tr("Parameters")); - - //otb::Wrapper::QtWidgetProgressReport* prog = new otb::Wrapper::QtWidgetProgressReport(m_Model); - //prog->SetApplication(m_Application); - //tab->addTab(prog, "Progress"); - tab->addTab(CreateDoc(), tr("Documentation")); - mainLayout->addWidget(tab); - - QTextEdit *log = new QTextEdit(); - connect( m_Model->GetLogOutput(), SIGNAL(NewContentLog(QString)), log, SLOT(append(QString) ) ); - tab->addTab(log, tr("Logs")); - - m_Message = new QLabel("<center><font color=\"#FF0000\">"+tr("Select parameters")+"</font></center>"); - connect( - m_Model, - SIGNAL( SetApplicationReady( bool ) ), - this, SLOT( UpdateMessageAfterApplicationReady( bool ) ) - ); - connect( - m_Model, - SIGNAL(SetProgressReportDone(int)), - this, SLOT(UpdateMessageAfterExecution(int)) ); - mainLayout->addWidget(m_Message); - - otb::Wrapper::QtWidgetSimpleProgressReport* progressReport = - new otb::Wrapper::QtWidgetSimpleProgressReport(m_Model); - progressReport->SetApplication(m_Application); - - QWidget* footer = CreateFooter(); - - QHBoxLayout *footLayout = new QHBoxLayout; - footLayout->addWidget(progressReport); - footLayout->addWidget(footer); - mainLayout->addLayout(footLayout); - - footLayout->setAlignment(footer, Qt::AlignBottom); - - QGroupBox *mainGroup = new QGroupBox(); - mainGroup->setLayout(mainLayout); - - QVBoxLayout *finalLayout = new QVBoxLayout(); - finalLayout->addWidget(mainGroup); - - // Make the final layout to the widget - this->setLayout(finalLayout); -} - -/*******************************************************************************/ -QWidget* -QtWidgetView -::CreateInputWidgets() -{ - QScrollArea *scrollArea = new QScrollArea; - - QWidget * widget = - otb::Wrapper::QtWidgetParameterFactory::CreateQtWidget( - m_Model->GetApplication()->GetParameterList(), - m_Model - ); - - scrollArea->setWidget( widget ); - scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); - scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); - scrollArea->setWidgetResizable(true); + m_IconPathDone = std::string("<img src=\":/icons/done\" width=\"16\" height=\"16\" />"); + m_IconPathFailed = std::string("<img src=\":/icons/failed\" width=\"16\" height=\"16\" />"); // // need to be connected to the end of a process QObject::connect( - m_Model, + GetModel(), SIGNAL( SetProgressReportDone( int ) ), // to: this, SLOT ( OnApplicationExecutionDone( int ) ) ); - - SetupParameterWidgets( widget ); - - return scrollArea; } /*******************************************************************************/ -QWidget* QtWidgetView -::CreateFooter() +::~QtWidgetView() { - // an HLayout with two buttons : Execute and Quit - QGroupBox *footerGroup = new QGroupBox; - QHBoxLayout *footerLayout = new QHBoxLayout; - - footerGroup->setFixedHeight(40); - footerGroup->setContentsMargins(0, 0, 0, 0); - footerLayout->setContentsMargins(5, 5, 5, 5); - - m_ExecButton = new QPushButton(footerGroup); - m_ExecButton->setDefault(true); - m_ExecButton->setEnabled(false); - m_ExecButton->setText(QObject::tr("Execute")); - connect( - m_Model, SIGNAL( SetApplicationReady( bool ) ), - m_ExecButton, SLOT( setEnabled( bool ) ) - ); - - QObject::connect( - m_ExecButton, SIGNAL( clicked() ), - // to: - this, SLOT( OnExecButtonClicked() ) - ); - QObject::connect( - this, SIGNAL( ExecuteAndWriteOutput() ), - // to: - m_Model, SLOT( ExecuteAndWriteOutputSlot() ) - ); - - m_QuitButton = new QPushButton(footerGroup); - m_QuitButton->setText(QObject::tr("Quit")); - connect( - m_QuitButton, - SIGNAL( clicked() ), - // to: - this, - SLOT( close() ) - ); - - // Add Ctrl-Q shortcut to quit - connect( m_QuitShortcut, SIGNAL(activated()), this, SLOT(close()) ); - - - // Put the buttons on the right - footerLayout->addStretch(); - footerLayout->addWidget(m_ExecButton); - footerLayout->addWidget(m_QuitButton); - - footerGroup->setLayout(footerLayout); - - return footerGroup; } /*******************************************************************************/ QWidget* QtWidgetView -::CreateDoc() +::CreateInputWidgets() { - QTextEdit *text = new QTextEdit; - text->setReadOnly(true); - - QTextDocument * doc = new QTextDocument(); + QWidget * widget = otb::Wrapper::QtWidgetView::CreateInputWidgets(); - std::string docContain; - otb::Wrapper::ApplicationHtmlDocGenerator::GenerateDoc( m_Application, docContain); + otb::Wrapper::QtWidgetParameterBase *paramWidget = + widget->findChild<otb::Wrapper::QtWidgetParameterBase*>(); - doc->setHtml(docContain.c_str()); + SetupParameterWidgets(paramWidget); - text->setDocument(doc); - - return text; + return widget; } /*******************************************************************************/ @@ -369,11 +192,11 @@ QtWidgetView SetupWidget( widget, - OutputImageInitializer( m_Application->GetName() ) + OutputImageInitializer( GetModel()->GetApplication()->GetName() ) ); SetupWidget( widget, - ComplexOutputImageInitializer( m_Application->GetName() ) + ComplexOutputImageInitializer( GetModel()->GetApplication()->GetName() ) ); SetupWidget( widget, OutputVectorDataInitializer() ); @@ -394,36 +217,6 @@ QtWidgetView initialize( qobject_cast< FileSelectionInitializer::argument_type >( widget ) ); } -/*******************************************************************************/ -void -QtWidgetView -::closeEvent( QCloseEvent * e ) -{ - assert( e!=NULL ); - - if( !IsClosable() ) - { - assert( !m_Application.IsNull() ); - - QMessageBox::warning( - this, - tr( "Warning!" ), - tr( "OTB-Application '%1' cannot be closed while running!") - .arg( m_Application->GetDocName() ) - ); - - e->ignore(); - - return; - } - - QWidget::closeEvent( e ); - - emit QuitSignal(); - - deleteLater(); -} - /*******************************************************************************/ /* SLOTS */ /*******************************************************************************/ @@ -431,226 +224,180 @@ void QtWidgetView ::OnExecButtonClicked() { - assert( m_Model!=NULL ); - assert( m_Model->GetApplication()!=NULL ); - - - assert( I18nCoreApplication::Instance()!=NULL ); - - // - // Get layer-stack, if any. - StackedLayerModel * layerStack = - I18nCoreApplication::Instance()->GetModel< StackedLayerModel >(); - - otb::Wrapper::Application::Pointer otbApp( m_Model->GetApplication() ); - - // - // Check output parameters of OTB-application. - StringVector paramKeys( otbApp->GetParametersKeys() ); - QStringList filenames1; - - KeyLayerAccumulator::KeyLayerPairList layers; - QStringList filenames2; - - for( StringVector::const_iterator it( paramKeys.begin() ); - it!=paramKeys.end(); - ++it ) + if ( !IsRunning() ) { - if( otbApp->IsParameterEnabled( *it, true ) && - otbApp->HasValue( *it ) ) + assert( GetModel()!=NULL ); + assert( GetModel()->GetApplication()!=NULL ); + + + assert( I18nCoreApplication::Instance()!=NULL ); + + // + // Get layer-stack, if any. + StackedLayerModel * layerStack = + I18nCoreApplication::Instance()->GetModel< StackedLayerModel >(); + + otb::Wrapper::Application::Pointer otbApp( GetModel()->GetApplication() ); + + // + // Check output parameters of OTB-application. + StringVector paramKeys( otbApp->GetParametersKeys() ); + QStringList filenames1; + + KeyLayerAccumulator::KeyLayerPairList layers; + QStringList filenames2; + + for( StringVector::const_iterator it( paramKeys.begin() ); + it!=paramKeys.end(); + ++it ) { - otb::Wrapper::Parameter::Pointer param( otbApp->GetParameterByKey( *it ) ); - assert( !param.IsNull() ); - - // qDebug() - // << it->c_str() << ": type" << otbApp->GetParameterType( *it ); - - // const char* filename = NULL; - std::string filename; - - switch( otbApp->GetParameterType( *it ) ) - { - case otb::Wrapper::ParameterType_OutputFilename: - filename = - otb::DynamicCast< otb::Wrapper::OutputFilenameParameter >( param ) - ->GetValue(); - break; - // - // FILENAME. - // - // IMAGE. - case otb::Wrapper::ParameterType_OutputImage: - filename = - otb::DynamicCast< otb::Wrapper::OutputImageParameter >( param ) - ->GetFileName(); - break; - // - // VECTOR-DATA. - case otb::Wrapper::ParameterType_OutputVectorData: - filename = - otb::DynamicCast< otb::Wrapper::OutputVectorDataParameter >( param ) - ->GetFileName(); - break; - // - // COMPLEX IMAGE. - case otb::Wrapper::ParameterType_ComplexOutputImage: - filename = - otb::DynamicCast< otb::Wrapper::ComplexOutputImageParameter >( param ) - ->GetFileName(); - break; - // - // NONE. - default: - break; - } - - if( QFileInfo( filename.c_str() ).exists() ) - filenames1.push_back( filename.c_str() ); - - if( layerStack!=NULL ) - { - KeyLayerAccumulator accumulator( - std::for_each( - layerStack->Begin(), - layerStack->End(), KeyLayerAccumulator( filename, layers ) - ) - ); - - if( accumulator.GetCount()>0 ) - filenames2.push_back( filename.c_str() ); - } - } - } - - { - QString message; - - if( filenames1.size()==1 ) - { - // qDebug() - // << it->c_str() << ":" << QString( filename.c_str() ); - - message = - tr( "Are you sure you want to overwrite file '%1'?" ) - .arg( filenames1.front() ); - } - else if( filenames1.size()>1 ) - { - message = - tr( "Following files will be overwritten. Are you sure you want to continue?\n- %1" ) - .arg( filenames1.join( "\n- " ) ); - } - - if( !message.isEmpty() ) + if( otbApp->IsParameterEnabled( *it, true ) && + otbApp->HasValue( *it ) ) + { + otb::Wrapper::Parameter::Pointer param( otbApp->GetParameterByKey( *it ) ); + assert( !param.IsNull() ); + + // qDebug() + // << it->c_str() << ": type" << otbApp->GetParameterType( *it ); + + // const char* filename = NULL; + std::string filename; + + switch( otbApp->GetParameterType( *it ) ) { - QMessageBox::StandardButton button = - QMessageBox::question( - this, - PROJECT_NAME, - message, - QMessageBox::Yes | QMessageBox::No, - QMessageBox::No - ); - - if( button==QMessageBox::No ) - return; + case otb::Wrapper::ParameterType_OutputFilename: + filename = + otb::DynamicCast< otb::Wrapper::OutputFilenameParameter >( param ) + ->GetValue(); + break; + // + // FILENAME. + // + // IMAGE. + case otb::Wrapper::ParameterType_OutputImage: + filename = + otb::DynamicCast< otb::Wrapper::OutputImageParameter >( param ) + ->GetFileName(); + break; + // + // VECTOR-DATA. + case otb::Wrapper::ParameterType_OutputVectorData: + filename = + otb::DynamicCast< otb::Wrapper::OutputVectorDataParameter >( param ) + ->GetFileName(); + break; + // + // COMPLEX IMAGE. + case otb::Wrapper::ParameterType_ComplexOutputImage: + filename = + otb::DynamicCast< otb::Wrapper::ComplexOutputImageParameter >( param ) + ->GetFileName(); + break; + // + // NONE. + default: + break; } - } - - { - QString message; - - if( filenames2.size()==1 ) + + if( QFileInfo( filename.c_str() ).exists() ) + filenames1.push_back( filename.c_str() ); + + if( layerStack!=NULL ) { - // qDebug() - // << it->c_str() << ":" << QString( filename.c_str() ); - - message = - tr( "File '%1' is being viewed in " PROJECT_NAME " and will be concurrently overwritten by running this %2. File will be removed from layer-stack before running %2 and reloaded after.\n\nDo you want to continue?" ) - .arg( filenames2.front() ) - .arg( otbApp->GetDocName() ); + KeyLayerAccumulator accumulator( + std::for_each( + layerStack->Begin(), + layerStack->End(), KeyLayerAccumulator( filename, layers ) + ) + ); + + if( accumulator.GetCount()>0 ) + filenames2.push_back( filename.c_str() ); } - else if( filenames2.size()>1 ) + } + } + { - message = - tr( "Following files are being viewed in " PROJECT_NAME " and will be concurrently overwritter by running %2. Files will be removed from layer-stack before running %2. Do you want to continue?\n- %1" ) - .arg( filenames2.join( "\n- " ) ) - .arg( otbApp->GetDocName() ); + QString message; + + if( filenames1.size()==1 ) + { + // qDebug() + // << it->c_str() << ":" << QString( filename.c_str() ); + + message = + tr( "Are you sure you want to overwrite file '%1'?" ) + .arg( filenames1.front() ); + } + else if( filenames1.size()>1 ) + { + message = + tr( "Following files will be overwritten. Are you sure you want to continue?\n- %1" ) + .arg( filenames1.join( "\n- " ) ); + } + + if( !message.isEmpty() ) + { + QMessageBox::StandardButton button = + QMessageBox::question( + this, + PROJECT_NAME, + message, + QMessageBox::Yes | QMessageBox::No, + QMessageBox::No + ); + + if( button==QMessageBox::No ) + return; + } } - - if( !message.isEmpty() ) + { - QMessageBox::StandardButton button = - QMessageBox::question( - this, - PROJECT_NAME, - message, - QMessageBox::Yes | QMessageBox::No, - QMessageBox::No - ); - - if( button==QMessageBox::No ) - return; - - while( !layers.empty() ) + QString message; + + if( filenames2.size()==1 ) { - layerStack->Delete( layers.front().first ); - - layers.pop_front(); + // qDebug() + // << it->c_str() << ":" << QString( filename.c_str() ); + + message = + tr( "File '%1' is being viewed in " PROJECT_NAME " and will be concurrently overwritten by running this %2. File will be removed from layer-stack before running %2 and reloaded after.\n\nDo you want to continue?" ) + .arg( filenames2.front() ) + .arg( otbApp->GetDocName() ); + } + else if( filenames2.size()>1 ) + { + message = + tr( "Following files are being viewed in " PROJECT_NAME " and will be concurrently overwritter by running %2. Files will be removed from layer-stack before running %2. Do you want to continue?\n- %1" ) + .arg( filenames2.join( "\n- " ) ) + .arg( otbApp->GetDocName() ); + } + + if( !message.isEmpty() ) + { + QMessageBox::StandardButton button = + QMessageBox::question( + this, + PROJECT_NAME, + message, + QMessageBox::Yes | QMessageBox::No, + QMessageBox::No + ); + + if( button==QMessageBox::No ) + return; + + while( !layers.empty() ) + { + layerStack->Delete( layers.front().first ); + + layers.pop_front(); + } } } } - - /* U N S A F E - // BUGFIX: Mantis-750 - // - // Remove files which will be overwritten in order to use - // file-existence to check whether to emit the OutputImageChanged - // signal (see ::OnApplicationExecutionDone()). - for( FileInfoVector::const_iterator it( fileInfos.begin() ); - it!=fileInfos.end(); - ++it ) - { - qDebug() << "Removing:" << it->filePath(); - - it->dir().remove( it->fileName() ); - } - */ - - emit ExecuteAndWriteOutput(); - - m_Message->setText("<center><font color=\"#FF0000\">"+tr("Running")+"</font></center>"); -} - -/******************************************************************************/ -void -QtWidgetView -::UpdateMessageAfterExecution(int status) -{ - if (status >= 0) - { - m_Message->setText("<center>" - "<img src=\":/icons/done\" width=\"16\" height=\"16\" />" - "<font color=\"#00A000\">"+tr("Done")+"</font></center>"); - } - else - { - m_Message->setText("<center>" - "<img src=\":/icons/failed\" width=\"16\" height=\"16\" />" - "<font color=\"#FF0000\">"+tr("Failed")+"</font></center>"); - } -} - -/*******************************************************************************/ -void -QtWidgetView -::UpdateMessageAfterApplicationReady( bool val ) -{ - if(val == true) - m_Message->setText("<center><font color=\"#00A000\">"+tr("Ready to run")+"</font></center>"); - else - m_Message->setText("<center><font color=\"#FF0000\">"+tr("Select parameters")+"</font></center>"); + otb::Wrapper::QtWidgetView::OnExecButtonClicked(); } /*******************************************************************************/ @@ -675,7 +422,7 @@ void QtWidgetView ::OnApplicationExecutionDone( int status ) { - otb::Wrapper::Application::Pointer otbApp( m_Model->GetApplication() ); + otb::Wrapper::Application::Pointer otbApp( GetModel()->GetApplication() ); if( status!=0 ) { @@ -765,6 +512,5 @@ QtWidgetView emit ExecutionDone( status ); } -} - -} +} // end of namespace Wrapper +} // end of namespace mvd diff --git a/Modules/Visualization/MonteverdiGui/src/mvdQuicklookViewRenderer.cxx b/Modules/Visualization/MonteverdiGui/src/mvdQuicklookViewRenderer.cxx index 027fc96930b6de96759dd7a8cba4a0fdf5f987cf..b223bc7cd85b482b3a6fd3e1c3100880f6a5e653 100644 --- a/Modules/Visualization/MonteverdiGui/src/mvdQuicklookViewRenderer.cxx +++ b/Modules/Visualization/MonteverdiGui/src/mvdQuicklookViewRenderer.cxx @@ -27,7 +27,8 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. -#include <QtOpenGL> +#include <QGLWidget> +// #include <QtOpenGL> // // System includes (sorted by alphabetic order) diff --git a/Modules/Visualization/MonteverdiGui/src/mvdTreeWidget.cxx b/Modules/Visualization/MonteverdiGui/src/mvdTreeWidget.cxx index 74da3c2fd7bf8ae0013317f63d8062c9a1dc289e..3837c44790ec3acfc89d120467626a191abb219f 100644 --- a/Modules/Visualization/MonteverdiGui/src/mvdTreeWidget.cxx +++ b/Modules/Visualization/MonteverdiGui/src/mvdTreeWidget.cxx @@ -533,7 +533,8 @@ operator << ( QDataStream& out, QTreeWidgetItem const * item ) "QDataStream& operator << ( QDataStream&, QTreeWidgetItem const * & );"; */ -#if DATA_STREAM_USE_TEMPLATE_OPERATORS +#if 0 // operator >> is used in QT5 this lead to wrong call, fix: comment or +// put operator >> def and decl in a specific namespace. return operator << < QTreeWidgetItem >( out, item ); #else // DATA_STREAM_USE_TEMPLATE_OPERATORS @@ -553,7 +554,7 @@ operator >>( QDataStream& in, QTreeWidgetItem * & item ) "QDataStream& operator >> ( QDataStream&, QTreeWidgetItem * & );"; */ -#if DATA_STREAM_USE_TEMPLATE_OPERATORS +#if 0 return operator >> < QTreeWidgetItem >( in, item ); #else // DATA_STREAM_USE_TEMPLATE_OPERATORS diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperAddProcessToWatchEvent.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperAddProcessToWatchEvent.h index 3cf9114c81a09c5c329913a69971acb59389bfce..9dec89465c76e56953a842882d45e3bade722415 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperAddProcessToWatchEvent.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperAddProcessToWatchEvent.h @@ -46,7 +46,7 @@ public: AddProcessToWatchEvent(){} AddProcessToWatchEvent(const Self& s) :itk::EventObject(s){}; - ~AddProcessToWatchEvent() ITK_OVERRIDE {} + ~AddProcessToWatchEvent() override {} /** Set/Get the process to watch */ virtual void SetProcess(itk::ProcessObject * process) @@ -70,16 +70,16 @@ public: } /** Virtual pure method to implement */ - itk::EventObject* MakeObject() const ITK_OVERRIDE + itk::EventObject* MakeObject() const override { return new Self; } - const char* GetEventName() const ITK_OVERRIDE + const char* GetEventName() const override { return "AddProcess"; } - bool CheckEvent(const itk::EventObject* e) const ITK_OVERRIDE + bool CheckEvent(const itk::EventObject* e) const override { return dynamic_cast<const Self*>(e); } diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h index f97134cbd1e4eb32f6768168b50eb5cab7c94158..421ef9a4a71e239ba313477d0d9b9fa25fdff714 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h @@ -22,6 +22,7 @@ #define otbWrapperApplication_h #include <string> +#include <set> #include "otbWrapperTypes.h" #include "otbWrapperTags.h" #include "otbWrapperParameterGroup.h" @@ -154,6 +155,9 @@ public: */ int ExecuteAndWriteOutput(); + /** Request the application to stop its processing */ + void Stop(); + /* Get the internal application parameters * * WARNING: this method may disappear from the API */ @@ -212,6 +216,9 @@ public: bool GetParameterEmpty(std::string paramKey); /** Set HasUserValue flag of parameter with key paramKey + * Note that when this function is called from DoInit, DoUpdateParameters + * or DoExecute, it will always set this flag to false, because this is + * the core behavior of the application. */ void SetParameterUserValue(std::string paramKey, bool value); @@ -300,7 +307,7 @@ public: */ bool IsParameterMissing(const std::string &key) const; - /* Set an default integer value, must used in the + /* Set a default integer value, must be used in the * DoInit when setting a value by default * for the parameter * @@ -312,7 +319,17 @@ public: */ void SetDefaultParameterInt(std::string parameter, int value); - /* Set a default floating value, must used in the + /* Get the default integer value of a parameter + * + * Can be called for types : + * \li ParameterType_Int + * \li ParameterType_Float + * \li ParameterType_Radius + * \li ParameterType_Choice + */ + int GetDefaultParameterInt(std::string parameter); + + /* Set a default floating value, must be used in the * DoInit when setting a value by default * for the parameter * @@ -321,6 +338,13 @@ public: */ void SetDefaultParameterFloat(std::string parameter, float value); + /* Get the default floating value of a parameter + * + * Can be called for types : + * \li ParameterType_Float + */ + float GetDefaultParameterFloat(std::string parameter); + /** Set a default pixel type for an output image parameter * * \param[in] parameter Name of the output image parameter @@ -475,7 +499,7 @@ public: * \throw itk::Exception if parameter is not found or not an * InputImageParameter */ - void SetParameterInputImage(std::string parameter, InputImageParameter::ImageBaseType * inputImage); + void SetParameterInputImage(std::string parameter, ImageBaseType * inputImage); /** * Get the output image parameter as an ImageBase * instead @@ -486,7 +510,7 @@ public: * \throw itk::Exception if parameter is not found or not an * OutputImageParameter */ - OutputImageParameter::ImageBaseType * GetParameterOutputImage(std::string parameter); + ImageBaseType * GetParameterOutputImage(std::string parameter); /** * Set the input complex image parameter as an ImageBase * instead @@ -497,7 +521,7 @@ public: * \throw itk::Exception if parameter is not found or not an * ComplexInputImageParameter */ - void SetParameterComplexInputImage(std::string parameter, ComplexInputImageParameter::ImageBaseType * inputImage); + void SetParameterComplexInputImage(std::string parameter, ImageBaseType * inputImage); /** * Get the complex output image parameter as an ImageBase * instead @@ -508,7 +532,7 @@ public: * \throw itk::Exception if parameter is not found or not an * ComplexOutputImageParameter */ - ComplexOutputImageParameter::ImageBaseType * GetParameterComplexOutputImage(std::string parameter); + ImageBaseType * GetParameterComplexOutputImage(std::string parameter); /** * Add an image to an InputImageList parameter as an ImageBase @@ -519,7 +543,7 @@ public: * \throw itk::Exception if parameter is not found or not an * InputImageList parameter */ - void AddImageToParameterInputImageList(std::string parameter, InputImageListParameter::ImageBaseType * img); + void AddImageToParameterInputImageList(std::string parameter, ImageBaseType * img); /** * Set the nth image of an InputImageList parameter as an ImageBase pointer @@ -531,7 +555,7 @@ public: * \throw itk::Exception if parameter is not found or not an * InputImageList parameter or if id is out of bounds */ - void SetNthParameterInputImageList(std::string parameter, const unsigned int &id, InputImageListParameter::ImageBaseType * img); + void SetNthParameterInputImageList(std::string parameter, const unsigned int &id, ImageBaseType * img); /** * Add a value to a parameter list as a string @@ -592,11 +616,16 @@ public: { \ Image##Type::Pointer ret; \ Parameter* param = GetParameterByKey(parameter); \ - if (dynamic_cast<InputImageParameter*>(param)) \ + InputImageParameter* paramDown = dynamic_cast<InputImageParameter*>(param); \ + ComplexInputImageParameter* paramDownC = dynamic_cast<ComplexInputImageParameter*>(param); \ + if ( paramDown ) \ { \ - InputImageParameter* paramDown = dynamic_cast<InputImageParameter*>(param); \ ret = paramDown->Get##Image(); \ } \ + else if ( paramDownC ) /* Support of ComplexInputImageParameter */ \ + { \ + ret = paramDownC->Get##Image(); \ + } \ return ret; \ } @@ -619,30 +648,16 @@ public: otbGetParameterImageMacro(UInt8RGBImage); otbGetParameterImageMacro(UInt8RGBAImage); - /* Get a complex image value - * - * Can be called for types : - * \li ParameterType_ComplexInputImage - */ - -#define otbGetParameterComplexImageMacro( Image ) \ - Image##Type * GetParameter##Image( std::string parameter ) \ - { \ - Image##Type::Pointer ret; \ - Parameter* param = GetParameterByKey(parameter); \ - ComplexInputImageParameter* paramDown = dynamic_cast<ComplexInputImageParameter*>(param); \ - if (paramDown) \ - { \ - ret = paramDown->Get##Image(); \ - } \ - return ret; \ - } - - otbGetParameterComplexImageMacro(ComplexFloatImage); - otbGetParameterComplexImageMacro(ComplexDoubleImage); + // Complex image + otbGetParameterImageMacro(ComplexInt16Image); + otbGetParameterImageMacro(ComplexInt32Image); + otbGetParameterImageMacro(ComplexFloatImage); + otbGetParameterImageMacro(ComplexDoubleImage); - otbGetParameterComplexImageMacro(ComplexFloatVectorImage); - otbGetParameterComplexImageMacro(ComplexDoubleVectorImage); + otbGetParameterImageMacro(ComplexInt16VectorImage); + otbGetParameterImageMacro(ComplexInt32VectorImage); + otbGetParameterImageMacro(ComplexFloatVectorImage); + otbGetParameterImageMacro(ComplexDoubleVectorImage); /* Get an image list value * @@ -853,12 +868,100 @@ public: this->SetDocLink(link); } + /** Get the origin of the image parameter 'key'. The optional 'idx' allows + * to select the image in an InputImageList. */ + ImageBaseType::PointType GetImageOrigin(const std::string & key, unsigned int idx = 0); + + /** Get the spacing of the image parameter 'key'. The optional 'idx' allows to + * select the image in an InputImageList. We use the signed spacing convention. */ + ImageBaseType::SpacingType GetImageSpacing(const std::string & key, unsigned int idx = 0); + + /** Get the size of the image parameter 'key'. The optional 'idx' allows to + * select the image in an InputImageList. It corresponds to the size of LargestPossibleRegion*/ + ImageBaseType::SizeType GetImageSize(const std::string & key, unsigned int idx = 0); + + /** Get the number of bands in the image parameter 'key'. The optional 'idx' + * allows to select the image in an InputImageList.*/ + unsigned int GetImageNbBands(const std::string & key, unsigned int idx = 0); + + /** Get the projection of the image parameter 'key'. The optional 'idx' allows + * to select the image in an InputImageList.*/ + std::string GetImageProjection(const std::string & key, unsigned int idx = 0); + + /** Get the keywordlist of the image parameter 'key'. The optional 'idx' + * allows to select the image in an InputImageList.*/ + otb::ImageKeywordlist GetImageKeywordlist(const std::string & key, unsigned int idx = 0); + + /** Set the requested region on the image parameter 'key' and propagate it. + * The returned value is an estimate of the RAM usage (in Bytes) to process + * this region. It should be assumed that the index of the largest possible + * region starts at (0,0). The optional 'idx' allows to select the image in + * an InputImageList*/ + unsigned long PropagateRequestedRegion(const std::string & key, ImageBaseType::RegionType region, unsigned int idx = 0); + + /** Get the requested region of the image parameter 'key'. The optional 'idx' + * allows to select the image in an InputImageList. It should be assumed that + * the index of the largest possible region starts at (0,0).*/ + ImageBaseType::RegionType GetImageRequestedRegion(const std::string & key, unsigned int idx = 0); + + /** Returns a copy of the metadata dictionary of the image */ + itk::MetaDataDictionary GetImageMetaData(const std::string & key, unsigned int idx = 0); + + /** Find out what is the pixel type from an image parameter + * This function assumes that the underlying object is either an otb::Image + * or an otb::VectorImage. The optional 'idx' allows to access InputImageList. + */ + ImagePixelType GetImageBasePixelType(const std::string & key, unsigned int idx = 0); + + /** Return the image from parameter 'key' as a base type. The optional 'idx' + * allows to access InputImageList. + * + * Works on parameters: + * \li ParameterType_InputImage + * \li ParameterType_InputImageList + * \li ParameterType_OutputImage + * \li ParameterType_ComplexInputImage + * \li ParameterType_ComplexOutputImage + */ + ImageBaseType* GetParameterImageBase(const std::string & key, unsigned int idx = 0); + + /** Set the image in parameter 'key' as a base type. The optional 'idx' + * allows to access InputImageList. + * + * Works on parameters: + * \li ParameterType_InputImage + * \li ParameterType_InputImageList + * \li ParameterType_ComplexInputImage + */ + void SetParameterImageBase(const std::string & key, ImageBaseType* img, unsigned int idx = 0); + + /** + Register all ProcessObject that are linked to parameters : + \li ParameterType_OutputImage + \li ParameterType_OutputVectorData + + Those ProcessObjects are stored in the m_Filters set and are deleted at the + end of ExecuteAndWriteOutput (if there are only held by the set) + This method can be called just before the end of a DoExecute in a derived + class of Application. + */ + void RegisterPipeline(); + + /** + Register all DataObject that are reachable from : + \li ParameterType_OutputImage + \li ParameterType_OutputVectorData + + Once registered, the methode ReleaseData is called on each one of them. + */ + void FreeRessources(); + protected: /** Constructor */ Application(); /** Destructor */ - ~Application() ITK_OVERRIDE; + ~Application() override; /* Register a ProcessObject as a new progress source */ void AddProcess(itk::ProcessObject* object, std::string description); @@ -987,6 +1090,8 @@ private: * implementation does nothing */ virtual void AfterExecuteAndWriteOutputs(); + virtual void DoFreeRessources(){}; + Application(const Application &); //purposely not implemented void operator =(const Application&); //purposely not implemented @@ -998,6 +1103,8 @@ private: itk::ProcessObject::Pointer m_ProgressSource; std::string m_ProgressSourceDescription; + std::set<itk::ProcessObject::Pointer> m_Filters; + /** Long name of the application (that can be displayed...) */ std::string m_DocName; /** Long and precise application description . */ @@ -1022,6 +1129,10 @@ private: bool m_HaveInXML; bool m_HaveOutXML; bool m_IsInXMLParsed; + + /** Flag is true when executing DoInit, DoUpdateParameters or DoExecute */ + bool m_IsInPrivateDo; + /** * Declare the class * - Wrapper::MapProjectionParametersHandler diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationFactory.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationFactory.h index 4b3119096c152a3d014bfbd01e5e98569943c0be..f0461e2982cb625f4c292201b3c077c533b596ab 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationFactory.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationFactory.h @@ -40,12 +40,12 @@ public: typedef itk::SmartPointer<const Self> ConstPointer; /** Class methods used to interface with the registered factories. */ - const char* GetITKSourceVersion(void) const ITK_OVERRIDE + const char* GetITKSourceVersion(void) const override { return ITK_SOURCE_VERSION; } - const char* GetDescription(void) const ITK_OVERRIDE + const char* GetDescription(void) const override { return "ApplicationFactory"; } @@ -74,7 +74,7 @@ protected: } - ~ApplicationFactory() ITK_OVERRIDE + ~ApplicationFactory() override { } @@ -82,7 +82,7 @@ protected: /** This method is provided by sub-classes of ObjectFactoryBase. * It should create the named itk object or return 0 if that object * is not supported by the factory implementation. */ - LightObject::Pointer CreateObject(const char* itkclassname ) ITK_OVERRIDE + LightObject::Pointer CreateObject(const char* itkclassname ) override { LightObject::Pointer ret; if ( m_ClassName == itkclassname) @@ -95,7 +95,7 @@ protected: * itkclass name, which are provide by this object */ std::list<LightObject::Pointer> - CreateAllObject(const char* itkclassname) ITK_OVERRIDE + CreateAllObject(const char* itkclassname) override { const std::string applicationClass("otbWrapperApplication"); std::list<LightObject::Pointer> list; diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationFactoryBase.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationFactoryBase.h index cafab0a14125e297801dd349ba5949aead2f8e24..2012736f81fb363ce896fcc0baaa3cefb4289ff7 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationFactoryBase.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationFactoryBase.h @@ -48,7 +48,7 @@ public: protected: ApplicationFactoryBase(){} - ~ApplicationFactoryBase() ITK_OVERRIDE{} + ~ApplicationFactoryBase() override{} private: ApplicationFactoryBase(const Self &); //purposely not implemented diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationRegistry.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationRegistry.h index 0bb290c71e68cca0aa1f87e61bc877b0b8a1715b..b31c8ed3b0744ad28a739152680c4774c08c4173 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationRegistry.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationRegistry.h @@ -79,7 +79,7 @@ public: protected: ApplicationRegistry(); - ~ApplicationRegistry() ITK_OVERRIDE; + ~ApplicationRegistry() override; private: ApplicationRegistry(const Self&); //purposely not implemented diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperBoolParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperBoolParameter.h new file mode 100644 index 0000000000000000000000000000000000000000..b2a26670de700f3daf95a9c943477366c59dba50 --- /dev/null +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperBoolParameter.h @@ -0,0 +1,87 @@ +/* + * 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 otbWrapperBoolParameter_h +#define otbWrapperBoolParameter_h + +#include "otbWrapperParameter.h" +#include "OTBApplicationEngineExport.h" + +namespace otb +{ +namespace Wrapper +{ + +/** \class BoolParameter + * \brief This class represent a boolean parameter for the wrapper framework + * + * It is intended to replace the deprecated EmptyParameter + * + * \ingroup OTBApplicationEngine + */ +class OTBApplicationEngine_EXPORT BoolParameter + : public Parameter +{ +public: + /** Standard class typedef */ + typedef BoolParameter Self; + typedef Parameter Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + /** Defining ::New() static method */ + itkNewMacro(Self); + + /** RTTI support */ + itkTypeMacro(BoolParameter, Parameter); + + /** This parameter is ON/OFF switch, it always has a value */ + bool HasValue() const override + { + return true; + } + + bool GetValue() const; + + std::string GetValueAsString() const; + + void SetValue(bool state); + + void SetValue(const std::string & str); + +protected: + /** Constructor */ + BoolParameter(); + + /** Destructor */ + ~BoolParameter() override + {} + +private: + BoolParameter(const BoolParameter &) = delete; + void operator =(const BoolParameter&) = delete; + + bool m_Value; +}; + +} // end of namespace Wrapper +} // end of namespace otb + +#endif diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperChoiceParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperChoiceParameter.h index b376323214a31e02f6846b80d2aed4c7b126e6e3..b2bd1d55f7097cb7d077c2e9f3920f640b70fcf1 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperChoiceParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperChoiceParameter.h @@ -88,12 +88,12 @@ public: /** Return any value */ virtual unsigned int GetValue(); - bool HasValue() const ITK_OVERRIDE + bool HasValue() const override { return !m_ChoiceList.empty(); } - void ClearValue() ITK_OVERRIDE + void ClearValue() override { // Same as constructor init value // Note that this may be invalid if HasValue() == false @@ -105,7 +105,7 @@ protected: ChoiceParameter(); /** Destructor */ - ~ChoiceParameter() ITK_OVERRIDE; + ~ChoiceParameter() override; struct Choice { diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperComplexInputImageParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperComplexInputImageParameter.h index 1fa00dd77d70660769bdd48e0031ac0d77d8e368..6cf2b6c34cc055c04bf271f941b822b197495595 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperComplexInputImageParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperComplexInputImageParameter.h @@ -44,8 +44,6 @@ public: typedef itk::SmartPointer<Self> Pointer; typedef itk::SmartPointer<const Self> ConstPointer; - typedef itk::ImageBase<2> ImageBaseType; - /** Defining ::New() static method */ itkNewMacro(Self); @@ -60,12 +58,37 @@ public: ComplexFloatVectorImageType* GetImage(); /** Get the input image as XXXImageType */ + ComplexInt16ImageType* GetComplexInt16Image(); + ComplexInt32ImageType* GetComplexInt32Image(); ComplexFloatImageType* GetComplexFloatImage(); ComplexDoubleImageType* GetComplexDoubleImage(); + ComplexInt16VectorImageType* GetComplexInt16VectorImage(); + ComplexInt32VectorImageType* GetComplexInt32VectorImage(); ComplexFloatVectorImageType* GetComplexFloatVectorImage(); ComplexDoubleVectorImageType* GetComplexDoubleVectorImage(); +/* Support for ComplexInputImageParameter. This has been done to support +the macro otbGetParameterImageMacro of otbWrapperApplication.h */ + UInt8ImageType* GetUInt8Image(); + UInt16ImageType* GetUInt16Image(); + Int16ImageType* GetInt16Image(); + UInt32ImageType* GetUInt32Image(); + Int32ImageType* GetInt32Image(); + FloatImageType* GetFloatImage(); + DoubleImageType* GetDoubleImage(); + + UInt8VectorImageType* GetUInt8VectorImage(); + UInt16VectorImageType* GetUInt16VectorImage(); + Int16VectorImageType* GetInt16VectorImage(); + UInt32VectorImageType* GetUInt32VectorImage(); + Int32VectorImageType* GetInt32VectorImage(); + FloatVectorImageType* GetFloatVectorImage(); + DoubleVectorImageType* GetDoubleVectorImage(); + + UInt8RGBImageType* GetUInt8RGBImage(); + UInt8RGBAImageType* GetUInt8RGBAImage(); + /** Get the input image as templated image type. */ template <class TImageType> TImageType* GetImage(); @@ -81,18 +104,9 @@ public: template <class TComplexInputImage, class TOutputImage> TOutputImage* CastImage(); - /** Cast an image to an image of the same type - * Image to Image, VectorImage to VectorImage, RGBAImage to RGBAImage. */ - template <class TComplexInputImage, class TOutputImage> - TOutputImage* SimpleCastImage(); - - /** Cast an image to a vector image. */ - template <class TComplexInputImage, class TOutputImage> - TOutputImage* CastVectorImageFromImage(); - - bool HasValue() const ITK_OVERRIDE; + bool HasValue() const override; - void ClearValue() ITK_OVERRIDE; + void ClearValue() override; protected: @@ -100,16 +114,13 @@ protected: ComplexInputImageParameter(); /** Destructor */ - ~ComplexInputImageParameter() ITK_OVERRIDE; + ~ComplexInputImageParameter() override; ImageBaseType::Pointer m_Image; std::string m_FileName; /** Readers typedefs */ - typedef otb::ImageFileReader<ComplexFloatImageType> ComplexFloatReaderType; - typedef otb::ImageFileReader<ComplexDoubleImageType> ComplexDoubleReaderType; - typedef otb::ImageFileReader<ComplexFloatVectorImageType> ComplexFloatVectorReaderType; typedef otb::ImageFileReader<ComplexDoubleVectorImageType> ComplexDoubleVectorReaderType; @@ -128,33 +139,6 @@ private: }; // End class ComplexInputImage Parameter - -// template specializations of CastImage<> should be declared in header -// so that the linker knows they exist when building OTB Applications - -#define otbDefineCastImageMacro(ComplexInputImageType, OutputImageType) \ - template<> OutputImageType * \ - ComplexInputImageParameter::CastImage<ComplexInputImageType , OutputImageType>(); \ - -#define otbGenericDefineCastImageMacro(ComplexInputImageType, prefix) \ - otbDefineCastImageMacro(ComplexInputImageType, ComplexFloat##prefix##ImageType) \ - otbDefineCastImageMacro(ComplexInputImageType, ComplexDouble##prefix##ImageType) - - -/********************************************************************* -********************** Image -> Image -**********************************************************************/ - - otbGenericDefineCastImageMacro(ComplexFloatImageType, ) - otbGenericDefineCastImageMacro(ComplexDoubleImageType, ) - - -/********************************************************************* -********************** VectorImage -> VectorImage -**********************************************************************/ - otbGenericDefineCastImageMacro(ComplexFloatVectorImageType, Vector) - otbGenericDefineCastImageMacro(ComplexDoubleVectorImageType, Vector) - } // End namespace Wrapper } // End namespace otb diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperComplexInputImageParameter.txx b/Modules/Wrappers/ApplicationEngine/include/otbWrapperComplexInputImageParameter.txx index 774dfdbf789b8cdb48252f76e7aad13bba90399c..86dd38fdc9993cf66f6c4a92b21b5dc9df541427 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperComplexInputImageParameter.txx +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperComplexInputImageParameter.txx @@ -24,8 +24,9 @@ #include "otbWrapperComplexInputImageParameter.h" #include "itkUnaryFunctorImageFilter.h" -#include "itkCastImageFilter.h" -#include "otbImageToVectorImageCastFilter.h" +// #include "itkCastImageFilter.h" +// #include "otbImageToVectorImageCastFilter.h" +#include "otbClampImageFilter.h" namespace otb { @@ -91,7 +92,15 @@ ComplexInputImageParameter::GetImage() } else { - if (dynamic_cast<ComplexFloatVectorImageType*>(m_Image.GetPointer())) + if (dynamic_cast<ComplexInt16VectorImageType*>(m_Image.GetPointer())) + { + return CastImage<ComplexInt16VectorImageType, TOutputImage>(); + } + else if (dynamic_cast<ComplexInt32VectorImageType*>(m_Image.GetPointer())) + { + return CastImage<ComplexInt32VectorImageType, TOutputImage>(); + } + else if (dynamic_cast<ComplexFloatVectorImageType*>(m_Image.GetPointer())) { return CastImage<ComplexFloatVectorImageType, TOutputImage>(); } @@ -99,6 +108,14 @@ ComplexInputImageParameter::GetImage() { return CastImage<ComplexDoubleVectorImageType, TOutputImage>(); } + else if (dynamic_cast<ComplexInt16ImageType*>(m_Image.GetPointer())) + { + return CastImage<ComplexInt16ImageType, TOutputImage>(); + } + else if (dynamic_cast<ComplexInt32ImageType*>(m_Image.GetPointer())) + { + return CastImage<ComplexInt32ImageType, TOutputImage>(); + } else if (dynamic_cast<ComplexFloatImageType*>(m_Image.GetPointer())) { return CastImage<ComplexFloatImageType, TOutputImage>(); @@ -115,42 +132,18 @@ ComplexInputImageParameter::GetImage() } } +/** declare a specialization for ImageBaseType */ +template <> +ImageBaseType* +ComplexInputImageParameter::GetImage(); template <class TComplexInputImage, class TOutputImage> TOutputImage* ComplexInputImageParameter::CastImage() -{ - itkExceptionMacro("Cast from "<<typeid(TComplexInputImage).name() - <<" to "<<typeid(TOutputImage).name()<<" not authorized."); -} - - -template <class TComplexInputImage, class TOutputImage> -TOutputImage* -ComplexInputImageParameter::SimpleCastImage() -{ - TComplexInputImage* realComplexInputImage = dynamic_cast<TComplexInputImage*>(m_Image.GetPointer()); - - typedef itk::CastImageFilter<TComplexInputImage, TOutputImage> CasterType; - typename CasterType::Pointer caster = CasterType::New(); - - caster->SetInput(realComplexInputImage); - caster->UpdateOutputInformation(); - - m_Image = caster->GetOutput(); - m_Caster = caster; - - return caster->GetOutput(); -} - - -template <class TComplexInputImage, class TOutputImage> -TOutputImage* -ComplexInputImageParameter::CastVectorImageFromImage() { TComplexInputImage* realComplexInputImage = dynamic_cast<TComplexInputImage*>(m_Image.GetPointer()); - typedef ImageToVectorImageCastFilter<TComplexInputImage, TOutputImage> CasterType; + typedef ClampImageFilter<TComplexInputImage, TOutputImage> CasterType; typename CasterType::Pointer caster = CasterType::New(); caster->SetInput(realComplexInputImage); @@ -160,6 +153,8 @@ ComplexInputImageParameter::CastVectorImageFromImage() m_Caster = caster; return caster->GetOutput(); + // itkExceptionMacro("Cast from "<<typeid(TComplexInputImage).name() + // <<" to "<<typeid(TOutputImage).name()<<" not authorized."); } template <class TComplexInputImage> diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperComplexOutputImageParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperComplexOutputImageParameter.h index 371c4d416691d36e3e07ffe50ea69c1580c20284..2dcfa3ddd20fb68606b03af241f917cd85b064f9 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperComplexOutputImageParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperComplexOutputImageParameter.h @@ -44,8 +44,6 @@ public: typedef itk::SmartPointer<Self> Pointer; typedef itk::SmartPointer<const Self> ConstPointer; - typedef itk::ImageBase<2> ImageBaseType; - /** Defining ::New() static method */ itkNewMacro(Self); @@ -77,7 +75,7 @@ public: itkGetMacro(RAMValue, unsigned int); /** Implement the reset method (replace pixel type by default type) */ - void Reset() ITK_OVERRIDE + void Reset() override { m_ComplexPixelType = m_DefaultComplexPixelType; } @@ -90,7 +88,7 @@ public: static bool ConvertStringToPixelType(const std::string &value, ComplexImagePixelType &type); /** Return true if a filename is set */ - bool HasValue() const ITK_OVERRIDE; + bool HasValue() const override; void SetFileName (const char* filename) { @@ -114,7 +112,7 @@ protected: /** Constructor */ ComplexOutputImageParameter(); /** Destructor */ - ~ComplexOutputImageParameter() ITK_OVERRIDE; + ~ComplexOutputImageParameter() override; template <class TInputImageType> void SwitchImageWrite(); @@ -122,23 +120,18 @@ protected: template <class TInputVectorImageType> void SwitchVectorImageWrite(); - //FloatVectorImageType::Pointer m_Image; ImageBaseType::Pointer m_Image; std::string m_FileName; ComplexImagePixelType m_ComplexPixelType; ComplexImagePixelType m_DefaultComplexPixelType; - typedef otb::ImageFileWriter<ComplexFloatImageType> ComplexFloatWriterType; - typedef otb::ImageFileWriter<ComplexDoubleImageType> ComplexDoubleWriterType; - - + typedef otb::ImageFileWriter<ComplexInt16VectorImageType> ComplexVectorInt16WriterType; + typedef otb::ImageFileWriter<ComplexInt32VectorImageType> ComplexVectorInt32WriterType; typedef otb::ImageFileWriter<ComplexFloatVectorImageType> ComplexVectorFloatWriterType; typedef otb::ImageFileWriter<ComplexDoubleVectorImageType> ComplexVectorDoubleWriterType; - - ComplexFloatWriterType::Pointer m_ComplexFloatWriter; - ComplexDoubleWriterType::Pointer m_ComplexDoubleWriter; - + ComplexVectorInt16WriterType::Pointer m_ComplexVectorInt16Writer; + ComplexVectorInt32WriterType::Pointer m_ComplexVectorInt32Writer; ComplexVectorFloatWriterType::Pointer m_ComplexVectorFloatWriter; ComplexVectorDoubleWriterType::Pointer m_ComplexVectorDoubleWriter; diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperCompositeApplication.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperCompositeApplication.h index 601b9450a9bf51cc6340b7d969076e2204d3309b..49c46aef4018345d7ee1b3caac3dc3c7e056c81d 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperCompositeApplication.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperCompositeApplication.h @@ -72,7 +72,7 @@ protected: CompositeApplication(); /** Destructor */ - ~CompositeApplication() ITK_OVERRIDE; + ~CompositeApplication() override; /** * Callback function to retrieve the process watchers on internal filters diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperDirectoryParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperDirectoryParameter.h index 252ea13f57a5a2571d2fc8c31bc49edd97579941..9e461109d9d850ed0f683040651ae174a7e54ffd 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperDirectoryParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperDirectoryParameter.h @@ -52,7 +52,7 @@ public: /** RTTI support */ itkTypeMacro(DirectoryParameter, Parameter); - bool HasValue() const ITK_OVERRIDE + bool HasValue() const override { return m_StringParam->HasValue(); } @@ -62,13 +62,13 @@ public: otbGetObjectMemberMacro(StringParam, Value , std::string); // Clear Value - void ClearValue() ITK_OVERRIDE + void ClearValue() override { m_StringParam->ClearValue(); } // Reimplement the SetActive method - void SetActive( const bool value ) ITK_OVERRIDE + void SetActive( const bool value ) override { Superclass::SetActive( value ); m_StringParam->SetActive( value ); @@ -85,7 +85,7 @@ protected: } /** Destructor */ - ~DirectoryParameter() ITK_OVERRIDE + ~DirectoryParameter() override {} private: diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperDocExampleStructure.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperDocExampleStructure.h index b7ab6885a137292d0be640b4d679ab081a9eede6..c8bdf7a960be0c6ad078ec407b164d5c8c8af5b2 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperDocExampleStructure.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperDocExampleStructure.h @@ -120,7 +120,7 @@ protected: /** Constructor */ DocExampleStructure(); /** Destructor */ - ~DocExampleStructure() ITK_OVERRIDE; + ~DocExampleStructure() override; private: DocExampleStructure(const DocExampleStructure &); //purposely not implemented diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperEmptyParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperEmptyParameter.h index 7978c5fb4f7a0345c123a0b8612196495cfafca1..a6845b1dceadb8b9aa82a2e4e4ab2ce54dc3d729 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperEmptyParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperEmptyParameter.h @@ -31,6 +31,8 @@ namespace Wrapper /** \class EmptyParameter * \brief This class represent an empty parameter for the wrapper framework (boolean value) * + * \deprecated in OTB 6.6, use BoolParameter instead + * * \ingroup OTBApplicationEngine */ class OTBApplicationEngine_EXPORT EmptyParameter @@ -50,12 +52,12 @@ public: itkTypeMacro(EmptyParameter, Parameter); /** HasValue */ - bool HasValue() const ITK_OVERRIDE + bool HasValue() const override { return false; } - bool HasUserValue() const ITK_OVERRIDE + bool HasUserValue() const override { return this->m_UserValue; } @@ -69,7 +71,7 @@ protected: } /** Destructor */ - ~EmptyParameter() ITK_OVERRIDE + ~EmptyParameter() override {} private: diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputFilenameParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputFilenameParameter.h index 5186853f01b28ecb35f01fe1e89e4202a68afb25..2fafb3ecd5fb32f6b406e67a2c023a75e1529364 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputFilenameParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputFilenameParameter.h @@ -51,7 +51,7 @@ public: itkTypeMacro(InputFilenameParameter, Parameter); - bool HasValue() const ITK_OVERRIDE + bool HasValue() const override { return m_StringParam->HasValue(); } @@ -69,7 +69,7 @@ public: } // Clear Value - void ClearValue() ITK_OVERRIDE + void ClearValue() override { m_StringParam->ClearValue(); } @@ -85,7 +85,7 @@ protected: } /** Destructor */ - ~InputFilenameParameter() ITK_OVERRIDE + ~InputFilenameParameter() override {} private: diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputImageListParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputImageListParameter.h index 889e6d8df2bd02d831a1c26a571475407e6b6f86..914ab7b249597bc8fbd035ae88a71c4b1903a8eb 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputImageListParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputImageListParameter.h @@ -48,8 +48,6 @@ public: typedef itk::SmartPointer< Self > Pointer; typedef itk::SmartPointer< const Self > ConstPointer; - typedef itk::ImageBase< 2 > ImageBaseType; - /** Defining ::New() static method */ itkNewMacro( Self ); diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputImageParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputImageParameter.h index 6ff36eedeed7f32c1382aa06be580d2904741967..29b9ac2866266b6439baf95154f147ea44241e67 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputImageParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputImageParameter.h @@ -44,8 +44,6 @@ public: typedef itk::SmartPointer<Self> Pointer; typedef itk::SmartPointer<const Self> ConstPointer; - typedef itk::ImageBase<2> ImageBaseType; - /** Defining ::New() static method */ itkNewMacro(Self); @@ -80,6 +78,16 @@ public: UInt8RGBImageType* GetUInt8RGBImage(); UInt8RGBAImageType* GetUInt8RGBAImage(); + // Complex image + ComplexInt16ImageType* GetComplexInt16Image(); + ComplexInt32ImageType* GetComplexInt32Image(); + ComplexFloatImageType* GetComplexFloatImage(); + ComplexDoubleImageType* GetComplexDoubleImage(); + + ComplexInt16VectorImageType* GetComplexInt16VectorImage(); + ComplexInt32VectorImageType* GetComplexInt32VectorImage(); + ComplexFloatVectorImageType* GetComplexFloatVectorImage(); + ComplexDoubleVectorImageType* GetComplexDoubleVectorImage(); /** Get the input image as templated image type. */ template <class TImageType> @@ -97,28 +105,16 @@ public: template <class TInputImage, class TOutputImage> TOutputImage* CastImage(); - /** Cast an image to an image of the same type - * Image to Image, VectorImage to VectorImage, RGBAImage to RGBAImage. */ - template <class TInputImage, class TOutputImage> - TOutputImage* SimpleCastImage(); - - - /** Cast an image to a vector image. */ - template <class TInputImage, class TOutputImage> - TOutputImage* CastVectorImageFromImage(); - - - bool HasValue() const ITK_OVERRIDE; - - void ClearValue() ITK_OVERRIDE; + bool HasValue() const override; + void ClearValue() override; protected: /** Constructor */ InputImageParameter(); /** Destructor */ - ~InputImageParameter() ITK_OVERRIDE; + ~InputImageParameter() override; ImageBaseType::Pointer m_Image; std::string m_FileName; @@ -145,6 +141,17 @@ protected: typedef otb::ImageFileReader<UInt8RGBImageType> UInt8RGBReaderType; typedef otb::ImageFileReader<UInt8RGBAImageType> UInt8RGBAReaderType; + // Complex + typedef otb::ImageFileReader<ComplexInt16ImageType> ComplexInt16ReaderType; + typedef otb::ImageFileReader<ComplexInt32ImageType> ComplexInt32ReaderType; + typedef otb::ImageFileReader<ComplexFloatImageType> ComplexFloatReaderType; + typedef otb::ImageFileReader<ComplexDoubleImageType> ComplexDoubleReaderType; + + typedef otb::ImageFileReader<ComplexInt16VectorImageType> ComplexInt16VectorReaderType; + typedef otb::ImageFileReader<ComplexInt32VectorImageType> ComplexInt32VectorReaderType; + typedef otb::ImageFileReader<ComplexFloatVectorImageType> ComplexFloatVectorReaderType; + typedef otb::ImageFileReader<ComplexDoubleVectorImageType> ComplexDoubleVectorReaderType; + itk::ProcessObject::Pointer m_Reader; itk::ProcessObject::Pointer m_Caster; @@ -160,63 +167,6 @@ private: }; // End class InputImage Parameter - -// template specializations of CastImage<> should be declared in header -// so that the linker knows they exist when building OTB Applications - -#define otbDeclareCastImageMacro(InputImageType, OutputImageType) \ - template<> OTBApplicationEngine_EXPORT OutputImageType * \ - InputImageParameter::CastImage<InputImageType , OutputImageType>(); \ - -#define otbGenericDeclareCastImageMacro(InputImageType, prefix) \ - otbDeclareCastImageMacro(InputImageType, UInt8##prefix##ImageType) \ - otbDeclareCastImageMacro(InputImageType, UInt16##prefix##ImageType) \ - otbDeclareCastImageMacro(InputImageType, Int16##prefix##ImageType) \ - otbDeclareCastImageMacro(InputImageType, UInt32##prefix##ImageType) \ - otbDeclareCastImageMacro(InputImageType, Int32##prefix##ImageType) \ - otbDeclareCastImageMacro(InputImageType, Float##prefix##ImageType) \ - otbDeclareCastImageMacro(InputImageType, Double##prefix##ImageType) - - -/********************************************************************* -********************** Image -> Image -**********************************************************************/ -otbGenericDeclareCastImageMacro(UInt8ImageType, ) -otbGenericDeclareCastImageMacro(Int16ImageType, ) -otbGenericDeclareCastImageMacro(UInt16ImageType, ) -otbGenericDeclareCastImageMacro(Int32ImageType, ) -otbGenericDeclareCastImageMacro(UInt32ImageType, ) -otbGenericDeclareCastImageMacro(FloatImageType, ) -otbGenericDeclareCastImageMacro(DoubleImageType, ) - - -/********************************************************************* -********************** VectorImage -> VectorImage -**********************************************************************/ -otbGenericDeclareCastImageMacro(UInt8VectorImageType, Vector) -otbGenericDeclareCastImageMacro(Int16VectorImageType, Vector) -otbGenericDeclareCastImageMacro(UInt16VectorImageType, Vector) -otbGenericDeclareCastImageMacro(Int32VectorImageType, Vector) -otbGenericDeclareCastImageMacro(UInt32VectorImageType, Vector) -otbGenericDeclareCastImageMacro(FloatVectorImageType, Vector) -otbGenericDeclareCastImageMacro(DoubleVectorImageType, Vector) - - -/********************************************************************* -********************** Image -> VectorImage -**********************************************************************/ -otbGenericDeclareCastImageMacro(UInt8ImageType, Vector) -otbGenericDeclareCastImageMacro(Int16ImageType, Vector) -otbGenericDeclareCastImageMacro(UInt16ImageType, Vector) -otbGenericDeclareCastImageMacro(Int32ImageType, Vector) -otbGenericDeclareCastImageMacro(UInt32ImageType, Vector) -otbGenericDeclareCastImageMacro(FloatImageType, Vector) -otbGenericDeclareCastImageMacro(DoubleImageType, Vector) - -#undef otbDeclareCastImageMacro -#undef otbGenericDeclareCastImageMacro - - } // End namespace Wrapper } // End namespace otb diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputImageParameter.txx b/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputImageParameter.txx index 9db0e6140868eb635b115f0b46627f956615d178..72a3794cddc43ae99c4aef6d2f362b89b8074477 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputImageParameter.txx +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputImageParameter.txx @@ -24,8 +24,7 @@ #include "otbWrapperInputImageParameter.h" #include "itkUnaryFunctorImageFilter.h" -#include "itkCastImageFilter.h" -#include "otbImageToVectorImageCastFilter.h" +#include "otbClampImageFilter.h" namespace otb { @@ -39,8 +38,6 @@ template <class TImageType> TImageType* InputImageParameter::GetImage() { - otbMsgDevMacro(<< "GetImage()"); - // Used m_PreviousFileName because if not, when the user call twice GetImage, // it without changing the filename, it returns 2 different // image pointers @@ -138,6 +135,22 @@ InputImageParameter::GetImage() { return CastImage<DoubleImageType, TImageType> (); } + else if (dynamic_cast<ComplexInt16ImageType*>(m_Image.GetPointer())) + { + return CastImage<ComplexInt16ImageType, TImageType>(); + } + else if (dynamic_cast<ComplexInt32ImageType*>(m_Image.GetPointer())) + { + return CastImage<ComplexInt32ImageType, TImageType>(); + } + else if (dynamic_cast<ComplexFloatImageType*>(m_Image.GetPointer())) + { + return CastImage<ComplexFloatImageType, TImageType>(); + } + else if (dynamic_cast<ComplexDoubleImageType*>(m_Image.GetPointer())) + { + return CastImage<ComplexDoubleImageType, TImageType>(); + } else if (dynamic_cast<UInt8VectorImageType*> (m_Image.GetPointer())) { return CastImage<UInt8VectorImageType, TImageType> (); @@ -174,6 +187,22 @@ InputImageParameter::GetImage() { return CastImage<UInt8RGBImageType, TImageType> (); } + else if (dynamic_cast<ComplexInt16VectorImageType*>(m_Image.GetPointer())) + { + return CastImage<ComplexInt16VectorImageType, TImageType>(); + } + else if (dynamic_cast<ComplexInt32VectorImageType*>(m_Image.GetPointer())) + { + return CastImage<ComplexInt32VectorImageType, TImageType>(); + } + else if (dynamic_cast<ComplexFloatVectorImageType*>(m_Image.GetPointer())) + { + return CastImage<ComplexFloatVectorImageType, TImageType>(); + } + else if (dynamic_cast<ComplexDoubleVectorImageType*>(m_Image.GetPointer())) + { + return CastImage<ComplexDoubleVectorImageType, TImageType>(); + } else { #if INPUT_IMAGE_PARAMETER_GET_IMAGE_EXCEPTION @@ -186,18 +215,14 @@ InputImageParameter::GetImage() } } +/** declare a specialization for ImageBaseType */ +template <> +ImageBaseType* +InputImageParameter::GetImage(); template <class TInputImage, class TOutputImage> TOutputImage* InputImageParameter::CastImage() -{ - itkExceptionMacro("Cast from "<<typeid(TInputImage).name()<<" to "<<typeid(TOutputImage).name()<<" not authorized."); -} - - -template <class TInputImage, class TOutputImage> -TOutputImage* -InputImageParameter::SimpleCastImage() { if ( dynamic_cast<TOutputImage*> (m_Image.GetPointer()) ) { @@ -207,7 +232,7 @@ InputImageParameter::SimpleCastImage() { TInputImage* realInputImage = dynamic_cast<TInputImage*>(m_Image.GetPointer()); - typedef itk::CastImageFilter<TInputImage, TOutputImage> CasterType; + typedef ClampImageFilter<TInputImage, TOutputImage> CasterType; typename CasterType::Pointer caster = CasterType::New(); caster->SetInput(realInputImage); @@ -217,29 +242,10 @@ InputImageParameter::SimpleCastImage() m_Caster = caster; return caster->GetOutput(); - } + } + // itkExceptionMacro("Cast from "<<typeid(TInputImage).name()<<" to "<<typeid(TOutputImage).name()<<" not authorized."); } - -template <class TInputImage, class TOutputImage> -TOutputImage* -InputImageParameter::CastVectorImageFromImage() -{ - TInputImage* realInputImage = dynamic_cast<TInputImage*>(m_Image.GetPointer()); - - typedef ImageToVectorImageCastFilter<TInputImage, TOutputImage> CasterType; - typename CasterType::Pointer caster = CasterType::New(); - - caster->SetInput(realInputImage); - caster->UpdateOutputInformation(); - - m_Image = caster->GetOutput(); - m_Caster = caster; - - return caster->GetOutput(); -} - - template <class TInputImage> void InputImageParameter::SetImage(TInputImage* image) diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputProcessXMLParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputProcessXMLParameter.h index 889d79600d1b8a51d0fe7887d06784a2ff569ece..b896b7f23d74a1ece8695c72f5b65ba38abbfd69 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputProcessXMLParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputProcessXMLParameter.h @@ -52,7 +52,7 @@ public: itkGetStringMacro(FileName); - bool HasValue() const ITK_OVERRIDE + bool HasValue() const override { if(m_FileName.empty()) return false; @@ -86,7 +86,7 @@ protected: InputProcessXMLParameter(); /** Destructor */ - ~InputProcessXMLParameter() ITK_OVERRIDE; + ~InputProcessXMLParameter() override; private: diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputVectorDataParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputVectorDataParameter.h index f84a3834ebb28767374455d8d48035ffac275dbf..9442815771d4ed60806c59dfe7b5595de3e304bd 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputVectorDataParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputVectorDataParameter.h @@ -62,16 +62,16 @@ public: void SetVectorData(VectorDataType* vectorData); - bool HasValue() const ITK_OVERRIDE; + bool HasValue() const override; - void ClearValue() ITK_OVERRIDE; + void ClearValue() override; protected: /** Constructor */ InputVectorDataParameter(); /** Destructor */ - ~InputVectorDataParameter() ITK_OVERRIDE; + ~InputVectorDataParameter() override; typedef otb::VectorDataFileReader<VectorDataType> VectorDataFileReaderType; VectorDataType::Pointer m_VectorData; diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperListViewParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperListViewParameter.h index fb03f066f03a7359751672d7a88a3db4b41f5867..aa5e3feb57a67eee540080b9bfca979216fd1454 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperListViewParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperListViewParameter.h @@ -84,13 +84,13 @@ public: /** Return any value */ virtual unsigned int GetValue(); - bool HasValue() const ITK_OVERRIDE + bool HasValue() const override { // a choice parameter always has a value return true; } - void ClearValue() ITK_OVERRIDE + void ClearValue() override { // nothing to do : a choice parameter always has a value } @@ -155,7 +155,7 @@ protected: ListViewParameter(); /** Destructor */ - ~ListViewParameter() ITK_OVERRIDE; + ~ListViewParameter() override; struct ListViewChoice { diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperMetaDataHelper.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperMetaDataHelper.h new file mode 100644 index 0000000000000000000000000000000000000000..36274a5a08de34996f70ac9e6eb17121b81fa963 --- /dev/null +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperMetaDataHelper.h @@ -0,0 +1,130 @@ +/* + * 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 otbWrapperMetaDataHelper_h +#define otbWrapperMetaDataHelper_h + +#include "otbMetaDataKey.h" +#include "otbImageKeywordlist.h" +#include "otbVectorDataKeywordlist.h" +#include "itkMetaDataDictionary.h" +#include "OTBApplicationEngineExport.h" + +namespace otb +{ +namespace Wrapper +{ + +/** + * \namespace MetaDataHelper + * + * \brief Contains small helper functions to manipulate itk::MetaDataDictionary + * + * These functions are only here to instanciate the different template function that + * allow to get/set values in MetaDataDictionary. + * + */ +namespace MetaDataHelper +{ + + enum class MDType + { + String, + Int, + Double, + GCP, + Vector, + ImageKWL, + VectorDataKWL, + BoolVector + }; + + OTBApplicationEngine_EXPORT MDType GetType(const std::string &val); + + OTBApplicationEngine_EXPORT std::string GetString( + const itk::MetaDataDictionary &dict, + const std::string &key); + OTBApplicationEngine_EXPORT void SetString( + itk::MetaDataDictionary &dict, + const std::string &key, + const std::string &val); + + OTBApplicationEngine_EXPORT unsigned int GetInt( + const itk::MetaDataDictionary &dict, + const std::string &key); + OTBApplicationEngine_EXPORT void SetInt( + itk::MetaDataDictionary &dict, + const std::string &key, + unsigned int val); + + OTBApplicationEngine_EXPORT double GetDouble( + const itk::MetaDataDictionary &dict, + const std::string &key); + OTBApplicationEngine_EXPORT void SetDouble( + itk::MetaDataDictionary &dict, + const std::string &key, + double val); + + OTBApplicationEngine_EXPORT otb::OTB_GCP GetGCP( + const itk::MetaDataDictionary &dict, + const std::string &key); + OTBApplicationEngine_EXPORT void SetGCP( + itk::MetaDataDictionary &dict, + const std::string &key, + const otb::OTB_GCP &val); + + OTBApplicationEngine_EXPORT otb::MetaDataKey::VectorType GetVector( + const itk::MetaDataDictionary &dict, + const std::string &key); + OTBApplicationEngine_EXPORT void SetVector( + itk::MetaDataDictionary &dict, + const std::string &key, + const otb::MetaDataKey::VectorType &val); + + OTBApplicationEngine_EXPORT otb::ImageKeywordlist GetImageKWL( + const itk::MetaDataDictionary &dict, + const std::string &key); + OTBApplicationEngine_EXPORT void SetImageKWL( + itk::MetaDataDictionary &dict, + const std::string &key, + const otb::ImageKeywordlist &val); + + OTBApplicationEngine_EXPORT otb::VectorDataKeywordlist GetVectorDataKWL( + const itk::MetaDataDictionary &dict, + const std::string &key); + OTBApplicationEngine_EXPORT void SetVectorDataKWL( + itk::MetaDataDictionary &dict, + const std::string &key, + const otb::VectorDataKeywordlist &val); + + OTBApplicationEngine_EXPORT otb::MetaDataKey::BoolVectorType GetBoolVector( + const itk::MetaDataDictionary &dict, + const std::string &key); + OTBApplicationEngine_EXPORT void SetBoolVector( + itk::MetaDataDictionary &dict, + const std::string &key, + const otb::MetaDataKey::BoolVectorType &val); + +} // end of namespace MetaDataHelper + +} // end of namespace Wrapper +} // end of namespace otb + +#endif diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperNumericalParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperNumericalParameter.h index 6fc5d551ae49345a04d3e67ea0e0efcc2a189433..54871040f393428f3febbba17ab0374de14b1934 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperNumericalParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperNumericalParameter.h @@ -54,7 +54,7 @@ public: typedef T ScalarType; /** Implement the reset method (replace value by default value) */ - void Reset() ITK_OVERRIDE + void Reset() override { m_Value = m_DefaultValue; } @@ -62,8 +62,8 @@ public: /** Set the value */ void SetValue( ScalarType value) { - // TODO check minimum/maximum - m_Value = value; + m_Value = ( value < m_MinimumValue ) ? m_MinimumValue : + ( value < m_MaximumValue ) ? value : m_MaximumValue ; // Set Active only if the parameter is not automatically set if (!GetAutomaticValue()) @@ -88,12 +88,12 @@ public: return boost::any_cast<ScalarType>(m_Value); } - bool HasValue() const ITK_OVERRIDE + bool HasValue() const override { return !m_Value.empty(); } - void ClearValue() ITK_OVERRIDE + void ClearValue() override { m_Value = boost::any(); } @@ -125,7 +125,7 @@ protected: {} /** Destructor */ - ~NumericalParameter() ITK_OVERRIDE + ~NumericalParameter() override {} /** Value */ diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputFilenameParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputFilenameParameter.h index c8b7437b552bce29a44d058c591886b56c54fffa..a528a399277bf1ea540525a10006eb4155ce0a80 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputFilenameParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputFilenameParameter.h @@ -51,7 +51,7 @@ public: itkTypeMacro(OutputFilenameParameter, Parameter); - bool HasValue() const ITK_OVERRIDE + bool HasValue() const override { return m_StringParam->HasValue(); } @@ -69,7 +69,7 @@ public: } // Clear Value - void ClearValue() ITK_OVERRIDE + void ClearValue() override { m_StringParam->ClearValue(); } @@ -85,7 +85,7 @@ protected: } /** Destructor */ - ~OutputFilenameParameter() ITK_OVERRIDE + ~OutputFilenameParameter() override {} private: diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputImageParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputImageParameter.h index b420299ff6b707f8ccbed39577b488684e527fae..eac7df4cadad4e1c8376918f53401439748a6094 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputImageParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputImageParameter.h @@ -45,8 +45,6 @@ public: typedef itk::SmartPointer<Self> Pointer; typedef itk::SmartPointer<const Self> ConstPointer; - typedef itk::ImageBase<2> ImageBaseType; - /** Defining ::New() static method */ itkNewMacro(Self); @@ -78,7 +76,7 @@ public: itkGetMacro(RAMValue, unsigned int); /** Implement the reset method (replace pixel type by default type) */ - void Reset() ITK_OVERRIDE + void Reset() override { m_PixelType = m_DefaultPixelType; } @@ -91,7 +89,7 @@ public: static bool ConvertStringToPixelType(const std::string &value, ImagePixelType &type); /** Return true if a filename is set */ - bool HasValue() const ITK_OVERRIDE; + bool HasValue() const override; void SetFileName (const char* filename) { @@ -117,19 +115,10 @@ protected: /** Constructor */ OutputImageParameter(); /** Destructor */ - ~OutputImageParameter() ITK_OVERRIDE; - - template <class TInputImageType> - void SwitchImageWrite(); - - template <class TInputVectorImageType> - void SwitchVectorImageWrite(); + ~OutputImageParameter() override; - template <class TInputVectorImageType> - void SwitchRGBImageWrite(); - - template <class TInputVectorImageType> - void SwitchRGBAImageWrite(); + template <class TInput> + int SwitchInput(TInput *img); //FloatVectorImageType::Pointer m_Image; ImageBaseType::Pointer m_Image; @@ -137,52 +126,28 @@ protected: ImagePixelType m_PixelType; ImagePixelType m_DefaultPixelType; - typedef otb::ImageFileWriter<UInt8ImageType> UInt8WriterType; - typedef otb::ImageFileWriter<Int16ImageType> Int16WriterType; - typedef otb::ImageFileWriter<UInt16ImageType> UInt16WriterType; - typedef otb::ImageFileWriter<Int32ImageType> Int32WriterType; - typedef otb::ImageFileWriter<UInt32ImageType> UInt32WriterType; - typedef otb::ImageFileWriter<FloatImageType> FloatWriterType; - typedef otb::ImageFileWriter<DoubleImageType> DoubleWriterType; - - typedef otb::ImageFileWriter<UInt8VectorImageType> VectorUInt8WriterType; - typedef otb::ImageFileWriter<Int16VectorImageType> VectorInt16WriterType; - typedef otb::ImageFileWriter<UInt16VectorImageType> VectorUInt16WriterType; - typedef otb::ImageFileWriter<Int32VectorImageType> VectorInt32WriterType; - typedef otb::ImageFileWriter<UInt32VectorImageType> VectorUInt32WriterType; - typedef otb::ImageFileWriter<FloatVectorImageType> VectorFloatWriterType; - typedef otb::ImageFileWriter<DoubleVectorImageType> VectorDoubleWriterType; - - typedef otb::ImageFileWriter<UInt8RGBAImageType> RGBAUInt8WriterType; - typedef otb::ImageFileWriter<UInt8RGBImageType> RGBUInt8WriterType; - - UInt8WriterType::Pointer m_UInt8Writer; - Int16WriterType::Pointer m_Int16Writer; - UInt16WriterType::Pointer m_UInt16Writer; - Int32WriterType::Pointer m_Int32Writer; - UInt32WriterType::Pointer m_UInt32Writer; - FloatWriterType::Pointer m_FloatWriter; - DoubleWriterType::Pointer m_DoubleWriter; - - VectorUInt8WriterType::Pointer m_VectorUInt8Writer; - VectorInt16WriterType::Pointer m_VectorInt16Writer; - VectorUInt16WriterType::Pointer m_VectorUInt16Writer; - VectorInt32WriterType::Pointer m_VectorInt32Writer; - VectorUInt32WriterType::Pointer m_VectorUInt32Writer; - VectorFloatWriterType::Pointer m_VectorFloatWriter; - VectorDoubleWriterType::Pointer m_VectorDoubleWriter; - - RGBUInt8WriterType::Pointer m_RGBUInt8Writer; - RGBAUInt8WriterType::Pointer m_RGBAUInt8Writer; - private: OutputImageParameter(const Parameter &); //purposely not implemented void operator =(const Parameter&); //purposely not implemented unsigned int m_RAMValue; + itk::ProcessObject::Pointer m_Caster; + + itk::ProcessObject::Pointer m_Writer; + }; // End class OutputImage Parameter +// Declare specialisation for UInt8RGBAImageType +template <> +int +OutputImageParameter::SwitchInput(UInt8RGBAImageType *img); + +// Declare specialisation for UInt8RGBImageType +template <> +int +OutputImageParameter::SwitchInput(UInt8RGBImageType *img); + } // End namespace Wrapper } // End namespace otb diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputProcessXMLParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputProcessXMLParameter.h index 7f247f2baa62153d67958ca85ead26f40479430a..d870ee8023bc22e5d4b8f36740af7f299d2aa91c 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputProcessXMLParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputProcessXMLParameter.h @@ -66,7 +66,7 @@ public: this->Modified(); } - bool HasValue() const ITK_OVERRIDE + bool HasValue() const override { if(m_FileName.empty()) return false; @@ -74,7 +74,7 @@ public: return true; } - void ClearValue() ITK_OVERRIDE + void ClearValue() override { m_FileName = ""; } @@ -94,7 +94,7 @@ protected: OutputProcessXMLParameter(); /** Destructor */ - ~OutputProcessXMLParameter() ITK_OVERRIDE; + ~OutputProcessXMLParameter() override; private: diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputVectorDataParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputVectorDataParameter.h index fb90702544a20191e1f5a474c0c7571cb48015aa..d1b9c31d37e9eff7e4d76eeaf4ac4c28b410d762 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputVectorDataParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputVectorDataParameter.h @@ -59,7 +59,7 @@ public: itkGetObjectMacro(VectorData, VectorDataType); /** Return true if a filename is set */ - bool HasValue() const ITK_OVERRIDE + bool HasValue() const override { std::string filename(this->GetFileName()); return !filename.empty(); @@ -116,7 +116,7 @@ protected: } /** Destructor */ - ~OutputVectorDataParameter() ITK_OVERRIDE + ~OutputVectorDataParameter() override {} diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperParameter.h index 236411f8f21e8b185bed7aa514770bb19ca00b14..7b997afc586489cdf53d657b2495c830134953a8 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperParameter.h @@ -31,26 +31,6 @@ namespace otb { namespace Wrapper { -enum DefaultValueMode - { - /** - * This parameter has no default behaviour and should be set by - * the user. - */ - DefaultValueMode_UNKNOWN, - /** - * The default value of this parameter can be estimated from - * other parameters. - */ - DefaultValueMode_RELATIVE, - - /** - * The default value of this parameter is not depending on any - * other parameter. - */ - DefaultValueMode_ABSOLUTE - }; - /** \class Parameter * \brief This class represent a parameter for the wrapper framework @@ -114,20 +94,29 @@ public: /** Toogle the parameter mandatory flag */ itkBooleanMacro(Mandatory); - /** Set the parameter AutomaticValue flag */ - itkSetMacro(AutomaticValue, bool); + /** Set the parameter AutomaticValue flag (which is the opposite of UserValue)*/ + virtual void SetAutomaticValue(bool flag) + { + this->SetUserValue(!flag); + } /** Get the parameter AutomaticValue flag */ - itkGetConstMacro(AutomaticValue, bool); - - /** Toogle the parameter AutomaticValue flag */ - itkBooleanMacro(AutomaticValue); - - /** Set the default value mode */ - itkSetEnumMacro(DefaultValueMode, DefaultValueMode); - - /** Get the default value mode */ - itkGetEnumMacro(DefaultValueMode, DefaultValueMode); + virtual bool GetAutomaticValue() const + { + return !m_UserValue; + } + + /** Toogle ON the parameter AutomaticValue flag */ + void AutomaticValueOn() + { + this->SetAutomaticValue(true); + } + + /** Toogle OFF the parameter AutomaticValue flag */ + void AutomaticValueOff() + { + this->SetAutomaticValue(false); + } /** Set the user access level */ itkSetEnumMacro(UserLevel, UserLevel); @@ -199,20 +188,6 @@ public: return m_ChildrenList; } - /** Store the state of the check box relative to this parameter (TO - * BE MOVED to QtWrapper Model ) - */ - virtual bool IsChecked() const - { - return m_IsChecked; - } - - /** Modify the state of the checkbox relative to this parameter */ - virtual void SetChecked(const bool value) - { - m_IsChecked = value; - } - protected: /** Constructor */ Parameter() : @@ -222,16 +197,13 @@ protected: m_Mandatory( true ), m_Active( false ), m_UserValue( false ), - m_AutomaticValue( false ), - m_DefaultValueMode( DefaultValueMode_UNKNOWN ), m_UserLevel( UserLevel_Basic ), m_Role( Role_Input ), - m_Root( this ), - m_IsChecked( false ) + m_Root( this ) {} /** Destructor */ - ~Parameter() ITK_OVERRIDE {} + ~Parameter() override {} /** Name of the parameter */ std::string m_Name; @@ -248,15 +220,9 @@ protected: /** True if activated (a mandatory parameter is always active) */ bool m_Active; - /** True if the value is set in user mode */ + /** True if the value is set in user mode (otherwise, it is an automatic value)*/ bool m_UserValue; - /** True if the application change the value of this parameter */ - bool m_AutomaticValue; - - /** Default value behaviour */ - DefaultValueMode m_DefaultValueMode; - UserLevel m_UserLevel; /** Default iotype mode */ @@ -268,9 +234,6 @@ protected: /** List of children parameters */ std::vector<Parameter::Pointer > m_ChildrenList; - /** Store the status of the checkbox */ - bool m_IsChecked; - private: Parameter(const Parameter &); //purposely not implemented void operator =(const Parameter&); //purposely not implemented diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperParameterGroup.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperParameterGroup.h index f6d552c6d3beb88184ce3194f001a1aafb7bf929..36c8240990de3b805a00248f573fa8a6f2cb81c8 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperParameterGroup.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperParameterGroup.h @@ -95,7 +95,7 @@ public: std::vector<std::string> GetParametersKeys(bool recursive = true); // Always has value - bool HasValue() const ITK_OVERRIDE + bool HasValue() const override { return true; } @@ -106,7 +106,7 @@ public: protected: ParameterGroup(); - ~ParameterGroup() ITK_OVERRIDE; + ~ParameterGroup() override; typedef std::vector<Parameter::Pointer> ParameterListType; ParameterListType m_ParameterList; diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperParameterList.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperParameterList.h index 2c9c699fbe3c540a62d9cc4b39c39bfa052508b6..e54590e42f3e113a07f084b57bde4c1749906abd 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperParameterList.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperParameterList.h @@ -91,7 +91,7 @@ public: void SetNthFileName( std::size_t, const std::string & ) override; /** */ - std::size_t SetStrings( const StringVector & ); + std::size_t SetStrings( const StringVector & ) override; /** */ std::size_t GetStrings( StringVector & ) const override; diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperProxyParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperProxyParameter.h index c7594f8c5dd625f96f144105513944e4c7fd39b1..1bc45bbd74c82432ed153eb420b8ce62358cf775 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperProxyParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperProxyParameter.h @@ -77,7 +77,7 @@ public: protected: ProxyParameter() {} - ~ProxyParameter() ITK_OVERRIDE {} + ~ProxyParameter() override {} private: ProxyParameter(const Self &); //purposely not implemented diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperRAMParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperRAMParameter.h index 0d6b36c2299cce88f4e43bf9502f22287dcfcedb..e9c4fb97d537b8d54b1a0b83ca8365f11306ab98 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperRAMParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperRAMParameter.h @@ -52,7 +52,7 @@ public: typedef NumericalParameter<unsigned int> UnsignedIntParameter; typedef UnsignedIntParameter::ScalarType ScalarType; - bool HasValue() const ITK_OVERRIDE + bool HasValue() const override { return m_UnsignedIntParam->HasValue(); } @@ -71,19 +71,19 @@ public: otbGetObjectMemberMacro(UnsignedIntParam, MaximumValue, ScalarType); // Clear Value - void ClearValue() ITK_OVERRIDE + void ClearValue() override { m_UnsignedIntParam->ClearValue(); } // Reset - void Reset() ITK_OVERRIDE + void Reset() override { m_UnsignedIntParam->Reset(); } // Reimplement the SetActive method - void SetActive( const bool value ) ITK_OVERRIDE + void SetActive( const bool value ) override { Superclass::SetActive( value ); m_UnsignedIntParam->SetActive( value ); @@ -107,7 +107,7 @@ protected: } /** Destructor */ - ~RAMParameter() ITK_OVERRIDE + ~RAMParameter() override {} private: diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperRadiusParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperRadiusParameter.h index 27e9e726fe445f4bab8aadf0cf7c39800a8cc922..020e647bbf89e2cff943ae98c1b83929557fa746 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperRadiusParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperRadiusParameter.h @@ -49,7 +49,7 @@ public: /** RTTI support */ itkTypeMacro(RadiusParameter, Parameter); - bool HasValue() const ITK_OVERRIDE + bool HasValue() const override { return true; } @@ -64,7 +64,7 @@ protected: } /** Destructor */ - ~RadiusParameter() ITK_OVERRIDE + ~RadiusParameter() override {} private: diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperStringParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperStringParameter.h index 9c8b1e88a976707a3da0d29842775f138777cd2b..861e0b428c38cb6d6e4579261740c0949c390a8c 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperStringParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperStringParameter.h @@ -63,12 +63,12 @@ public: return m_Value; } - bool HasValue() const ITK_OVERRIDE + bool HasValue() const override { return !m_Value.empty(); } - void ClearValue() ITK_OVERRIDE + void ClearValue() override { m_Value = ""; } @@ -79,7 +79,7 @@ protected: {} /** Destructor */ - ~StringParameter() ITK_OVERRIDE + ~StringParameter() override {} std::string m_Value; diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperTypes.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperTypes.h index 63dafb639b432a1e3508084cdcc860b7c9efc7ae..bf51898aa92afed9ebad8929ba74ae403655e929 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperTypes.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperTypes.h @@ -58,7 +58,8 @@ typedef enum ParameterType_ComplexOutputImage, ParameterType_RAM, ParameterType_OutputProcessXML, - ParameterType_InputProcessXML + ParameterType_InputProcessXML, + ParameterType_Bool } ParameterType; typedef enum @@ -77,10 +78,16 @@ typedef enum ImagePixelType_uint32, ImagePixelType_float, ImagePixelType_double, + ImagePixelType_cint16, + ImagePixelType_cint32, + ImagePixelType_cfloat, + ImagePixelType_cdouble, } ImagePixelType; typedef enum { + ComplexImagePixelType_int16, + ComplexImagePixelType_int32, ComplexImagePixelType_float, ComplexImagePixelType_double, } ComplexImagePixelType; @@ -119,13 +126,19 @@ typedef otb::VectorImage<double> DoubleVectorImageType; typedef otb::Image< itk::RGBPixel<unsigned char> > UInt8RGBImageType; typedef otb::Image< itk::RGBAPixel<unsigned char> > UInt8RGBAImageType; +typedef std::complex<short> Int16ComplexPixelType; +typedef std::complex<int> Int32ComplexPixelType; typedef std::complex<float> FloatComplexPixelType; typedef std::complex<double> DoubleComplexPixelType; -// Complex Image Type (first : double and float) +// Complex Image Type +typedef otb::Image< Int16ComplexPixelType, 2 > ComplexInt16ImageType; +typedef otb::Image< Int32ComplexPixelType, 2 > ComplexInt32ImageType; typedef otb::Image< FloatComplexPixelType, 2 > ComplexFloatImageType; typedef otb::Image< DoubleComplexPixelType, 2 > ComplexDoubleImageType; +typedef otb::VectorImage< Int16ComplexPixelType, 2 > ComplexInt16VectorImageType; +typedef otb::VectorImage< Int32ComplexPixelType, 2 > ComplexInt32VectorImageType; typedef otb::VectorImage<FloatComplexPixelType, 2 > ComplexFloatVectorImageType; typedef otb::VectorImage< DoubleComplexPixelType, 2 > ComplexDoubleVectorImageType; @@ -141,6 +154,8 @@ typedef otb::ObjectList<VectorDataType> VectorDataListType; typedef otb::ObjectList<FloatVectorImageType> FloatVectorImageListType; typedef otb::ObjectList<FloatImageType> FloatImageListType; +typedef itk::ImageBase<2> ImageBaseType; + } // end namespace Wrapper } // end namespace otb diff --git a/Modules/Wrappers/ApplicationEngine/src/CMakeLists.txt b/Modules/Wrappers/ApplicationEngine/src/CMakeLists.txt index 343f9db8354ca588189b10f7fcf625413225f1e4..4b665b6f97843fecb8e4d192949ce1316626c42e 100644 --- a/Modules/Wrappers/ApplicationEngine/src/CMakeLists.txt +++ b/Modules/Wrappers/ApplicationEngine/src/CMakeLists.txt @@ -32,10 +32,14 @@ set( OTBApplicationEngine_SRC otbWrapperOutputImageParameter.cxx otbWrapperInputImageParameter.cxx otbWrapperInputImageParameterUInt8.cxx - otbWrapperInputImageParameterInt16.cxx otbWrapperInputImageParameterUInt16.cxx - otbWrapperInputImageParameterInt32.cxx otbWrapperInputImageParameterUInt32.cxx + otbWrapperInputImageParameterInt16.cxx + otbWrapperInputImageParameterInt32.cxx + otbWrapperInputImageParameterCInt16.cxx + otbWrapperInputImageParameterCInt32.cxx + otbWrapperInputImageParameterCFloat.cxx + otbWrapperInputImageParameterCDouble.cxx otbWrapperInputImageParameterFloat.cxx otbWrapperInputImageParameterDouble.cxx otbWrapperParameterKey.cxx @@ -52,7 +56,8 @@ set( OTBApplicationEngine_SRC otbWrapperStringListParameter.cxx otbWrapperAbstractParameterList.cxx otbWrapperParameterList.cxx - otbLogger.cxx + otbWrapperBoolParameter.cxx + otbWrapperMetaDataHelper.cxx ) add_library(OTBApplicationEngine ${OTBApplicationEngine_SRC}) diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx index cca32d50d38ee1b3c8bb056854863e49179a493b..cd34d9bddcb85596a19be8c969c11ad23dda56a5 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx @@ -37,7 +37,7 @@ #include "otbWrapperRAMParameter.h" #include "otbWrapperProxyParameter.h" #include "otbWrapperParameterKey.h" - +#include "otbWrapperBoolParameter.h" #include "otbWrapperAddProcessToWatchEvent.h" @@ -45,6 +45,8 @@ #include "otbWrapperTypes.h" #include <exception> #include "itkMacro.h" +#include <stack> +#include <set> namespace otb { @@ -65,7 +67,8 @@ Application::Application() m_Doclink(""), m_HaveInXML(true), m_HaveOutXML(true), - m_IsInXMLParsed(false) + m_IsInXMLParsed(false), + m_IsInPrivateDo(false) { // Don't call Init from the constructor, since it calls a virtual method ! m_Logger->SetName("Application.logger"); @@ -138,6 +141,11 @@ void Application::SetParameterInt(std::string parameter, int value, bool hasUser ChoiceParameter* paramChoice = dynamic_cast<ChoiceParameter*>(param); paramChoice->SetValue(value); } + else if (dynamic_cast<BoolParameter*>(param)) + { + BoolParameter* paramBool = dynamic_cast<BoolParameter*>(param); + paramBool->SetValue(static_cast<bool>(value)); + } this->SetParameterUserValue(parameter, hasUserValueFlag); } @@ -250,6 +258,11 @@ void Application::SetParameterString(std::string parameter, std::string value, b if ( !paramDown->SetFileName(value) ) otbAppLogCRITICAL( <<"Invalid XML parameter filename " << value <<"."); } + else if (dynamic_cast<BoolParameter*>(param)) + { + BoolParameter* paramDown = dynamic_cast<BoolParameter*>(param); + paramDown->SetValue(value); + } else { otbAppLogWARNING( <<"This parameter can't be set using SetParameterString()."); @@ -293,8 +306,8 @@ void Application::SetParameterStringList(std::string parameter, std::vector<std: void Application::SetParameterEmpty(std::string parameter, bool value, bool hasUserValueFlag) { - GetParameterByKey(parameter)->SetActive(value); this->SetParameterUserValue(parameter, hasUserValueFlag); + GetParameterByKey(parameter)->SetActive(value); } void Application::SetParameterUserValue(std::string paramKey, bool value) @@ -304,7 +317,14 @@ void Application::SetParameterUserValue(std::string paramKey, bool value) using Application::EnableParameter(); **/ EnableParameter(paramKey); - GetParameterByKey(paramKey)->SetUserValue(value); + if (m_IsInPrivateDo) + { + GetParameterByKey(paramKey)->SetUserValue(false); + } + else + { + GetParameterByKey(paramKey)->SetUserValue(value); + } } const Parameter* Application::GetParameterByKey(std::string name, bool follow) const @@ -320,7 +340,9 @@ void Application::Init() m_ParameterList = ParameterGroup::New(); //reset inXML parse checker in case if reinit-ing m_IsInXMLParsed = false; + m_IsInPrivateDo = true; this->DoInit(); + m_IsInPrivateDo = false; //rashad: global parameters. now used only for inxml and outxml if(this->GetHaveInXML()) @@ -352,12 +374,221 @@ void Application::UpdateParameters() } } } + m_IsInPrivateDo = true; this->DoUpdateParameters(); + m_IsInPrivateDo = false; } void Application::AfterExecuteAndWriteOutputs() {} +void +Application::RegisterPipeline() +{ + std::stack< itk::DataObject * > dataStack; + std::set< itk::DataObject * > inputData; + std::vector<std::string> paramList = GetParametersKeys(true); + // Get both end of the pipeline + for ( auto const & key : paramList ) + { + if ( GetParameterType(key) == ParameterType_OutputImage ) + { + Parameter* param = GetParameterByKey(key); + OutputImageParameter * outP = + dynamic_cast< OutputImageParameter * >( param ); + itk::ImageBase< 2 > * outData = outP->GetValue(); + if ( outData ) + dataStack.push(outData); + } + else if ( GetParameterType(key) == ParameterType_OutputVectorData ) + { + Parameter* param = GetParameterByKey(key); + OutputVectorDataParameter * outP = + dynamic_cast< OutputVectorDataParameter * >( param ); + VectorDataType * outData = outP->GetValue(); + if ( outData ) + dataStack.push(outData); + } + else if ( GetParameterType(key) == ParameterType_InputImage ) + { + Parameter* param = GetParameterByKey(key); + InputImageParameter * inP = + dynamic_cast< InputImageParameter * >( param ); + if ( !inP->HasValue() ) + continue; + ImageBaseType * inData = inP->GetImage< ImageBaseType >(); + if ( inData && !inputData.count(inData) ) + inputData.insert(inData); + } + else if ( GetParameterType(key) == ParameterType_InputImageList ) + { + Parameter * param = GetParameterByKey(key); + InputImageListParameter * inP = + dynamic_cast< InputImageListParameter * > ( param ); + if ( !inP->HasValue() ) + continue; + const FloatVectorImageListType * list = inP->GetImageList(); + for ( auto it = list->Begin() ; it != list->End() ; ++it ) + { + FloatVectorImageType * inData = it.Get().GetPointer(); + if ( inData && !inputData.count(inData) ) + inputData.insert(inData); + } + } + else if ( GetParameterType(key) == ParameterType_InputVectorData ) + { + Parameter * param = GetParameterByKey(key); + InputVectorDataParameter * inP = + dynamic_cast< InputVectorDataParameter * > ( param ); + if ( !inP->HasValue() ) + continue; + VectorDataType * inData = inP->GetVectorData(); + if ( inData && !inputData.count(inData) ) + inputData.insert(inData); + } + else if ( GetParameterType(key) == ParameterType_InputVectorDataList ) + { + Parameter * param = GetParameterByKey(key); + InputVectorDataListParameter * inP = + dynamic_cast< InputVectorDataListParameter * > ( param ); + if ( !inP->HasValue() ) + continue; + VectorDataListType * list = inP->GetVectorDataList(); + for ( auto it = list->Begin() ; it != list->End() ; ++it ) + { + VectorDataType * inData = it.Get().GetPointer(); + if ( inData && !inputData.count(inData) ) + inputData.insert(inData); + } + } + } + + // DFS + while ( !dataStack.empty() ) + { + itk::DataObject * current = dataStack.top(); + dataStack.pop(); + // whether current = null or is an input data it has no source + if ( !current || inputData.count( current ) ) + continue; + // if current is a list push every of its members in datastack + if ( dynamic_cast< DataObjectListInterface *> (current) ) + { + DataObjectListInterface * list = + dynamic_cast< DataObjectListInterface *> (current); + int length = list->Size(); + for ( int i = 0 ; i < length ; i++ ) + { + itk::DataObject * newData = list->GetNthDataObject(i); + if ( !current || inputData.count( current ) ) + continue; + dataStack.push( newData ); + continue; + } + } + // Finally get the current's process object source + itk::ProcessObject * process = (current->GetSource()).GetPointer(); + if ( !process || m_Filters.find( process ) != m_Filters.end() ) + continue; + m_Filters.insert( process ); + std::vector< itk::DataObject::Pointer > inputs = process->GetInputs(); + // Push back all source's inputs in datastack + for ( auto const & it : inputs ) + { + if ( inputData.count( it.GetPointer() ) ) + continue; + dataStack.push( it.GetPointer() ); + } + } +} + +void Application::FreeRessources() +{ + std::set< itk::DataObject * > dataSetToRelease; // do not release output + std::set< itk::DataObject * > dataSet; + std::vector<std::string> paramList = GetParametersKeys(true); + // Get the end of the pipeline + for ( const auto & key : paramList ) + { + if ( GetParameterType(key) == ParameterType_OutputImage ) + { + Parameter* param = GetParameterByKey(key); + OutputImageParameter * outP = dynamic_cast<OutputImageParameter*>(param); + itk::ImageBase<2> * outData = outP->GetValue(); + if ( outData ) + dataSet.insert(outData); + } + else if ( GetParameterType(key) == ParameterType_OutputVectorData ) + { + Parameter* param = GetParameterByKey(key); + OutputVectorDataParameter * outP = dynamic_cast<OutputVectorDataParameter*>(param); + Wrapper::VectorDataType * outData = outP->GetValue(); + if ( outData ) + dataSet.insert(outData); + } + else + continue; + } + // initialize DFS + std::stack< itk::ProcessObject * > processStack; + for ( auto data : dataSet ) + { + auto process = (data->GetSource()).GetPointer(); + if ( process ) + processStack.push( process ); + } + // DFS + while ( !processStack.empty() ) + { + itk::ProcessObject * current = processStack.top(); + processStack.pop(); + // if null continue + if ( !current ) + continue; + // Get all inputs + auto inputVector = current->GetInputs(); + for ( auto data : inputVector ) + { + // If input is null or already in the set continue + if ( !data.GetPointer() || dataSet.count( data.GetPointer() ) ) + continue; + // If input is a list + if ( dynamic_cast< DataObjectListInterface *> (data.GetPointer()) ) + { + DataObjectListInterface * list = + dynamic_cast< DataObjectListInterface *> (data.GetPointer()); + int length = list->Size(); + for ( int i = 0 ; i < length ; i++ ) + { + itk::DataObject * newData = list->GetNthDataObject(i); + if ( !newData || dataSet.count( newData ) ) + continue; + dataSet.insert( newData ); + dataSetToRelease.insert( newData ); + itk::ProcessObject * process = newData->GetSource().GetPointer(); + if ( process ) + processStack.push( process ); + } + } + else + { + dataSet.insert( data.GetPointer() ); + dataSetToRelease.insert( data.GetPointer() ); + itk::ProcessObject * process = data->GetSource().GetPointer(); + if ( process ) + processStack.push( process ); + } + } + } + // Release data + for ( auto data : dataSetToRelease ) + { + data->ReleaseData(); + } + // Call override method + DoFreeRessources(); +} + int Application::Execute() { @@ -387,7 +618,9 @@ int Application::Execute() itk::Statistics::MersenneTwisterRandomVariateGenerator::GetInstance()->Initialize(); } + m_IsInPrivateDo = true; this->DoExecute(); + m_IsInPrivateDo = false; // Ensure that all output image parameter have called UpdateOutputInformation() for (auto it = paramList.begin(); it != paramList.end(); ++it) @@ -412,6 +645,8 @@ int Application::ExecuteAndWriteOutput() { m_Chrono.Restart(); + m_Logger->LogSetupInformation(); + int status = this->Execute(); if (status == 0) @@ -453,7 +688,6 @@ int Application::ExecuteAndWriteOutput() if(outputParam!=ITK_NULLPTR) { - outputParam->InitializeWriters(); std::string checkReturn = outputParam->CheckFileName(true); if (!checkReturn.empty()) { @@ -463,6 +697,7 @@ int Application::ExecuteAndWriteOutput() { outputParam->SetRAMValue(ram); } + outputParam->InitializeWriters(); std::ostringstream progressId; progressId << "Writing " << outputParam->GetFileName() << "..."; AddProcess(outputParam->GetWriter(), progressId.str()); @@ -502,7 +737,6 @@ int Application::ExecuteAndWriteOutput() outputParam->Write(); } } - //xml writer parameter else if (m_HaveOutXML && GetParameterType(key) == ParameterType_OutputProcessXML && IsParameterEnabled(key) && HasValue(key) ) @@ -518,11 +752,19 @@ int Application::ExecuteAndWriteOutput() } this->AfterExecuteAndWriteOutputs(); - m_Chrono.Stop(); + + FreeRessources(); + m_Filters.clear(); return status; } +void +Application::Stop() +{ + m_ProgressSource->SetAbortGenerateData(true); +} + /* Enable the use of an optional parameter. Returns the previous state */ void Application::EnableParameter(std::string paramKey) { @@ -724,6 +966,10 @@ ParameterType Application::GetParameterType(std::string paramKey) const { type = ParameterType_InputProcessXML; } + else if (dynamic_cast<const BoolParameter*>(param)) + { + type = ParameterType_Bool; + } else { itkExceptionMacro(<< "Unknown parameter : " << paramKey); @@ -796,6 +1042,37 @@ void Application::SetDefaultParameterInt(std::string parameter, int value) } } +int Application::GetDefaultParameterInt(std::string parameter) +{ + Parameter* param = GetParameterByKey(parameter); + int ret = 0 ; + if (dynamic_cast<RadiusParameter*>(param)) + { + RadiusParameter* paramRadius = dynamic_cast<RadiusParameter*>(param); + ret = paramRadius->GetDefaultValue(); + } + else if (dynamic_cast<IntParameter*>(param)) + { + IntParameter* paramInt = dynamic_cast<IntParameter*>(param); + ret = paramInt->GetDefaultValue(); + } + else if (dynamic_cast<FloatParameter*>(param)) + { + FloatParameter* paramFloat = dynamic_cast<FloatParameter*>(param); + ret = paramFloat->GetDefaultValue(); + } + else if (dynamic_cast<RAMParameter*>(param)) + { + RAMParameter* paramRAM = dynamic_cast<RAMParameter*>(param); + ret = paramRAM->GetDefaultValue(); + } + else + { + // log + } + return ret; +} + void Application::SetDefaultParameterFloat(std::string parameter, float value) { Parameter* param = GetParameterByKey(parameter); @@ -808,6 +1085,18 @@ void Application::SetDefaultParameterFloat(std::string parameter, float value) } } +float Application::GetDefaultParameterFloat(std::string parameter) +{ + Parameter* param = GetParameterByKey(parameter); + + if (dynamic_cast<FloatParameter*>(param)) + { + FloatParameter* paramFloat = dynamic_cast<FloatParameter*>(param); + return paramFloat->GetDefaultValue(); + } + return 0; +} + void Application::SetDefaultOutputPixelType(std::string parameter, ImagePixelType type) { Parameter* param = GetParameterByKey(parameter); @@ -1007,6 +1296,16 @@ int Application::GetParameterInt(std::string parameter) ChoiceParameter* paramChoice = dynamic_cast<ChoiceParameter*>(param); ret = paramChoice->GetValue(); } + else if (dynamic_cast<BoolParameter*>(param)) + { + BoolParameter* paramBool = dynamic_cast<BoolParameter*>(param); + ret = static_cast<int>(paramBool->GetValue()); + } + else if (dynamic_cast<EmptyParameter*>(param)) + { + // This case is here for compatibility purpose with deprecated EmptyParameter + ret = static_cast<int>(this->IsParameterEnabled(parameter)); + } else { itkExceptionMacro(<<parameter << " parameter can't be casted to int"); @@ -1128,6 +1427,11 @@ std::string Application::GetParameterString(std::string parameter) InputProcessXMLParameter* paramDown = dynamic_cast<InputProcessXMLParameter*>(param); ret = paramDown->GetFileName(); } + else if (dynamic_cast<BoolParameter*>(param)) + { + BoolParameter* paramDown = dynamic_cast<BoolParameter*>(param); + ret = paramDown->GetValueAsString(); + } else { itkExceptionMacro(<<parameter << " : parameter can't be casted to string"); @@ -1180,7 +1484,7 @@ Application return ret; } -void Application::SetParameterInputImage(std::string parameter, InputImageParameter::ImageBaseType * inputImage) +void Application::SetParameterInputImage(std::string parameter, ImageBaseType * inputImage) { Parameter* param = GetParameterByKey(parameter); @@ -1196,7 +1500,7 @@ void Application::SetParameterInputImage(std::string parameter, InputImageParame } } -OutputImageParameter::ImageBaseType * Application::GetParameterOutputImage(std::string parameter) +ImageBaseType * Application::GetParameterOutputImage(std::string parameter) { Parameter* param = GetParameterByKey(parameter); @@ -1213,7 +1517,7 @@ OutputImageParameter::ImageBaseType * Application::GetParameterOutputImage(std:: } -void Application::SetParameterComplexInputImage(std::string parameter, ComplexInputImageParameter::ImageBaseType * inputImage) +void Application::SetParameterComplexInputImage(std::string parameter, ImageBaseType * inputImage) { Parameter* param = GetParameterByKey(parameter); @@ -1229,7 +1533,7 @@ void Application::SetParameterComplexInputImage(std::string parameter, ComplexIn } } -ComplexOutputImageParameter::ImageBaseType * Application::GetParameterComplexOutputImage(std::string parameter) +ImageBaseType * Application::GetParameterComplexOutputImage(std::string parameter) { Parameter* param = GetParameterByKey(parameter); @@ -1245,7 +1549,7 @@ ComplexOutputImageParameter::ImageBaseType * Application::GetParameterComplexOut } } -void Application::AddImageToParameterInputImageList(std::string parameter, InputImageListParameter::ImageBaseType * img) +void Application::AddImageToParameterInputImageList(std::string parameter, ImageBaseType * img) { Parameter* param = GetParameterByKey(parameter); @@ -1262,7 +1566,7 @@ void Application::AddImageToParameterInputImageList(std::string parameter, Input } -void Application::SetNthParameterInputImageList(std::string parameter, const unsigned int &id, InputImageListParameter::ImageBaseType * img) +void Application::SetNthParameterInputImageList(std::string parameter, const unsigned int &id, ImageBaseType * img) { Parameter* param = GetParameterByKey(parameter); @@ -1450,7 +1754,8 @@ std::string Application::GetParameterAsString(std::string paramKey) || type == ParameterType_ComplexInputImage || type == ParameterType_InputVectorData || type == ParameterType_OutputImage || type == ParameterType_OutputVectorData || type == ParameterType_ListView || type == ParameterType_Choice - || type == ParameterType_OutputProcessXML || type == ParameterType_InputProcessXML ) + || type == ParameterType_OutputProcessXML || type == ParameterType_InputProcessXML + || type == ParameterType_Bool) { ret = this->GetParameterString( paramKey ); } @@ -1703,5 +2008,217 @@ double Application::GetLastExecutionTiming() const return m_Chrono.GetElapsedMilliseconds() / 1000.0; } +ImageBaseType::PointType +Application::GetImageOrigin(const std::string & key, unsigned int idx) +{ + return this->GetParameterImageBase(key, idx)->GetOrigin(); +} + +ImageBaseType::SpacingType +Application::GetImageSpacing(const std::string & key, unsigned int idx) +{ + return otb::internal::GetSignedSpacing(this->GetParameterImageBase(key, idx)); +} + +ImageBaseType::SizeType +Application::GetImageSize(const std::string & key, unsigned int idx) +{ + return this->GetParameterImageBase(key, idx)->GetLargestPossibleRegion().GetSize(); +} + +unsigned int +Application::GetImageNbBands(const std::string & key, unsigned int idx) +{ + return this->GetParameterImageBase(key, idx)->GetNumberOfComponentsPerPixel(); +} + +std::string +Application::GetImageProjection(const std::string & key, unsigned int idx) +{ + std::string proj; + const itk::MetaDataDictionary& dict = + this->GetParameterImageBase(key, idx)->GetMetaDataDictionary(); + + if (!dict.HasKey(MetaDataKey::ProjectionRefKey)) + return std::string(""); + + itk::ExposeMetaData<std::string>(dict, MetaDataKey::ProjectionRefKey, proj); + return proj; +} + +otb::ImageKeywordlist +Application::GetImageKeywordlist(const std::string & key, unsigned int idx) +{ + ImageKeywordlist kwl; + const itk::MetaDataDictionary& dict = + this->GetParameterImageBase(key, idx)->GetMetaDataDictionary(); + + if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey)) + itk::ExposeMetaData<ImageKeywordlist>(dict, MetaDataKey::OSSIMKeywordlistKey, kwl); + + return kwl; +} + +unsigned long +Application::PropagateRequestedRegion(const std::string & key, ImageBaseType::RegionType region, unsigned int idx) +{ + ImageBaseType* image = this->GetParameterImageBase(key, idx); + ImageBaseType::RegionType largest = image->GetLargestPossibleRegion(); + ImageBaseType::RegionType requested = region; + requested.SetIndex(0, requested.GetIndex(0) + largest.GetIndex(0)); + requested.SetIndex(1, requested.GetIndex(1) + largest.GetIndex(1)); + image->SetRequestedRegion(requested); + image->PropagateRequestedRegion(); + // estimate RAM usage + otb::PipelineMemoryPrintCalculator::Pointer memoryPrintCalculator = + otb::PipelineMemoryPrintCalculator::New(); + memoryPrintCalculator->SetDataToWrite(image); + memoryPrintCalculator->SetBiasCorrectionFactor(1); + memoryPrintCalculator->Compute(false); + return memoryPrintCalculator->GetMemoryPrint(); +} + +ImageBaseType::RegionType +Application::GetImageRequestedRegion(const std::string & key, unsigned int idx) +{ + ImageBaseType* image = this->GetParameterImageBase(key, idx); + ImageBaseType::RegionType largest = image->GetLargestPossibleRegion(); + ImageBaseType::RegionType requested = image->GetRequestedRegion(); + requested.SetIndex(0, requested.GetIndex(0) - largest.GetIndex(0)); + requested.SetIndex(1, requested.GetIndex(1) - largest.GetIndex(1)); + return requested; +} + +itk::MetaDataDictionary +Application::GetImageMetaData(const std::string & key, unsigned int idx) +{ + ImageBaseType* image = this->GetParameterImageBase(key, idx); + return image->GetMetaDataDictionary(); +} + +ImageBaseType* +Application::GetParameterImageBase(const std::string & key, unsigned int idx) +{ + Parameter* param = GetParameterByKey(key); + if (dynamic_cast<InputImageParameter*>(param)) + { + InputImageParameter* paramDown = dynamic_cast<InputImageParameter*>(param); + return paramDown->GetImage<ImageBaseType>(); + } + else if (dynamic_cast<InputImageListParameter*>(param)) + { + InputImageListParameter* paramDown = dynamic_cast<InputImageListParameter*>(param); + return paramDown->GetNthImage(idx); + } + else if (dynamic_cast<ComplexInputImageParameter*>(param)) + { + ComplexInputImageParameter* paramDown = dynamic_cast<ComplexInputImageParameter*>(param); + return paramDown->GetImage<ImageBaseType>(); + } + else if (dynamic_cast<OutputImageParameter*>(param)) + { + OutputImageParameter* paramDown = dynamic_cast<OutputImageParameter*>(param); + return paramDown->GetValue(); + } + else if (dynamic_cast<ComplexOutputImageParameter*>(param)) + { + ComplexOutputImageParameter* paramDown = dynamic_cast<ComplexOutputImageParameter*>(param); + return paramDown->GetValue(); + } + else + { + itkExceptionMacro("Wrong parameter type, expect InputImageParameter, " + "InputImageListParameter, ComplexInputImageParameter, " + "OutputImageParameter, ComplexOutputImageParameter"); + } + return nullptr; +} + +void +Application::SetParameterImageBase(const std::string & key, ImageBaseType* img, unsigned int idx) +{ + Parameter* param = GetParameterByKey(key); + if (dynamic_cast<InputImageParameter*>(param)) + { + InputImageParameter* paramDown = dynamic_cast<InputImageParameter*>(param); + paramDown->SetImage<ImageBaseType>(img); + } + else if (dynamic_cast<InputImageListParameter*>(param)) + { + InputImageListParameter* paramDown = dynamic_cast<InputImageListParameter*>(param); + if (idx >= paramDown->Size()) + { + paramDown->AddImage(img); + } + else + { + paramDown->SetNthImage(idx, img); + } + } + else if (dynamic_cast<ComplexInputImageParameter*>(param)) + { + ComplexInputImageParameter* paramDown = dynamic_cast<ComplexInputImageParameter*>(param); + paramDown->SetImage<ImageBaseType>(img); + } + else + { + itkExceptionMacro("Wrong parameter type, expect InputImageParameter, InputImageListParameter or ComplexInputImageParameter"); + } +} + +ImagePixelType +Application::GetImageBasePixelType(const std::string & key, unsigned int idx) +{ + ImageBaseType* img = this->GetParameterImageBase(key, idx); + if (! img) + { + itkExceptionMacro("No input image"); + } + std::string className(img->GetNameOfClass()); + if (className == "VectorImage") + { +#define FindVectorImagePixelTypeMacro(TImage, TPixel) \ + TImage##VectorImageType* img##TImage = dynamic_cast< TImage##VectorImageType* >(img); \ + if ( img##TImage ) return ImagePixelType_##TPixel ; + + FindVectorImagePixelTypeMacro(UInt8, uint8) + FindVectorImagePixelTypeMacro(Int16, int16) + FindVectorImagePixelTypeMacro(UInt16, uint16) + FindVectorImagePixelTypeMacro(Int32, int32) + FindVectorImagePixelTypeMacro(UInt32, uint32) + FindVectorImagePixelTypeMacro(Float, float) + FindVectorImagePixelTypeMacro(Double, double) + FindVectorImagePixelTypeMacro(ComplexInt16, cint16) + FindVectorImagePixelTypeMacro(ComplexInt32, cint32) + FindVectorImagePixelTypeMacro(ComplexFloat, cfloat) + FindVectorImagePixelTypeMacro(ComplexDouble, cdouble) +#undef FindVectorImagePixelTypeMacro + } + else + { +#define FindImagePixelTypeMacro(TImage, TPixel) \ + TImage##ImageType* img##TImage = dynamic_cast< TImage##ImageType* >(img); \ + if ( img##TImage ) return ImagePixelType_##TPixel ; + + FindImagePixelTypeMacro(UInt8, uint8) + FindImagePixelTypeMacro(Int16, int16) + FindImagePixelTypeMacro(UInt16, uint16) + FindImagePixelTypeMacro(Int32, int32) + FindImagePixelTypeMacro(UInt32, uint32) + FindImagePixelTypeMacro(Float, float) + FindImagePixelTypeMacro(Double, double) + FindImagePixelTypeMacro(ComplexInt16, cint16) + FindImagePixelTypeMacro(ComplexInt32, cint32) + FindImagePixelTypeMacro(ComplexFloat, cfloat) + FindImagePixelTypeMacro(ComplexDouble, cdouble) + FindImagePixelTypeMacro(UInt8RGB, uint8) + FindImagePixelTypeMacro(UInt8RGBA, uint8) +#undef FindImagePixelTypeMacro + } + itkWarningMacro("Unknown pixel type"); + // by default uint8 + return ImagePixelType_uint8; +} + } } diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplicationRegistry.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplicationRegistry.cxx index f022af0ddbe47d8d7c59415363fff57800151c4f..f68d3a39233577a2f5e139063eb43da100cf9130 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplicationRegistry.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplicationRegistry.cxx @@ -211,10 +211,6 @@ ApplicationRegistry::CreateApplication(const std::string& name, bool useFactory) appli = app; appli->Init(); } - else - { - otbMsgDevMacro( << "Error ApplicationRegistry factory did not return an Application: " << possibleApp->GetNameOfClass() << std::endl ); - } } } @@ -350,10 +346,6 @@ ApplicationRegistry::GetAvailableApplications(bool useFactory) std::string curName(app->GetName()); appSet.insert(curName); } - else - { - otbMsgDevMacro( << "Error ApplicationRegistry factory did not return an Application: " << (*i)->GetNameOfClass() << std::endl ); - } } } @@ -438,7 +430,7 @@ ApplicationRegistry::LoadApplicationFromPath(std::string path,std::string name) } else { - otbMsgDevMacro( << "Can't load library : " << path << std::endl ); + otbLogMacro(Warning,<< "Failed to load libraries from " << path << " while trying to create application "<<name ); } } return appli; diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperBoolParameter.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperBoolParameter.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d34cb43676fb8faaa382091457f6fafe06d2fdf8 --- /dev/null +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperBoolParameter.cxx @@ -0,0 +1,81 @@ +/* + * 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 "otbWrapperBoolParameter.h" + +namespace otb +{ +namespace Wrapper +{ + +BoolParameter::BoolParameter() + : m_Value(false) +{} + +bool +BoolParameter::GetValue() const +{ + return m_Value; +} + +std::string +BoolParameter::GetValueAsString() const +{ + return std::string(m_Value?"true":"false"); +} + +void +BoolParameter::SetValue(bool state) +{ + if (m_Value != state) + { + m_Value = state; + this->Modified(); + } + this->SetActive(true); +} + +void +BoolParameter::SetValue(const std::string & str) +{ + std::string lowerStr; + // only strings less than 8 characters expected + lowerStr.reserve(8); + for (unsigned int i=0 ; i < std::min(8U,(unsigned int) str.size()) ; i++ ) + { + lowerStr.push_back(tolower(str[i])); + } + if (lowerStr == "1" || lowerStr == "on" || lowerStr == "true" || lowerStr == "yes") + { + this->SetValue(true); + } + else if (lowerStr == "0" || lowerStr == "off" || lowerStr == "false" || lowerStr == "no") + { + this->SetValue(false); + } + else + { + itkGenericExceptionMacro(<< "Wrong value for BoolParameter (" << str << ")," + " accepts: 0, 1, on, off, true, false, yes, no"); + } +} + +} // end of namespace Wrapper +} // end of namespace otb diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperComplexInputImageParameter.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperComplexInputImageParameter.cxx index 6c59ad4c83753feeacf012655642eba680586279..1b3883e36c085758beb606f470fae231ad89b291 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperComplexInputImageParameter.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperComplexInputImageParameter.cxx @@ -65,6 +65,15 @@ ComplexInputImageParameter::GetImage() return this->GetImage<ComplexFloatVectorImageType>(); } +template <> +ImageBaseType* +ComplexInputImageParameter::GetImage() +{ + if (m_Image.IsNull()) + return this->GetImage<ComplexFloatVectorImageType>(); + + return m_Image; +} #define otbGetImageMacro(image) \ image##Type * \ @@ -73,14 +82,18 @@ ComplexInputImageParameter::GetImage() return this->GetImage< image##Type > (); \ } +otbGetImageMacro(ComplexInt16Image); +otbGetImageMacro(ComplexInt32Image); otbGetImageMacro(ComplexFloatImage); otbGetImageMacro(ComplexDoubleImage); +otbGetImageMacro(ComplexInt16VectorImage); +otbGetImageMacro(ComplexInt32VectorImage); otbGetImageMacro(ComplexFloatVectorImage); otbGetImageMacro(ComplexDoubleVectorImage); -#define otbCastImageMacro(ComplexInputImageType, OutputImageType, theMethod) \ +/*#define otbCastImageMacro(ComplexInputImageType, OutputImageType, theMethod) \ template<> OutputImageType * \ ComplexInputImageParameter::CastImage<ComplexInputImageType , OutputImageType>() \ { \ @@ -89,22 +102,22 @@ otbGetImageMacro(ComplexDoubleVectorImage); #define otbGenericCastImageMacro(ComplexInputImageType, theMethod, prefix) \ otbCastImageMacro(ComplexInputImageType, ComplexFloat##prefix##ImageType, theMethod) \ - otbCastImageMacro(ComplexInputImageType, ComplexDouble##prefix##ImageType, theMethod) + otbCastImageMacro(ComplexInputImageType, ComplexDouble##prefix##ImageType, theMethod)*/ -/********************************************************************* +/******************************************************************** ********************** Image -> Image -**********************************************************************/ +*********************************************************************/ - otbGenericCastImageMacro(ComplexFloatImageType, SimpleCastImage, ) - otbGenericCastImageMacro(ComplexDoubleImageType, SimpleCastImage, ) +// otbGenericCastImageMacro(ComplexFloatImageType, SimpleCastImage, ) +// otbGenericCastImageMacro(ComplexDoubleImageType, SimpleCastImage, ) /********************************************************************* ********************** VectorImage -> VectorImage **********************************************************************/ - otbGenericCastImageMacro(ComplexFloatVectorImageType, SimpleCastImage, Vector) - otbGenericCastImageMacro(ComplexDoubleVectorImageType, SimpleCastImage, Vector) +// otbGenericCastImageMacro(ComplexFloatVectorImageType, SimpleCastImage, Vector) +// otbGenericCastImageMacro(ComplexDoubleVectorImageType, SimpleCastImage, Vector) void ComplexInputImageParameter::SetImage(ComplexFloatVectorImageType* image) @@ -133,6 +146,38 @@ ComplexInputImageParameter::ClearValue() m_UseFilename = true; } +/* Support for ComplexInputImageParameter. This has been done to support +the macro otbGetParameterImageMacro of otbWrapperApplication.h */ +#define otbGetFalseImageMacro(image) \ + image##Type * \ + ComplexInputImageParameter::Get##image () \ + { \ + return nullptr; \ + } + +otbGetFalseImageMacro(DoubleImage); +otbGetFalseImageMacro(DoubleVectorImage); + +otbGetFalseImageMacro(FloatImage); +otbGetFalseImageMacro(FloatVectorImage); + +otbGetFalseImageMacro(Int16Image); +otbGetFalseImageMacro(Int16VectorImage); + +otbGetFalseImageMacro(UInt16Image); +otbGetFalseImageMacro(UInt16VectorImage); + +otbGetFalseImageMacro(Int32Image); +otbGetFalseImageMacro(Int32VectorImage); + +otbGetFalseImageMacro(UInt32Image); +otbGetFalseImageMacro(UInt32VectorImage); + +otbGetFalseImageMacro(UInt8Image); +otbGetFalseImageMacro(UInt8VectorImage); + +otbGetFalseImageMacro(UInt8RGBImage); +otbGetFalseImageMacro(UInt8RGBAImage); } } diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperComplexOutputImageParameter.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperComplexOutputImageParameter.cxx index 64ef3657181d767341ce804d642374d6ed7b6a27..4218836ed7eb3091f1cf1a451c165d9bb77a040a 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperComplexOutputImageParameter.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperComplexOutputImageParameter.cxx @@ -20,8 +20,7 @@ #include "otbWrapperComplexOutputImageParameter.h" #include "itkUnaryFunctorImageFilter.h" -#include "itkCastImageFilter.h" -#include "itkVectorCastImageFilter.h" +#include "otbClampImageFilter.h" #ifdef OTB_USE_MPI @@ -59,6 +58,16 @@ ComplexOutputImageParameter::ConvertPixelTypeToString(ComplexImagePixelType type std::string ret; switch(type) { + case ComplexImagePixelType_int16: + { + ret = "cint16"; + break; + } + case ComplexImagePixelType_int32: + { + ret = "cint32"; + break; + } case ComplexImagePixelType_float: { ret = "cfloat"; @@ -76,7 +85,11 @@ ComplexOutputImageParameter::ConvertPixelTypeToString(ComplexImagePixelType type bool ComplexOutputImageParameter::ConvertStringToPixelType(const std::string &value, ComplexImagePixelType &type) { - if (value == "cfloat") + if (value == "cint16") + type = ComplexImagePixelType_int16; + if (value == "cint32") + type = ComplexImagePixelType_int32; + else if (value == "cfloat") type = ComplexImagePixelType_float; else if (value == "cdouble") type = ComplexImagePixelType_double; @@ -87,16 +100,15 @@ ComplexOutputImageParameter::ConvertStringToPixelType(const std::string &value, void ComplexOutputImageParameter::InitializeWriters() { - m_ComplexFloatWriter = ComplexFloatWriterType::New(); - m_ComplexDoubleWriter = ComplexDoubleWriterType::New(); - + m_ComplexVectorInt16Writer = ComplexVectorInt16WriterType::New(); + m_ComplexVectorInt32Writer = ComplexVectorInt32WriterType::New(); m_ComplexVectorFloatWriter = ComplexVectorFloatWriterType::New(); m_ComplexVectorDoubleWriter = ComplexVectorDoubleWriterType::New(); } template <typename TInput, typename TOutput> void CastAndWriteImage(itk::ImageBase<2> * in, otb::ImageFileWriter<TOutput> * writer, const std::string & filename, const unsigned int & ramValue) { - typedef itk::CastImageFilter<TInput, TOutput> ClampFilterType; + typedef ClampImageFilter<TInput, TOutput> ClampFilterType; typename ClampFilterType::Pointer clampFilter = ClampFilterType::New(); clampFilter->SetInput( dynamic_cast<TInput*>(in)); @@ -157,46 +169,58 @@ ComplexOutputImageParameter::SwitchImageWrite() { switch(m_ComplexPixelType ) { - case ComplexImagePixelType_float: + case ComplexImagePixelType_int16: { - CastAndWriteImage<TInputImageType,ComplexFloatImageType>(m_Image,m_ComplexFloatWriter,m_FileName,m_RAMValue); + CastAndWriteImage<TInputImageType,ComplexInt16VectorImageType>( + m_Image , + m_ComplexVectorInt16Writer , + m_FileName , + m_RAMValue ); break; } - case ComplexImagePixelType_double: + case ComplexImagePixelType_int32: { - CastAndWriteImage<TInputImageType,ComplexDoubleImageType>(m_Image,m_ComplexDoubleWriter,m_FileName,m_RAMValue); + CastAndWriteImage<TInputImageType,ComplexInt32VectorImageType>( + m_Image , + m_ComplexVectorInt32Writer , + m_FileName , + m_RAMValue ); break; } - } -} - - -template <class TInputVectorImageType> -void -ComplexOutputImageParameter::SwitchVectorImageWrite() - { - switch(m_ComplexPixelType ) - { case ComplexImagePixelType_float: { - CastAndWriteImage<TInputVectorImageType,ComplexFloatVectorImageType>(m_Image,m_ComplexVectorFloatWriter,m_FileName,m_RAMValue); + CastAndWriteImage<TInputImageType,ComplexFloatVectorImageType>( + m_Image , + m_ComplexVectorFloatWriter , + m_FileName , + m_RAMValue ); break; } case ComplexImagePixelType_double: { - CastAndWriteImage<TInputVectorImageType,ComplexDoubleVectorImageType>(m_Image,m_ComplexVectorDoubleWriter,m_FileName,m_RAMValue); + CastAndWriteImage<TInputImageType,ComplexDoubleVectorImageType>( + m_Image , + m_ComplexVectorDoubleWriter , + m_FileName , + m_RAMValue ); break; } } - } - +} void ComplexOutputImageParameter::Write() { m_Image->UpdateOutputInformation(); - - if (dynamic_cast<ComplexFloatImageType*>(m_Image.GetPointer())) + if (dynamic_cast<ComplexInt16ImageType*>(m_Image.GetPointer())) + { + SwitchImageWrite<ComplexInt16ImageType>(); + } + else if (dynamic_cast<ComplexInt16ImageType*>(m_Image.GetPointer())) + { + SwitchImageWrite<ComplexInt16ImageType>(); + } + else if (dynamic_cast<ComplexFloatImageType*>(m_Image.GetPointer())) { SwitchImageWrite<ComplexFloatImageType>(); } @@ -204,13 +228,21 @@ ComplexOutputImageParameter::Write() { SwitchImageWrite<ComplexDoubleImageType>(); } + else if (dynamic_cast<ComplexInt16VectorImageType*>(m_Image.GetPointer())) + { + SwitchImageWrite<ComplexInt16VectorImageType>(); + } + else if (dynamic_cast<ComplexInt32VectorImageType*>(m_Image.GetPointer())) + { + SwitchImageWrite<ComplexInt32VectorImageType>(); + } else if (dynamic_cast<ComplexFloatVectorImageType*>(m_Image.GetPointer())) { - SwitchVectorImageWrite<ComplexFloatVectorImageType>(); + SwitchImageWrite<ComplexFloatVectorImageType>(); } else if (dynamic_cast<ComplexDoubleVectorImageType*>(m_Image.GetPointer())) { - SwitchVectorImageWrite<ComplexDoubleVectorImageType>(); + SwitchImageWrite<ComplexDoubleVectorImageType>(); } else { @@ -221,40 +253,34 @@ ComplexOutputImageParameter::Write() itk::ProcessObject* ComplexOutputImageParameter::GetWriter() { - int type = 0; - // 0 : image - // 1 : VectorImage - - if ( dynamic_cast<ComplexFloatVectorImageType*>( m_Image.GetPointer()) || - dynamic_cast<ComplexDoubleVectorImageType*>(m_Image.GetPointer())) - { - type = 1; - } - itk::ProcessObject* writer = ITK_NULLPTR; switch ( GetComplexPixelType() ) { + case ComplexImagePixelType_int16: + { + writer = m_ComplexVectorInt16Writer; + break; + } + case ComplexImagePixelType_int32: + { + writer = m_ComplexVectorInt32Writer; + break; + } case ComplexImagePixelType_float: { - if( type == 1 ) writer = m_ComplexVectorFloatWriter; - else - writer = m_ComplexFloatWriter; - break; + break; } case ComplexImagePixelType_double: { - if( type == 1 ) writer = m_ComplexVectorDoubleWriter; - else - writer = m_ComplexDoubleWriter; - break; + break; } } return writer; } -ComplexOutputImageParameter::ImageBaseType* +ImageBaseType* ComplexOutputImageParameter::GetValue( ) { return m_Image; diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperElevationParametersHandler.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperElevationParametersHandler.cxx index f645553e03907713a71ffd57b2dcab6539d88ec5..726f1dbe3ca72c67b825b2a6a385844dbc826319 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperElevationParametersHandler.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperElevationParametersHandler.cxx @@ -57,7 +57,11 @@ void ElevationParametersHandler::AddElevationParameters(Application::Pointer app oss.str(""); oss << key<<".geoid"; app->AddParameter(ParameterType_InputFilename, oss.str(), "Geoid File"); - app->SetParameterDescription(oss.str(),"Use a geoid grid to get the height above the ellipsoid in case there is no DEM available, no coverage for some points or pixels with no_data in the DEM tiles. A version of the geoid can be found on the OTB website (https://git.orfeo-toolbox.org/otb-data.git/blob/HEAD:/Input/DEM/egm96.grd)."); + app->SetParameterDescription(oss.str(),"Use a geoid grid to get the height " + "above the ellipsoid in case there is no DEM available, no coverage for " + "some points or pixels with no_data in the DEM tiles. A version of the " + "geoid can be found on the OTB website" + "(https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb-data/blob/master/Input/DEM/egm96.grd)."); app->MandatoryOff(oss.str()); std::string geoidFromConfig = otb::ConfigurationManager::GetGeoidFile(); diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameter.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameter.cxx index 166ab2956ad5fc46a6bd1df6a1298e3066b4f23f..2b806426a16818f07293d9e05844541c45f472f7 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameter.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameter.cxx @@ -68,10 +68,19 @@ InputImageParameter::GetImage() return this->GetImage<FloatVectorImageType>(); } +template <> +ImageBaseType* +InputImageParameter::GetImage() +{ + if (m_Image.IsNull()) + return this->GetImage<FloatVectorImageType>(); + + return m_Image; +} + otbGetImageMacro(UInt8RGBImage); otbGetImageMacro(UInt8RGBAImage); - void InputImageParameter::SetImage(FloatVectorImageType* image) { diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterCDouble.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterCDouble.cxx new file mode 100644 index 0000000000000000000000000000000000000000..304a871a7757c1a3d7296319b058c48054bd9869 --- /dev/null +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterCDouble.cxx @@ -0,0 +1,31 @@ +/* + * 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 "otbWrapperInputImageParameter.h" +#include "otbWrapperInputImageParameterMacros.h" +#include "otbWrapperTypes.h" + +namespace otb +{ +namespace Wrapper +{ +otbGetImageAndVectorImageMacro(ComplexDouble); +} +} diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterCFloat.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterCFloat.cxx new file mode 100644 index 0000000000000000000000000000000000000000..264b851038d31309591fc0302450db99bbcd49d8 --- /dev/null +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterCFloat.cxx @@ -0,0 +1,31 @@ +/* + * 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 "otbWrapperInputImageParameter.h" +#include "otbWrapperInputImageParameterMacros.h" +#include "otbWrapperTypes.h" + +namespace otb +{ +namespace Wrapper +{ +otbGetImageAndVectorImageMacro(ComplexFloat); +} +} diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterCInt16.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterCInt16.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d49f3d031a92ff29987d485298eb4aae41c84216 --- /dev/null +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterCInt16.cxx @@ -0,0 +1,31 @@ +/* + * 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 "otbWrapperInputImageParameter.h" +#include "otbWrapperInputImageParameterMacros.h" +#include "otbWrapperTypes.h" + +namespace otb +{ +namespace Wrapper +{ +otbGetImageAndVectorImageMacro(ComplexInt16); +} +} \ No newline at end of file diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterCInt32.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterCInt32.cxx new file mode 100644 index 0000000000000000000000000000000000000000..5d675543ad21f25620b2ee410e6a31d70c98b8bc --- /dev/null +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterCInt32.cxx @@ -0,0 +1,31 @@ +/* + * 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 "otbWrapperInputImageParameter.h" +#include "otbWrapperInputImageParameterMacros.h" +#include "otbWrapperTypes.h" + +namespace otb +{ +namespace Wrapper +{ +otbGetImageAndVectorImageMacro(ComplexInt32); +} +} diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterDouble.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterDouble.cxx index e6a07bc294ff440924d5efa5f42f5634cffd1081..b7735195eac6a82a3d9cfdf0726a7aaacd6169c9 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterDouble.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterDouble.cxx @@ -19,19 +19,13 @@ */ #include "otbWrapperInputImageParameter.h" -#include "itksys/SystemTools.hxx" -#include "otbWrapperTypes.h" #include "otbWrapperInputImageParameterMacros.h" -#include "otb_boost_string_header.h" +#include "otbWrapperTypes.h" namespace otb { namespace Wrapper { -otbGetImageMacro(DoubleImage); -otbGetImageMacro(DoubleVectorImage) -otbGenericCastImageMacro(DoubleImageType, SimpleCastImage, ) -otbGenericCastImageMacro(DoubleVectorImageType, SimpleCastImage, Vector) -otbGenericCastImageMacro(DoubleImageType, CastVectorImageFromImage, Vector) +otbGetImageAndVectorImageMacro(Double); } } diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterFloat.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterFloat.cxx index fda1544048718215b7dd7757d37baeee12fbb6af..9d41953f67861b5021752e86868ba9a7de3a375a 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterFloat.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterFloat.cxx @@ -20,18 +20,12 @@ #include "otbWrapperInputImageParameter.h" #include "otbWrapperInputImageParameterMacros.h" -#include "itksys/SystemTools.hxx" #include "otbWrapperTypes.h" -#include "otb_boost_string_header.h" namespace otb { namespace Wrapper { -otbGetImageMacro(FloatImage); -otbGetImageMacro(FloatVectorImage) -otbGenericCastImageMacro(FloatImageType, SimpleCastImage, ) -otbGenericCastImageMacro(FloatVectorImageType, SimpleCastImage, Vector) -otbGenericCastImageMacro(FloatImageType, CastVectorImageFromImage, Vector) +otbGetImageAndVectorImageMacro(Float); } } diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterInt16.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterInt16.cxx index 22f617fce468169f23ed64db00e695902430f127..217fda3d3fcf00838937df23d0a8d70393555d33 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterInt16.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterInt16.cxx @@ -19,19 +19,13 @@ */ #include "otbWrapperInputImageParameter.h" -#include "itksys/SystemTools.hxx" -#include "otbWrapperTypes.h" #include "otbWrapperInputImageParameterMacros.h" -#include "otb_boost_string_header.h" +#include "otbWrapperTypes.h" namespace otb { namespace Wrapper { -otbGetImageMacro(Int16Image); -otbGetImageMacro(Int16VectorImage) -otbGenericCastImageMacro(Int16ImageType, SimpleCastImage, ) -otbGenericCastImageMacro(Int16VectorImageType, SimpleCastImage, Vector) -otbGenericCastImageMacro(Int16ImageType, CastVectorImageFromImage, Vector) +otbGetImageAndVectorImageMacro(Int16); } } diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterInt32.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterInt32.cxx index ab59107c9e357068ef461bd3b975ec3e16d524b2..6a38bb1a303e90639ca24985d4f2f01795e1de04 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterInt32.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterInt32.cxx @@ -19,19 +19,13 @@ */ #include "otbWrapperInputImageParameter.h" -#include "itksys/SystemTools.hxx" -#include "otbWrapperTypes.h" #include "otbWrapperInputImageParameterMacros.h" -#include "otb_boost_string_header.h" +#include "otbWrapperTypes.h" namespace otb { namespace Wrapper { -otbGetImageMacro(Int32Image); -otbGetImageMacro(Int32VectorImage) -otbGenericCastImageMacro(Int32ImageType, SimpleCastImage, ) -otbGenericCastImageMacro(Int32VectorImageType, SimpleCastImage, Vector) -otbGenericCastImageMacro(Int32ImageType, CastVectorImageFromImage, Vector) +otbGetImageAndVectorImageMacro(Int32); } } diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterMacros.h b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterMacros.h index 4cc9d4d7ae998e8aec82b0856b8ac6e44dcad377..2f1a7915b4f9b1491fde3ba0f9d77fc004e9e021 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterMacros.h +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterMacros.h @@ -28,22 +28,9 @@ return this->GetImage< image##Type > (); \ } - -#define otbCastImageMacro(InputImageType, OutputImageType, theMethod) \ - template<> OutputImageType * \ - InputImageParameter::CastImage<InputImageType , OutputImageType>() \ - { \ - return this->theMethod<InputImageType , OutputImageType>(); \ - } - -#define otbGenericCastImageMacro(InputImageType, theMethod, prefix) \ - otbCastImageMacro(InputImageType, UInt8##prefix##ImageType, theMethod) \ - otbCastImageMacro(InputImageType, UInt16##prefix##ImageType, theMethod) \ - otbCastImageMacro(InputImageType, Int16##prefix##ImageType, theMethod) \ - otbCastImageMacro(InputImageType, UInt32##prefix##ImageType, theMethod) \ - otbCastImageMacro(InputImageType, Int32##prefix##ImageType, theMethod) \ - otbCastImageMacro(InputImageType, Float##prefix##ImageType, theMethod) \ - otbCastImageMacro(InputImageType, Double##prefix##ImageType, theMethod) +#define otbGetImageAndVectorImageMacro(type) \ + otbGetImageMacro(type##Image); \ + otbGetImageMacro(type##VectorImage); #endif diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt16.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt16.cxx index c63857e57bd7bfd30fb466f74e9e36bcc1ddeea7..d2e58d1503439919714e15252ea8b7f608bf79a6 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt16.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt16.cxx @@ -19,19 +19,13 @@ */ #include "otbWrapperInputImageParameter.h" -#include "itksys/SystemTools.hxx" -#include "otbWrapperTypes.h" #include "otbWrapperInputImageParameterMacros.h" -#include "otb_boost_string_header.h" +#include "otbWrapperTypes.h" namespace otb { namespace Wrapper { -otbGetImageMacro(UInt16Image); -otbGetImageMacro(UInt16VectorImage) -otbGenericCastImageMacro(UInt16ImageType, SimpleCastImage, ) -otbGenericCastImageMacro(UInt16VectorImageType, SimpleCastImage, Vector) -otbGenericCastImageMacro(UInt16ImageType, CastVectorImageFromImage, Vector) +otbGetImageAndVectorImageMacro(UInt16); } } diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt32.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt32.cxx index 50fdf0adf18aefe30b7b1efac80f2b5028619565..fe75efce28305dd87fee383fa026084610d43497 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt32.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt32.cxx @@ -19,19 +19,13 @@ */ #include "otbWrapperInputImageParameter.h" -#include "itksys/SystemTools.hxx" -#include "otbWrapperTypes.h" #include "otbWrapperInputImageParameterMacros.h" -#include "otb_boost_string_header.h" +#include "otbWrapperTypes.h" namespace otb { namespace Wrapper { -otbGetImageMacro(UInt32Image); -otbGetImageMacro(UInt32VectorImage) -otbGenericCastImageMacro(UInt32ImageType, SimpleCastImage, ) -otbGenericCastImageMacro(UInt32VectorImageType, SimpleCastImage, Vector) -otbGenericCastImageMacro(UInt32ImageType, CastVectorImageFromImage, Vector) +otbGetImageAndVectorImageMacro(UInt32); } } diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt8.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt8.cxx index d388456e4267e8ba0753d54ff05439657d2c2e13..e8af7e127a3d2270dda6c6bb7ffd6ea60f825a04 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt8.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt8.cxx @@ -19,19 +19,13 @@ */ #include "otbWrapperInputImageParameter.h" -#include "itksys/SystemTools.hxx" -#include "otbWrapperTypes.h" #include "otbWrapperInputImageParameterMacros.h" -#include "otb_boost_string_header.h" +#include "otbWrapperTypes.h" namespace otb { namespace Wrapper { -otbGetImageMacro(UInt8Image); -otbGetImageMacro(UInt8VectorImage) -otbGenericCastImageMacro(UInt8ImageType, SimpleCastImage, ) -otbGenericCastImageMacro(UInt8VectorImageType, SimpleCastImage, Vector) -otbGenericCastImageMacro(UInt8ImageType, CastVectorImageFromImage, Vector) +otbGetImageAndVectorImageMacro(UInt8); } } diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputProcessXMLParameter.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputProcessXMLParameter.cxx index 938936ebf64784d0287e9d5e4be25701e2c2c738..8287525aa66b9266a994486b49c613a4a8d9ae24 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputProcessXMLParameter.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputProcessXMLParameter.cxx @@ -306,8 +306,9 @@ InputProcessXMLParameter::Read(Application::Pointer this_) } } - if ( type == ParameterType_OutputFilename || type == ParameterType_OutputVectorData || - type == ParameterType_String || type == ParameterType_Choice || type == ParameterType_RAM) + if (type == ParameterType_OutputFilename || type == ParameterType_OutputVectorData || + type == ParameterType_String || type == ParameterType_Choice || + type == ParameterType_RAM || type == ParameterType_Bool) { this_->SetParameterString(key, value); } diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperMapProjectionParametersHandler.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperMapProjectionParametersHandler.cxx index 493191677c554686770604ca734effe4017c3784..a4d4557c6d58dad4cdd47bec748822eac41d2ffd 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperMapProjectionParametersHandler.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperMapProjectionParametersHandler.cxx @@ -50,7 +50,7 @@ void MapProjectionParametersHandler::AddMapProjectionParameters( Application::Po oss.str(""); oss <<key<<".utm" <<".northhem"; - app->AddParameter(ParameterType_Empty, oss.str(), "Northern Hemisphere"); + app->AddParameter(ParameterType_Bool, oss.str(), "Northern Hemisphere"); app->SetParameterDescription(oss.str(),"The transverse mercator projections are defined by their zone number as well as the hemisphere. Activate this parameter if your image is in the northern hemisphere."); diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperMetaDataHelper.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperMetaDataHelper.cxx new file mode 100644 index 0000000000000000000000000000000000000000..02ddfea8985acb5b67f29cbbf344139b5bcacc3f --- /dev/null +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperMetaDataHelper.cxx @@ -0,0 +1,221 @@ +/* + * 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 "otbWrapperMetaDataHelper.h" +#include "itkMetaDataObject.h" + +namespace otb +{ +namespace Wrapper +{ +namespace MetaDataHelper +{ + +MDType GetType(const std::string &val) +{ + MDType ret(MDType::String); + otb::MetaDataKey::KeyType kt = otb::MetaDataKey::GetKeyType(val); + switch (kt) + { + case otb::MetaDataKey::TSTRING: + ret = MDType::String; + break; + case otb::MetaDataKey::TENTIER: + ret = MDType::Int; + break; + case otb::MetaDataKey::TDOUBLE: + ret = MDType::Double; + break; + case otb::MetaDataKey::TOTB_GCP: + ret = MDType::GCP; + break; + case otb::MetaDataKey::TVECTOR: + ret = MDType::Vector; + break; + case otb::MetaDataKey::TOSSIMKEYWORDLIST: + ret = MDType::ImageKWL; + break; + case otb::MetaDataKey::TVECTORDATAKEYWORDLIST: + ret = MDType::VectorDataKWL; + break; + case otb::MetaDataKey::TBOOLVECTOR: + ret = MDType::BoolVector; + break; + default: + break; + } + return ret; +} + +std::string +GetString( + const itk::MetaDataDictionary &dict, + const std::string &key) +{ + std::string ret; + itk::ExposeMetaData<std::string>(dict, key, ret); + return ret; +} + +void +SetString( + itk::MetaDataDictionary &dict, + const std::string &key, + const std::string &val) +{ + itk::EncapsulateMetaData<std::string>(dict, key, val); +} + +unsigned int +GetInt( + const itk::MetaDataDictionary &dict, + const std::string &key) +{ + unsigned int ret=0; + itk::ExposeMetaData<unsigned int>(dict, key, ret); + return ret; +} + +void +SetInt( + itk::MetaDataDictionary &dict, + const std::string &key, + unsigned int val) +{ + itk::EncapsulateMetaData<unsigned int>(dict, key, val); +} + +double +GetDouble( + const itk::MetaDataDictionary &dict, + const std::string &key) +{ + double ret = 0.0; + itk::ExposeMetaData<double>(dict, key, ret); + return ret; +} + +void +SetDouble( + itk::MetaDataDictionary &dict, + const std::string &key, + double val) +{ + itk::EncapsulateMetaData<double>(dict, key, val); +} + +otb::OTB_GCP +GetGCP( + const itk::MetaDataDictionary &dict, + const std::string &key) +{ + otb::OTB_GCP ret; + itk::ExposeMetaData<otb::OTB_GCP>(dict, key, ret); + return ret; +} + +void +SetGCP( + itk::MetaDataDictionary &dict, + const std::string &key, + const otb::OTB_GCP &val) +{ + itk::EncapsulateMetaData<otb::OTB_GCP>(dict, key, val); +} + +otb::MetaDataKey::VectorType +GetVector( + const itk::MetaDataDictionary &dict, + const std::string &key) +{ + otb::MetaDataKey::VectorType ret; + itk::ExposeMetaData<otb::MetaDataKey::VectorType>(dict, key, ret); + return ret; +} + +void +SetVector( + itk::MetaDataDictionary &dict, + const std::string &key, + const otb::MetaDataKey::VectorType &val) +{ + itk::EncapsulateMetaData<otb::MetaDataKey::VectorType>(dict, key, val); +} + +otb::ImageKeywordlist +GetImageKWL( + const itk::MetaDataDictionary &dict, + const std::string &key) +{ + otb::ImageKeywordlist ret; + itk::ExposeMetaData<otb::ImageKeywordlist>(dict, key, ret); + return ret; +} + +void +SetImageKWL( + itk::MetaDataDictionary &dict, + const std::string &key, + const otb::ImageKeywordlist &val) +{ + itk::EncapsulateMetaData<otb::ImageKeywordlist>(dict, key, val); +} + +otb::VectorDataKeywordlist +GetVectorDataKWL( + const itk::MetaDataDictionary &dict, + const std::string &key) +{ + otb::VectorDataKeywordlist ret; + itk::ExposeMetaData<otb::VectorDataKeywordlist>(dict, key, ret); + return ret; +} + +void +SetVectorDataKWL( + itk::MetaDataDictionary &dict, + const std::string &key, + const otb::VectorDataKeywordlist &val) +{ + itk::EncapsulateMetaData<otb::VectorDataKeywordlist>(dict, key, val); +} + +otb::MetaDataKey::BoolVectorType +GetBoolVector( + const itk::MetaDataDictionary &dict, + const std::string &key) +{ + otb::MetaDataKey::BoolVectorType ret; + itk::ExposeMetaData<otb::MetaDataKey::BoolVectorType>(dict, key, ret); + return ret; +} + +void +SetBoolVector( + itk::MetaDataDictionary &dict, + const std::string &key, + const otb::MetaDataKey::BoolVectorType &val) +{ + itk::EncapsulateMetaData<otb::MetaDataKey::BoolVectorType>(dict, key, val); +} + +} // end of namespace MetaDataHelper +} // end of namespace Wrapper +} // end of namespace otb diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputImageParameter.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputImageParameter.cxx index 2790bdce255aa5d0e8a3f92ab625e274ce48bf10..9e6e33efdac2c1223830dad9db754e7110777817 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputImageParameter.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputImageParameter.cxx @@ -20,7 +20,6 @@ #include "otbWrapperOutputImageParameter.h" #include "otbClampImageFilter.h" -#include "otbClampVectorImageFilter.h" #include "otbImageIOFactory.h" #include "itksys/SystemTools.hxx" @@ -43,7 +42,9 @@ namespace Wrapper OutputImageParameter::OutputImageParameter() : m_PixelType(ImagePixelType_float), m_DefaultPixelType(ImagePixelType_float), - m_RAMValue(0) + m_RAMValue(0), + m_Caster(nullptr), + m_Writer(nullptr) { this->SetName("Output Image"); this->SetKey("out"); @@ -94,6 +95,26 @@ std::string OutputImageParameter::ConvertPixelTypeToString(ImagePixelType type) ret = "double"; break; } + case ImagePixelType_cint16: + { + ret = "cint16"; + break; + } + case ImagePixelType_cint32: + { + ret = "cint32"; + break; + } + case ImagePixelType_cfloat: + { + ret = "cfloat"; + break; + } + case ImagePixelType_cdouble: + { + ret = "cdouble"; + break; + } } return ret; } @@ -115,6 +136,14 @@ OutputImageParameter::ConvertStringToPixelType(const std::string &value, ImagePi type = ImagePixelType_float; else if (value == "double") type = ImagePixelType_double; + else if (value == "cint16") + type = ImagePixelType_cint16; + else if (value == "cint32") + type = ImagePixelType_cint32; + else if (value == "cfloat") + type = ImagePixelType_cfloat; + else if (value == "cdouble") + type = ImagePixelType_cdouble; else return false; return true; @@ -122,119 +151,138 @@ OutputImageParameter::ConvertStringToPixelType(const std::string &value, ImagePi void OutputImageParameter::InitializeWriters() { - m_UInt8Writer = UInt8WriterType::New(); - m_Int16Writer = Int16WriterType::New(); - m_UInt16Writer = UInt16WriterType::New(); - m_Int32Writer = Int32WriterType::New(); - m_UInt32Writer = UInt32WriterType::New(); - m_FloatWriter = FloatWriterType::New(); - m_DoubleWriter = DoubleWriterType::New(); - - m_VectorUInt8Writer = VectorUInt8WriterType::New(); - m_VectorInt16Writer = VectorInt16WriterType::New(); - m_VectorUInt16Writer = VectorUInt16WriterType::New(); - m_VectorInt32Writer = VectorInt32WriterType::New(); - m_VectorUInt32Writer = VectorUInt32WriterType::New(); - m_VectorFloatWriter = VectorFloatWriterType::New(); - m_VectorDoubleWriter = VectorDoubleWriterType::New(); - - m_RGBUInt8Writer = RGBUInt8WriterType::New(); - m_RGBAUInt8Writer = RGBAUInt8WriterType::New(); -} + ImageBaseType* imgBase = m_Image.GetPointer(); + // Guess the image type + std::string className(m_Image->GetNameOfClass()); + if (className == "VectorImage") + { + UInt8VectorImageType* imgUInt8 = dynamic_cast<UInt8VectorImageType*>(imgBase); + if (imgUInt8 && SwitchInput(imgUInt8)) return; + Int16VectorImageType* imgInt16 = dynamic_cast<Int16VectorImageType*>(imgBase); + if (imgInt16 && SwitchInput(imgInt16)) return; -template <typename TInput, typename TOutput> void ClampAndWriteImage(itk::ImageBase<2> * in, otb::ImageFileWriter<TOutput> * writer, const std::string & filename, const unsigned int & ramValue) -{ - typedef otb::ClampImageFilter<TInput, TOutput> ClampFilterType; - typename ClampFilterType::Pointer clampFilter = ClampFilterType::New(); - clampFilter->SetInput( dynamic_cast<TInput*>(in)); - - bool useStandardWriter = true; + UInt16VectorImageType* imgUInt16 = dynamic_cast<UInt16VectorImageType*>(imgBase); + if (imgUInt16 && SwitchInput(imgUInt16)) return; - #ifdef OTB_USE_MPI + Int32VectorImageType* imgInt32 = dynamic_cast<Int32VectorImageType*>(imgBase); + if (imgInt32 && SwitchInput(imgInt32)) return; - otb::MPIConfig::Pointer mpiConfig = otb::MPIConfig::Instance(); + UInt32VectorImageType* imgUInt32 = dynamic_cast<UInt32VectorImageType*>(imgBase); + if (imgUInt32 && SwitchInput(imgUInt32)) return; - if (mpiConfig->GetNbProcs() > 1) - { - useStandardWriter = false; + FloatVectorImageType* imgFloat = dynamic_cast<FloatVectorImageType*>(imgBase); + if (imgFloat && SwitchInput(imgFloat)) return; - // Get file extension - std::string extension = itksys::SystemTools::GetFilenameExtension(filename); + DoubleVectorImageType* imgDouble = dynamic_cast<DoubleVectorImageType*>(imgBase); + if (imgDouble && SwitchInput(imgDouble)) return; - if(extension == ".vrt") - { - // Use the WriteMPI function - WriteMPI(clampFilter->GetOutput(),filename,ramValue); - } - #ifdef OTB_USE_SPTW - else if (extension == ".tif") - { - // Use simple parallel tiff writer - typedef otb::SimpleParallelTiffWriter<TOutput> SPTWriterType; + ComplexInt16VectorImageType* imgCInt16 = dynamic_cast<ComplexInt16VectorImageType*>(imgBase); + if (imgCInt16 && SwitchInput(imgCInt16)) return; - typename SPTWriterType::Pointer sptWriter = SPTWriterType::New(); - sptWriter->SetFileName(filename); - sptWriter->SetInput(clampFilter->GetOutput()); - sptWriter->SetAutomaticAdaptativeStreaming(ramValue); - sptWriter->Update(); - } - - #endif - else - { - itkGenericExceptionMacro("File format "<<extension<<" not supported for parallel writing with MPI. Supported formats are .vrt and .tif. Extended filenames are not supported."); - } - + ComplexInt32VectorImageType* imgCInt32 = dynamic_cast<ComplexInt32VectorImageType*>(imgBase); + if (imgCInt32 && SwitchInput(imgCInt32)) return; + + ComplexFloatVectorImageType* imgCFloat = dynamic_cast<ComplexFloatVectorImageType*>(imgBase); + if (imgCFloat && SwitchInput(imgCFloat)) return; + + ComplexDoubleVectorImageType* imgCDouble = dynamic_cast<ComplexDoubleVectorImageType*>(imgBase); + if (imgCDouble && SwitchInput(imgCDouble)) return; } - - #endif - - if(useStandardWriter) + else { - - writer->SetFileName( filename ); - writer->SetInput(clampFilter->GetOutput()); - writer->SetAutomaticAdaptativeStreaming(ramValue); - writer->Update(); + UInt8ImageType* imgUInt8 = dynamic_cast<UInt8ImageType*>(imgBase); + if (imgUInt8 && SwitchInput(imgUInt8)) return; + + Int16ImageType* imgInt16 = dynamic_cast<Int16ImageType*>(imgBase); + if (imgInt16 && SwitchInput(imgInt16)) return; + + UInt16ImageType* imgUInt16 = dynamic_cast<UInt16ImageType*>(imgBase); + if (imgUInt16 && SwitchInput(imgUInt16)) return; + + Int32ImageType* imgInt32 = dynamic_cast<Int32ImageType*>(imgBase); + if (imgInt32 && SwitchInput(imgInt32)) return; + + UInt32ImageType* imgUInt32 = dynamic_cast<UInt32ImageType*>(imgBase); + if (imgUInt32 && SwitchInput(imgUInt32)) return; + + FloatImageType* imgFloat = dynamic_cast<FloatImageType*>(imgBase); + if (imgFloat && SwitchInput(imgFloat)) return; + + DoubleImageType* imgDouble = dynamic_cast<DoubleImageType*>(imgBase); + if (imgDouble && SwitchInput(imgDouble)) return; + + ComplexInt16ImageType* imgCInt16 = dynamic_cast<ComplexInt16ImageType*>(imgBase); + if (imgCInt16 && SwitchInput(imgCInt16)) return; + + ComplexInt32ImageType* imgCInt32 = dynamic_cast<ComplexInt32ImageType*>(imgBase); + if (imgCInt32 && SwitchInput(imgCInt32)) return; + + ComplexFloatImageType* imgCFloat = dynamic_cast<ComplexFloatImageType*>(imgBase); + if (imgCFloat && SwitchInput(imgCFloat)) return; + + ComplexDoubleImageType* imgCDouble = dynamic_cast<ComplexDoubleImageType*>(imgBase); + if (imgCDouble && SwitchInput(imgCDouble)) return; + + UInt8RGBImageType* imgRGB = dynamic_cast<UInt8RGBImageType*>(imgBase); + if (imgRGB && SwitchInput(imgRGB)) return; + + UInt8RGBAImageType* imgRGBA = dynamic_cast<UInt8RGBAImageType*>(imgBase); + if (imgRGBA && SwitchInput(imgRGBA)) return; } + + itkExceptionMacro("Unknown image type"); } -template <typename TInput, typename TOutput > void ClampAndWriteVectorImage(itk::ImageBase<2> * in, otb::ImageFileWriter<TOutput > * writer, const std::string & filename, const unsigned int & ramValue) + +template <typename TInput, typename TOutput> +std::pair<itk::ProcessObject::Pointer,itk::ProcessObject::Pointer> +ClampAndWriteVectorImage( TInput * in , + const std::string & filename , + const unsigned int & ramValue ) { - typedef otb::ClampVectorImageFilter<TInput, TOutput> ClampFilterType; - typename ClampFilterType::Pointer clampFilter = ClampFilterType::New(); - clampFilter->SetInput( dynamic_cast<TInput*>(in)); + std::pair<itk::ProcessObject::Pointer,itk::ProcessObject::Pointer> ret; + typedef ClampImageFilter < TInput , TOutput > ClampFilterType; + typename ClampFilterType::Pointer clampFilter ( ClampFilterType::New() ); + + clampFilter->SetInput( in); + ret.first = clampFilter.GetPointer(); bool useStandardWriter = true; - -#ifdef OTB_USE_MPI - + + #ifdef OTB_USE_MPI + otb::MPIConfig::Pointer mpiConfig = otb::MPIConfig::Instance(); - + if (mpiConfig->GetNbProcs() > 1) { useStandardWriter = false; - + // Get file extension std::string extension = itksys::SystemTools::GetFilenameExtension(filename); - + if(extension == ".vrt") { - // Use the WriteMPI function - WriteMPI(clampFilter->GetOutput(),filename,ramValue); + // Use the MPIVrtWriter + typedef otb::MPIVrtWriter<TOutput> VRTWriterType; + + typename VRTWriterType::Pointer vrtWriter = VRTWriterType::New(); + vrtWriter->SetInput(clampFilter->GetOutput()); + vrtWriter->SetFileName(filename); + vrtWriter->SetAvailableRAM(ramValue); + ret.second = vrtWriter.GetPointer(); } #ifdef OTB_USE_SPTW else if (extension == ".tif") { // Use simple parallel tiff writer typedef otb::SimpleParallelTiffWriter<TOutput> SPTWriterType; - + typename SPTWriterType::Pointer sptWriter = SPTWriterType::New(); sptWriter->SetFileName(filename); sptWriter->SetInput(clampFilter->GetOutput()); - sptWriter->SetAutomaticAdaptativeStreaming(ramValue); - sptWriter->Update(); + sptWriter->GetStreamingManager()->SetDefaultRAM(ramValue); + ret.second = sptWriter.GetPointer(); } #endif @@ -242,329 +290,148 @@ template <typename TInput, typename TOutput > void ClampAndWriteVectorImage(itk: { itkGenericExceptionMacro("File format "<<extension<<" not supported for parallel writing with MPI. Supported formats are .vrt and .tif. Extended filenames are not supported."); } + } + #endif if(useStandardWriter) { - - writer->SetFileName( filename ); - writer->SetInput(clampFilter->GetOutput()); - writer->SetAutomaticAdaptativeStreaming(ramValue); - writer->Update(); + typename otb::ImageFileWriter<TOutput>::Pointer writer = + otb::ImageFileWriter<TOutput>::New(); + writer->SetFileName( filename ); + writer->SetInput(clampFilter->GetOutput()); + writer->GetStreamingManager()->SetDefaultRAM(ramValue); + ret.second = writer.GetPointer(); } -} + return ret; +} -template <class TInputImageType> -void -OutputImageParameter::SwitchImageWrite() +template <class TInput> +int +OutputImageParameter::SwitchInput(TInput *img) { + if (! img) return 0; + + std::pair<itk::ProcessObject::Pointer,itk::ProcessObject::Pointer> ret; switch(m_PixelType ) { case ImagePixelType_uint8: { - ClampAndWriteImage<TInputImageType,UInt8ImageType>(m_Image,m_UInt8Writer,m_FileName,m_RAMValue); + ret = ClampAndWriteVectorImage< TInput , UInt8VectorImageType > ( + img , + m_FileName , + m_RAMValue ); break; } case ImagePixelType_int16: { - ClampAndWriteImage<TInputImageType,Int16ImageType>(m_Image,m_Int16Writer,m_FileName,m_RAMValue); + ret = ClampAndWriteVectorImage< TInput , Int16VectorImageType > ( + img , + m_FileName , + m_RAMValue ); break; } case ImagePixelType_uint16: { - ClampAndWriteImage<TInputImageType,UInt16ImageType>(m_Image,m_UInt16Writer,m_FileName,m_RAMValue); + ret = ClampAndWriteVectorImage< TInput , UInt16VectorImageType > ( + img , + m_FileName , + m_RAMValue ); break; } case ImagePixelType_int32: { - ClampAndWriteImage<TInputImageType,Int32ImageType>(m_Image,m_Int32Writer,m_FileName,m_RAMValue); + ret = ClampAndWriteVectorImage< TInput , Int32VectorImageType > ( + img , + m_FileName , + m_RAMValue ); break; } case ImagePixelType_uint32: { - ClampAndWriteImage<TInputImageType,UInt32ImageType>(m_Image,m_UInt32Writer,m_FileName,m_RAMValue); + ret = ClampAndWriteVectorImage< TInput , UInt32VectorImageType > ( + img , + m_FileName , + m_RAMValue ); break; } case ImagePixelType_float: { - ClampAndWriteImage<TInputImageType,FloatImageType>(m_Image,m_FloatWriter,m_FileName,m_RAMValue); + ret = ClampAndWriteVectorImage< TInput , FloatVectorImageType > ( + img , + m_FileName , + m_RAMValue ); break; } case ImagePixelType_double: { - ClampAndWriteImage<TInputImageType,DoubleImageType>(m_Image,m_DoubleWriter,m_FileName,m_RAMValue); - break; - } - } -} - - -template <class TInputVectorImageType> -void -OutputImageParameter::SwitchVectorImageWrite() - { - switch(m_PixelType ) - { - case ImagePixelType_uint8: - { - ClampAndWriteVectorImage<TInputVectorImageType,UInt8VectorImageType>(m_Image,m_VectorUInt8Writer,m_FileName,m_RAMValue); - break; - } - case ImagePixelType_int16: - { - ClampAndWriteVectorImage<TInputVectorImageType,Int16VectorImageType>(m_Image,m_VectorInt16Writer,m_FileName,m_RAMValue); - break; - } - case ImagePixelType_uint16: - { - ClampAndWriteVectorImage<TInputVectorImageType,UInt16VectorImageType>(m_Image,m_VectorUInt16Writer,m_FileName,m_RAMValue); + ret = ClampAndWriteVectorImage< TInput , DoubleVectorImageType > ( + img , + m_FileName , + m_RAMValue ); break; } - case ImagePixelType_int32: + case ImagePixelType_cint16: { - ClampAndWriteVectorImage<TInputVectorImageType,Int32VectorImageType>(m_Image,m_VectorInt32Writer,m_FileName,m_RAMValue); + ret = ClampAndWriteVectorImage < TInput , ComplexInt16VectorImageType > ( + img , + m_FileName , + m_RAMValue ); break; } - case ImagePixelType_uint32: + case ImagePixelType_cint32: { - ClampAndWriteVectorImage<TInputVectorImageType,UInt32VectorImageType>(m_Image,m_VectorUInt32Writer,m_FileName,m_RAMValue); + ret = ClampAndWriteVectorImage < TInput , ComplexInt32VectorImageType > ( + img , + m_FileName , + m_RAMValue ); break; } - case ImagePixelType_float: + case ImagePixelType_cfloat: { - ClampAndWriteVectorImage<TInputVectorImageType,FloatVectorImageType>(m_Image,m_VectorFloatWriter,m_FileName,m_RAMValue); + ret = ClampAndWriteVectorImage < TInput , ComplexFloatVectorImageType > ( + img , + m_FileName , + m_RAMValue ); break; } - case ImagePixelType_double: + case ImagePixelType_cdouble: { - ClampAndWriteVectorImage<TInputVectorImageType,DoubleVectorImageType>(m_Image,m_VectorDoubleWriter,m_FileName,m_RAMValue); + ret = ClampAndWriteVectorImage < TInput , ComplexDoubleVectorImageType > ( + img , + m_FileName , + m_RAMValue ); break; } + default: + break; } - } - - -template <class TInputRGBAImageType> -void -OutputImageParameter::SwitchRGBAImageWrite() - { - if( m_PixelType == ImagePixelType_uint8 ) - { - m_RGBAUInt8Writer->SetFileName( this->GetFileName() ); - m_RGBAUInt8Writer->SetInput(dynamic_cast<UInt8RGBAImageType*>(m_Image.GetPointer()) ); - m_RGBAUInt8Writer->SetAutomaticAdaptativeStreaming(m_RAMValue); - m_RGBAUInt8Writer->Update(); - } - else - itkExceptionMacro("Unknown PixelType for RGBA Image. Only uint8 is supported."); - } - -template <class TInputRGBImageType> -void -OutputImageParameter::SwitchRGBImageWrite() - { - if( m_PixelType == ImagePixelType_uint8 ) - { - m_RGBUInt8Writer->SetFileName( this->GetFileName() ); - m_RGBUInt8Writer->SetInput(dynamic_cast<UInt8RGBImageType*>(m_Image.GetPointer()) ); - m_RGBUInt8Writer->SetAutomaticAdaptativeStreaming(m_RAMValue); - m_RGBUInt8Writer->Update(); - } - else - itkExceptionMacro("Unknown PixelType for RGB Image. Only uint8 is supported."); - } + // Save the caster and writer + m_Caster = ret.first; + m_Writer = ret.second; + return 1; +} void OutputImageParameter::Write() { - m_Image->UpdateOutputInformation(); + m_Writer->Update(); - if (dynamic_cast<UInt8ImageType*>(m_Image.GetPointer())) - { - SwitchImageWrite<UInt8ImageType>(); - } - else if (dynamic_cast<Int16ImageType*>(m_Image.GetPointer())) - { - SwitchImageWrite<Int16ImageType>(); - } - else if (dynamic_cast<UInt16ImageType*>(m_Image.GetPointer())) - { - SwitchImageWrite<UInt16ImageType>(); - } - else if (dynamic_cast<Int32ImageType*>(m_Image.GetPointer())) - { - SwitchImageWrite<Int32ImageType>(); - } - else if (dynamic_cast<UInt32ImageType*>(m_Image.GetPointer())) - { - SwitchImageWrite<UInt32ImageType>(); - } - else if (dynamic_cast<FloatImageType*>(m_Image.GetPointer())) - { - SwitchImageWrite<FloatImageType>(); - } - else if (dynamic_cast<DoubleImageType*>(m_Image.GetPointer())) - { - SwitchImageWrite<DoubleImageType>(); - } - else if (dynamic_cast<UInt8VectorImageType*>(m_Image.GetPointer())) - { - SwitchVectorImageWrite<UInt8VectorImageType>(); - } - else if (dynamic_cast<Int16VectorImageType*>(m_Image.GetPointer())) - { - SwitchVectorImageWrite<Int16VectorImageType>(); - } - else if (dynamic_cast<UInt16VectorImageType*>(m_Image.GetPointer())) - { - SwitchVectorImageWrite<UInt16VectorImageType>(); - } - else if (dynamic_cast<Int32VectorImageType*>(m_Image.GetPointer())) - { - SwitchVectorImageWrite<Int32VectorImageType>(); - } - else if (dynamic_cast<UInt32VectorImageType*>(m_Image.GetPointer())) - { - SwitchVectorImageWrite<UInt32VectorImageType>(); - } - else if (dynamic_cast<FloatVectorImageType*>(m_Image.GetPointer())) - { - SwitchVectorImageWrite<FloatVectorImageType>(); - } - else if (dynamic_cast<DoubleVectorImageType*>(m_Image.GetPointer())) - { - SwitchVectorImageWrite<DoubleVectorImageType>(); - } - else if (dynamic_cast<UInt8RGBImageType*>(m_Image.GetPointer())) - { - SwitchRGBImageWrite<UInt8RGBImageType>(); - } - else if (dynamic_cast<UInt8RGBAImageType*>(m_Image.GetPointer())) - { - SwitchRGBAImageWrite<UInt8RGBAImageType>(); - } - else - { - itkExceptionMacro("Unknown image type"); - } - } + // Clean internal filters + m_Caster = nullptr; + m_Writer = nullptr; +} itk::ProcessObject* OutputImageParameter::GetWriter() { - int type = 0; - // 0 : image - // 1 : VectorImage - // 2 : RGBAImage - // 3 : RGBImage - itk::ProcessObject* writer = ITK_NULLPTR; - if (dynamic_cast<UInt8VectorImageType*> (m_Image.GetPointer()) - || dynamic_cast<Int16VectorImageType*> (m_Image.GetPointer()) - || dynamic_cast<UInt16VectorImageType*> (m_Image.GetPointer()) - || dynamic_cast<Int32VectorImageType*> (m_Image.GetPointer()) - || dynamic_cast<UInt32VectorImageType*> (m_Image.GetPointer()) - || dynamic_cast<FloatVectorImageType*> (m_Image.GetPointer()) - || dynamic_cast<DoubleVectorImageType*> (m_Image.GetPointer())) - { - type = 1; - } - else if (dynamic_cast<UInt8RGBAImageType*> (m_Image.GetPointer())) - { - type = 2; - writer = m_RGBAUInt8Writer; - itkWarningMacro("UInt8RGBAImageType will be saved in UInt8 format."); - return writer; - } - else if (dynamic_cast<UInt8RGBImageType*> (m_Image.GetPointer())) - { - type = 3; - writer = m_RGBUInt8Writer; - itkWarningMacro("UInt8RGBImageType will be saved in UInt8 format."); - return writer; - } - - switch (GetPixelType()) - { - case ImagePixelType_uint8: - { - switch(type) - { - case 0: - writer = m_UInt8Writer; - break; - case 1: - writer = m_VectorUInt8Writer; - break; - case 2: - writer = m_RGBAUInt8Writer; - break; - default: - writer = m_RGBUInt8Writer; - break; - } - break; - } - case ImagePixelType_int16: - { - if (type == 1) - writer = m_VectorInt16Writer; - else - if (type == 0) writer = m_Int16Writer; - break; - } - case ImagePixelType_uint16: - { - if (type == 1) - writer = m_VectorUInt16Writer; - else - if (type == 0) writer = m_UInt16Writer; - break; - } - case ImagePixelType_int32: - { - if (type == 1) - writer = m_VectorInt32Writer; - else - if (type == 0) writer = m_Int32Writer; - break; - } - case ImagePixelType_uint32: - { - if (type == 1) - writer = m_VectorUInt32Writer; - else - if (type == 0) writer = m_UInt32Writer; - break; - } - case ImagePixelType_float: - { - if (type == 1) - writer = m_VectorFloatWriter; - else - if (type == 0) writer = m_FloatWriter; - break; - } - case ImagePixelType_double: - { - if (type == 1) - writer = m_VectorDoubleWriter; - else - if (type == 0) writer = m_DoubleWriter; - break; - } - } - if (ITK_NULLPTR == writer) - { - itkExceptionMacro("Unknown Writer type."); - } - - return writer; + return m_Writer; } -OutputImageParameter::ImageBaseType* +ImageBaseType* OutputImageParameter::GetValue( ) { return m_Image; @@ -625,5 +492,45 @@ OutputImageParameter::CheckFileName(bool fixMissingExtension) return ret; } +// Specialization for UInt8RGBAImageType +template <> +int +OutputImageParameter::SwitchInput(UInt8RGBAImageType *img) +{ + if (! img) return 0; + if( m_PixelType == ImagePixelType_uint8 ) + { + typename otb::ImageFileWriter<UInt8RGBAImageType>::Pointer writer = + otb::ImageFileWriter<UInt8RGBAImageType>::New(); + writer->SetFileName( this->GetFileName() ); + writer->SetInput(img); + writer->GetStreamingManager()->SetDefaultRAM(m_RAMValue); + m_Writer = writer.GetPointer(); + } + else + itkExceptionMacro("Unknown PixelType for RGBA Image. Only uint8 is supported."); + return 1; +} + +// Specialization for UInt8RGBImageType +template <> +int +OutputImageParameter::SwitchInput(UInt8RGBImageType *img) +{ + if (! img) return 0; + if( m_PixelType == ImagePixelType_uint8 ) + { + typename otb::ImageFileWriter<UInt8RGBImageType>::Pointer writer = + otb::ImageFileWriter<UInt8RGBImageType>::New(); + writer->SetFileName( this->GetFileName() ); + writer->SetInput(img); + writer->GetStreamingManager()->SetDefaultRAM(m_RAMValue); + m_Writer = writer.GetPointer(); + } + else + itkExceptionMacro("Unknown PixelType for RGB Image. Only uint8 is supported."); + return 1; +} + } } diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputProcessXMLParameter.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputProcessXMLParameter.cxx index 5ba103723d9d93908d66f14330570e515f9caadd..cc2f69e995dc0cdcf1b7e83d4ffa267a8df64c15 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputProcessXMLParameter.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputProcessXMLParameter.cxx @@ -235,7 +235,9 @@ OutputProcessXMLParameter::ParseGroup(const std::string& group) } else { - bool paramExists = m_Appli->HasUserValue(key) && m_Appli->IsParameterEnabled(key); + bool paramExists = m_Appli->HasUserValue(key) && + m_Appli->IsParameterEnabled(key) && + m_Appli->GetParameterRole(key) == Role_Input; if ( type == ParameterType_OutputProcessXML ) { paramExists = false; @@ -305,7 +307,7 @@ OutputProcessXMLParameter::ParseGroup(const std::string& group) type == ParameterType_Directory || type == ParameterType_InputImage || type == ParameterType_ComplexInputImage || type == ParameterType_InputVectorData || type == ParameterType_Choice || type == ParameterType_OutputVectorData || - type == ParameterType_OutputFilename) + type == ParameterType_OutputFilename || type == ParameterType_Bool) { value = m_Appli->GetParameterString(key); } diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperParameterGroup.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperParameterGroup.cxx index 2ba9ba9307936fba2a190c054c050e69181c696c..9846f99ce4e471a557b30422e8735f483dbe73eb 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperParameterGroup.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperParameterGroup.cxx @@ -40,6 +40,7 @@ #include "otbWrapperParameterKey.h" #include "otbWrapperRAMParameter.h" #include "otbWrapperProxyParameter.h" +#include "otbWrapperBoolParameter.h" #include "otb_boost_string_header.h" @@ -332,6 +333,10 @@ ParameterGroup::GetSelectedItems(std::string paramKey) { return ParameterType_InputProcessXML; } + else if (type == "Bool") + { + return ParameterType_Bool; + } else { std::cerr << "Cannot find parameter type code for type: " << type << std::endl; @@ -466,6 +471,11 @@ std::string ParameterGroup::GetParameterTypeAsString(ParameterType type) paramType = "InputProcessXML"; } break; + case ParameterType_Bool: + { + paramType = "Bool"; + } + break; default: { std::cerr << "Cannot find string version of parameter type" << std::endl; @@ -625,6 +635,11 @@ ParameterGroup::AddParameter(ParameterType type, std::string paramKey, std::stri newParam = InputProcessXMLParameter::New(); } break; + case ParameterType_Bool: + { + newParam = BoolParameter::New(); + } + break; } if (newParam.IsNull()) diff --git a/Modules/Wrappers/ApplicationEngine/test/CMakeLists.txt b/Modules/Wrappers/ApplicationEngine/test/CMakeLists.txt index 860c8673636aff84ee7d5ae5f26c9c5ab0bc733d..e92b69dc0324ee9debb1e80104b846a545fa3c4d 100644 --- a/Modules/Wrappers/ApplicationEngine/test/CMakeLists.txt +++ b/Modules/Wrappers/ApplicationEngine/test/CMakeLists.txt @@ -41,6 +41,7 @@ otbWrapperApplicationHtmlDocGeneratorTest.cxx otbWrapperInputVectorDataParameterTest.cxx otbWrapperOutputImageParameterTest.cxx otbApplicationMemoryConnectTest.cxx +otbWrapperImageInterface.cxx ) add_executable(otbApplicationEngineTestDriver ${OTBApplicationEngineTests}) @@ -171,6 +172,12 @@ otb_add_test(NAME owTvOutputImageParameter COMMAND otbApplicationEngineTestDrive "my description" ) +#~ otb_add_test(NAME owTvOutputImageParameterConversion COMMAND otbApplicationEngineTestDriver + #~ otbWrapperOutputImageParameterConversionTest + #~ ${INPUTDATA}/poupees.tif + #~ ${TEMP}/poupees_out.tif + #~ ) + otb_add_test(NAME owTvDocExampleStructureTest COMMAND otbApplicationEngineTestDriver --compare-ascii ${NOTOL} ${BASELINE}/owTuDocExampleStructureTest.txt @@ -183,6 +190,7 @@ otb_add_test(NAME owTuDocExampleStructureNew COMMAND otbApplicationEngineTestDri otbWrapperDocExampleStructureNew ) +# Warning this test require otbapp_Smoothing and otbapp_ConcatenateImages to be built otb_add_test(NAME owTvApplicationMemoryConnectTest COMMAND otbApplicationEngineTestDriver otbApplicationMemoryConnectTest $<TARGET_FILE_DIR:otbapp_Smoothing> ${INPUTDATA}/poupees.tif @@ -191,3 +199,13 @@ otb_add_test(NAME owTvApplicationMemoryConnectTest COMMAND otbApplicationEngineT otb_add_test(NAME owTvParameterGroup COMMAND otbApplicationEngineTestDriver otbWrapperParameterList ) + +otb_add_test(NAME owTvImageInterface COMMAND otbApplicationEngineTestDriver + --compare-ascii ${NOTOL} + ${BASELINE_FILES}/owTvImageInterfaceOut.txt + ${TEMP}/owTvImageInterfaceOut.txt + otbWrapperImageInterface + $<TARGET_FILE_DIR:otbapp_Smoothing> + ${INPUTDATA}/Capitole_Rasterization.tif + ${TEMP}/owTvImageInterfaceOut.txt + ) diff --git a/Modules/Wrappers/ApplicationEngine/test/otbApplicationEngineTestDriver.cxx b/Modules/Wrappers/ApplicationEngine/test/otbApplicationEngineTestDriver.cxx index f5b3aabf3d5b4642044293927422883c491198f1..7413baadc59f2332227a41603d3018f474a85f0f 100644 --- a/Modules/Wrappers/ApplicationEngine/test/otbApplicationEngineTestDriver.cxx +++ b/Modules/Wrappers/ApplicationEngine/test/otbApplicationEngineTestDriver.cxx @@ -51,5 +51,7 @@ void RegisterTests() REGISTER_TEST(otbWrapperInputVectorDataParameterNew); REGISTER_TEST(otbWrapperOutputImageParameterNew); REGISTER_TEST(otbWrapperOutputImageParameterTest1); + //~ REGISTER_TEST(otbWrapperOutputImageParameterConversionTest); REGISTER_TEST(otbApplicationMemoryConnectTest); + REGISTER_TEST(otbWrapperImageInterface); } diff --git a/Modules/Wrappers/ApplicationEngine/test/otbWrapperImageInterface.cxx b/Modules/Wrappers/ApplicationEngine/test/otbWrapperImageInterface.cxx new file mode 100644 index 0000000000000000000000000000000000000000..cc1963ecd181d8a75d280ed209bd53dca990913d --- /dev/null +++ b/Modules/Wrappers/ApplicationEngine/test/otbWrapperImageInterface.cxx @@ -0,0 +1,96 @@ +/* + * 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. + */ + +#if defined(_MSC_VER) +#pragma warning ( disable : 4786 ) +#endif + +#include "otbWrapperApplicationRegistry.h" + + +int otbWrapperImageInterface(int argc, char * argv[]) +{ + if(argc<4) + { + std::cerr<<"Usage: "<<argv[0]<<" application_path input_image output_txt"<<std::endl; + return EXIT_FAILURE; + } + + std::string path = argv[1]; + std::string input = argv[2]; + std::string output = argv[3]; + + otb::Wrapper::ApplicationRegistry::SetApplicationPath(path); + + otb::Wrapper::Application::Pointer app1 = otb::Wrapper::ApplicationRegistry::CreateApplication("Smoothing"); + + if(app1.IsNull()) + { + std::cerr<<"Failed to create application"<<std::endl; + return EXIT_FAILURE; + } + + std::ofstream ofs( output ); + if (!ofs.is_open()) + { + fprintf(stderr, "Error, can't open file"); + return EXIT_FAILURE; + } + + app1->SetParameterString("in",input); + app1->Execute(); + + ofs << "Size: "<< app1->GetImageSize("out") << std::endl; + ofs << "Origin: "<< app1->GetImageOrigin("out") << std::endl; + ofs << "Spacing: "<< app1->GetImageSpacing("out") << std::endl; + ofs << "Keywordlist: "<< std::endl; + otb::ImageKeywordlist kwl = app1->GetImageKeywordlist("out"); + kwl.Print(ofs); + ofs << "ProjectionRef:"<< std::endl; + ofs << app1->GetImageProjection("out") << std::endl; + + itk::MetaDataDictionary dict = app1->GetImageMetaData("out"); + ofs << "Dictionary keys:"<< std::endl; + for (auto & key : dict.GetKeys()) + { + ofs << " - "<< key << std::endl; + } + + otb::Wrapper::ImageBaseType::RegionType region; + region.SetIndex(0,10); + region.SetIndex(1,10); + region.SetSize(0,7); + region.SetSize(1,7); + + ofs << "RAM usage (in Bytes): "<< app1->PropagateRequestedRegion("out",region) << std::endl; + ofs << "Input requested: "<< app1->GetImageRequestedRegion("in") << std::endl; + + otb::Wrapper::Application::Pointer app2 = + otb::Wrapper::ApplicationRegistry::CreateApplication("ConcatenateImages"); + app2->AddParameterStringList("il",input); + app2->AddParameterStringList("il",input); + app2->Execute(); + + ofs << "Number of bands [il]: "<< app2->GetImageNbBands("il",0) << "+" + << app2->GetImageNbBands("il",1) << std::endl; + ofs << "Number of bands [out]: "<< app2->GetImageNbBands("out")<< std::endl; + ofs.close(); + return EXIT_SUCCESS; +} diff --git a/Modules/Wrappers/ApplicationEngine/test/otbWrapperOutputImageParameterTest.cxx b/Modules/Wrappers/ApplicationEngine/test/otbWrapperOutputImageParameterTest.cxx index 76d6c6056e6ba55ed46f3edda89923fc1ad0c861..ea8899b8e0d50685f8e0973f17e1a50081dde7f5 100644 --- a/Modules/Wrappers/ApplicationEngine/test/otbWrapperOutputImageParameterTest.cxx +++ b/Modules/Wrappers/ApplicationEngine/test/otbWrapperOutputImageParameterTest.cxx @@ -23,8 +23,10 @@ #endif #include "otbWrapperOutputImageParameter.h" +#include "otbWrapperInputImageParameter.h" #include "otbImageFileReader.h" #include "otbWrapperTypes.h" +#include <vector> int otbWrapperOutputImageParameterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { @@ -34,7 +36,6 @@ int otbWrapperOutputImageParameterNew(int itkNotUsed(argc), char * itkNotUsed(ar return EXIT_SUCCESS; } - int otbWrapperOutputImageParameterTest1(int itkNotUsed(argc), char* argv[]) { typedef otb::Wrapper::OutputImageParameter OutputImageParameterType; @@ -59,3 +60,59 @@ int otbWrapperOutputImageParameterTest1(int itkNotUsed(argc), char* argv[]) return EXIT_SUCCESS; } + + +// template < typename ImageType > +// void Cross( int p , std::string inputfilename, std::string outputfilename) +// { +// otb::Wrapper::InputImageParameter::Pointer paramIn ( +// otb::Wrapper::InputImageParameter::New() ); +// paramIn->SetFromFileName( inputfilename ); +// otb::Wrapper::OutputImageParameter::Pointer paramOut( +// otb::Wrapper::OutputImageParameter::New() ); +// paramOut->SetFileName( outputfilename ); +// paramOut->SetImage(paramIn->GetImage<ImageType>()); +// paramOut->InitializeWriters(); +// paramOut->SetPixelType(static_cast<otb::Wrapper::ImagePixelType>(p)); +// paramOut->Write(); +// } + + +// int otbWrapperOutputImageParameterConversionTest(int , char* argv[]) +// { +// std::string filenamein = argv[1]; +// std::string filenameout = argv[2] ; +// std::string extension = filenameout.substr( filenameout.find_last_of('.') ); + +// filenameout = filenameout.substr( 0 , filenameout.find_last_of('.') ); + +// for ( int i = otb::Wrapper::ImagePixelType_uint8 ; i < 11 ; i++ ) +// { +// std::string type = +// otb::Wrapper::OutputImageParameter::ConvertPixelTypeToString( +// static_cast<otb::Wrapper::ImagePixelType>(i) ); +// Cross< otb::Wrapper::UInt8ImageType > (i , filenamein , filenameout+"_UInt8_"+ type + extension ) ; +// Cross< otb::Wrapper::Int16ImageType > ( i , filenamein , filenameout+"_Int16_"+ type + extension ) ; +// Cross< otb::Wrapper::UInt16ImageType > ( i , filenamein , filenameout+"_UInt16_"+ type + extension ) ; +// Cross< otb::Wrapper::Int32ImageType > ( i , filenamein , filenameout+"_Int21_"+ type + extension ) ; +// Cross< otb::Wrapper::UInt32ImageType > ( i , filenamein , filenameout+"_UInt32_"+ type + extension ) ; +// Cross< otb::Wrapper::FloatImageType > ( i , filenamein , filenameout+"_float_"+ type + extension ) ; +// Cross< otb::Wrapper::DoubleImageType > ( i , filenamein , filenameout+"_double_"+ type + extension ) ; +// Cross< otb::Wrapper::UInt8VectorImageType > ( i , filenamein , filenameout+"_UInt8Vect_"+ type + extension ) ; +// Cross< otb::Wrapper::Int16VectorImageType > ( i , filenamein , filenameout+"_Int16Vect_"+ type + extension ) ; +// Cross< otb::Wrapper::UInt16VectorImageType > ( i , filenamein , filenameout+"_UInt16Vect_"+ type + extension ) ; +// Cross< otb::Wrapper::Int32VectorImageType > ( i , filenamein , filenameout+"_Int21Vect_"+ type + extension ) ; +// Cross< otb::Wrapper::UInt32VectorImageType > ( i , filenamein , filenameout+"_UInt32Vect_"+ type + extension ) ; +// Cross< otb::Wrapper::FloatVectorImageType > ( i , filenamein , filenameout+"_floatVect_"+ type + extension ) ; +// Cross< otb::Wrapper::DoubleVectorImageType > ( i , filenamein , filenameout+"_doubleVect_"+ type + extension ) ; +// Cross< otb::Wrapper::ComplexInt16ImageType > ( i , filenamein , filenameout+"_CInt16_"+ type + extension ) ; +// Cross< otb::Wrapper::ComplexInt32ImageType > ( i , filenamein , filenameout+"_CInt32_"+ type + extension ) ; +// Cross< otb::Wrapper::ComplexFloatImageType > ( i , filenamein , filenameout+"_Cfloat_"+ type + extension ) ; +// Cross< otb::Wrapper::ComplexDoubleImageType > ( i , filenamein , filenameout+"_Cdouble_"+ type + extension ) ; +// Cross< otb::Wrapper::ComplexInt16VectorImageType > ( i , filenamein , filenameout+"_CInt16Vect_"+ type + extension ) ; +// Cross< otb::Wrapper::ComplexInt32VectorImageType > ( i , filenamein , filenameout+"_CInt32Vect_"+ type + extension ) ; +// Cross< otb::Wrapper::ComplexFloatVectorImageType > ( i , filenamein , filenameout+"_CfloatVect_"+ type + extension ) ; +// Cross< otb::Wrapper::ComplexDoubleVectorImageType > ( i , filenamein , filenameout+"_CdoubleVect_"+ type + extension ) ; +// } +// return 0; +// } diff --git a/Modules/Wrappers/CommandLine/include/otbWrapperCommandLineLauncher.h b/Modules/Wrappers/CommandLine/include/otbWrapperCommandLineLauncher.h index c54d4a9fed22c2358c08f4589a08077ba5881443..51b76e9b0b49e69e44aad8fbdf280f89624d59be 100644 --- a/Modules/Wrappers/CommandLine/include/otbWrapperCommandLineLauncher.h +++ b/Modules/Wrappers/CommandLine/include/otbWrapperCommandLineLauncher.h @@ -122,7 +122,7 @@ protected: CommandLineLauncher(); /** Destructor */ - ~CommandLineLauncher() ITK_OVERRIDE; + ~CommandLineLauncher() override; /** Load the executable path. It looks for the key --modulePath, * extract and interpret as path the following strings. diff --git a/Modules/Wrappers/CommandLine/include/otbWrapperCommandLineParser.h b/Modules/Wrappers/CommandLine/include/otbWrapperCommandLineParser.h index 42c449f18c386d45091cb2a6f0533e4164b82ed9..9f35a7b8920633f9c80299551528fd766cce27f6 100644 --- a/Modules/Wrappers/CommandLine/include/otbWrapperCommandLineParser.h +++ b/Modules/Wrappers/CommandLine/include/otbWrapperCommandLineParser.h @@ -90,7 +90,7 @@ protected: CommandLineParser(); /** Destructor */ - ~CommandLineParser() ITK_OVERRIDE; + ~CommandLineParser() override; private: CommandLineParser(const CommandLineParser &); //purposely not implemented diff --git a/Modules/Wrappers/CommandLine/src/otbApplicationLauncherCommandLine.cxx b/Modules/Wrappers/CommandLine/src/otbApplicationLauncherCommandLine.cxx index 4c5bd8a93f43780e7d4827b260ae92e73ca9fde3..72f8b84d95c656070dbe0748572a1e140e2d78b7 100644 --- a/Modules/Wrappers/CommandLine/src/otbApplicationLauncherCommandLine.cxx +++ b/Modules/Wrappers/CommandLine/src/otbApplicationLauncherCommandLine.cxx @@ -270,7 +270,7 @@ int main(int argc, char* argv[]) if (argc < 2) { ShowUsage(argv); - return false; + return EXIT_FAILURE; } std::vector<std::string> vexp; @@ -302,7 +302,7 @@ int main(int argc, char* argv[]) if (vexp.empty()) { ShowUsage(argv); - return false; + return EXIT_FAILURE; } bool success = launcher->Load(vexp) && launcher->ExecuteAndWriteOutput(); diff --git a/Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx b/Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx index cf70dc07b7bd8e50922a313f4bc6ff21ecaa973c..0af9b9afc04e6f272194224570c54b3c92e041a4 100644 --- a/Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx +++ b/Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx @@ -435,7 +435,8 @@ CommandLineLauncher::ParamResultType CommandLineLauncher::LoadParameters() type == ParameterType_InputVectorData || type == ParameterType_OutputVectorData || type == ParameterType_RAM || - type == ParameterType_OutputProcessXML) // || type == ParameterType_InputProcessXML) + type == ParameterType_OutputProcessXML || + type == ParameterType_Bool) // || type == ParameterType_InputProcessXML) { // Single value parameter m_Application->SetParameterString(paramKey, values[0]); @@ -686,7 +687,7 @@ std::string CommandLineLauncher::DisplayParameterHelp(const Parameter::Pointer & { oss << "<int32> "; } - else if (type == ParameterType_Empty ) + else if (type == ParameterType_Empty || type == ParameterType_Bool) { oss << "<boolean> "; } @@ -728,7 +729,7 @@ std::string CommandLineLauncher::DisplayParameterHelp(const Parameter::Pointer & { defPixType = OutputImageParameter::ConvertPixelTypeToString(paramDown->GetDefaultPixelType()); } - oss << " [pixel=uint8/uint16/int16/uint32/int32/float/double]"; + oss << " [pixel=uint8/uint16/int16/uint32/int32/float/double/cint16/cint32/cfloat/cdouble]"; oss << " (default value is " << defPixType <<")"; } diff --git a/Modules/Wrappers/QGIS/CMakeLists.txt b/Modules/Wrappers/QGIS/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..be0c9e5a007919499c0dd3dc6fd20b2a53821997 --- /dev/null +++ b/Modules/Wrappers/QGIS/CMakeLists.txt @@ -0,0 +1,21 @@ +# +# 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(OTBQgis) +otb_module_impl() diff --git a/Modules/Wrappers/QGIS/otb-module.cmake b/Modules/Wrappers/QGIS/otb-module.cmake new file mode 100644 index 0000000000000000000000000000000000000000..027cc94172711373072c28340a14e0d56a1a4323 --- /dev/null +++ b/Modules/Wrappers/QGIS/otb-module.cmake @@ -0,0 +1,34 @@ +# +# 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 "Required to generate descriptor files for QGIS processing plugin.") + +otb_module(OTBQgis + DEPENDS + OTBITK + OTBApplicationEngine + + TEST_DEPENDS + OTBTestKernel + + DESCRIPTION + "${DOCUMENTATION}" +) + diff --git a/Modules/Wrappers/QGIS/src/CMakeLists.txt b/Modules/Wrappers/QGIS/src/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec8a07e7bd2da70c3f31f2efc3af5fc4829f201e --- /dev/null +++ b/Modules/Wrappers/QGIS/src/CMakeLists.txt @@ -0,0 +1,56 @@ +# +# 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. + +add_executable(otbQgisDescriptor otbQgisDescriptor.cxx) +target_link_libraries(otbQgisDescriptor ${OTBQgis_LIBRARIES}) +otb_module_target(otbQgisDescriptor) + +set(dfiles) +set(app_list ${OTB_APPLICATIONS_NAME_LIST}) +list(REMOVE_ITEM app_list "TestApplication") +list(REMOVE_ITEM app_list "ApplicationExample") +list(REMOVE_DUPLICATES app_list) +foreach(otb_app ${app_list}) + set(dfile "${OTB_BINARY_DIR}/descriptors/${otb_app}.txt") + add_custom_command(OUTPUT "${dfile}" + COMMAND "$<TARGET_FILE:otbQgisDescriptor>" + "${otb_app}" "${OTB_BINARY_DIR}/lib/otb/applications" "${OTB_BINARY_DIR}/descriptors/" + DEPENDS otbQgisDescriptor + WORKING_DIRECTORY ${OTB_BINARY_DIR} + COMMENT "./bin/otbQgisDescriptor ${otb_app} ./lib/otb/applications ./descriptors/" + VERBATIM) +list(APPEND dfiles "${dfile}") +endforeach() + +add_custom_target(clean_algs_txt + COMMAND "${CMAKE_COMMAND}" "-E" "remove_directory" "${OTB_BINARY_DIR}/descriptors/" + COMMAND "${CMAKE_COMMAND}" "-E" "remove_directory" "${CMAKE_INSTALL_PREFIX}/descriptors/" + COMMAND "${CMAKE_COMMAND}" "-E" "make_directory" "${OTB_BINARY_DIR}/descriptors/" + COMMAND "${CMAKE_COMMAND}" "-E" "echo" "Generating descriptor files for QGIS" + DEPENDS otbQgisDescriptor + ) + +add_custom_target(generate_qgis_descriptor + COMMAND "${CMAKE_COMMAND}" "-E" "echo" "Installing: ${CMAKE_INSTALL_PREFIX}/descriptors/" + COMMAND "${CMAKE_COMMAND}" "-E" "copy_directory" "${OTB_BINARY_DIR}/descriptors" "${CMAKE_INSTALL_PREFIX}/descriptors" + DEPENDS clean_algs_txt ${dfiles} + ) + +#otb_module_target_label(generate_qgis_descriptor) + diff --git a/Modules/Wrappers/QGIS/src/otbQgisDescriptor.cxx b/Modules/Wrappers/QGIS/src/otbQgisDescriptor.cxx new file mode 100644 index 0000000000000000000000000000000000000000..ba56afbd28ec07b812ec4e818e20436f5e384999 --- /dev/null +++ b/Modules/Wrappers/QGIS/src/otbQgisDescriptor.cxx @@ -0,0 +1,348 @@ +/* + * 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 "otbWrapperChoiceParameter.h" +#include "otbWrapperListViewParameter.h" +#include "otbWrapperBoolParameter.h" +#include "otbWrapperApplicationRegistry.h" + +#include <iostream> +#include <cassert> +#include <fstream> + +int main(int argc, char* argv[]) +{ + if (argc < 3) + { + std::cerr << "Usage : " << argv[0] << " name OTB_APPLICATION_PATH [out_dir]" << std::endl; + return EXIT_FAILURE; + } + + using namespace otb::Wrapper; + + const std::string module(argv[1]); + + /* TestApplication is removed in CMakeLists.txt */ +#if 0 + if (module == "TestApplication") + return EXIT_SUCCESS; +#endif + + ApplicationRegistry::AddApplicationPath(argv[2]); + Application::Pointer appli = ApplicationRegistry::CreateApplicationFaster(module.c_str()); + + assert(!appli.IsNull()); + + std::map<ParameterType, std::string> parameterTypeToString; + parameterTypeToString[ParameterType_Empty] = "QgsProcessingParameterBoolean"; + parameterTypeToString[ParameterType_Bool] = "QgsProcessingParameterBoolean"; + parameterTypeToString[ParameterType_Int] = "QgsProcessingParameterNumber"; + parameterTypeToString[ParameterType_Float] = "QgsProcessingParameterNumber"; + parameterTypeToString[ParameterType_RAM] = "QgsProcessingParameterNumber"; + parameterTypeToString[ParameterType_Radius] = "QgsProcessingParameterNumber"; + parameterTypeToString[ParameterType_Choice] = "OTBParameterChoice"; + parameterTypeToString[ParameterType_String] = "QgsProcessingParameterString"; + parameterTypeToString[ParameterType_InputImage] = "QgsProcessingParameterRasterLayer"; + parameterTypeToString[ParameterType_InputFilename] = "QgsProcessingParameterFile"; + parameterTypeToString[ParameterType_InputImageList] = "QgsProcessingParameterMultipleLayers"; + parameterTypeToString[ParameterType_InputVectorData] = "QgsProcessingParameterVectorLayer"; + parameterTypeToString[ParameterType_InputFilenameList] = "QgsProcessingParameterMultipleLayers"; + parameterTypeToString[ParameterType_InputVectorDataList] = "QgsProcessingParameterMultipleLayers"; + parameterTypeToString[ParameterType_OutputImage] = "QgsProcessingParameterRasterDestination"; + parameterTypeToString[ParameterType_OutputVectorData] = "QgsProcessingParameterVectorDestination"; + parameterTypeToString[ParameterType_OutputFilename] = "QgsProcessingParameterFileDestination"; + parameterTypeToString[ParameterType_Directory] = "QgsProcessingParameterFile"; + // TODO + parameterTypeToString[ParameterType_StringList] = "QgsProcessingParameterString"; + // ListView parameters are treated as plain string (QLineEdit) in qgis processing ui. + // This seems rather unpleasant when comparing Qgis processing with Monteverdi/Mapla in OTB + // We tried to push something simple with checkboxes but its too risky for this version + // and clock is ticking... + + parameterTypeToString[ParameterType_ListView] = "QgsProcessingParameterString"; + + // For next update of plugin code ListView should use a custom widget wrapper and behave + // exactly like OTB Mapla. And this #if 0 block is our TODO remainder. + #if 0 + parameterTypeToString[ParameterType_ListView] = "OTBParameterListView"; + #endif + + const std::vector<std::string> appKeyList = appli->GetParametersKeys(true); + const unsigned int nbOfParam = appKeyList.size(); + + std::string output_file = module + ".txt"; + std::string algs_txt = "algs.txt"; + if (argc > 3) + { + output_file = std::string(argv[3]) + module + ".txt"; + algs_txt = std::string(argv[3]) + "algs.txt"; + } + std::ofstream dFile; + dFile.open (output_file, std::ios::out); + std::cerr << "Writing " << output_file << std::endl; + + std::string output_parameter_name; + bool hasRasterOutput = false; + { + for (unsigned int i = 0; i < nbOfParam; i++) + { + Parameter::Pointer param = appli->GetParameterByKey(appKeyList[i]); + if (param->GetMandatory()) + { + ParameterType type = appli->GetParameterType(appKeyList[i]); + if (type == ParameterType_OutputImage ) + { + output_parameter_name = appKeyList[i]; + hasRasterOutput = true; + } + } + } + } + + if(output_parameter_name.empty()) + dFile << module << std::endl; + else + dFile << module << "|" << output_parameter_name << std::endl; + + dFile << appli->GetDescription() << std::endl; + const std::string group = appli->GetDocTags().size() > 0 ? appli->GetDocTags()[0] : "UNCLASSIFIED"; + dFile << group << std::endl; + + for (unsigned int i = 0; i < nbOfParam; i++) + { + const std::string name = appKeyList[i]; + + Parameter::Pointer param = appli->GetParameterByKey(name); + ParameterType type = appli->GetParameterType(name); + const std::string description = param->GetName(); + if ( type == ParameterType_Group || + type == ParameterType_OutputProcessXML || + type == ParameterType_InputProcessXML || + type == ParameterType_RAM || + param->GetRole() == Role_Output ) + { + // group parameter cannot have any value. + // outxml and inxml parameters are not relevant for QGIS and is considered a bit noisy + // ram is added by qgis-otb processing provider plugin as an advanced parameter for all apps + // parameter role cannot be of type Role_Output + continue; + } + auto it = parameterTypeToString.find(type); + assert( it != parameterTypeToString.end() ); + if( it == parameterTypeToString.end() ) + { + std::cerr << "No mapping found for parameter '" <<name <<"' type=" << type << std::endl; + return EXIT_FAILURE; + } + std::string qgis_type = it->second; +#if 0 + if (type == ParameterType_ListView) + { + ListViewParameter *lv_param = dynamic_cast<ListViewParameter*>(param.GetPointer()); + std::cerr << "lv_param->GetSingleSelection()" << lv_param->GetSingleSelection() << std::endl; + if (lv_param->GetSingleSelection()) + { + + qgis_type = "QgsProcessingParameterEnum"; + std::vector<std::string> key_list = appli->GetChoiceKeys(name); + std::string values = ""; + for( auto k : key_list) + values += k + ";"; + values.pop_back(); + dFile << "|" << values ; + } + } +#endif + + bool isDestination = false; + bool isEpsgCode = false; + + // use QgsProcessingParameterCrs if required. + // TODO: do a regex on name to match ==epsg || *\.epsg.\* + if ( name == "epsg" + || name == "map.epsg.code" + || name == "mapproj.epsg.code" + || name == "mode.epsg.code") + { + qgis_type = "QgsProcessingParameterCrs"; + isEpsgCode = true; + } + + dFile << qgis_type << "|" << name << "|" << description; + + std::string default_value = "None"; + if (type == ParameterType_Int) + { + if (isEpsgCode) + { + if (param->HasValue() && appli->GetParameterInt(name) < 1) + default_value = "EPSG: " + appli->GetParameterAsString(name); + else + default_value = "ProjectCrs"; + } + else + { + dFile << "|QgsProcessingParameterNumber.Integer"; + default_value = param->HasValue() ? appli->GetParameterAsString(name): "0"; + } + } + else if (type == ParameterType_Float) + { + dFile << "|QgsProcessingParameterNumber.Double"; + default_value = param->HasValue() ? appli->GetParameterAsString(name): "0"; + } + else if (type == ParameterType_Radius) + { + dFile << "|QgsProcessingParameterNumber.Integer"; + default_value = param->HasValue() ? appli->GetParameterAsString(name): "0"; + } + else if(type == ParameterType_InputFilename) + { + // TODO: if parameter InputFilename can give supported extensions + // we can use it gitlab #1559 + dFile << "|QgsProcessingParameterFile.File|txt"; + } + else if(type == ParameterType_Directory) + { + dFile << "|QgsProcessingParameterFile.Folder|False"; + } + else if (type == ParameterType_InputImageList) + { + dFile << "|3"; //QgsProcessing.TypeRaster + } + else if (type == ParameterType_InputVectorDataList) + { + dFile << "|-1"; //QgsProcessing.TypeVectorAnyGeometry + } + else if (type == ParameterType_InputVectorData) + { + dFile << "|-1"; //QgsProcessing.TypeVectorAnyGeometry + } + else if(type == ParameterType_InputFilenameList) + { + dFile << "|4"; //QgsProcessing.TypeFile" + } + else if(type ==ParameterType_String) + { + // Below line is interpreted in qgis processing as + // 1. default_value = None + // 2. multiLine = False + // For more details, + // please refer to documetation of QgsProcessingParameterString. + default_value = "None|False"; + } + else if(type ==ParameterType_StringList) + { + // Below line is interpreted in qgis processing as + // 1. default_value = None + // 2. multiLine = True + // For more details, + // please refer to documetation of QgsProcessingParameterString. + // setting default_value this way is an exception for ParameterType_StringList and ParameterType_String + default_value = "None|True"; + } + else if (type == ParameterType_InputImage) + { + // default is None and nothing to add to dFile + } + else if(type ==ParameterType_ListView) + { + // default is None and nothing to add to dFile + } + else if(type == ParameterType_Bool) + { + default_value = appli->GetParameterAsString(name); + } + else if(type == ParameterType_Choice) + { + std::vector<std::string> key_list = appli->GetChoiceKeys(name); + std::string values = ""; + for( auto k : key_list) + values += k + ";"; + + values.pop_back(); + dFile << "|" << values ; + ChoiceParameter *cparam = dynamic_cast<ChoiceParameter*>(param.GetPointer()); + default_value = std::to_string(cparam->GetValue()); + } + else if(type == ParameterType_OutputVectorData || + type == ParameterType_OutputImage || + type == ParameterType_OutputFilename) + { + // No need for default_value, optional and extra fields in dFile. + // If parameter is a destination type. qgis_type|name|description is enough. + // So we simply set isDestination to true and skip to end to append a new line. + isDestination = true; + } + else + { + std::cout << "ERROR: default_value is empty for '" << name << "' type='" << qgis_type << "'" << std::endl; + return EXIT_FAILURE; + } + + if (!isDestination) + { + std::string optional; + if (param->GetMandatory()) + { + // TODO: avoid workaround for stringlist types (fix appengine) + // type == ParameterType_StringList check is needed because: + // If parameter is mandatory it can have no value + // It is accepted in OTB that, string list could be generated dynamically + // qgis has no such option to handle dynamic values yet.. + // So mandatory parameters whose type is StringList is considered optional + optional = param->HasValue() || type == ParameterType_StringList ? "True" : "False"; + } + else + { + optional = "True"; + } + #if 0 + std::cerr << name; + std::cerr << " mandatory=" << param->GetMandatory(); + std::cerr << " HasValue=" << param->HasValue(); + std::cerr << " qgis_type=" << qgis_type; + std::cerr << " optional=" << optional << std::endl; + #endif + dFile << "|" << default_value << "|" << optional; + } + dFile << std::endl; + } + + if(hasRasterOutput) + { + dFile << "*QgsProcessingParameterEnum|outputpixeltype|Output pixel type|unit8;int;float;double|False|2|True" << std::endl; + } + + dFile.close(); + + std::ofstream indexFile; + indexFile.open (algs_txt, std::ios::out | std::ios::app ); + indexFile << group << "|" << module << std::endl; + indexFile.close(); + std::cerr << "Updated " << algs_txt << std::endl; + + appli = nullptr; + ApplicationRegistry::CleanRegistry(); + + return EXIT_SUCCESS; + } + + diff --git a/Modules/Wrappers/QtWidget/include/itkQtProgressBar.h b/Modules/Wrappers/QtWidget/include/itkQtProgressBar.h index 5dd5b1b48203dfd471be3baf5800d76e657dbb0c..3b1087a570faa23510d888a8fa029044fe0805cb 100644 --- a/Modules/Wrappers/QtWidget/include/itkQtProgressBar.h +++ b/Modules/Wrappers/QtWidget/include/itkQtProgressBar.h @@ -22,7 +22,7 @@ #ifndef __itkQtProgressBar_h #define __itkQtProgressBar_h -#include <QtGui> +#include <QtWidgets> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility #include "itkCommand.h" #endif //tag=QT4-boost-compatibility @@ -42,7 +42,7 @@ public: QtProgressBar( QWidget *parent ); /** Destructor */ - ~QtProgressBar() ITK_OVERRIDE; + ~QtProgressBar() override; /** Get Command */ RedrawCommandType * GetRedrawCommand( void ) const; diff --git a/Modules/Wrappers/QtWidget/include/otbQtApplication.h b/Modules/Wrappers/QtWidget/include/otbQtApplication.h index 3950aaf3a57aeb3967dabf60a5911b4aa44078f2..c378f3d804d9c4f5ba8e4f8d047742e3e7decde2 100644 --- a/Modules/Wrappers/QtWidget/include/otbQtApplication.h +++ b/Modules/Wrappers/QtWidget/include/otbQtApplication.h @@ -22,7 +22,7 @@ #ifndef otbQtApplication_h #define otbQtApplication_h -#include <QtGui> +#include <QtWidgets> #include <QString> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility #include "itkMacro.h" @@ -40,7 +40,7 @@ class OTBQtWidget_EXPORT QtApplication : public QApplication public: QtApplication(int& argc, char** argv); - bool notify(QObject *object, QEvent* event) ITK_OVERRIDE; + bool notify(QObject *object, QEvent* event) override; signals: diff --git a/Modules/Wrappers/QtWidget/include/otbQtFileSelectionWidget.h b/Modules/Wrappers/QtWidget/include/otbQtFileSelectionWidget.h index ec1977b33a45fb3cfaf3c5f6f77bd80e135a3545..a5fdfd5543b8d3ac1b5f0ec46807840cb573f7c5 100644 --- a/Modules/Wrappers/QtWidget/include/otbQtFileSelectionWidget.h +++ b/Modules/Wrappers/QtWidget/include/otbQtFileSelectionWidget.h @@ -21,7 +21,7 @@ #ifndef otbQtFileSelectionWidget_h #define otbQtFileSelectionWidget_h -#include <QtGui> +#include <QtWidgets> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility #include "otbWrapperInputImageListParameter.h" #include "otbWrapperInputFilenameListParameter.h" @@ -51,7 +51,7 @@ public: }; QtFileSelectionWidget(); - ~QtFileSelectionWidget() ITK_OVERRIDE; + ~QtFileSelectionWidget() override; bool IsChecked() { diff --git a/Modules/Wrappers/QtWidget/include/otbQtLogOutput.h b/Modules/Wrappers/QtWidget/include/otbQtLogOutput.h index b4ca74de997643e8800d1e160d3a25b4b47cd57b..299216529fb629450af18629c0dcb0f32250784a 100644 --- a/Modules/Wrappers/QtWidget/include/otbQtLogOutput.h +++ b/Modules/Wrappers/QtWidget/include/otbQtLogOutput.h @@ -21,7 +21,7 @@ #ifndef otbQtLogOutput_h #define otbQtLogOutput_h -#include <QtGui> +#include <QtWidgets> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility #include "itkStdStreamLogOutput.h" #endif //tag=QT4-boost-compatibility @@ -55,16 +55,16 @@ public: itkNewMacro(QtLogOutput); /** flush a buffer */ - void Flush() ITK_OVERRIDE; + void Flush() override; /** Write to multiple outputs */ - void Write(double timestamp) ITK_OVERRIDE; + void Write(double timestamp) override; /** Write to a buffer */ - void Write(std::string const &content) ITK_OVERRIDE; + void Write(std::string const &content) override; /** Write to a buffer */ - void Write(std::string const &content, double timestamp) ITK_OVERRIDE; + void Write(std::string const &content, double timestamp) override; signals: void NewContentLog(QString); @@ -74,9 +74,9 @@ protected: QtLogOutput(); /** Destructor */ - ~QtLogOutput() ITK_OVERRIDE; + ~QtLogOutput() override; - void PrintSelf(std::ostream &os, itk::Indent indent) const ITK_OVERRIDE; + void PrintSelf(std::ostream &os, itk::Indent indent) const override; }; } diff --git a/Modules/Wrappers/QtWidget/include/otbQtStringSelectionWidget.h b/Modules/Wrappers/QtWidget/include/otbQtStringSelectionWidget.h index 1b65bb6d2e0cf142e53c5d30e50412141e21fcbc..fc8bbd382cfb1158afef63d662df95ec35183947 100644 --- a/Modules/Wrappers/QtWidget/include/otbQtStringSelectionWidget.h +++ b/Modules/Wrappers/QtWidget/include/otbQtStringSelectionWidget.h @@ -21,7 +21,7 @@ #ifndef otbQtStringSelectionWidget_h #define otbQtStringSelectionWidget_h -#include <QtGui> +#include <QtWidgets> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility #include "otbWrapperStringListParameter.h" #include "otbWrapperQtWidgetParameterBase.h" @@ -49,7 +49,7 @@ signals: public: QtStringSelectionWidget(); - ~QtStringSelectionWidget() ITK_OVERRIDE; + ~QtStringSelectionWidget() override; bool IsChecked() { @@ -73,7 +73,7 @@ public: std::string ToStdString() { - return m_Input->text().toAscii().constData(); + return m_Input->text().toLatin1().constData(); } void ClearText() diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetBoolParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetBoolParameter.h new file mode 100644 index 0000000000000000000000000000000000000000..681ef9c6933b622487dd1599813b9e6f96ea4923 --- /dev/null +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetBoolParameter.h @@ -0,0 +1,66 @@ +/* + * 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 otbWrapperQtWidgetBoolParameter_h +#define otbWrapperQtWidgetBoolParameter_h + +#include <QtGui> +#ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility +#include "otbWrapperBoolParameter.h" +#include "otbWrapperQtWidgetParameterBase.h" +#endif //tag=QT4-boost-compatibility + +namespace otb +{ +namespace Wrapper +{ + +/** \class QtWidgetBoolParameter + * \brief + * + * \ingroup OTBQtWidget + */ +class OTBQtWidget_EXPORT QtWidgetBoolParameter : public QtWidgetParameterBase +{ + Q_OBJECT + +public: + QtWidgetBoolParameter(BoolParameter*, QtWidgetModel*); + ~QtWidgetBoolParameter() ITK_OVERRIDE; + +public slots: + void SetValue( bool value ); + +private: + QtWidgetBoolParameter(const QtWidgetBoolParameter&) = delete; + void operator=(const QtWidgetBoolParameter&) = delete; + + void DoCreateWidget() ITK_OVERRIDE; + + void DoUpdateGUI() ITK_OVERRIDE; + + QToolButton *m_Button; +}; + + +} +} + +#endif diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetChoiceParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetChoiceParameter.h index 855a26e9c82831dbcbb02c86e92524d9d1916adf..345c6e59ce8f7ea678e9945e27d787e9d1e4ca41 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetChoiceParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetChoiceParameter.h @@ -21,7 +21,7 @@ #ifndef otbWrapperQtWidgetChoiceParameter_h #define otbWrapperQtWidgetChoiceParameter_h -#include <QtGui> +#include <QtWidgets> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility #include "otbWrapperChoiceParameter.h" #include "otbWrapperQtWidgetParameterBase.h" @@ -42,7 +42,7 @@ class OTBQtWidget_EXPORT QtWidgetChoiceParameter : public QtWidgetParameterBase Q_OBJECT public: QtWidgetChoiceParameter(ChoiceParameter*, QtWidgetModel*); - ~QtWidgetChoiceParameter() ITK_OVERRIDE; + ~QtWidgetChoiceParameter() override; protected slots: void SetValue( int value ); @@ -51,9 +51,9 @@ private: QtWidgetChoiceParameter(const QtWidgetChoiceParameter&); //purposely not implemented void operator=(const QtWidgetChoiceParameter&); //purposely not implemented - void DoCreateWidget() ITK_OVERRIDE; + void DoCreateWidget() override; - void DoUpdateGUI() ITK_OVERRIDE; + void DoUpdateGUI() override; ChoiceParameter::Pointer m_ChoiceParam; diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetComplexInputImageParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetComplexInputImageParameter.h index 249283011ea5b85fbe7f85aeb32ac1ece4c19691..02a76fd9789ccc5d2b52359ee0b19cb812c2e683 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetComplexInputImageParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetComplexInputImageParameter.h @@ -21,7 +21,7 @@ #ifndef otbWrapperQtWidgetComplexInputImageParameter_h #define otbWrapperQtWidgetComplexInputImageParameter_h -#include <QtGui> +#include <QtWidgets> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility #include "otbWrapperComplexInputImageParameter.h" #include "otbWrapperQtWidgetParameterBase.h" @@ -43,7 +43,7 @@ class OTBQtWidget_EXPORT QtWidgetComplexInputImageParameter : public QtWidgetPar Q_OBJECT public: QtWidgetComplexInputImageParameter(ComplexInputImageParameter*, QtWidgetModel*); - ~QtWidgetComplexInputImageParameter() ITK_OVERRIDE; + ~QtWidgetComplexInputImageParameter() override; inline const QLineEdit* GetInput() const; inline QLineEdit* GetInput(); @@ -56,9 +56,9 @@ private: QtWidgetComplexInputImageParameter(const QtWidgetComplexInputImageParameter&); //purposely not implemented void operator=(const QtWidgetComplexInputImageParameter&); //purposely not implemented - void DoCreateWidget() ITK_OVERRIDE; + void DoCreateWidget() override; - void DoUpdateGUI() ITK_OVERRIDE; + void DoUpdateGUI() override; ComplexInputImageParameter::Pointer m_ComplexInputImageParam; diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetComplexOutputImageParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetComplexOutputImageParameter.h index 1ec7b3f3250570a5dcb66887de841a40606cd039..ed964c1826be12671db0bacbb15fc90709088444 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetComplexOutputImageParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetComplexOutputImageParameter.h @@ -21,7 +21,7 @@ #ifndef otbWrapperQtWidgetComplexOutputImageParameter_h #define otbWrapperQtWidgetComplexOutputImageParameter_h -#include <QtGui> +#include <QtWidgets> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility #include "otbWrapperComplexOutputImageParameter.h" #include "otbWrapperQtWidgetParameterBase.h" @@ -43,7 +43,7 @@ class OTBQtWidget_EXPORT QtWidgetComplexOutputImageParameter : public QtWidgetPa Q_OBJECT public: QtWidgetComplexOutputImageParameter(ComplexOutputImageParameter*, QtWidgetModel*); - ~QtWidgetComplexOutputImageParameter() ITK_OVERRIDE; + ~QtWidgetComplexOutputImageParameter() override; inline const QLineEdit* GetInput() const; inline QLineEdit* GetInput(); @@ -62,9 +62,9 @@ private: QtWidgetComplexOutputImageParameter(const QtWidgetComplexOutputImageParameter&); //purposely not implemented void operator=(const QtWidgetComplexOutputImageParameter&); //purposely not implemented - void DoCreateWidget() ITK_OVERRIDE; + void DoCreateWidget() override; - void DoUpdateGUI() ITK_OVERRIDE; + void DoUpdateGUI() override; std::string m_FileName; ComplexOutputImageParameter::Pointer m_OutputImageParam; diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetDirectoryParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetDirectoryParameter.h index 8a9a4951bbc58c8672c5f1b6fc569e2e638b0f32..28d257bb7128ad766f2bb51b69058e6e6a617905 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetDirectoryParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetDirectoryParameter.h @@ -21,7 +21,7 @@ #ifndef otbWrapperQtWidgetDirectoryParameter_h #define otbWrapperQtWidgetDirectoryParameter_h -#include <QtGui> +#include <QtWidgets> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility #include "otbWrapperDirectoryParameter.h" #include "otbWrapperQtWidgetParameterBase.h" @@ -43,7 +43,7 @@ class OTBQtWidget_EXPORT QtWidgetDirectoryParameter : public QtWidgetParameterBa Q_OBJECT public: QtWidgetDirectoryParameter(DirectoryParameter*, QtWidgetModel*); - ~QtWidgetDirectoryParameter() ITK_OVERRIDE; + ~QtWidgetDirectoryParameter() override; protected slots: void SetFileName( const QString& value ); @@ -53,9 +53,9 @@ private: QtWidgetDirectoryParameter(const QtWidgetDirectoryParameter&); //purposely not implemented void operator=(const QtWidgetDirectoryParameter&); //purposely not implemented - void DoCreateWidget() ITK_OVERRIDE; + void DoCreateWidget() override; - void DoUpdateGUI() ITK_OVERRIDE; + void DoUpdateGUI() override; DirectoryParameter::Pointer m_DirectoryParam; diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetEmptyParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetEmptyParameter.h index c5c9f6a7bdb12da3dfc546552b97c281980c10c1..9503fd41def09832f2f40ef69265aa6c2ac6be94 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetEmptyParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetEmptyParameter.h @@ -21,7 +21,7 @@ #ifndef otbWrapperQtWidgetEmptyParameter_h #define otbWrapperQtWidgetEmptyParameter_h -#include <QtGui> +#include <QtWidgets> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility #include "otbWrapperEmptyParameter.h" #include "otbWrapperQtWidgetParameterBase.h" @@ -43,15 +43,15 @@ class OTBQtWidget_EXPORT QtWidgetEmptyParameter : public QtWidgetParameterBase public: QtWidgetEmptyParameter(EmptyParameter*, QtWidgetModel*); - ~QtWidgetEmptyParameter() ITK_OVERRIDE; + ~QtWidgetEmptyParameter() override; private: QtWidgetEmptyParameter(const QtWidgetEmptyParameter&); //purposely not implemented void operator=(const QtWidgetEmptyParameter&); //purposely not implemented - void DoCreateWidget() ITK_OVERRIDE; + void DoCreateWidget() override; - void DoUpdateGUI() ITK_OVERRIDE; + void DoUpdateGUI() override; }; diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetFloatParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetFloatParameter.h index 47275ef86c56021d0c99aa0ad07441d2690ec4d6..275e6ddcde5d7fcc07f43423815d5527fb56127f 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetFloatParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetFloatParameter.h @@ -21,7 +21,7 @@ #ifndef otbWrapperQtWidgetFloatParameter_h #define otbWrapperQtWidgetFloatParameter_h -#include <QtGui> +#include <QtWidgets> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility #include "otbWrapperNumericalParameter.h" #include "otbWrapperQtWidgetParameterBase.h" @@ -42,7 +42,7 @@ class OTBQtWidget_EXPORT QtWidgetFloatParameter : public QtWidgetParameterBase Q_OBJECT public: QtWidgetFloatParameter(FloatParameter*, QtWidgetModel*); - ~QtWidgetFloatParameter() ITK_OVERRIDE; + ~QtWidgetFloatParameter() override; protected slots: void SetValue( double value ); @@ -51,9 +51,9 @@ private: QtWidgetFloatParameter(const QtWidgetFloatParameter&); //purposely not implemented void operator=(const QtWidgetFloatParameter&); //purposely not implemented - void DoCreateWidget() ITK_OVERRIDE; + void DoCreateWidget() override; - void DoUpdateGUI() ITK_OVERRIDE; + void DoUpdateGUI() override; QHBoxLayout * m_QHBoxLayout; QDoubleSpinBox * m_QDoubleSpinBox; diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputFilenameListParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputFilenameListParameter.h index 9a64d46a516b26cde431b9c078fea5a9c01e5ca9..24558b81294aa74e23ab56f9f5b2e5cb2db84090 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputFilenameListParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputFilenameListParameter.h @@ -21,7 +21,7 @@ #ifndef otbWrapperQtWidgetInputFilenameListParameter_h #define otbWrapperQtWidgetInputFilenameListParameter_h -#include <QtGui> +#include <QtWidgets> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility # include "otbWrapperQtWidgetParameterList.h" diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputFilenameParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputFilenameParameter.h index 110c18a292d63d5f7d50dd01e94da8c5b3c2cd78..1ba8cbfc000bfb57b638ae8dcb5883d4099e5b1c 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputFilenameParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputFilenameParameter.h @@ -21,7 +21,7 @@ #ifndef otbWrapperQtWidgetInputFilenameParameter_h #define otbWrapperQtWidgetInputFilenameParameter_h -#include <QtGui> +#include <QtWidgets> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility #include "otbWrapperInputFilenameParameter.h" #include "otbWrapperQtWidgetParameterBase.h" @@ -43,7 +43,7 @@ class OTBQtWidget_EXPORT QtWidgetInputFilenameParameter : public QtWidgetParamet Q_OBJECT public: QtWidgetInputFilenameParameter(InputFilenameParameter*, QtWidgetModel*); - ~QtWidgetInputFilenameParameter() ITK_OVERRIDE; + ~QtWidgetInputFilenameParameter() override; inline const QLineEdit* GetInput() const; inline QLineEdit* GetInput(); @@ -56,9 +56,9 @@ private: QtWidgetInputFilenameParameter(const QtWidgetInputFilenameParameter&); //purposely not implemented void operator=(const QtWidgetInputFilenameParameter&); //purposely not implemented - void DoCreateWidget() ITK_OVERRIDE; + void DoCreateWidget() override; - void DoUpdateGUI() ITK_OVERRIDE; + void DoUpdateGUI() override; InputFilenameParameter::Pointer m_FilenameParam; diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputImageListParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputImageListParameter.h index a975dedc454e3a329c040f53168fa14cdb16fef9..5f629f4ad7c3cdb447803b0cafdb213ff1848d32 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputImageListParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputImageListParameter.h @@ -22,7 +22,7 @@ #define otbWrapperQtWidgetInputImageListParameter_h -#include <QtGui> +#include <QtWidgets> #include "OTBQtWidgetExport.h" diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputImageParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputImageParameter.h index 5c970fc5c7b6e41a5c57eed44931d5e3172e1f0d..ba9edaad53d588409340680fb870a0182cf8b51b 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputImageParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputImageParameter.h @@ -21,7 +21,7 @@ #ifndef otbWrapperQtWidgetInputImageParameter_h #define otbWrapperQtWidgetInputImageParameter_h -#include <QtGui> +#include <QtWidgets> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility #include "otbWrapperInputImageParameter.h" #include "otbWrapperQtWidgetParameterBase.h" @@ -43,7 +43,7 @@ class OTBQtWidget_EXPORT QtWidgetInputImageParameter : public QtWidgetParameterB Q_OBJECT public: QtWidgetInputImageParameter(InputImageParameter*, QtWidgetModel*); - ~QtWidgetInputImageParameter() ITK_OVERRIDE; + ~QtWidgetInputImageParameter() override; inline const QLineEdit* GetInput() const; inline QLineEdit* GetInput(); @@ -62,9 +62,9 @@ private: QtWidgetInputImageParameter(const QtWidgetInputImageParameter&); //purposely not implemented void operator=(const QtWidgetInputImageParameter&); //purposely not implemented - void DoCreateWidget() ITK_OVERRIDE; + void DoCreateWidget() override; - void DoUpdateGUI() ITK_OVERRIDE; + void DoUpdateGUI() override; InputImageParameter::Pointer m_InputImageParam; diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputProcessXMLParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputProcessXMLParameter.h index 407d76c3ad10e4ee77f0324291d9024a877b23fc..cc7d2391a53d9b517e875927e3660d357a81c3a3 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputProcessXMLParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputProcessXMLParameter.h @@ -21,7 +21,7 @@ #ifndef otbWrapperQtWidgetInputProcessXMLParameter_h #define otbWrapperQtWidgetInputProcessXMLParameter_h -#include <QtGui> +#include <QtWidgets> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility #include "otbWrapperInputProcessXMLParameter.h" #include "otbWrapperQtWidgetParameterBase.h" @@ -43,7 +43,7 @@ class OTBQtWidget_EXPORT QtWidgetInputProcessXMLParameter : public QtWidgetParam Q_OBJECT public: QtWidgetInputProcessXMLParameter(InputProcessXMLParameter*, QtWidgetModel*); - ~QtWidgetInputProcessXMLParameter() ITK_OVERRIDE; + ~QtWidgetInputProcessXMLParameter() override; inline const QLineEdit* GetInput() const; inline QLineEdit* GetInput(); @@ -56,9 +56,9 @@ private: QtWidgetInputProcessXMLParameter(const QtWidgetInputProcessXMLParameter&); //purposely not implemented void operator=(const QtWidgetInputProcessXMLParameter&); //purposely not implemented - void DoCreateWidget() ITK_OVERRIDE; + void DoCreateWidget() override; - void DoUpdateGUI() ITK_OVERRIDE; + void DoUpdateGUI() override; InputProcessXMLParameter::Pointer m_XMLParam; diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputVectorDataListParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputVectorDataListParameter.h index 7101cee908f87593f092471aa75d6b451be4e5f0..b9ac60aa2fc937b8fe86bbbe279695f17992de56 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputVectorDataListParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputVectorDataListParameter.h @@ -22,7 +22,7 @@ #define otbWrapperQtWidgetInputVectorDataListParameter_h -#include <QtGui> +#include <QtWidgets> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputVectorDataParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputVectorDataParameter.h index 8b7a6d785cf82c9a812967e39cbb1a3c79e568d3..024f39093cc25eee88ce5610d1cd26c455779627 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputVectorDataParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputVectorDataParameter.h @@ -21,7 +21,7 @@ #ifndef otbWrapperQtWidgetInputVectorDataParameter_h #define otbWrapperQtWidgetInputVectorDataParameter_h -#include <QtGui> +#include <QtWidgets> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility #include "otbWrapperInputVectorDataParameter.h" #include "otbWrapperQtWidgetParameterBase.h" @@ -43,7 +43,7 @@ class OTBQtWidget_EXPORT QtWidgetInputVectorDataParameter : public QtWidgetParam Q_OBJECT public: QtWidgetInputVectorDataParameter(InputVectorDataParameter*, QtWidgetModel*); - ~QtWidgetInputVectorDataParameter() ITK_OVERRIDE; + ~QtWidgetInputVectorDataParameter() override; inline const QLineEdit* GetInput() const; inline QLineEdit* GetInput(); @@ -56,9 +56,9 @@ private: QtWidgetInputVectorDataParameter(const QtWidgetInputVectorDataParameter&); //purposely not implemented void operator=(const QtWidgetInputVectorDataParameter&); //purposely not implemented - void DoCreateWidget() ITK_OVERRIDE; + void DoCreateWidget() override; - void DoUpdateGUI() ITK_OVERRIDE; + void DoUpdateGUI() override; InputVectorDataParameter::Pointer m_InputVectorDataParam; diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetIntParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetIntParameter.h index aa39992d98f8ddc88ebfb860663cc9fcf48583d4..2ad22eb518fbf7896d1850c4b3d5bd4ab7e4cfca 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetIntParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetIntParameter.h @@ -21,7 +21,7 @@ #ifndef otbWrapperQtWidgetIntParameter_h #define otbWrapperQtWidgetIntParameter_h -#include <QtGui> +#include <QtWidgets> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility #include "otbWrapperNumericalParameter.h" #include "otbWrapperQtWidgetParameterBase.h" @@ -43,7 +43,7 @@ class OTBQtWidget_EXPORT QtWidgetIntParameter : public QtWidgetParameterBase Q_OBJECT public: QtWidgetIntParameter(IntParameter*, QtWidgetModel*); - ~QtWidgetIntParameter() ITK_OVERRIDE; + ~QtWidgetIntParameter() override; protected slots: void SetValue( int value ); @@ -52,9 +52,9 @@ private: QtWidgetIntParameter(const QtWidgetIntParameter&); //purposely not implemented void operator=(const QtWidgetIntParameter&); //purposely not implemented - void DoCreateWidget() ITK_OVERRIDE; + void DoCreateWidget() override; - void DoUpdateGUI() ITK_OVERRIDE; + void DoUpdateGUI() override; QHBoxLayout * m_QHBoxLayout; QSpinBox * m_QSpinBox; diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetListEditItemModel.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetListEditItemModel.h index 34000ebc980150843eabbbebc0b58302b0de3027..4c879607445b438c779ed51a71bc33710e8aecc0 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetListEditItemModel.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetListEditItemModel.h @@ -122,7 +122,7 @@ public: QObject * p = nullptr ); /** \brief Destructor. */ - ~ListEditItemModel() ITK_OVERRIDE; + ~ListEditItemModel() override; // // QAbstractItemModel overloads. @@ -130,31 +130,31 @@ public: /** * \see http://qt-project.org/doc/qt-4.8/qabstractitemmodel.html#columnCount */ - int columnCount( const QModelIndex & p = QModelIndex() ) const ITK_OVERRIDE; + int columnCount( const QModelIndex & p = QModelIndex() ) const override; /** * \see http://qt-project.org/doc/qt-4.8/qabstractitemmodel.html#data */ QVariant data( const QModelIndex & index, - int role = Qt::DisplayRole ) const ITK_OVERRIDE; + int role = Qt::DisplayRole ) const override; /** * \see http://qt-project.org/doc/qt-4.8/qabstractitemmodel.html#flags */ - Qt::ItemFlags flags( const QModelIndex & index ) const ITK_OVERRIDE; + Qt::ItemFlags flags( const QModelIndex & index ) const override; /** * \see http://qt-project.org/doc/qt-4.8/qabstractitemmodel.html#hasChildren */ - bool hasChildren( const QModelIndex & p = QModelIndex() ) const ITK_OVERRIDE; + bool hasChildren( const QModelIndex & p = QModelIndex() ) const override; /** * \see http://qt-project.org/doc/qt-4.8/qabstractitemmodel.html#headerData */ QVariant headerData( int section, Qt::Orientation orientation, - int role = Qt::DisplayRole ) const ITK_OVERRIDE; + int role = Qt::DisplayRole ) const override; /** * \see http://qt-project.org/doc/qt-4.8/qabstractitemmodel.html#index @@ -162,7 +162,7 @@ public: QModelIndex index( int row, int column, - const QModelIndex & p = QModelIndex() ) const ITK_OVERRIDE; + const QModelIndex & p = QModelIndex() ) const override; /** * \see http://doc.qt.io/qt-4.8/qabstractitemmodel.html#insertRow @@ -176,12 +176,12 @@ public: bool insertRows( int row, int count, - const QModelIndex & p = QModelIndex() ) ITK_OVERRIDE; + const QModelIndex & p = QModelIndex() ) override; /** * \see http://qt-project.org/doc/qt-4.8/qabstractitemmodel.html#parent */ - QModelIndex parent( const QModelIndex & index ) const ITK_OVERRIDE; + QModelIndex parent( const QModelIndex & index ) const override; /** * \see http://qt-project.org/doc/qt-4.8/qabstractitemmodel.html#removeRows @@ -189,12 +189,12 @@ public: bool removeRows( int row, int count, - const QModelIndex & p = QModelIndex() ) ITK_OVERRIDE; + const QModelIndex & p = QModelIndex() ) override; /** * \see http://qt-project.org/doc/qt-4.8/qabstractitemmodel.html#rowCount */ - int rowCount( const QModelIndex & p = QModelIndex() ) const ITK_OVERRIDE; + int rowCount( const QModelIndex & p = QModelIndex() ) const override; /** * \see http://qt-project.org/doc/qt-4.8/qabstractitemmodel.html#setData @@ -202,7 +202,7 @@ public: bool setData( const QModelIndex & index, const QVariant & value, - int role = Qt::EditRole ) ITK_OVERRIDE; + int role = Qt::EditRole ) override; /** */ virtual bool Swap( int, int ); diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetListEditWidget.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetListEditWidget.h index a804dbe7bc8e5df5964abe581f528ce5ee6e2401..a74a4f1dd252f27c0f9248676ea49206cd41c6a7 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetListEditWidget.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetListEditWidget.h @@ -33,7 +33,7 @@ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. -#include <QtGui> +#include <QtWidgets> // // System includes (sorted by alphabetic order) diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetListViewParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetListViewParameter.h index 3f8685810f20fd377825d1f8b1021d32f2be43bb..3901befc975ab46344b6e6c1919687f9b2dc2791 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetListViewParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetListViewParameter.h @@ -21,7 +21,7 @@ #ifndef otbWrapperQtWidgetListViewParameter_h #define otbWrapperQtWidgetListViewParameter_h -#include <QtGui> +#include <QtWidgets> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility #include "otbWrapperListViewParameter.h" #include "otbWrapperQtWidgetParameterBase.h" @@ -42,7 +42,7 @@ class OTBQtWidget_EXPORT QtWidgetListViewParameter : public QtWidgetParameterBas Q_OBJECT public: QtWidgetListViewParameter(ListViewParameter*, QtWidgetModel*); - ~QtWidgetListViewParameter() ITK_OVERRIDE; + ~QtWidgetListViewParameter() override; std::vector<int> GetSelectedItems() { @@ -56,9 +56,9 @@ private: QtWidgetListViewParameter(const QtWidgetListViewParameter&); //purposely not implemented void operator=(const QtWidgetListViewParameter&); //purposely not implemented - void DoCreateWidget() ITK_OVERRIDE; + void DoCreateWidget() override; - void DoUpdateGUI() ITK_OVERRIDE; + void DoUpdateGUI() override; ListViewParameter::Pointer m_ListViewParam; diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetModel.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetModel.h index 92c135dd6e049c4e697e7058a8e783bd52a99daa..3427dfb84f1b0e75777642c18899837eda14e480 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetModel.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetModel.h @@ -21,7 +21,7 @@ #ifndef otbWrapperQtWidgetModel_h #define otbWrapperQtWidgetModel_h -#include <QtGui> +#include <QtWidgets> #include <QTimer> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility #include "otbWrapperApplication.h" @@ -44,7 +44,7 @@ class OTBQtWidget_EXPORT AppliThread : public QThread m_Application = app; } - ~AppliThread() ITK_OVERRIDE; + ~AppliThread() override; inline void Execute() { @@ -68,8 +68,15 @@ signals: */ void ExceptionRaised( QString what ); +public slots: + /** Ask the running application to stop */ + void Stop() + { + m_Application->Stop(); + } + protected: - void run() ITK_OVERRIDE; + void run() override; private: AppliThread(const AppliThread&); //purposely not implemented @@ -90,7 +97,7 @@ class OTBQtWidget_EXPORT QtWidgetModel : public QObject public: QtWidgetModel(Application* app); - ~QtWidgetModel() ITK_OVERRIDE; + ~QtWidgetModel() override; Application* GetApplication() { @@ -139,6 +146,8 @@ signals: void UpdateGui(); + void Stop(); + protected slots: /** * \brief Slot called when execution is requested (e.g. by diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputFilenameParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputFilenameParameter.h index fc39587360685386f1017b966b7d7d01f1d8afaa..6d12f4908ea6ed284717dab3c7c2f6d2e21680d8 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputFilenameParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputFilenameParameter.h @@ -21,7 +21,7 @@ #ifndef otbWrapperQtWidgetOutputFilenameParameter_h #define otbWrapperQtWidgetOutputFilenameParameter_h -#include <QtGui> +#include <QtWidgets> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility #include "otbWrapperOutputFilenameParameter.h" #include "otbWrapperQtWidgetParameterBase.h" @@ -43,7 +43,7 @@ class OTBQtWidget_EXPORT QtWidgetOutputFilenameParameter : public QtWidgetParame Q_OBJECT public: QtWidgetOutputFilenameParameter(OutputFilenameParameter*, QtWidgetModel*); - ~QtWidgetOutputFilenameParameter() ITK_OVERRIDE; + ~QtWidgetOutputFilenameParameter() override; inline const QLineEdit* GetInput() const; inline QLineEdit* GetInput(); @@ -58,9 +58,9 @@ private: QtWidgetOutputFilenameParameter(const QtWidgetOutputFilenameParameter&); //purposely not implemented void operator=(const QtWidgetOutputFilenameParameter&); //purposely not implemented - void DoCreateWidget() ITK_OVERRIDE; + void DoCreateWidget() override; - void DoUpdateGUI() ITK_OVERRIDE; + void DoUpdateGUI() override; OutputFilenameParameter::Pointer m_FilenameParam; diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputImageParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputImageParameter.h index 878f7ee56f61dbd40f27a04c5f5853cc5c3802fc..4a66a9412cf031db298d8280d3841c22fd74f6ce 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputImageParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputImageParameter.h @@ -21,7 +21,7 @@ #ifndef otbWrapperQtWidgetOutputImageParameter_h #define otbWrapperQtWidgetOutputImageParameter_h -#include <QtGui> +#include <QtWidgets> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility #include "otbWrapperOutputImageParameter.h" #include "otbWrapperQtWidgetParameterBase.h" @@ -43,7 +43,7 @@ class OTBQtWidget_EXPORT QtWidgetOutputImageParameter : public QtWidgetParameter Q_OBJECT public: QtWidgetOutputImageParameter(OutputImageParameter*, QtWidgetModel*); - ~QtWidgetOutputImageParameter() ITK_OVERRIDE; + ~QtWidgetOutputImageParameter() override; inline const QLineEdit* GetInput() const; inline QLineEdit* GetInput(); @@ -62,9 +62,9 @@ private: QtWidgetOutputImageParameter(const QtWidgetOutputImageParameter&); //purposely not implemented void operator=(const QtWidgetOutputImageParameter&); //purposely not implemented - void DoCreateWidget() ITK_OVERRIDE; + void DoCreateWidget() override; - void DoUpdateGUI() ITK_OVERRIDE; + void DoUpdateGUI() override; std::string m_FileName; OutputImageParameter::Pointer m_OutputImageParam; diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputProcessXMLParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputProcessXMLParameter.h index 10cd6481e7b7609ec8012602ff10d95da13ad036..00a3804453490444f4320b66ce91bf367563d9c2 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputProcessXMLParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputProcessXMLParameter.h @@ -21,7 +21,7 @@ #ifndef otbWrapperQtWidgetOutputProcessXMLParameter_h #define otbWrapperQtWidgetOutputProcessXMLParameter_h -#include <QtGui> +#include <QtWidgets> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility #include "otbWrapperOutputProcessXMLParameter.h" #include "otbWrapperQtWidgetParameterBase.h" @@ -43,7 +43,7 @@ class OTBQtWidget_EXPORT QtWidgetOutputProcessXMLParameter : public QtWidgetPara Q_OBJECT public: QtWidgetOutputProcessXMLParameter(OutputProcessXMLParameter*, QtWidgetModel*); - ~QtWidgetOutputProcessXMLParameter() ITK_OVERRIDE; + ~QtWidgetOutputProcessXMLParameter() override; inline const QLineEdit* GetInput() const; inline QLineEdit* GetInput(); @@ -58,9 +58,9 @@ private: QtWidgetOutputProcessXMLParameter(const QtWidgetOutputProcessXMLParameter&); //purposely not implemented void operator=(const QtWidgetOutputProcessXMLParameter&); //purposely not implemented - void DoCreateWidget() ITK_OVERRIDE; + void DoCreateWidget() override; - void DoUpdateGUI() ITK_OVERRIDE; + void DoUpdateGUI() override; OutputProcessXMLParameter::Pointer m_XMLParam; diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputVectorDataParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputVectorDataParameter.h index 2e9fcae1eea43bd348d2f126e01760bf61a7bddd..e2b675dfdfa70bb85f5c2f25022a35ac0714fd93 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputVectorDataParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputVectorDataParameter.h @@ -21,7 +21,7 @@ #ifndef otbWrapperQtWidgetOutputVectorDataParameter_h #define otbWrapperQtWidgetOutputVectorDataParameter_h -#include <QtGui> +#include <QtWidgets> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility #include "otbWrapperOutputVectorDataParameter.h" #include "otbWrapperQtWidgetParameterBase.h" @@ -43,7 +43,7 @@ class OTBQtWidget_EXPORT QtWidgetOutputVectorDataParameter : public QtWidgetPara Q_OBJECT public: QtWidgetOutputVectorDataParameter(OutputVectorDataParameter*, QtWidgetModel*); - ~QtWidgetOutputVectorDataParameter() ITK_OVERRIDE; + ~QtWidgetOutputVectorDataParameter() override; inline const QLineEdit* GetInput() const; inline QLineEdit* GetInput(); @@ -61,9 +61,9 @@ private: QtWidgetOutputVectorDataParameter(const QtWidgetOutputVectorDataParameter&); //purposely not implemented void operator=(const QtWidgetOutputVectorDataParameter&); //purposely not implemented - void DoCreateWidget() ITK_OVERRIDE; + void DoCreateWidget() override; - void DoUpdateGUI() ITK_OVERRIDE; + void DoUpdateGUI() override; std::string m_FileName; OutputVectorDataParameter::Pointer m_OutputVectorDataParam; diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetParameterBase.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetParameterBase.h index db88ca9ace0243f4a10165b560e26dc2967b4869..f0874fdd8461773f26efd8c70eeeecca03f6f98f 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetParameterBase.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetParameterBase.h @@ -21,7 +21,7 @@ #ifndef otbWrapperQtWidgetParameterBase_h #define otbWrapperQtWidgetParameterBase_h -#include <QtGui> +#include <QtWidgets> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility #include "otbWrapperParameter.h" #include "otbWrapperQtWidgetModel.h" @@ -33,6 +33,8 @@ namespace otb namespace Wrapper { +class QtWidgetParameterGroup; + /** \class QtWidgetParameterBase * \brief * @@ -41,12 +43,26 @@ namespace Wrapper class OTBQtWidget_EXPORT QtWidgetParameterBase : public QWidget { Q_OBJECT + friend class QtWidgetParameterGroup; public: QtWidgetParameterBase( Parameter *, QtWidgetModel * ); - ~QtWidgetParameterBase() ITK_OVERRIDE; + ~QtWidgetParameterBase() override; void CreateWidget(); + /** Store the state of the check box relative to this parameter + */ + virtual bool IsChecked() const + { + return m_IsChecked; + } + + /** Modify the state of the checkbox relative to this parameter */ + virtual void SetChecked(const bool value) + { + m_IsChecked = value; + } + public slots: void UpdateGUI(); virtual void SetActivationState( bool value ); @@ -77,6 +93,9 @@ private: QtWidgetModel * m_Model; Parameter * m_Param; + + /** Store the status of the checkbox */ + bool m_IsChecked; }; diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetParameterFactory.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetParameterFactory.h index d5ae3f2a4805ef648dc2cb23b26e70639ac6fcb4..729700992e4a1f678539198681cd5e5753b0ca4d 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetParameterFactory.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetParameterFactory.h @@ -21,7 +21,7 @@ #ifndef otbWrapperQtWidgetFactory_h #define otbWrapperQtWidgetFactory_h -#include <QtGui> +#include <QtWidgets> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility #include "itkObject.h" #include "itkObjectFactory.h" @@ -64,7 +64,7 @@ public: protected: QtWidgetParameterFactory(); - ~QtWidgetParameterFactory() ITK_OVERRIDE; + ~QtWidgetParameterFactory() override; private: QtWidgetParameterFactory(const Self&); //purposely not implemented diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetParameterGroup.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetParameterGroup.h index 3e3969739fa821ad30ed26666c5e019e89ea1746..c13d3c9af1bd361a9e10febbc4056dc3323f7ae4 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetParameterGroup.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetParameterGroup.h @@ -21,7 +21,7 @@ #ifndef otbWrapperQtWidgetParameterGroup_h #define otbWrapperQtWidgetParameterGroup_h -#include <QtGui> +#include <QtWidgets> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility #include "otbWrapperParameterGroup.h" #include "otbWrapperRadiusParameter.h" @@ -46,20 +46,20 @@ class OTBQtWidget_EXPORT QtWidgetParameterGroup : public QtWidgetParameterBase Q_OBJECT public: QtWidgetParameterGroup(ParameterGroup::Pointer, QtWidgetModel*); - ~QtWidgetParameterGroup() ITK_OVERRIDE; + ~QtWidgetParameterGroup() override; public slots: - void SetActivationState( bool value ) ITK_OVERRIDE; + void SetActivationState( bool value ) override; private: QtWidgetParameterGroup(const QtWidgetParameterGroup&); //purposely not implemented void operator=(const QtWidgetParameterGroup&); //purposely not implemented - void DoCreateWidget() ITK_OVERRIDE; + void DoCreateWidget() override; - void DoUpdateGUI() ITK_OVERRIDE; + void DoUpdateGUI() override; - virtual void ProcessChild(Parameter * currentNode, bool status); + virtual void ProcessChild(QObject* currentNode, bool status); ParameterGroup::Pointer m_ParamList; diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetParameterLabel.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetParameterLabel.h index bbe31014cb7c9d7d337683bfd58c6d6a79d79783..8e499ea842e91a253898f50a3f3a8ce96a340df9 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetParameterLabel.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetParameterLabel.h @@ -21,7 +21,7 @@ #ifndef otbWrapperQtWidgetParameterLabel_h #define otbWrapperQtWidgetParameterLabel_h -#include <QtGui> +#include <QtWidgets> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility #include "otbWrapperParameter.h" #endif //tag=QT4-boost-compatibility @@ -43,7 +43,7 @@ class OTBQtWidget_EXPORT QtWidgetParameterLabel : public QWidget Q_OBJECT public: QtWidgetParameterLabel(Parameter*); - ~QtWidgetParameterLabel() ITK_OVERRIDE; + ~QtWidgetParameterLabel() override; private: QtWidgetParameterLabel(const QtWidgetParameterLabel&); //purposely not implemented diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetParameterList.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetParameterList.h index 61768297a1677ba29bd4ad8396890551a299d2e0..2dad93b44f3ff3bfb211d9eb894e2629252487e9 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetParameterList.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetParameterList.h @@ -21,7 +21,7 @@ #ifndef otbWrapperQtWidgetParameterList_h #define otbWrapperQtWidgetParameterList_h -#include <QtGui> +#include <QtWidgets> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility # include "otbWrapperQtWidgetParameterBase.h" #endif //tag=QT4-boost-compatibility diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetProgressReport.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetProgressReport.h index 521a109acb13cc041df3acaeab103f1890a8f514..ff301c26196ce77055c6fc0b42dcc3c556ba60b5 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetProgressReport.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetProgressReport.h @@ -21,7 +21,7 @@ #ifndef otbWrapperQtWidgetProgressReport_h #define otbWrapperQtWidgetProgressReport_h -#include <QtGui> +#include <QtWidgets> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility #include "otbWrapperQtWidgetModel.h" #include "itkQtProgressBar.h" @@ -45,7 +45,7 @@ class OTBQtWidget_EXPORT QtWidgetProgressReport : public QWidget Q_OBJECT public: QtWidgetProgressReport(QtWidgetModel * model); - ~QtWidgetProgressReport() ITK_OVERRIDE; + ~QtWidgetProgressReport() override; void SetApplication(Application::Pointer app); diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetRAMParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetRAMParameter.h index eabf78f1e91209cf540e2ef74fc4e3c708059193..c8c6e074128943d77ef706fbb7f4005e6ade40aa 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetRAMParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetRAMParameter.h @@ -21,7 +21,7 @@ #ifndef otbWrapperQtWidgetRAMParameter_h #define otbWrapperQtWidgetRAMParameter_h -#include <QtGui> +#include <QtWidgets> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility #include "otbWrapperRAMParameter.h" #include "otbWrapperQtWidgetParameterBase.h" @@ -43,7 +43,7 @@ class OTBQtWidget_EXPORT QtWidgetRAMParameter : public QtWidgetParameterBase Q_OBJECT public: QtWidgetRAMParameter(RAMParameter*, QtWidgetModel*); - ~QtWidgetRAMParameter() ITK_OVERRIDE; + ~QtWidgetRAMParameter() override; protected slots: void SetValue( int value ); @@ -52,9 +52,9 @@ private: QtWidgetRAMParameter(const QtWidgetRAMParameter&); //purposely not implemented void operator=(const QtWidgetRAMParameter&); //purposely not implemented - void DoCreateWidget() ITK_OVERRIDE; + void DoCreateWidget() override; - void DoUpdateGUI() ITK_OVERRIDE; + void DoUpdateGUI() override; QHBoxLayout * m_QHBoxLayout; QSpinBox * m_QSpinBox; diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetSimpleProgressReport.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetSimpleProgressReport.h index 3f5c4605bf77da04611aa403ed553d6a121015a5..25d705223186d32669b9ca22f0aeb3d08d40bc85 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetSimpleProgressReport.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetSimpleProgressReport.h @@ -21,7 +21,7 @@ #ifndef otbWrapperQtWidgetSimpleProgressReport_h #define otbWrapperQtWidgetSimpleProgressReport_h -#include <QtGui> +#include <QtWidgets> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility #include "otbWrapperQtWidgetModel.h" #include "itkProcessObject.h" @@ -45,7 +45,7 @@ class OTBQtWidget_EXPORT QtWidgetSimpleProgressReport : public QWidget Q_OBJECT public: QtWidgetSimpleProgressReport(QtWidgetModel * model); - ~QtWidgetSimpleProgressReport() ITK_OVERRIDE; + ~QtWidgetSimpleProgressReport() override; void SetApplication(Application::Pointer app); diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetStringParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetStringParameter.h index b639cf379712c9b03566fe832a3b409f535dfd8d..da520b579e7a91887142a8a672e49d3f92df6058 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetStringParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetStringParameter.h @@ -21,7 +21,7 @@ #ifndef otbWrapperQtWidgetStringParameter_h #define otbWrapperQtWidgetStringParameter_h -#include <QtGui> +#include <QtWidgets> #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility #include "otbWrapperStringParameter.h" #include "otbWrapperQtWidgetParameterBase.h" @@ -42,7 +42,7 @@ class OTBQtWidget_EXPORT QtWidgetStringParameter : public QtWidgetParameterBase Q_OBJECT public: QtWidgetStringParameter(StringParameter*, QtWidgetModel*); - ~QtWidgetStringParameter() ITK_OVERRIDE; + ~QtWidgetStringParameter() override; protected slots: void SetValue( const QString& value ); @@ -51,9 +51,9 @@ private: QtWidgetStringParameter(const QtWidgetStringParameter&); //purposely not implemented void operator=(const QtWidgetStringParameter&); //purposely not implemented - void DoCreateWidget() ITK_OVERRIDE; + void DoCreateWidget() override; - void DoUpdateGUI() ITK_OVERRIDE; + void DoUpdateGUI() override; StringParameter::Pointer m_StringParam; QHBoxLayout * m_HLayout; diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetView.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetView.h index 08857a242016ffb592d3005b209d6b2ffbb874fb..42b399d7e52d7e7c4a483a6ebf233159eac929df 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetView.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetView.h @@ -21,76 +21,244 @@ #ifndef otbWrapperQtWidgetView_h #define otbWrapperQtWidgetView_h -#include <QtGui> -#include <QObject> -#include <QShortcut> +#include <QtWidgets> + +// +// OTB includes (sorted by alphabetic order) #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 //tag=QT4-boost-compatibility +#include "otbWrapperApplication.h" #include "otbWrapperQtWidgetModel.h" #endif //tag=QT4-boost-compatibility +#include "OTBQtWidgetExport.h" namespace otb { namespace Wrapper { -/** \class QtWidgetView - * \brief +/*****************************************************************************/ +/* CLASS DEFINITION SECTION */ + +/** + * \class QtWidgetView * * \ingroup OTBQtWidget + * + * \brief WIP. */ -class OTBQtWidget_EXPORT QtWidgetView : public QWidget + +class OTBQtWidget_EXPORT QtWidgetView : + public QWidget { + /*-[ QOBJECT SECTION ]-----------------------------------------------------*/ + Q_OBJECT + + Q_PROPERTY( bool isClosable + READ IsClosable + WRITE SetClosable ); + + /*-[ PUBLIC SECTION ]------------------------------------------------------*/ + +// +// Public methods. public: - QtWidgetView(Application* app); - ~QtWidgetView() ITK_OVERRIDE; + /** + */ + static char const * const OBJECT_NAME; + + /** \brief Constructor. */ + QtWidgetView( const otb::Wrapper::Application::Pointer & otbApp, + QWidget* p =0, + Qt::WindowFlags flags =0 ); + + /** \brief Destructor. */ + ~QtWidgetView() override; + + /** \brief Gui Creation. */ void CreateGui(); - QtWidgetModel* GetModel() + /** \brief Model Accessor */ + inline otb::Wrapper::QtWidgetModel* GetModel() { return m_Model; } + /** + * \return The OTB-application pointer of this view. + */ + //~ otb::Wrapper::Application::ConstPointer GetApplication() const + //~ { + //~ return otb::ConstCast< otb::Wrapper::Application >( + //~ m_Application + //~ ); + //~ } + + /** + */ + inline bool IsClosable() const; + + /*-[ PUBLIC SLOTS SECTION ]------------------------------------------------*/ + +// +// Public SLOTS. public slots: - void CloseSlot(); - void UnhandledException(QString message); - void OnExceptionRaised(QString message); -private slots: - void UpdateMessageAfterExecuteClicked(); - void UpdateMessageAfterExecution(int status); - void UpdateMessageAfterApplicationReady(bool val); + /*-[ SIGNALS SECTION ]-----------------------------------------------------*/ +// +// Signals. signals: void QuitSignal(); + void ExecuteAndWriteOutput(); + void Stop(); + /*-[ PROTECTED SECTION ]---------------------------------------------------*/ + +// +// Protected methods. +protected: + + bool IsRunning(); + + virtual QWidget* CreateInputWidgets(); + + // + // QWidget overloads. + + void closeEvent( QCloseEvent * event ) override; + +// +// Protected attributes. +protected: + + /** Html section for 'Done' icon */ + std::string m_IconPathDone; + + /** Html section for 'Failed' icon */ + std::string m_IconPathFailed; + +protected slots: + + /** + */ + void OnExecButtonClicked(); + + void UnhandledException(QString message); + void OnExceptionRaised( QString what ); + + /*-[ PRIVATE SECTION ]-----------------------------------------------------*/ + +// +// Private methods. private: + QtWidgetView(const QtWidgetView&); //purposely not implemented void operator=(const QtWidgetView&); //purposely not implemented QWidget* CreateFooter(); - QWidget* CreateInputWidgets(); - QWidget* CreateDoc(); - Application::Pointer m_Application; - QtWidgetModel* m_Model; +// +// Private attributes. - QTextEdit *m_LogText; - QTabWidget *m_TabWidget; +private: + + otb::Wrapper::QtWidgetModel* m_Model; QPushButton* m_ExecButton; QPushButton* m_QuitButton; QShortcut* m_QuitShortcut; QLabel* m_Message; + QTextEdit *m_LogText; + QTabWidget *m_TabWidget; + + bool m_IsClosable : 1; + + bool m_IsRunning; + + /*-[ PRIVATE SLOTS SECTION ]-----------------------------------------------*/ + +// +// Slots. +private slots: + void UpdateMessageAfterExecution(int status); + void UpdateMessageAfterApplicationReady(bool val); + + /** + */ + inline void OnProgressReportBegin(); + + /** + */ + inline void OnProgressReportEnd( int status ); + + /** + */ + inline void SetClosable( bool ); + }; +} // end namespace 'Wrapper' +} // end namespace 'otb' + +/*****************************************************************************/ +/* INLINE SECTION */ + +namespace otb +{ + +namespace Wrapper +{ + +/*****************************************************************************/ +inline +bool +QtWidgetView +::IsClosable() const +{ + return m_IsClosable; } + +/*****************************************************************************/ +inline +void +QtWidgetView +::SetClosable( bool enabled ) +{ + m_IsClosable = enabled; + + setEnabled( true ); + + if( m_QuitButton!=NULL ) + m_QuitButton->setEnabled( m_IsClosable ); } +/*******************************************************************************/ +inline +void +QtWidgetView +::OnProgressReportBegin() +{ + SetClosable( false ); +} + +/*******************************************************************************/ +inline +void +QtWidgetView +::OnProgressReportEnd( int ) +{ + SetClosable( true ); +} + +} // end namespace 'Wrapper' + +} // end namespace 'otb' + #endif diff --git a/Modules/Wrappers/QtWidget/otb-module.cmake b/Modules/Wrappers/QtWidget/otb-module.cmake index 45705efe1866dcb7e458fb554bfedc174c354dab..d09a29d36fcd4f05543863ca3354e52956d310ab 100644 --- a/Modules/Wrappers/QtWidget/otb-module.cmake +++ b/Modules/Wrappers/QtWidget/otb-module.cmake @@ -25,7 +25,7 @@ ENABLE_SHARED DEPENDS OTBApplicationEngine OTBITK - OTBQt4 + OTBQt OTBQtAdapters TEST_DEPENDS diff --git a/Modules/Wrappers/QtWidget/src/CMakeLists.txt b/Modules/Wrappers/QtWidget/src/CMakeLists.txt index 28cb58c37691087555171daca7ab833814eed571..a69e06e03b56bec7259fe4ae8984ca915a5f21d4 100644 --- a/Modules/Wrappers/QtWidget/src/CMakeLists.txt +++ b/Modules/Wrappers/QtWidget/src/CMakeLists.txt @@ -57,6 +57,7 @@ set(OTBQtWidget_SRC otbWrapperQtWidgetListEditWidget.cxx otbWrapperQtWidgetListEditItemModel.cxx otbWrapperQtWidgetParameterList.cxx + otbWrapperQtWidgetBoolParameter.cxx ) set(OTBQtWidget_MOC_HDR @@ -97,14 +98,15 @@ set(OTBQtWidget_MOC_HDR ../include/otbWrapperQtWidgetListEditWidget.h ../include/otbWrapperQtWidgetListEditItemModel.h ../include/otbWrapperQtWidgetParameterList.h + ../include/otbWrapperQtWidgetBoolParameter.h ) set( OTBQtWidget_FORMS otbWrapperQtWidgetListEditWidget.ui ) -qt4_wrap_cpp( OTBQtWidget_MOC_SRC ${OTBQtWidget_MOC_HDR} ) -qt4_wrap_ui( OTBQtWidget_FORMS_HEADERS ${OTBQtWidget_FORMS} ) +qt5_wrap_cpp( OTBQtWidget_MOC_SRC ${OTBQtWidget_MOC_HDR} ) +qt5_wrap_ui( OTBQtWidget_FORMS_HEADERS ${OTBQtWidget_FORMS} ) add_library( OTBQtWidget ${OTBQtWidget_SRC} @@ -114,7 +116,7 @@ add_library( OTBQtWidget target_link_libraries( OTBQtWidget ${OTBApplicationEngine_LIBRARIES} - ${OTBQt4_LIBRARIES} + ${OTBQt_LIBRARIES} ${OTBQtAdapters_LIBRARIES} ) @@ -124,7 +126,7 @@ add_executable(otbApplicationLauncherQt otbApplicationLauncherQt.cxx) target_link_libraries(otbApplicationLauncherQt ${OTBQtWidget_LIBRARIES} ${OTBApplicationEngine_LIBRARIES} - ${OTBQt4_LIBRARIES} + ${OTBQt_LIBRARIES} ) otb_module_target(otbApplicationLauncherQt) set_linker_stack_size_flag(otbApplicationLauncherQt 10000000) diff --git a/Modules/Wrappers/QtWidget/src/otbApplicationLauncherQt.cxx b/Modules/Wrappers/QtWidget/src/otbApplicationLauncherQt.cxx index 5b4225f479ec6bf70e325f9643b09bcd3ca016fe..529ce721f9c19c152adcfdc18f3b23453799c7d7 100644 --- a/Modules/Wrappers/QtWidget/src/otbApplicationLauncherQt.cxx +++ b/Modules/Wrappers/QtWidget/src/otbApplicationLauncherQt.cxx @@ -18,7 +18,7 @@ * limitations under the License. */ -#include <QtGui> +#include <QtWidgets> #include "otbWrapperApplicationRegistry.h" #include "otbWrapperQtWidgetView.h" #include "otbWrapperQtWidgetSimpleProgressReport.h" @@ -36,9 +36,11 @@ int main(int argc, char* argv[]) { // Handle UTF-8 filenames QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8")); - QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); - QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8")); - + /*/////////////////////////////// Warning ////////////////////// + we need to replace those lines with a function of Qt5 + // QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); + // QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8")); + //////////////////////////////////////////////////////////////////*/ QtApplication qtApp(argc, argv); if (argc < 2) diff --git a/Modules/Wrappers/QtWidget/src/otbQtApplication.cxx b/Modules/Wrappers/QtWidget/src/otbQtApplication.cxx index 6e4d60d92759ec96b4a23130c515ff352f99bc9f..40db99f6b6e483b6c860b6ea9f4cb3a56658038d 100644 --- a/Modules/Wrappers/QtWidget/src/otbQtApplication.cxx +++ b/Modules/Wrappers/QtWidget/src/otbQtApplication.cxx @@ -28,7 +28,7 @@ namespace Wrapper QtApplication::QtApplication(int& argcc, char** argvv) : QApplication(argcc, argvv) { - + std::cout<<QApplication::font().defaultFamily().toStdString()<<std::endl; } bool diff --git a/Modules/Wrappers/QtWidget/src/otbQtFileSelectionWidget.cxx b/Modules/Wrappers/QtWidget/src/otbQtFileSelectionWidget.cxx index 44eb911061301a5c3373857794a037ac2059f088..f13ea01d81f2360c9fbe6520728122dc8af68e3e 100644 --- a/Modules/Wrappers/QtWidget/src/otbQtFileSelectionWidget.cxx +++ b/Modules/Wrappers/QtWidget/src/otbQtFileSelectionWidget.cxx @@ -98,14 +98,14 @@ QtFileSelectionWidget QString filename( m_IOMode == IO_MODE_INPUT - ? GetOpenFileName( + ? otb::GetOpenFilename( this, QString(), m_Input->text(), tr( "All files (*)" ), NULL, QFileDialog::ReadOnly ) - : GetSaveFileName( + : otb::GetSaveFilename( this, QString(), m_Input->text(), diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetBoolParameter.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetBoolParameter.cxx new file mode 100644 index 0000000000000000000000000000000000000000..effe1fc5633d5541681928e1a2ce3f6667442129 --- /dev/null +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetBoolParameter.cxx @@ -0,0 +1,95 @@ +/* + * 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 "otbWrapperQtWidgetBoolParameter.h" + +namespace otb +{ +namespace Wrapper +{ + +QtWidgetBoolParameter::QtWidgetBoolParameter(BoolParameter* boolParam, QtWidgetModel* m) + : QtWidgetParameterBase(boolParam, m) +{ +} + +QtWidgetBoolParameter::~QtWidgetBoolParameter() +{ +} + +void QtWidgetBoolParameter::SetValue( bool value ) +{ + BoolParameter* paramDown = dynamic_cast<BoolParameter*>(this->GetParam()); + assert(paramDown && "Not a BoolParameter"); + if (paramDown->GetValue() != value) + { + paramDown->SetValue(value); + + QString key( paramDown->GetKey() ); + emit ParameterChanged(key); + } +} + +void QtWidgetBoolParameter::DoUpdateGUI() +{ + BoolParameter* paramDown = dynamic_cast<BoolParameter*>(this->GetParam()); + assert(paramDown && "Not a BoolParameter"); + if (paramDown->GetValue() != m_Button->isChecked()) + { + m_Button->setChecked(paramDown->GetValue()); + } + QString buttonText(paramDown->GetValue()?"On":"Off"); + if (m_Button->text() != buttonText) + { + m_Button->setText(buttonText); + } +} + +void QtWidgetBoolParameter::DoCreateWidget() +{ + QHBoxLayout *hLayout = new QHBoxLayout; + hLayout->setSpacing(0); + hLayout->setContentsMargins(0, 0, 0, 0); + + m_Button = new QToolButton; + m_Button->setCheckable(true); + BoolParameter* paramDown = dynamic_cast<BoolParameter*>(this->GetParam()); + assert(paramDown && "Not a BoolParameter"); + if (paramDown->GetValue()) + { + m_Button->setText("On"); + m_Button->setChecked(true); + } + else + { + m_Button->setText("Off"); + } + + connect( m_Button, SIGNAL(toggled(bool)), this, SLOT(SetValue(bool)) ); + connect( m_Button, SIGNAL(toggled(bool)), GetModel(), SLOT(NotifyUpdate()) ); + + hLayout->addWidget(m_Button); + hLayout->addStretch(); + + this->setLayout(hLayout); +} + +} +} diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetComplexInputImageParameter.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetComplexInputImageParameter.cxx index 198b4a4929706fff9a83aeb9451bb644edcc5b96..c497430f277d2e087cb4a46cf8507ee809f7d7b9 100644 --- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetComplexInputImageParameter.cxx +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetComplexInputImageParameter.cxx @@ -86,7 +86,7 @@ QtWidgetComplexInputImageParameter assert( m_Input!=NULL ); QString filename( - GetOpenFileName( + otb::GetOpenFilename( this, QString(), m_Input->text(), diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetComplexOutputImageParameter.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetComplexOutputImageParameter.cxx index 0cd5800dfa462ba05af6123a247ca48c15d29d78..9e670fa0e3f5ceb8806ef25144f064570288bcf6 100644 --- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetComplexOutputImageParameter.cxx +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetComplexOutputImageParameter.cxx @@ -67,6 +67,8 @@ void QtWidgetComplexOutputImageParameter::DoCreateWidget() // Set the Output PixelType choice Combobox m_ComboBox = new QComboBox; m_ComboBox->setToolTip("Complex Output Pixel Type"); + m_ComboBox->addItem( "cint16"); + m_ComboBox->addItem( "cint32"); m_ComboBox->addItem( "cfloat"); m_ComboBox->addItem( "cdouble"); m_ComboBox->setCurrentIndex(m_OutputImageParam->GetComplexPixelType()); @@ -93,7 +95,7 @@ QtWidgetComplexOutputImageParameter assert( m_Input!=NULL ); QString filename( - GetSaveFileName( + otb::GetSaveFilename( this, QString(), m_Input->text(), diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputFilenameParameter.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputFilenameParameter.cxx index 93011f37eb41736daf76cd063b5bdac4ff44fca5..d7e766a004048a306f8bac932a1b56b0a095a7b0 100644 --- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputFilenameParameter.cxx +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputFilenameParameter.cxx @@ -88,7 +88,7 @@ QtWidgetInputFilenameParameter assert( m_Input!=NULL ); QString filename( - GetOpenFileName( + otb::GetOpenFilename( this, QString(), m_Input->text(), diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputImageParameter.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputImageParameter.cxx index 8f9873bbbd81fcc3023d54899d0ec5e92cf32229..776c51897f869ce72d7292fede3de817297b33ce 100644 --- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputImageParameter.cxx +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputImageParameter.cxx @@ -96,7 +96,7 @@ QtWidgetInputImageParameter assert( m_Input!=NULL ); QString filename( - GetOpenFileName( + otb::GetOpenFilename( this, QString(), m_Input->text(), diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputProcessXMLParameter.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputProcessXMLParameter.cxx index 9229d584f77997a4764941f5a4cccbcc54d6810a..095232c8320076f1ac3489d0ebf4f1fe38f510d2 100644 --- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputProcessXMLParameter.cxx +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputProcessXMLParameter.cxx @@ -87,7 +87,7 @@ QtWidgetInputProcessXMLParameter assert( m_Input!=NULL ); QString filename( - GetOpenFileName( + otb::GetOpenFilename( this, QString(), m_Input->text(), diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputVectorDataParameter.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputVectorDataParameter.cxx index 26c6e54af87acfacc9f65b531cd6b10b703de3f9..d5956e3367c06d140b842156195fba110ee54701 100644 --- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputVectorDataParameter.cxx +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputVectorDataParameter.cxx @@ -88,7 +88,7 @@ QtWidgetInputVectorDataParameter assert( m_Input!=NULL ); QString filename( - GetOpenFileName( + otb::GetOpenFilename( this, QString(), m_Input->text(), diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetListEditWidget.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetListEditWidget.cxx index f2b1524dc9a3f080e8dfd18a02ada040db381ea7..ded59cba2dbb3fc2f94b24f2e4f3717f1e380285 100644 --- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetListEditWidget.cxx +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetListEditWidget.cxx @@ -257,7 +257,7 @@ ListEditWidget { if (multi) { - output = GetOpenFileNames( + output = otb::GetOpenFilenames( this, tr( "Select input filename..." ), filePath, @@ -268,7 +268,7 @@ ListEditWidget else { output.push_back( - GetOpenFileName( + otb::GetOpenFilename( this, tr( "Select input filename..." ), filePath, @@ -281,7 +281,7 @@ ListEditWidget else { output.push_back( - GetSaveFileName( + otb::GetSaveFilename( this, tr( "Select output filename..." ), filePath, diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetModel.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetModel.cxx index a0d61138d72e424fd282b89c1daeb9da67bb9fe6..d19102fa8fe5bd21479caf4724941c7da5fd130a 100644 --- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetModel.cxx +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetModel.cxx @@ -200,7 +200,7 @@ QtWidgetModel } // launch the output image writing - AppliThread * taskAppli = new AppliThread( m_Application ); + AppliThread *taskAppli = new AppliThread( m_Application ); QObject::connect( taskAppli, @@ -225,10 +225,19 @@ QtWidgetModel SLOT( deleteLater() ) ); + QObject::connect( + this, + SIGNAL( Stop() ), + taskAppli, + SLOT( Stop() ) + ); + // Tell the Progress Reporter to begin emit SetProgressReportBegin(); taskAppli->Execute(); + + emit SetApplicationReady(true); } void @@ -322,6 +331,10 @@ AppliThread m_Application->GetLogger()->Fatal(string("Cannot open image ") + err.m_Filename + string(". ") + err.GetDescription() + string("\n")); emit ExceptionRaised( err.what() ); } + catch(itk::ProcessAborted& /*err*/) + { + m_Application->GetLogger()->Info("Processing aborted\n"); + } catch(itk::ExceptionObject& err) { m_Application->GetLogger()->Debug("Caught itk::ExceptionObject during application execution:\n"); diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetOutputFilenameParameter.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetOutputFilenameParameter.cxx index 4f395262c43dd1ab3dc85c1bcf5f4ccdd315b298..ac68fffa02650ccd6e8552223e5a677d079d0ef2 100644 --- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetOutputFilenameParameter.cxx +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetOutputFilenameParameter.cxx @@ -83,7 +83,7 @@ QtWidgetOutputFilenameParameter assert( m_Input!=NULL ); QString filename( - GetSaveFileName( + otb::GetSaveFilename( this, QString(), m_Input->text(), diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetOutputImageParameter.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetOutputImageParameter.cxx index 140ff6534f8487f97bbda7d0a99fc49128401843..1f65c3e75f7a2cb78d97333e789dffba4ba1eba9 100644 --- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetOutputImageParameter.cxx +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetOutputImageParameter.cxx @@ -75,6 +75,10 @@ void QtWidgetOutputImageParameter::DoCreateWidget() m_ComboBox->addItem( "uint 32"); m_ComboBox->addItem( "float"); m_ComboBox->addItem( "double"); + m_ComboBox->addItem( "cint16"); + m_ComboBox->addItem( "cint32"); + m_ComboBox->addItem( "cfloat"); + m_ComboBox->addItem( "cdouble"); m_ComboBox->setCurrentIndex(m_OutputImageParam->GetPixelType()); connect( m_ComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(SetPixelType(int)) ); connect( m_ComboBox, SIGNAL(currentIndexChanged(int)), GetModel(), SLOT(NotifyUpdate()) ); @@ -98,7 +102,7 @@ QtWidgetOutputImageParameter assert( m_Input!=NULL ); QString filename( - GetSaveFileName( + otb::GetSaveFilename( this, QString(), m_Input->text(), diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetOutputProcessXMLParameter.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetOutputProcessXMLParameter.cxx index 324fa4e10a57d6c9432ac4cf1a2e62d99e07f107..78265698ccbab8bdceb60a2c9155164e22f95a91 100644 --- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetOutputProcessXMLParameter.cxx +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetOutputProcessXMLParameter.cxx @@ -82,7 +82,7 @@ QtWidgetOutputProcessXMLParameter assert( m_Input!=NULL ); QString filename( - GetSaveFileName( + otb::GetSaveFilename( this, QString(), m_Input->text(), diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetOutputVectorDataParameter.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetOutputVectorDataParameter.cxx index 62c06044a1decaa9f28b12a3af67b4a63f3b16b0..318c0bd3fcc3b28142adac02ba01fdc3203a9f5f 100644 --- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetOutputVectorDataParameter.cxx +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetOutputVectorDataParameter.cxx @@ -78,7 +78,7 @@ QtWidgetOutputVectorDataParameter assert( m_Input!=NULL ); QString filename( - GetSaveFileName( + otb::GetSaveFilename( this, QString(), m_Input->text(), diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetParameterBase.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetParameterBase.cxx index eb44e1a4ee8eca304b95e7e52f11a185c2560c0a..86789e4197d67cdf0848b673b9a4508740e4949b 100644 --- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetParameterBase.cxx +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetParameterBase.cxx @@ -26,7 +26,9 @@ namespace Wrapper { QtWidgetParameterBase::QtWidgetParameterBase(Parameter * param, QtWidgetModel* m) - : m_Model(m), m_Param(param) + : m_Model(m) + , m_Param(param) + , m_IsChecked( false ) { } @@ -89,7 +91,7 @@ void QtWidgetParameterBase::SetActivationState( bool value ) } this->setEnabled(value); - m_Param->SetChecked(value); + this->SetChecked(value); m_Param->SetActive(value); } diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetParameterFactory.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetParameterFactory.cxx index 89763c423741832b3c1e21f21ef144ff85690a22..f675050e2347ecbfea6604ee8bdbda458d5f08f3 100644 --- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetParameterFactory.cxx +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetParameterFactory.cxx @@ -50,6 +50,7 @@ #include "otbWrapperQtWidgetRAMParameter.h" #include "otbWrapperQtWidgetStringParameter.h" #include "otbWrapperQtWidgetStringListParameter.h" +#include "otbWrapperQtWidgetBoolParameter.h" namespace otb @@ -123,7 +124,7 @@ QtWidgetParameterFactory::CreateQtWidget( Parameter* param, QtWidgetModel* model CREATEWIDGET(InputVectorDataParameter, QtWidgetInputVectorDataParameter) CREATEWIDGET(OutputImageParameter, QtWidgetOutputImageParameter) CREATEWIDGET(OutputVectorDataParameter, QtWidgetOutputVectorDataParameter) - CREATEWIDGET(EmptyParameter, QtWidgetEmptyParameter) + CREATEWIDGET(BoolParameter, QtWidgetBoolParameter) CREATEWIDGET(ParameterGroup, QtWidgetParameterGroup) CREATEWIDGET(RAMParameter, QtWidgetRAMParameter) CREATEWIDGET(OutputProcessXMLParameter, QtWidgetOutputProcessXMLParameter) diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetParameterGroup.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetParameterGroup.cxx index 12af047e282ec56f150656711ba4086c238ea647..b9ba4673cb1049c6ebccfced5e5e13774f5fbdba 100644 --- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetParameterGroup.cxx +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetParameterGroup.cxx @@ -141,10 +141,10 @@ void QtWidgetParameterGroup::DoCreateWidget() group->setChecked(false); // Update iteratively the children status - for (unsigned int idx = 0; idx < param->GetChildrenList().size(); ++idx) + for (auto child : specificWidget->children()) { // deactivate the children tree - this->ProcessChild(param->GetChildrenList()[idx], false); + this->ProcessChild(child, false); } } else @@ -176,33 +176,35 @@ void QtWidgetParameterGroup::SetActivationState( bool value ) this->setEnabled(value); // Update iteratively the children status - for (unsigned int idx = 0; idx < m_ParamList->GetChildrenList().size(); ++idx) + for (auto child : this->children() ) { - this->ProcessChild(m_ParamList->GetChildrenList()[idx], value); + this->ProcessChild(child, value); } } // Activate iteratively the children -void QtWidgetParameterGroup::ProcessChild(Parameter* currentNode, bool status) +void QtWidgetParameterGroup::ProcessChild(QObject* currentNode, bool status) { // Activate the current node if it was checked - if ( currentNode->IsChecked() && status) + QtWidgetParameterBase* widgetBase = dynamic_cast<QtWidgetParameterBase*>(currentNode); + if(widgetBase) { - currentNode->SetActive(status); - } + if ( widgetBase->IsChecked() && status) + { + widgetBase->GetParam()->SetActive(status); + } - // If the status is false (deactivating) deactivate all the children - // tree - if (!status) - { - currentNode->SetActive(status); + // If the status is false (deactivating) deactivate all the children + // tree + if (!status) + { + widgetBase->GetParam()->SetActive(status); + } } - unsigned int counter = 0; - while(counter < currentNode->GetChildrenList().size()) + for (auto child : currentNode->children() ) { - this->ProcessChild(currentNode->GetChildrenList()[counter], status); - ++counter; + this->ProcessChild(child, status); } } diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetStringListParameter.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetStringListParameter.cxx index 60a9073ae2d41215e8d3a387edb616c7994359cc..b358491f83774f47cf16ef8af8df45476fb9e2ae 100644 --- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetStringListParameter.cxx +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetStringListParameter.cxx @@ -71,7 +71,7 @@ QtWidgetStringListParameter::UpdateStringList() void QtWidgetStringListParameter::SetString(const QString& value) { - m_StringListParam->AddString(value.toAscii().constData()); + m_StringListParam->AddString(value.toLatin1().constData()); m_StringListParam->SetUserValue(true); QString key( m_StringListParam->GetKey() ); emit ParameterChanged(key); diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetStringParameter.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetStringParameter.cxx index 54ffc7f82f1b0c2281bc77008d5e10684ae20b46..1485f8ef9655012a15d8b2c3876e11ba43cdd749 100644 --- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetStringParameter.cxx +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetStringParameter.cxx @@ -75,7 +75,7 @@ void QtWidgetStringParameter::DoCreateWidget() void QtWidgetStringParameter::SetValue(const QString& value) { - m_StringParam->SetValue(value.toAscii().constData()); + m_StringParam->SetValue(value.toLatin1().constData()); // notify of value change QString key( m_StringParam->GetKey() ); emit ParameterChanged(key); diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetView.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetView.cxx index 39c9d80bd4f84283c9878a6c985404ad9e37dfaa..f689d59d81183f5c54173b29afdd2307403c1bbe 100644 --- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetView.cxx +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetView.cxx @@ -20,31 +20,77 @@ #include "otbWrapperQtWidgetView.h" +#include <functional> + #include "otbWrapperQtWidgetParameterGroup.h" #include "otbWrapperQtWidgetParameterFactory.h" -#include "otbWrapperQtWidgetProgressReport.h" -#include "otbWrapperOutputImageParameter.h" -#include "otbWrapperChoiceParameter.h" -#include "otbWrapperQtWidgetSimpleProgressReport.h" #include "otbWrapperApplicationHtmlDocGenerator.h" - -#include "itksys/SystemTools.hxx" - +#include "otbWrapperOutputFilenameParameter.h" +#include "otbWrapperOutputVectorDataParameter.h" +#include "otbWrapperQtWidgetSimpleProgressReport.h" namespace otb { namespace Wrapper { - -QtWidgetView::QtWidgetView(Application* app) +/* + TRANSLATOR mvd::Wrapper::QtWidgetView + + Necessary for lupdate to be aware of C++ namespaces. + + Context comment for translator. +*/ + +/*****************************************************************************/ +/* CONSTANTS */ + +char const * const +QtWidgetView +::OBJECT_NAME = "otb::Wrapper::QtWidgetView"; + +/*****************************************************************************/ +/* CLASS IMPLEMENTATION SECTION */ +/*****************************************************************************/ +QtWidgetView::QtWidgetView( const otb::Wrapper::Application::Pointer & otbApp, + QWidget* p, + Qt::WindowFlags flags ) : + QWidget( p, flags ), + m_IconPathDone(""), + m_IconPathFailed(""), + m_Model( NULL ), + m_ExecButton( NULL ), + m_QuitButton( NULL ), + m_Message( NULL ), + m_LogText( NULL ), + m_TabWidget( NULL ), + m_IsClosable( true ), + m_IsRunning(false) { - m_Model = new QtWidgetModel(app); - m_Application = app; + setObjectName( QtWidgetView::OBJECT_NAME ); + + m_Model = new otb::Wrapper::QtWidgetModel( otbApp ); + m_QuitShortcut = new QShortcut(QKeySequence("Ctrl+Q"), this); + + QObject::connect( + m_Model, SIGNAL( SetProgressReportBegin() ), + this, SLOT( OnProgressReportBegin() ) + ); + + QObject::connect( + m_Model, SIGNAL( SetProgressReportDone( int ) ), + this, SLOT( OnProgressReportEnd( int ) ) + ); + + QObject::connect( + m_Model, SIGNAL( ExceptionRaised( QString ) ), + this, SLOT( OnExceptionRaised( QString ) ) + ); } QtWidgetView::~QtWidgetView() { delete m_Model; + m_Model = NULL; } void QtWidgetView::CreateGui() @@ -53,71 +99,74 @@ void QtWidgetView::CreateGui() QVBoxLayout *mainLayout = new QVBoxLayout(); m_TabWidget = new QTabWidget(); - m_TabWidget->addTab(CreateInputWidgets(), "Parameters"); + m_TabWidget->addTab(CreateInputWidgets(), tr("Parameters")); m_LogText = new QTextEdit(); connect( m_Model->GetLogOutput(), SIGNAL(NewContentLog(QString)), m_LogText, SLOT(append(QString) ) ); - m_TabWidget->addTab(m_LogText, "Logs"); - QtWidgetProgressReport* prog = new QtWidgetProgressReport(m_Model); - prog->SetApplication(m_Application); - m_TabWidget->addTab(prog, "Progress"); - m_TabWidget->addTab(CreateDoc(), "Documentation"); + m_TabWidget->addTab(m_LogText, tr("Logs")); + m_TabWidget->addTab(CreateDoc(), tr("Documentation")); mainLayout->addWidget(m_TabWidget); - m_Message = new QLabel("<center><font color=\"#FF0000\">Select parameters</font></center>"); - connect( m_Model, SIGNAL(SetApplicationReady(bool)), this, SLOT(UpdateMessageAfterApplicationReady(bool)) ); + m_Message = new QLabel("<center><font color=\"#FF0000\">"+tr("Select parameters")+"</font></center>"); + connect( m_Model, SIGNAL(SetApplicationReady(bool)), this, SLOT( UpdateMessageAfterApplicationReady(bool)) ); connect( m_Model, SIGNAL(SetProgressReportDone(int)), this, SLOT(UpdateMessageAfterExecution(int)) ); mainLayout->addWidget(m_Message); - QtWidgetSimpleProgressReport * progressReport = new QtWidgetSimpleProgressReport(m_Model); - progressReport->SetApplication(m_Application); + otb::Wrapper::QtWidgetSimpleProgressReport * progressReport = new otb::Wrapper::QtWidgetSimpleProgressReport(m_Model); + progressReport->SetApplication(m_Model->GetApplication()); + QWidget* footer = CreateFooter(); + QHBoxLayout *footLayout = new QHBoxLayout; footLayout->addWidget(progressReport); - footLayout->addWidget(CreateFooter()); + footLayout->addWidget(footer); mainLayout->addLayout(footLayout); + footLayout->setAlignment(footer, Qt::AlignBottom); + QGroupBox *mainGroup = new QGroupBox(); mainGroup->setLayout(mainLayout); QVBoxLayout *finalLayout = new QVBoxLayout(); finalLayout->addWidget(mainGroup); - connect( m_Model, SIGNAL(ExceptionRaised(QString)), this, SLOT(OnExceptionRaised(QString)) ); - // Make the final layout to the widget this->setLayout(finalLayout); } -void QtWidgetView::UpdateMessageAfterExecuteClicked() -{ - m_Message->setText("<center><font color=\"#FF0000\">Running</font></center>"); -} - void QtWidgetView::UpdateMessageAfterExecution(int status) { if (status >= 0) { - m_Message->setText("<center><font color=\"#00A000\">Done</font></center>"); + m_Message->setText("<center>"+QString(m_IconPathDone.c_str())+ + "<font color=\"#00A000\">"+tr("Done")+"</font></center>"); } else { - m_Message->setText("<center><font color=\"#FF0000\">Failed</font></center>"); + m_Message->setText("<center>"+QString(m_IconPathFailed.c_str())+ + "<font color=\"#FF0000\">"+tr("Failed")+"</font></center>"); } + m_ExecButton->setText(QObject::tr("Execute")); + m_IsRunning = false; } void QtWidgetView::UpdateMessageAfterApplicationReady( bool val ) { - if(val == true) - m_Message->setText("<center><font color=\"#00A000\">Ready to run</font></center>"); - else - m_Message->setText("<center><font color=\"#FF0000\">Select parameters</font></center>"); + if(!m_IsRunning) + { + if(val == true) + m_Message->setText("<center><font color=\"#00A000\">"+tr("Ready to run")+"</font></center>"); + else + m_Message->setText("<center><font color=\"#FF0000\">"+tr("Select parameters")+"</font></center>"); + } } QWidget* QtWidgetView::CreateInputWidgets() { QScrollArea *scrollArea = new QScrollArea; - // Put the main group inside a scroll area - scrollArea->setWidget(QtWidgetParameterFactory::CreateQtWidget(m_Model->GetApplication()->GetParameterList(), m_Model)); + + scrollArea->setWidget( otb::Wrapper::QtWidgetParameterFactory::CreateQtWidget( + m_Model->GetApplication()->GetParameterList(), + m_Model)); scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); scrollArea->setWidgetResizable(true); @@ -131,7 +180,7 @@ QWidget* QtWidgetView::CreateFooter() // an HLayout with two buttons : Execute and Quit QGroupBox *footerGroup = new QGroupBox; QHBoxLayout *footerLayout = new QHBoxLayout; - + footerGroup->setFixedHeight(40); footerGroup->setContentsMargins(0, 0, 0, 0); footerLayout->setContentsMargins(5, 5, 5, 5); @@ -140,17 +189,17 @@ QWidget* QtWidgetView::CreateFooter() m_ExecButton->setDefault(true); m_ExecButton->setEnabled(false); m_ExecButton->setText(QObject::tr("Execute")); - connect( m_ExecButton, SIGNAL(clicked()), m_Model, SLOT(ExecuteAndWriteOutputSlot() ) ); - connect( m_Model, SIGNAL(SetApplicationReady(bool)), m_ExecButton, SLOT(setEnabled(bool)) ); - connect( m_ExecButton, SIGNAL(clicked()), this, SLOT(UpdateMessageAfterExecuteClicked() ) ); + connect( m_Model, SIGNAL( SetApplicationReady( bool ) ), m_ExecButton, SLOT( setEnabled( bool ) )); + QObject::connect( m_ExecButton, SIGNAL( clicked() ), this, SLOT( OnExecButtonClicked() )); + QObject::connect( this, SIGNAL( ExecuteAndWriteOutput() ), m_Model, SLOT( ExecuteAndWriteOutputSlot() )); + QObject::connect( this, SIGNAL( Stop() ), m_Model, SIGNAL( Stop() )); m_QuitButton = new QPushButton(footerGroup); m_QuitButton->setText(QObject::tr("Quit")); - connect( m_QuitButton, SIGNAL(clicked()), this, SLOT(CloseSlot()) ); + connect(m_QuitButton, SIGNAL( clicked() ), this, SLOT( close() )); // Add Ctrl-Q shortcut to quit - m_QuitShortcut = new QShortcut(QKeySequence("Ctrl+Q"), this); - connect( m_QuitShortcut, SIGNAL(activated()), this, SLOT(CloseSlot()) ); + connect( m_QuitShortcut, SIGNAL(activated()), this, SLOT(close()) ); // Put the buttons on the right footerLayout->addStretch(); @@ -170,7 +219,7 @@ QWidget* QtWidgetView::CreateDoc() QTextDocument * doc = new QTextDocument(); std::string docContain; - ApplicationHtmlDocGenerator::GenerateDoc( m_Application, docContain, true); + otb::Wrapper::ApplicationHtmlDocGenerator::GenerateDoc( GetModel()->GetApplication(), docContain); doc->setHtml(docContain.c_str()); @@ -179,13 +228,49 @@ QWidget* QtWidgetView::CreateDoc() return text; } -void QtWidgetView::CloseSlot() +void QtWidgetView::closeEvent( QCloseEvent * e ) { - // Close the widget - this->close(); + assert( e!=NULL ); + + if( !IsClosable() ) + { + assert( GetModel()->GetApplication() ); + + QMessageBox::warning( + this, + tr( "Warning!" ), + tr( "OTB-Application '%1' cannot be closed while running!") + .arg( GetModel()->GetApplication()->GetDocName() ) + ); + + e->ignore(); + + return; + } + + QWidget::closeEvent( e ); - // Emit a signal to close any widget that this gui belonging to emit QuitSignal(); + + deleteLater(); +} + +void +QtWidgetView +::OnExecButtonClicked() +{ + if (m_IsRunning) + { + m_Message->setText("<center><font color=\"#FF0000\">"+tr("Cancelling")+"...</font></center>"); + emit Stop(); + } + else + { + m_IsRunning = true; + m_Message->setText("<center><font color=\"#FF0000\">"+tr("Running")+"</font></center>"); + m_ExecButton->setText(QObject::tr("Cancel")); + emit ExecuteAndWriteOutput(); + } } void QtWidgetView::UnhandledException(QString message) @@ -194,10 +279,16 @@ void QtWidgetView::UnhandledException(QString message) m_LogText->append(message); } -void QtWidgetView::OnExceptionRaised(QString /*message*/) +void QtWidgetView::OnExceptionRaised( QString /*message*/) { m_TabWidget->setCurrentIndex(1); } +bool QtWidgetView::IsRunning() +{ + return m_IsRunning; } -} + +} // end of namespace Wrapper +} // end of namespace otb + diff --git a/Modules/Wrappers/QtWidget/test/otbWrapperQtWidgetParameterFactory.cxx b/Modules/Wrappers/QtWidget/test/otbWrapperQtWidgetParameterFactory.cxx index 9ff2a0eea24d0fd3e4311cbf79ad482d67c124fa..e830bd13244a2de97a1a78603eab13247ae38c9f 100644 --- a/Modules/Wrappers/QtWidget/test/otbWrapperQtWidgetParameterFactory.cxx +++ b/Modules/Wrappers/QtWidget/test/otbWrapperQtWidgetParameterFactory.cxx @@ -54,19 +54,19 @@ protected: { } - ~StubApplication() ITK_OVERRIDE + ~StubApplication() override { } - void DoInit() ITK_OVERRIDE + void DoInit() override { } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { } }; diff --git a/Modules/Wrappers/QtWidget/test/otbWrapperQtWidgetShowWidget.cxx b/Modules/Wrappers/QtWidget/test/otbWrapperQtWidgetShowWidget.cxx index 701cbc78381f4a82f81323dd97053097b2e1dd4b..5d3eed199faa970a5b1819e7f8f33c7af0e00145 100644 --- a/Modules/Wrappers/QtWidget/test/otbWrapperQtWidgetShowWidget.cxx +++ b/Modules/Wrappers/QtWidget/test/otbWrapperQtWidgetShowWidget.cxx @@ -19,7 +19,7 @@ */ -#include <QtGui> +#include <QtWidgets> #include "otbWrapperApplicationRegistry.h" #include "otbWrapperQtWidgetView.h" #include "otbWrapperQtWidgetProgressReport.h" diff --git a/Modules/Wrappers/SWIG/src/itkBase.i b/Modules/Wrappers/SWIG/src/itkBase.i index 2a15719f26f03106b4bb599ac0161931bb0636a7..f2ae37cc3d9dbf5268026f9e22508921a2946332 100644 --- a/Modules/Wrappers/SWIG/src/itkBase.i +++ b/Modules/Wrappers/SWIG/src/itkBase.i @@ -44,13 +44,194 @@ } } +// BASIC ITK TYPES WRAPPING +%include "itkFloatTypes.h" +%include "itkIntTypes.h" + // Some code from STL // Do not wrap if not necessary as it really slows down compilation %include <std_string.i> %include <std_vector.i> +%include <std_map.i> +#if SWIGPYTHON +%include <std_complex.i> +#endif + +%template(vectorstring) std::vector< std::string >; +%template(mapstringstring) std::map< std::string, std::string >; +%template(vectorbool) std::vector<bool>; +%template(vectordouble) std::vector<double>; + +#if SWIGPYTHON +%extend std::map< std::string, std::string > +{ + %pythoncode + { + def __str__(self): + ret = "{" + for key in self: + ret += str(key)+":"+str(self[key])+", " + if len(ret) == 1: + ret += ", " + return ret[:-2]+"}" + } +}; +#endif + +//---------------- ITK classes ------------------------------------ + +namespace itk +{ + +template <unsigned int VDim = 2> +class Size +{ +public: + Size(); + ~Size(); + void Fill(unsigned long val); + SizeValueType GetElement(unsigned long element) const; + void SetElement(unsigned long element, SizeValueType val); + static unsigned int GetSizeDimension(); +}; + +template <unsigned int VDim = 2> +class Index +{ +public: + Index(); + ~Index(); + void Fill(signed long val); + IndexValueType GetElement(unsigned long element) const; + void SetElement(unsigned long element, IndexValueType val); + static unsigned int GetIndexDimension(); +}; + +template <unsigned int VDim> +class ImageRegion +{ +public: + ImageRegion(); + ImageRegion(const Index<VDim> &index, const Size<VDim> &size); + ~ImageRegion(); + void SetIndex(const Index<VDim> &index); + void SetSize(const Size<VDim> &size); + void SetUpperIndex(const Index<VDim> &idx); + Index<VDim> GetUpperIndex() const; + const Index<VDim> & GetIndex() const; + const Size<VDim> & GetSize() const; + bool IsInside(const Index<VDim> & index) const; + void SetSize(unsigned int i, SizeValueType val); + SizeValueType GetSize(unsigned int i) const; + void SetIndex(unsigned int i, IndexValueType val); + IndexValueType GetIndex(unsigned int i) const; +}; + +template <typename TValue, unsigned int VLength = 3> +class FixedArray +{ +public: + FixedArray(); + ~FixedArray(); + unsigned int Size(); + void SetElement(unsigned short idx, const TValue &val); + const TValue & GetElement(unsigned short idx); +}; + +template <typename TValue, unsigned int NDim = 3> +class Vector: public FixedArray<TValue,NDim> +{ +public: + Vector(); + ~Vector(); + typedef NumericTraits<TValue>::RealType RealValueType; + RealValueType GetNorm() const; + RealValueType GetSquaredNorm() const; + RealValueType Normalize(); +}; + +template <typename TCoord, unsigned int NDim = 3> +class Point: public FixedArray<TCoord,NDim> +{ +public: + Point(); + ~Point(); +}; + +// Instanciate the needed templates +%template(itkSize) Size<2>; +%template(itkIndex) Index<2>; +%template(itkRegion) ImageRegion<2>; +%template(itkFixedArray) FixedArray<SpacePrecisionType,2>; +%template(itkVector) Vector<SpacePrecisionType,2>; +%template(itkPoint) Point<SpacePrecisionType,2>; -%template(vectorstring) std::vector< std::string >; +} // end of namespace itk + +#if SWIGPYTHON + +%define WRAP_AS_LIST(N, T...) +%extend T + { + %pythoncode + { + def __str__(self): + ret = "[" + for index in range(N): + ret += str(self.GetElement(index))+"," + ret = ret[:-1] + "]" + return ret + def __len__(self): + return N + def __getitem__(self,idx): + if idx >= N or idx < 0: + raise IndexError('Index outside [0,'+str(N-1)+']') + return self.GetElement(idx) + def __setitem__(self,idx,val): + if idx >= N or idx < 0: + raise IndexError('Index outside [0,'+str(N-1)+']') + return self.SetElement(idx,val) + } + }; +%enddef + +namespace itk +{ +WRAP_AS_LIST(2, Size<2>) +WRAP_AS_LIST(2, Index<2>) +WRAP_AS_LIST(2, FixedArray<SpacePrecisionType,2>) +WRAP_AS_LIST(2, Vector<SpacePrecisionType,2>) +WRAP_AS_LIST(2, Point<SpacePrecisionType,2>) + +%extend ImageRegion<2> +{ + %pythoncode + { + def __str__(self): + return "{index:"+str(self.GetIndex())+", size:"+str(self.GetSize())+"}" + def __len__(self): + return 2 + def keys(self): + return ['index', 'size'] + def __getitem__(self,key): + if key == 'index': + return self.GetIndex() + elif key == 'size': + return self.GetSize() + else: + raise IndexError('Key not in ["index","size"]') + def __setitem__(self,key,val): + if key == 'index': + self.SetIndex(val) + elif key == 'size': + self.SetSize(val) + else: + raise IndexError('Key not in ["index","size"]') + } +}; +} // end of namespace itk +#endif class itkIndent { public: @@ -155,6 +336,21 @@ class itkIndent { }; DECLARE_REF_COUNT_CLASS( itkObjectFactoryBase ) +class itkMetaDataObjectBase : public itkLightObject +{ +public: + virtual const std::type_info & GetMetaDataObjectTypeInfo() const; + virtual const char * GetMetaDataObjectTypeName() const; + virtual const char * GetNameOfClass() const; + virtual void Print(std::ostream &os) const; +protected: + itkMetaDataObjectBase(); +#if SWIGJAVA + ~itkMetaDataObjectBase(); +#endif +}; +DECLARE_REF_COUNT_CLASS(itkMetaDataObjectBase) + class itkMetaDataDictionary { public: virtual void Print(std::ostream & os) const; @@ -163,7 +359,20 @@ class itkIndent { ~itkMetaDataDictionary(); std::vector< std::string > GetKeys() const; bool HasKey(std::string const & arg0) const; + const itkMetaDataObjectBase* Get(const std::string &) const; + void Set(const std::string &, itkMetaDataObjectBase *); }; + +namespace itk +{ + +template <typename T> +inline bool ExposeMetaData(const itkMetaDataDictionary & Dictionary, const std::string key, T & outval); + +template <typename T> +inline void EncapsulateMetaData(itkMetaDataDictionary & Dictionary, const std::string & key, const T & invalue); + +} class itkCommand : public itkObject { public: diff --git a/Modules/Wrappers/SWIG/src/itkBase.includes b/Modules/Wrappers/SWIG/src/itkBase.includes index 8cf4ee05bcc49a0a3542a5dee614fcafcb8de29b..4f7902f3a4e44a4b5883602803aaa83d906dcde5 100644 --- a/Modules/Wrappers/SWIG/src/itkBase.includes +++ b/Modules/Wrappers/SWIG/src/itkBase.includes @@ -38,6 +38,8 @@ typedef itk::ProcessObject::Pointer itkProcessObject_Pointer; typedef itk::ObjectFactoryBase itkObjectFactoryBase; typedef itk::ObjectFactoryBase::Pointer itkObjectFactoryBase_Pointer; typedef itk::MetaDataDictionary itkMetaDataDictionary; +typedef itk::MetaDataObjectBase itkMetaDataObjectBase; +typedef itk::MetaDataObjectBase::Pointer itkMetaDataObjectBase_Pointer; typedef itk::Indent itkIndent; typedef itk::Command itkCommand; diff --git a/Modules/Wrappers/SWIG/src/otbApplication.i b/Modules/Wrappers/SWIG/src/otbApplication.i index d945d52af4dc68f35b84e30601c69fa2896557c5..665b689fd17300b423490b77bace6c518edc5164 100644 --- a/Modules/Wrappers/SWIG/src/otbApplication.i +++ b/Modules/Wrappers/SWIG/src/otbApplication.i @@ -21,7 +21,7 @@ %module otbApplication - %{ +%{ #include "itkBase.includes" #include "otbWrapperSWIGIncludes.h" #include <string> // std::string @@ -67,6 +67,8 @@ import_array(); %apply (unsigned int** ARGOUTVIEW_ARRAY3, int *DIM1, int *DIM2, int *DIM3) {(unsigned int** buffer, int *dim1, int *dim2, int *dim3)}; %apply (unsigned long** ARGOUTVIEW_ARRAY3, int *DIM1, int *DIM2, int *DIM3) {(unsigned long** buffer, int *dim1, int *dim2, int *dim3)}; %apply (double** ARGOUTVIEW_ARRAY3, int *DIM1, int *DIM2, int *DIM3) {(double** buffer, int *dim1, int *dim2, int *dim3)}; +%apply (std::complex<float>** ARGOUTVIEW_ARRAY3, int *DIM1, int *DIM2, int *DIM3) {(std::complex<float>** buffer, int *dim1, int *dim2, int *dim3)}; +%apply (std::complex<double>** ARGOUTVIEW_ARRAY3, int *DIM1, int *DIM2, int *DIM3) {(std::complex<double>** buffer, int *dim1, int *dim2, int *dim3)}; #endif /* OTB_SWIGNUMPY */ @@ -74,12 +76,6 @@ namespace otb { namespace Wrapper { - enum DefaultValueMode - { - DefaultValueMode_UNKNOWN, - DefaultValueMode_RELATIVE, - DefaultValueMode_ABSOLUTE - }; typedef enum { @@ -106,7 +102,8 @@ namespace Wrapper ParameterType_ComplexOutputImage, ParameterType_RAM, ParameterType_OutputProcessXML, - ParameterType_InputProcessXML + ParameterType_InputProcessXML, + ParameterType_Bool } ParameterType; typedef enum @@ -124,6 +121,10 @@ namespace Wrapper ImagePixelType_uint32, ImagePixelType_float, ImagePixelType_double, + ImagePixelType_cint16, + ImagePixelType_cint32, + ImagePixelType_cfloat, + ImagePixelType_cdouble, } ImagePixelType; typedef enum @@ -138,9 +139,70 @@ namespace Wrapper ComplexImagePixelType_double, } ComplexImagePixelType; -} +} // end of namespace Wrapper -} +class ImageKeywordlist +{ +public: + typedef std::map<std::string, std::string> KeywordlistMap; + typedef KeywordlistMap::size_type KeywordlistMapSizeType; + ImageKeywordlist(); + virtual ~ImageKeywordlist(); + const KeywordlistMap& GetKeywordlist() const; + void Clear(void); + KeywordlistMapSizeType Empty() const; + KeywordlistMapSizeType GetSize(void) const; + const std::string& GetMetadataByKey(const std::string& key) const; + bool HasKey(const std::string& key) const; + virtual void ClearMetadataByKey(const std::string& key); + virtual void AddKey(const std::string& key, const std::string& value); + virtual void Print(std::ostream& os, itkIndent indent = 0) const; +}; + +class VectorDataKeywordlist +{ +public: + VectorDataKeywordlist(); + ~VectorDataKeywordlist(); + // VectorDataKeywordlist(const Self& other); + // TODO : finish wrapping +}; + +class OTB_GCP +{ +public: + std::string m_Id; + std::string m_Info; + double m_GCPCol; + double m_GCPRow; + double m_GCPX; + double m_GCPY; + double m_GCPZ; + OTB_GCP(); + ~OTB_GCP(); + void Print(std::ostream& os) const; +}; + +#if SWIGPYTHON +%extend ImageKeywordlist + { + %pythoncode + { + def __str__(self): + return str(self.GetKeywordlist()) + def __len__(self): + return self.GetSize() + def __getitem__(self,key): + return self.GetKeywordlist()[key] + def __setitem__(self,key,val): + self.GetKeywordlist()[key] = val + def keys(self): + return self.GetKeywordlist().keys() + } + } +#endif + +} // end of namespace otb class Application: public itkObject { @@ -199,23 +261,34 @@ public: std::vector<std::string> GetParameterStringList(std::string parameter); std::string GetParameterAsString(std::string paramKey); - InputImageParameter::ImageBaseType * GetParameterOutputImage(std::string parameter); - void SetParameterInputImage(std::string parameter, InputImageParameter::ImageBaseType * inputImage); - ComplexInputImageParameter::ImageBaseType * GetParameterComplexOutputImage(std::string parameter); - void SetParameterComplexInputImage(std::string parameter, ComplexInputImageParameter::ImageBaseType * inputImage); - void AddImageToParameterInputImageList(std::string parameter,InputImageParameter::ImageBaseType * img); + ImageBaseType * GetParameterOutputImage(std::string parameter); + void SetParameterInputImage(std::string parameter, ImageBaseType * inputImage); + ImageBaseType * GetParameterComplexOutputImage(std::string parameter); + void SetParameterComplexInputImage(std::string parameter, ImageBaseType * inputImage); + void AddImageToParameterInputImageList(std::string parameter,ImageBaseType * img); void AddParameterStringList(std::string parameter,const std::string & str); - void SetNthParameterInputImageList(std::string parameter, const unsigned int &id, InputImageParameter::ImageBaseType * img); + void SetNthParameterInputImageList(std::string parameter, const unsigned int &id, ImageBaseType * img); void SetNthParameterStringList(std::string parameter, const unsigned int &id, const std::string& str); void ClearParameterInputImageList(std::string parameter); unsigned int GetNumberOfElementsInParameterInputImageList(std::string parameter); - + itk::Point<SpacePrecisionType,2> GetImageOrigin(const std::string & key, unsigned int idx = 0); + itk::Vector<SpacePrecisionType,2> GetImageSpacing(const std::string & key, unsigned int idx = 0); + itk::Size<2> GetImageSize(const std::string & key, unsigned int idx = 0); + unsigned int GetImageNbBands(const std::string & key, unsigned int idx = 0); + std::string GetImageProjection(const std::string & key, unsigned int idx = 0); + otb::ImageKeywordlist GetImageKeywordlist(const std::string & key, unsigned int idx = 0); + unsigned long PropagateRequestedRegion(const std::string & key, itk::ImageRegion<2> region, unsigned int idx = 0); + itk::ImageRegion<2> GetImageRequestedRegion(const std::string & key, unsigned int idx = 0); + itkMetaDataDictionary GetImageMetaData(const std::string & key, unsigned int idx = 0); + otb::Wrapper::ImagePixelType GetImageBasePixelType(const std::string & key, unsigned int idx = 0); itkProcessObject* GetProgressSource() const; std::string GetProgressDescription() const; + void FreeRessources(); + itkSetStringMacro(DocName); itkGetStringMacro(DocName); itkSetStringMacro(DocLongDescription); @@ -250,154 +323,161 @@ public: %extend { #define SetFromNumpyArrayMacro(prefix, PixelDataType, ImageClass) \ - void Set##ImageClass##From##prefix##NumpyArray_(std::string pkey, ##PixelDataType##* buffer, int dim1, int dim2, int dim3) \ - { \ - otb::Wrapper::Parameter *parameter = $self->GetParameterList()->GetParameterByKey(pkey); \ - InputImageParameter* inputImageParam = dynamic_cast<InputImageParameter*>(parameter); \ - typedef otb::##ImageClass##<##PixelDataType##> ImageType; \ - ImageType::Pointer output = ImageType::New(); \ - typedef ImageType::SizeType SizeType; \ - typedef ImageType::IndexType IndexType; \ - typedef ImageType::RegionType RegionType; \ - typedef ImageType::PointType PointType; \ - typedef ImageType::SpacingType SpacingType; \ - typedef ImageType::DirectionType DirectionType; \ - IndexType start; \ - DirectionType direction; \ - start.Fill( 0 ); \ - SizeType size; \ - size[0] = dim2; size[1] = dim1; \ - SetVectorLengthMacro \ - output->Allocate(); \ - unsigned int numberOfPixels = dim1 * dim2 * dim3; \ - RegionType region; \ - region.SetIndex( start ); \ - region.SetSize( size ); \ - PointType origin; \ - origin.Fill( 0.0 ); \ - SpacingType spacing; \ - spacing.Fill( 1.0 ); \ - direction.SetIdentity(); \ - output->SetOrigin( origin ); \ - output->SetSignedSpacing( spacing ); \ - output->SetDirection(direction); \ - output->SetLargestPossibleRegion(region); \ - output->SetRequestedRegion(output->GetLargestPossibleRegion()); \ - output->SetBufferedRegion(output->GetLargestPossibleRegion()); \ - output->GetPixelContainer()->SetImportPointer(buffer, numberOfPixels, false); \ - inputImageParam->SetImage<ImageType>(output); \ + ImageBaseType* Set##ImageClass##From##prefix##NumpyArray_(std::string pkey, int idx, ##PixelDataType##* buffer, int dim1, int dim2, int dim3) \ + { \ + typedef otb::##ImageClass##<##PixelDataType##> ImageType; \ + ImageType::Pointer output = ImageType::New(); \ + unsigned int numberOfPixels = dim1 * dim2 * dim3; \ + ImageType::RegionType region; \ + region.SetIndex(0, 0); \ + region.SetIndex(1, 0); \ + region.SetSize( 0, dim2); \ + region.SetSize( 1, dim1); \ + output->SetNumberOfComponentsPerPixel(dim3); \ + output->SetRegions(region); \ + output->GetPixelContainer()->SetImportPointer(buffer, numberOfPixels, false); \ + $self->SetParameterImageBase(pkey,output.GetPointer(),idx); \ + return output.GetPointer(); \ } -#define SetVectorLengthMacro output->SetVectorLength(dim3); - SetFromNumpyArrayMacro(Float, float, VectorImage) - SetFromNumpyArrayMacro(Int8, signed char, VectorImage) - SetFromNumpyArrayMacro(Int16, signed short, VectorImage) - SetFromNumpyArrayMacro(Int32, signed int, VectorImage) - SetFromNumpyArrayMacro(Int64, signed long, VectorImage) - SetFromNumpyArrayMacro(UInt8, unsigned char, VectorImage) - SetFromNumpyArrayMacro(UInt16, unsigned short, VectorImage) - SetFromNumpyArrayMacro(UInt32, unsigned int, VectorImage) - SetFromNumpyArrayMacro(UInt64, unsigned long, VectorImage) - SetFromNumpyArrayMacro(Double, double, VectorImage) -#undef SetVectorLengthMacro - -#define SetVectorLengthMacro dim3=1; - SetFromNumpyArrayMacro(Float, float, Image) - SetFromNumpyArrayMacro(Int8, signed char, Image) - SetFromNumpyArrayMacro(Int16, signed short, Image) - SetFromNumpyArrayMacro(Int32, signed int, Image) - SetFromNumpyArrayMacro(Int64, signed long, Image) - SetFromNumpyArrayMacro(UInt8, unsigned char, Image) - SetFromNumpyArrayMacro(UInt16, unsigned short, Image) - SetFromNumpyArrayMacro(UInt32, unsigned int, Image) - SetFromNumpyArrayMacro(UInt64, unsigned long, Image) - SetFromNumpyArrayMacro(Double, double, Image) -#undef SetVectorLengthMacro + SetFromNumpyArrayMacro(UInt8, unsigned char, VectorImage) + SetFromNumpyArrayMacro(Int16, signed short, VectorImage) + SetFromNumpyArrayMacro(UInt16, unsigned short, VectorImage) + SetFromNumpyArrayMacro(Int32, signed int, VectorImage) + SetFromNumpyArrayMacro(UInt32, unsigned int, VectorImage) + // SetFromNumpyArrayMacro(Int64, signed long, VectorImage) + // SetFromNumpyArrayMacro(UInt64, unsigned long, VectorImage) + SetFromNumpyArrayMacro(Float, float, VectorImage) + SetFromNumpyArrayMacro(Double, double, VectorImage) + SetFromNumpyArrayMacro(CFloat, std::complex<float>, VectorImage) + SetFromNumpyArrayMacro(CDouble, std::complex<double>, VectorImage) + + SetFromNumpyArrayMacro(UInt8, unsigned char, Image) + SetFromNumpyArrayMacro(Int16, signed short, Image) + SetFromNumpyArrayMacro(UInt16, unsigned short, Image) + SetFromNumpyArrayMacro(Int32, signed int, Image) + SetFromNumpyArrayMacro(UInt32, unsigned int, Image) + // SetFromNumpyArrayMacro(Int64, signed long, Image) + // SetFromNumpyArrayMacro(UInt64, unsigned long, Image) + SetFromNumpyArrayMacro(Float, float, Image) + SetFromNumpyArrayMacro(Double, double, Image) + SetFromNumpyArrayMacro(CFloat, std::complex<float>, Image) + SetFromNumpyArrayMacro(CDouble, std::complex<double>, Image) #undef SetFromNumpyArrayMacro -#define GetVectorImageAsNumpyArrayMacro(prefix, PixelType) \ - void GetVectorImageAs##prefix##NumpyArray_(std::string pkey, ##PixelType##** buffer, int *dim1, int *dim2, int *dim3) \ - { \ - otb::Wrapper::Parameter *parameter = $self->GetParameterList()->GetParameterByKey(pkey); \ - OutputImageParameter* outputImageParam = dynamic_cast<OutputImageParameter*>(parameter); \ - typedef itk::ImageBase<2> ImageBaseType; \ - typedef ImageBaseType::RegionType RegionType; \ - ImageBaseType::Pointer imageBase; \ - imageBase = outputImageParam->GetValue(); \ - imageBase->Update(); \ - typedef ImageBaseType::SizeType SizeType; \ - typedef ImageBaseType::IndexType IndexType; \ - typedef ImageBaseType::PointType PointType; \ - typedef ImageBaseType::SpacingType SpacingType; \ - RegionType region = imageBase->GetBufferedRegion(); \ - SizeType size = region.GetSize(); \ - *dim1 = size[1]; \ - *dim2 = size[0]; \ - typedef otb::VectorImage<signed char> Int8ImageType; \ - typedef otb::VectorImage<signed short> Int16ImageType; \ - typedef otb::VectorImage<signed int> Int32ImageType; \ - typedef otb::VectorImage<unsigned char> UInt8ImageType; \ - typedef otb::VectorImage<unsigned short> UInt16ImageType; \ - typedef otb::VectorImage<unsigned int> UInt32ImageType; \ - typedef otb::VectorImage<float> FloatImageType; \ - typedef otb::VectorImage<double> DoubleImageType; \ - if (dynamic_cast<UInt8ImageType*>(imageBase.GetPointer())) \ - { \ - UInt8ImageType* output = dynamic_cast<UInt8ImageType*>(imageBase.GetPointer()); \ - *buffer = reinterpret_cast<##PixelType##*>(output->GetBufferPointer()); \ - *dim3 = output->GetNumberOfComponentsPerPixel(); \ - } \ - else if (dynamic_cast<Int16ImageType*>(imageBase.GetPointer())) \ - { \ - Int16ImageType* output = dynamic_cast<Int16ImageType*>(imageBase.GetPointer()); \ - *buffer = reinterpret_cast<##PixelType##*>(output->GetBufferPointer()); \ - *dim3 = output->GetNumberOfComponentsPerPixel(); \ - } \ - else if (dynamic_cast<UInt16ImageType*>(imageBase.GetPointer())) \ - { \ - UInt16ImageType* output = dynamic_cast<UInt16ImageType*>(imageBase.GetPointer()); \ - *buffer = reinterpret_cast<##PixelType##*>(output->GetBufferPointer()); \ - *dim3 = output->GetNumberOfComponentsPerPixel(); \ - } \ - else if (dynamic_cast<Int32ImageType*>(imageBase.GetPointer())) \ - { \ - Int32ImageType* output = dynamic_cast<Int32ImageType*>(imageBase.GetPointer()); \ - *buffer = reinterpret_cast<##PixelType##*>(output->GetBufferPointer()); \ - *dim3 = output->GetNumberOfComponentsPerPixel(); \ - } \ - else if (dynamic_cast<UInt32ImageType*>(imageBase.GetPointer())) \ - { \ - UInt32ImageType* output = dynamic_cast<UInt32ImageType*>(imageBase.GetPointer()); \ - *buffer = reinterpret_cast<##PixelType##*>(output->GetBufferPointer()); \ - *dim3 = output->GetNumberOfComponentsPerPixel(); \ - } \ - else if (dynamic_cast<FloatImageType*>(imageBase.GetPointer())) \ - { \ - FloatImageType* output = dynamic_cast<FloatImageType*>(imageBase.GetPointer()); \ - *buffer = reinterpret_cast<##PixelType##*>(output->GetBufferPointer()); \ - *dim3 = output->GetNumberOfComponentsPerPixel(); \ - } \ - else if (dynamic_cast<DoubleImageType*>(imageBase.GetPointer())) \ - { \ - DoubleImageType* output = dynamic_cast<DoubleImageType*>(imageBase.GetPointer()); \ - *buffer = reinterpret_cast<##PixelType##*>(output->GetBufferPointer()); \ - *dim3 = output->GetNumberOfComponentsPerPixel(); \ - } \ - else \ - { \ - std::cerr << "unknown image type. cannot make a numpy array" << std::endl; \ - } \ - } +#define GetVectorImageAsNumpyArrayMacro(suffix, TPixel) \ + void GetVectorImageAs##suffix##NumpyArray_ \ + (std::string pkey, ##TPixel##** buffer, int *dim1, int *dim2, int *dim3) \ + { \ + ImageBaseType *img = $self->GetParameterOutputImage(pkey); \ + img->Update(); \ + unsigned int nbComp = img->GetNumberOfComponentsPerPixel(); \ + ImageBaseType::RegionType region = img->GetBufferedRegion(); \ + ImageBaseType::SizeType size = region.GetSize(); \ + *dim1 = region.GetSize(1); \ + *dim2 = region.GetSize(0); \ + *dim3 = nbComp; \ + std::string className(img->GetNameOfClass()); \ + if (className == "VectorImage") \ + { \ + typedef otb::VectorImage<##TPixel##,2> LocalVectorImageType; \ + LocalVectorImageType* imgDown = dynamic_cast<LocalVectorImageType*>(img); \ + if (imgDown) \ + *buffer = reinterpret_cast<##TPixel##*>(imgDown->GetBufferPointer()); \ + else \ + std::cerr << "VectorImage type doesn't match" << std::endl; \ + } \ + else \ + { \ + if (nbComp == 1) \ + { \ + otb::Image<##TPixel##,2>* imgDown = dynamic_cast< otb::Image<##TPixel##,2>* >(img); \ + if (imgDown) \ + *buffer = reinterpret_cast<##TPixel##*>(imgDown->GetBufferPointer()); \ + else \ + std::cerr << "Image type doesn't match" << std::endl; \ + } \ + else \ + { \ + std::cerr << "Unhandled number of components in otb::Image (RGB<T> " \ + "and RGBA<T> not supported yet)" << std::endl; \ + } \ + } \ + } - GetVectorImageAsNumpyArrayMacro(Float, float) - GetVectorImageAsNumpyArrayMacro(Int16, signed short) - GetVectorImageAsNumpyArrayMacro(Int32, signed int) - GetVectorImageAsNumpyArrayMacro(UInt8, unsigned char) - GetVectorImageAsNumpyArrayMacro(UInt16, unsigned short) - GetVectorImageAsNumpyArrayMacro(UInt32, unsigned int) - GetVectorImageAsNumpyArrayMacro(Double, double) + GetVectorImageAsNumpyArrayMacro(UInt8, unsigned char) + GetVectorImageAsNumpyArrayMacro(Int16,signed short); + GetVectorImageAsNumpyArrayMacro(UInt16,unsigned short); + GetVectorImageAsNumpyArrayMacro(Int32,signed int); + GetVectorImageAsNumpyArrayMacro(UInt32,unsigned int); + GetVectorImageAsNumpyArrayMacro(Float,float); + GetVectorImageAsNumpyArrayMacro(Double,double); + GetVectorImageAsNumpyArrayMacro(CFloat,std::complex<float> ); + GetVectorImageAsNumpyArrayMacro(CDouble,std::complex<double> ); + // CInt16 and CInt32 are not supported in Numpy #undef GetVectorImageAsNumpyArrayMacro + std::string ConvertPixelTypeToNumpy(otb::Wrapper::ImagePixelType pixType) + { + std::ostringstream oss; + switch (pixType) + { + case otb::Wrapper::ImagePixelType_uint8 : + oss << "uint" << (sizeof(unsigned char) * 8); + break; + case otb::Wrapper::ImagePixelType_int16 : + oss << "int" << (sizeof(signed short) * 8); + break; + case otb::Wrapper::ImagePixelType_uint16 : + oss << "uint" << (sizeof(unsigned short) * 8); + break; + case otb::Wrapper::ImagePixelType_int32 : + oss << "int" << (sizeof(signed int) * 8); + break; + case otb::Wrapper::ImagePixelType_uint32 : + oss << "uint" << (sizeof(unsigned int) * 8); + break; + case otb::Wrapper::ImagePixelType_float : + oss << "float" << (sizeof(float) * 8); + break; + case otb::Wrapper::ImagePixelType_double : + oss << "float" << (sizeof(double) * 8); + break; + case otb::Wrapper::ImagePixelType_cfloat : + oss << "complex" << (sizeof(std::complex<float>) * 8); + break; + case otb::Wrapper::ImagePixelType_cdouble : + oss << "complex" << (sizeof(std::complex<double>) * 8); + break; + default: + std::cerr << "Pixel type not handled" << std::endl; + break; + } + return oss.str(); + } + + void SetupImageInformation( + ImageBaseType* img, + itk::Point<SpacePrecisionType,2> origin, + itk::Vector<SpacePrecisionType,2> spacing, + itk::Size<2> size, + itk::ImageRegion<2> bufferRegion, + itkMetaDataDictionary metadata) + { + img->SetOrigin(origin); + otb::internal::SetSignedSpacing(img, spacing); + itk::ImageRegion<2> largest; + largest.SetSize(size); + img->SetLargestPossibleRegion(largest); + if (bufferRegion.GetSize() != img->GetBufferedRegion().GetSize()) + { + std::cerr << "Given buffered size doesn't match actual buffer size" << std::endl; + return; + } + img->SetRequestedRegion(bufferRegion); + img->SetBufferedRegion(bufferRegion); + img->SetMetaDataDictionary(metadata); + } } /* end of %extend */ #endif /* OTB_SWIGNUMPY */ @@ -502,6 +582,7 @@ class ApplicationProxy(object): ParameterType_Empty : 'ParameterType_Empty', ParameterType_Choice : 'ParameterType_Choice', ParameterType_Group : 'ParameterType_Group', + ParameterType_Bool : 'ParameterType_Bool' }.get(parameter_type, 'ParameterType_UNKNOWN') def __str__(self): @@ -510,6 +591,10 @@ class ApplicationProxy(object): s += self.GetDocLongDescription() return s + def SetParameters(self, dict_params): + for param_key, param_value in dict_params.iteritems(): + self.SetParameterValue(param_key, param_value) + def SetParameterValue(self, paramKey, value): paramType = self.GetParameterType(paramKey) if paramType in [ParameterType_InputProcessXML, ParameterType_RAM, @@ -522,13 +607,15 @@ class ApplicationProxy(object): elif paramType in [ParameterType_InputImageList, ParameterType_InputVectorDataList, ParameterType_InputFilenameList, ParameterType_StringList, ParameterType_ListView]: - return self.setParameterStringList(paramKey, value) + return self.SetParameterStringList(paramKey, value) elif paramType in [ParameterType_Int, ParameterType_Radius]: return self.SetParameterInt(paramKey, value) elif paramType in [ParameterType_Float]: return self.SetParameterFloat(paramKey, value) elif paramType in [ParameterType_Empty]: return self.EnableParameter(paramKey) + elif paramType in [ParameterType_Bool]: + return self.SetParameterString(paramKey, str(value) ) elif paramType in [ParameterType_Group]: return ApplicationProxy(self, paramKey) elif paramType in [ParameterType_Choice]: @@ -537,6 +624,13 @@ class ApplicationProxy(object): print ("Unsupported parameter type '%s' with key '%s'" %(self.GetParameterTypeAsString(paramType) ,paramKey)) return + def GetParameters(self): + ret = {} + for key in self.GetParametersKeys(): + if self.HasValue(key) and self.IsParameterEnabled(key) and self.GetParameterRole(key) == 0: + ret[key] = self.GetParameterValue(key) + return ret + def GetParameterValue(self, paramKey): paramType = self.GetParameterType(paramKey) if paramType in [ParameterType_InputProcessXML, @@ -556,6 +650,8 @@ class ApplicationProxy(object): return self.GetParameterFloat(paramKey) elif paramType in [ParameterType_Empty]: return self.IsParameterEnabled(paramKey) + elif paramType in [ParameterType_Bool]: + return bool(self.GetParameterInt(paramKey)) elif paramType in [ParameterType_Group, ParameterType_Choice]: return ApplicationProxy(self, paramKey) else: @@ -622,140 +718,159 @@ class ApplicationProxy(object): { %pythoncode { - def SetImageFromNumpyArray(self, paramKey, npArray): + NumpyExporterMap = { + ImagePixelType_uint8 : GetVectorImageAsUInt8NumpyArray_, + ImagePixelType_int16 : GetVectorImageAsInt16NumpyArray_, + ImagePixelType_uint16 : GetVectorImageAsUInt16NumpyArray_, + ImagePixelType_int32 : GetVectorImageAsInt32NumpyArray_, + ImagePixelType_uint32 : GetVectorImageAsUInt32NumpyArray_, + ImagePixelType_float : GetVectorImageAsFloatNumpyArray_, + ImagePixelType_double : GetVectorImageAsDoubleNumpyArray_, + ImagePixelType_cfloat : GetVectorImageAsCFloatNumpyArray_, + ImagePixelType_cdouble : GetVectorImageAsCDoubleNumpyArray_, + } + ImageImporterMap = { + ImagePixelType_uint8 : SetImageFromUInt8NumpyArray_, + ImagePixelType_int16 : SetImageFromInt16NumpyArray_, + ImagePixelType_uint16 : SetImageFromUInt16NumpyArray_, + ImagePixelType_int32 : SetImageFromInt32NumpyArray_, + ImagePixelType_uint32 : SetImageFromUInt32NumpyArray_, + ImagePixelType_float : SetImageFromFloatNumpyArray_, + ImagePixelType_double : SetImageFromDoubleNumpyArray_, + ImagePixelType_cfloat : SetImageFromCFloatNumpyArray_, + ImagePixelType_cdouble : SetImageFromCDoubleNumpyArray_, + } + VectorImageImporterMap = { + ImagePixelType_uint8 : SetVectorImageFromUInt8NumpyArray_, + ImagePixelType_int16 : SetVectorImageFromInt16NumpyArray_, + ImagePixelType_uint16 : SetVectorImageFromUInt16NumpyArray_, + ImagePixelType_int32 : SetVectorImageFromInt32NumpyArray_, + ImagePixelType_uint32 : SetVectorImageFromUInt32NumpyArray_, + ImagePixelType_float : SetVectorImageFromFloatNumpyArray_, + ImagePixelType_double : SetVectorImageFromDoubleNumpyArray_, + ImagePixelType_cfloat : SetVectorImageFromCFloatNumpyArray_, + ImagePixelType_cdouble : SetVectorImageFromCDoubleNumpyArray_, + } + + def SetImageFromNumpyArray(self, paramKey, npArray, index=0): """ This method takes a numpy array and set ImageIOBase of InputImageParameter by creating an otbImage with same pixel type as numpyarray.dtype """ - if len(npArray.shape) == 3: - raise ValueError( "(len(npArray.shape) == 3)\n" - "Input array given is of 3 dimension.\n" - "SetImageFromNumpyArray create ImageIO from otbImage and thus demands a 2d array.\n" - "you can either provide an 2d numpy array or use SetVectorImageFromNumpyArray depending on your application.\n") - - dt = npArray.dtype.name - if dt == 'int8': - self.SetImageFromInt8NumpyArray_(paramKey, npArray) - elif dt == 'int16': - self.SetImageFromInt16NumpyArray_(paramKey, npArray) - elif dt == 'int32': - self.SetImageFromInt32NumpyArray_(paramKey, npArray) - elif dt == 'uint8': - self.SetImageFromUInt8NumpyArray_(paramKey, npArray) - elif dt == 'uint16': - self.SetImageFromUInt16NumpyArray_(paramKey, npArray) - elif dt == 'uint32': - self.SetImageFromUInt32NumpyArray_(paramKey, npArray) - elif dt == 'float': - self.SetImageFromFloatNumpyArray_(paramKey, npArray) - elif dt == 'double': - self.SetImageFromDoubleNumpyArray_(paramKey, npArray) + shp = npArray.shape + if len(shp) == 2: + npArray = npArray.reshape((shp[0],shp[1],1)) + elif len(shp) == 3: + if shp[2] > 1: + raise ValueError( "More than 1 band in numpy array\n" + "Cannot convert to Image, use SetVectorImageFromNumpyArray instead\n") else: - self.SetImageFromFloatNumpyArray_(paramKey, npArray) - return - - def SetVectorImageFromNumpyArray(self, paramKey, npArray): + raise ValueError( "Expected 2 or 3 dimensions for numpyarray\n") + dt = npArray.dtype.name + isFound = False + for pixT in self.ImageImporterMap: + if dt == self.ConvertPixelTypeToNumpy(pixT): + isFound = True + img = self.ImageImporterMap[pixT](self,paramKey, index, npArray) + break + if len(shp) == 2: + npArray = npArray.reshape(shp) + if not isFound: + raise ValueError("Can't convert Numpy array of dtype "+dt) + return img + + def SetVectorImageFromNumpyArray(self, paramKey, npArray, index=0): """ - This method takes a numpy array and set ImageIOBase of + This method takes a numpy array and set InputImageParameter by creating an otbVectorImage with same pixel type as numpyarray.dtype. - NOTE: Input (npArray) must be an ndarray with 3 dimension, - len(npArray.shape) must be > 2 + NOTE: Input (npArray) must be an ndarray with 2 or 3 dimensions, """ - if len(npArray.shape) < 3: - raise ValueError( "(len(npArray.shape) < 3)\n" - "Input array given is not of 3 dimension.\n" - "SetVectorImageFromNumpyArray create ImageIO from otbVectorImage and thus demands an array of shape 3.\n" - "you can either provide an 3d numpy array or use SetImageFromNumpyArray depending on your application.\n") - + shp = npArray.shape + if len(shp) == 2: + npArray = npArray.reshape((shp[0],shp[1],1)) + elif len(npArray.shape) != 3: + raise ValueError( "Expected 2 or 3 dimensions for numpyarray") dt = npArray.dtype.name - if dt == 'int8': - self.SetVectorImageFromInt8NumpyArray_(paramKey, npArray) - elif dt == 'int16': - self.SetVectorImageFromInt16NumpyArray_(paramKey, npArray) - elif dt == 'int32': - self.SetVectorImageFromInt32NumpyArray_(paramKey, npArray) - elif dt == 'uint8': - self.SetVectorImageFromUInt8NumpyArray_(paramKey, npArray) - elif dt == 'uint16': - self.SetVectorImageFromUInt16NumpyArray_(paramKey, npArray) - elif dt == 'uint32': - self.SetVectorImageFromUInt32NumpyArray_(paramKey, npArray) - elif dt == 'float': - self.SetVectorImageFromFloatNumpyArray_(paramKey, npArray) - elif dt == 'double': - self.SetVectorImageFromDoubleNumpyArray_(paramKey, npArray) - else: - self.SetVectorImageFromFloatNumpyArray_(paramKey, npArray) - return + isFound = False + for pixT in self.VectorImageImporterMap: + if dt == self.ConvertPixelTypeToNumpy(pixT): + isFound = True + img = self.VectorImageImporterMap[pixT](self,paramKey, index, npArray) + break + if len(shp) == 2: + npArray = npArray.reshape(shp) + if not isFound: + raise ValueError("Can't convert Numpy array of dtype "+dt) + return img def GetVectorImageAsNumpyArray(self, paramKey, dt='float'): """ - If datatype is unknown this method assumes to numpy.float32 - Valid datatypes are: - int8, int16, int32, uint8, uint16, uint32, float, double. - NOTE: This method always return an numpy array with dimension 3 + This function retrieves an output image parameter as a Numpy array. + The array datatype is guessed automatically from the underlying + otb::VectorImage<T,2> type (should also work with otb::Image<T,2>). The + optional parameter dt is deprecated and should not be used anymore. The + possible output datatypes are: + int8, int16, int32, uint8, uint16, uint32, float, double, cint16, cint32, + cfloat, cdouble. + NOTE: This method always return an numpy array with 3 dimensions + NOTE: cint16 and cint32 are not supported yet """ - if dt == 'int8': - return self.GetVectorImageAsInt8NumpyArray_(paramKey) - elif dt == 'int16': - return self.GetVectorImageAsInt16NumpyArray_(paramKey) - elif dt == 'int32': - return self.GetVectorImageAsInt32NumpyArray_(paramKey) - elif dt == 'uint8': - return self.GetVectorImageAsUInt8NumpyArray_(paramKey) - elif dt == 'uint16': - return self.GetVectorImageAsUInt16NumpyArray_(paramKey) - elif dt == 'uint32': - return self.GetVectorImageAsUInt32NumpyArray_(paramKey) - elif dt == 'float': - return self.GetVectorImageAsFloatNumpyArray_(paramKey) - elif dt == 'double': - return self.GetVectorImageAsDoubleNumpyArray_(paramKey) - else: - print ("Unknown datatype '" + dt + "'. Using float instead. Available types are:") - print ("int8, int16, int32, uint8, uint16, uint32, float, double") - return self.GetVectorImageAsFloatNumpyArray_(paramKey) + pixT = self.GetImageBasePixelType(paramKey) + return self.NumpyExporterMap[pixT](self,paramKey) def GetImageAsNumpyArray(self, paramKey, dt='float'): """ - If datatype is unknown this method assumes to numpy.float32 - Valid datatypes are: - int8, int16, int32, uint8, uint16, uint32, float, double. - NOTE: This method always return an numpy array with dimension 3 + This function retrieves an output image parameter as a Numpy array. + The array datatype is guessed automatically from the underlying + otb::VectorImage<T,2> type (should also work with otb::Image<T,2>). The + optional parameter dt is deprecated and should not be used anymore. The + possible output datatypes are: + int8, int16, int32, uint8, uint16, uint32, float, double, cint16, cint32, + cfloat, cdouble. + NOTE: This method always return an numpy array with 2 dimensions + NOTE: cint16 and cint32 are not supported yet """ - if dt == 'int8': - numpy_vector_image = self.GetVectorImageAsInt8NumpyArray_(paramKey) - elif dt == 'int16': - numpy_vector_image = self.GetVectorImageAsInt16NumpyArray_(paramKey) - elif dt == 'int32': - numpy_vector_image = self.GetVectorImageAsInt32NumpyArray_(paramKey) - elif dt == 'uint8': - numpy_vector_image = self.GetVectorImageAsUInt8NumpyArray_(paramKey) - elif dt == 'uint16': - numpy_vector_image = self.GetVectorImageAsUInt16NumpyArray_(paramKey) - elif dt == 'uint32': - numpy_vector_image = self.GetVectorImageAsUInt32NumpyArray_(paramKey) - elif dt == 'float': - numpy_vector_image = self.GetVectorImageAsFloatNumpyArray_(paramKey) - elif dt == 'double': - numpy_vector_image = self.GetVectorImageAsDoubleNumpyArray_(paramKey) - - else: - print ("Unknown datatype '" + dt + "'. Using float instead. Available types are:") - print ("int8, int16, int32, uint8, uint16, uint32, float, double") - numpy_vector_image = self.GetVectorImageAsFloatNumpyArray_(paramKey) - - if numpy_vector_image.shape[2] > 1: - raise ValueError("numpy_vector_image.shape[2] > 1\n" + pixT = self.GetImageBasePixelType(paramKey) + array = self.NumpyExporterMap[pixT](self,paramKey) + if array.shape[2] > 1: + raise ValueError("array.shape[2] > 1\n" "Output image from application has more than 1 band\n" "GetImageFromNumpyArray only returns the first band, which will result in a loss of data.\n" "In this case you must use GetVectorImageFromNumpyArray which is capable of return a 3 dimension image.\n") + array = array[:,:,0] + return array - numpy_vector_image = numpy_vector_image[:,:,0] - return numpy_vector_image + def ImportImage(self, paramKey, pyImg, index = 0): + """ + Import an image into a parameter, from a Python dict. with the following + keys: array, origin, spacing, size, region, metadata + """ + img = self.SetImageFromNumpyArray(paramKey, pyImg["array"], index) + self.SetupImageInformation(img, pyImg["origin"], pyImg["spacing"], pyImg["size"], pyImg["region"], pyImg["metadata"]) + def ImportVectorImage(self, paramKey, pyImg, index = 0): + """ + Import a vector image into a parameter, from a Python dict. with the following + keys: array, origin, spacing, size, region, metadata + """ + img = self.SetVectorImageFromNumpyArray(paramKey, pyImg["array"], index) + self.SetupImageInformation(img, pyImg["origin"], pyImg["spacing"], pyImg["size"], pyImg["region"], pyImg["metadata"]) + + def ExportImage(self, paramKey): + """ + Export an output image from an otbApplication into a python dictionary with the + following fields: array, origin, spacing, size, region, metadata + """ + output = {} + output["array"] = self.GetVectorImageAsNumpyArray(paramKey) + output["origin"] = self.GetImageOrigin(paramKey) + output["spacing"] = self.GetImageSpacing(paramKey) + output["size"] = self.GetImageSize(paramKey) + output["region"] = self.GetImageRequestedRegion(paramKey) + output["metadata"] = self.GetImageMetaData(paramKey) + return output } } @@ -770,6 +885,7 @@ public: static Application_Pointer CreateApplication(const std::string& name); static void AddApplicationPath(std::string newpath); static void SetApplicationPath(std::string newpath); + static void CleanRegistry(); protected: Registry(); @@ -793,3 +909,133 @@ public: }; %include "PyCommand.i" + +%extend itkMetaDataDictionary +{ + int GetType(const std::string &key) + { + return (int) otb::Wrapper::MetaDataHelper::GetType(key); + } + + std::string GetString(const std::string &key) + { + return otb::Wrapper::MetaDataHelper::GetString(* $self,key); + } + void SetString(const std::string &key, const std::string &val) + { + otb::Wrapper::MetaDataHelper::SetString(* $self,key,val); + } + + unsigned int GetInt(const std::string &key) + { + return otb::Wrapper::MetaDataHelper::GetInt(* $self,key); + } + void SetInt(const std::string &key, unsigned int val) + { + otb::Wrapper::MetaDataHelper::SetInt(* $self,key,val); + } + + double GetDouble(const std::string &key) + { + return otb::Wrapper::MetaDataHelper::GetDouble(* $self,key); + } + void SetDouble(const std::string &key, double val) + { + otb::Wrapper::MetaDataHelper::SetDouble(* $self,key,val); + } + + otb::OTB_GCP GetGCP(const std::string &key) + { + return otb::Wrapper::MetaDataHelper::GetGCP(* $self,key); + } + void SetGCP(const std::string &key, const otb::OTB_GCP &val) + { + otb::Wrapper::MetaDataHelper::SetGCP(* $self,key,val); + } + + std::vector<double> GetVector(const std::string &key) + { + return otb::Wrapper::MetaDataHelper::GetVector(* $self,key); + } + void SetVector(const std::string &key, const std::vector<double> &val) + { + otb::Wrapper::MetaDataHelper::SetVector(* $self,key,val); + } + + otb::ImageKeywordlist GetImageKWL(const std::string &key) + { + return otb::Wrapper::MetaDataHelper::GetImageKWL(* $self,key); + } + void SetImageKWL(const std::string &key, const otb::ImageKeywordlist &val) + { + otb::Wrapper::MetaDataHelper::SetImageKWL(* $self,key,val); + } + + otb::VectorDataKeywordlist GetVectorDataKWL(const std::string &key) + { + return otb::Wrapper::MetaDataHelper::GetVectorDataKWL(* $self,key); + } + void SetVectorDataKWL(const std::string &key, const otb::VectorDataKeywordlist &val) + { + otb::Wrapper::MetaDataHelper::SetVectorDataKWL(* $self,key,val); + } + + std::vector<bool> GetBoolVector(const std::string &key) + { + return otb::Wrapper::MetaDataHelper::GetBoolVector(* $self,key); + } + void SetBoolVector(const std::string &key, const std::vector<bool> &val) + { + otb::Wrapper::MetaDataHelper::SetBoolVector(* $self,key,val); + } + +#if SWIGPYTHON +// enhance the MetaDataDictionary class for Python + %pythoncode + { + GetterMap = { + 0 : GetString, + 1 : GetInt, + 2 : GetDouble, + 3 : GetGCP, + 4 : GetVector, + 5 : GetImageKWL, + 6 : GetVectorDataKWL, + 7 : GetBoolVector, + } + + SetterMap = { + 0 : SetString, + 1 : SetInt, + 2 : SetDouble, + 3 : SetGCP, + 4 : SetVector, + 5 : SetImageKWL, + 6 : SetVectorDataKWL, + 7 : SetBoolVector, + } + + def __str__(self): + ret = '' + for k in self.GetKeys(): + ret += k + ':<...>, ' + if len(ret) == 0: + ret += ', ' + return "{"+ret[:-2] +"}" + def __len__(self): + return len(self.GetKeys()) + def keys(self): + return self.GetKeys() + def __getitem__(self,key): + if key in self.GetKeys(): + return self.GetterMap[self.GetType(key)](self,key) + else: + raise IndexError('Key not recognized') + def __setitem__(self,key,val): + if key in self.GetKeys(): + self.SetterMap[self.GetType(key)](self,key,val) + else: + raise IndexError('Key not recognized') + } +#endif +}; diff --git a/Modules/Wrappers/SWIG/src/otbWrapperSWIGIncludes.h b/Modules/Wrappers/SWIG/src/otbWrapperSWIGIncludes.h index 9bd940ef789a342131b1656906c14c1566949e40..8ded93c90a6869320b45d597d51d43d4ca565a43 100644 --- a/Modules/Wrappers/SWIG/src/otbWrapperSWIGIncludes.h +++ b/Modules/Wrappers/SWIG/src/otbWrapperSWIGIncludes.h @@ -24,6 +24,7 @@ #include "otbWrapperApplicationRegistry.h" #include "otbWrapperAddProcessToWatchEvent.h" #include "otbWrapperDocExampleStructure.h" +#include "otbWrapperMetaDataHelper.h" typedef otb::Wrapper::Application Application; typedef otb::Wrapper::Application::Pointer Application_Pointer; @@ -36,4 +37,6 @@ typedef otb::Wrapper::InputImageParameter InputImageParameter; typedef otb::Wrapper::ComplexOutputImageParameter ComplexOutputImageParameter; typedef otb::Wrapper::ComplexInputImageParameter ComplexInputImageParameter; +typedef otb::Wrapper::ImageBaseType ImageBaseType; + #endif diff --git a/Modules/Wrappers/SWIG/src/python/itkPyCommand.h b/Modules/Wrappers/SWIG/src/python/itkPyCommand.h index d65c4eea7bf23a3cabdca32d58978110f4522f96..5537bd56c3794bef6f809a588b9936ee1c27baa7 100644 --- a/Modules/Wrappers/SWIG/src/python/itkPyCommand.h +++ b/Modules/Wrappers/SWIG/src/python/itkPyCommand.h @@ -70,8 +70,8 @@ public: PyObject * GetCommandCallable(); - void Execute(Object *, const EventObject&); - void Execute(const Object *, const EventObject&); + void Execute(Object *, const EventObject&) override; + void Execute(const Object *, const EventObject&) override; protected: PyCommand(); diff --git a/Modules/Wrappers/SWIG/test/python/CMakeLists.txt b/Modules/Wrappers/SWIG/test/python/CMakeLists.txt index b0e0ac49bc32e831d3780db989ad2a08938e293b..edbef92fe8ac7a2267ec0c395a84809b3151c16f 100644 --- a/Modules/Wrappers/SWIG/test/python/CMakeLists.txt +++ b/Modules/Wrappers/SWIG/test/python/CMakeLists.txt @@ -141,3 +141,15 @@ add_test( NAME pyTvBug1498 ${OTB_DATA_ROOT}/Input/poupees.tif ${TEMP}/Bu1498-output.tif) +add_test( NAME pyTvParametersDict + COMMAND ${TEST_DRIVER} Execute + ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/PythonTestDriver.py + PythonParametersDict + ${OTB_DATA_ROOT}/Input/poupees.tif) + +add_test( NAME pyTvImageInterface + COMMAND ${TEST_DRIVER} Execute + ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/PythonTestDriver.py + PythonImageInterface + ${OTB_DATA_ROOT}/Examples/QB_Toulouse_Ortho_XS.tif + ) diff --git a/Modules/Wrappers/SWIG/test/python/PythonImageInterface.py b/Modules/Wrappers/SWIG/test/python/PythonImageInterface.py new file mode 100644 index 0000000000000000000000000000000000000000..62aade511e61aeaf5689fdaa00f8bda03afe4b9a --- /dev/null +++ b/Modules/Wrappers/SWIG/test/python/PythonImageInterface.py @@ -0,0 +1,23 @@ + +def test(otb, argv): + # Create a smoothing application + app = otb.Registry.CreateApplication("Smoothing") + app.SetParameterString("in",argv[1]) + app.Execute() + + # Setup a special requested region + myRegion = otb.itkRegion() + myRegion.GetSize()[0] = 20 + myRegion.GetSize()[1] = 25 + myRegion.GetIndex().Fill(10) + app.PropagateRequestedRegion("out",myRegion) + print(app.GetImageRequestedRegion("in")) + + # Create a ReadImageInfo application and plug the output of app + app2 = otb.Registry.CreateApplication("ReadImageInfo") + ex = app.ExportImage("out") + app2.ImportVectorImage("in", ex) + app2.Execute() + someKeys = ['sizex', 'sizey', 'spacingx', 'spacingy', 'sensor', 'projectionref'] + for key in someKeys: + print(key + ' : ' + str(app2.GetParameterValue(key)) ) diff --git a/Modules/Wrappers/SWIG/test/python/PythonNewStyleParametersTest.py b/Modules/Wrappers/SWIG/test/python/PythonNewStyleParametersTest.py index 4cb17b6fe546d0c2ad2a97222d40e5eca83eae4b..c6cb4f3c4bad06845c8a3e9449f83174cbe35aca 100644 --- a/Modules/Wrappers/SWIG/test/python/PythonNewStyleParametersTest.py +++ b/Modules/Wrappers/SWIG/test/python/PythonNewStyleParametersTest.py @@ -84,12 +84,12 @@ def test(otb, argv): cm_assert(app.MAP.UTM.ZONE, 31) # 10 - bool type sub parameters of choice parameter get - app.DisableParameter('map.utm.northhem') + app.SetParameterInt('map.utm.northhem',0) cm_assert(app.MAP.UTM.NORTHHEM, False) # 11 - bool type sub parameters of choice parameter set app.MAP.UTM.NORTHHEM = True - cm_assert(True, app.IsParameterEnabled('map.utm.northhem') ) + cm_assert(True, app.GetParameterInt('map.utm.northhem') ) #12 - simple choice parameter set app.OUTPUTS.MODE = 'auto' @@ -128,7 +128,7 @@ def test(otb, argv): cm_assert(app.IsParameterEnabled('outputs.isotropic'), True) #21 - parameter bool get - app.DisableParameter('outputs.isotropic') + app.SetParameterInt('outputs.isotropic',0) cm_assert(False, app.OUTPUTS.ISOTROPIC) #Do not execute. we need LARGEINPUT. so we tried a small application diff --git a/Modules/Wrappers/SWIG/test/python/PythonParametersDict.py b/Modules/Wrappers/SWIG/test/python/PythonParametersDict.py new file mode 100644 index 0000000000000000000000000000000000000000..d05161acc4c52dde972821ef827edeea26344be8 --- /dev/null +++ b/Modules/Wrappers/SWIG/test/python/PythonParametersDict.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# +# 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. +# + +# -*- coding: utf-8 -*- + +# +# Example on the use of parameters dictionaries +# + +def test(otb, argv): + app = otb.Registry.CreateApplication("Smoothing") + + app.SetParameterString("out", "myOutput.tif") + app.SetParameterInt("type.mean.radius",4) + prm = app.GetParameters() + if prm["out"] != "myOutput.tif": + exit(1) + if prm["type.mean.radius"] != 4: + exit(1) + prm["in"] = argv[1] + prm["type"] = "anidif" + prm["type.anidif.nbiter"] = 12 + app.SetParameters(prm) + if app.GetParameterString("in") != argv[1]: + exit(1) + if app.GetParameterInt("type.anidif.nbiter") != 12: + exit(1) + diff --git a/PSC.md b/PSC.md new file mode 100644 index 0000000000000000000000000000000000000000..cb617baf96310af46eac6aea61c5d453939b1ae7 --- /dev/null +++ b/PSC.md @@ -0,0 +1,281 @@ +# Project Steering Committee + +This document describes the Project Steering Committee of the Orfeo ToolBox. + +## PSC scope + +The aim of the **OTB Project Steering committee (PSC)** is to provide +high level guidance and coordination for the ORFEO ToolBox. + +It provides a central point of contact for the project and arbitrates +disputes. It is also a stable base of “institutional knowledge†to the +project and tries its best to involve more developers. + +It should help to guarantee that OTB remains open and company neutral. + +### Roadmaps + +The PSC gathers and publishes high level roadmaps for OTB: + +- Feature roadmap +- Technical roadmap (developer and coding guidelines and workflows, + target systems, packaging ...) +- Infrastructure roadmap (SCM, wiki, dashboard ...) + +The PSC also publishes the guidelines and the acceptance policy for +feature requests. It enforces them. It monitors and approves new feature +requests. + +### Communication + +The PSC coordinates communication actions: + +- Ensures that the wiki is up-to-date, +- Ensures that the website is up-to-date and proposes new content, +- Ensures regular posting on the blog and social networks, +- Keeps track of opportunities to communicate: Symposium and events + where OTB should be represented, +- Keeps track of opportunities from communities: Google Summer of Code + project, link with other OSGeo and FOSS projects, +- Is responsible for the organization of events around OTB (i.e. users + meetings and hackathon). + +### User support and documentation + +The PSC ensures that users are given an appropriate support: + +- Ensures that support is working (unanswered questions, questions + from other places than the user list ...) +- Proposes addition to the documentation based on users feedback, +- Proposes new features for the roadmap based on users feedback, +- Proposes new ways for support and documentation + +### Contribution management + +The PSC publishes the guidelines and acceptance policy for +contributions. It enforces them. + +It monitors and approves new proposals. + +It ensures that contribution is as easy as possible, by monitoring +technical means for contribution and proposing evolutions to guidelines, +policies and means. + +### Release planning + +The PSC publishes release guidelines and policies, and enforces them. + +The PSC puts together the next Release roadmap and proposes a planning. +It is then responsible for the release preparation. + +The final approval for a release is given by the PSC (motion proposed to +the otb-developers mailing list). + +### Handling of legal issues + +The PSC is responsible for addressing any issue about copyright or +licensing that may occur, and most importantly, it is responsible for +taking preventive actions about those issues. + +## How does the PSC work? + +This section describes how the PSC works. It is inspired by existing +governance statuses in other open source community projects related to +OTB like +[GDAL](https://trac.osgeo.org/gdal/wiki/GovernanceAndCommunity), +[Quantum +GIS](http://www2.qgis.org/en/site/getinvolved/governance/index.html) or +[GRASS](http://trac.osgeo.org/grass/wiki/PSC). + +### PSC members + +All members have equal standing and voice in the PSC. The PSC seats are +non-expiring. PSC members may resign their position, or be asked to +vacate their seat after a unanimous vote of no confidence from the +remaining PSC members. + +The expectations on PSC members are: + +- Be willing to commit to the OTB development effort +- Be responsive to requests for information from fellow members +- Be able and willing to attend on-line meetings +- Act in the best interests of the project + +It is important to note that the PSC is not a legal entity! + +### Roles + +Members can be assigned roles corresponding to each category of the PSC +scope described above. + +Being assigned a role does not mean undertaking all necessary actions, +but rather ensuring that actions will be undertaken. + +In addition to their specific roles, members of the PSC commit to +participate actively in discussions and votes. + +One member of the PSC is designated as the Chair and is the ultimate +adjudicator in case of deadlock or irretrievable break down of +decision-making, or in case of disputes over voting. + +### When is a PSC vote required? + +A vote of the PSC is required in the following cases: + +1. Some Merge Request (see below) +2. Addition or removal of PSC members (including the selection of a new + Chair) +3. Release process + +In addition, a vote can be summoned for: + +1. Changing PSC rules and processes +2. Anything else that might be controversial + +#### Merge Request + +All changes in Orfeo ToolBox (code, API, infrastructure or processes) must be +handle with a Merge Request : + +- Anything that could cause backward compatibility issues, +- Adding substantial amounts of new code, +- Changing inter-subsystem APIs, or objects, +- Any change in the code or in the documentation. + +Merge Request can implement an issue in GitLab. + +Merge Requests must be provided to a git hosted platform (GitLab, GitHub, etc.). +Merge request can be discussed on the developer list or directly on GitLab. + +Votes are necessary to accept Merge Request : +- Core developers ('Master' members in Gitlab ; it includes PSC members) can vote +- At least two +1 are necessary +- PSC members have veto + +#### Add or remove PSC members + +To be eligible for membership in the PSC, a person should demonstrate +**a substantial and ongoing involvement in OTB**. The PSC is not only +composed of OTB developers as there are many ways to join and contribute +to the project. Anyone is eligible to be nominated to the OTB PSC. +Ideally, nominees would be OTB users or developers who have a deep +understanding of the project. In addition, nominees should meet the +qualifications set forth in this document. Anyone can submit a +nomination. + +#### Release phases + +The release manager (the PSC member in charge of release planning) +submits to vote the following release decisions: + +1. Date of the next release +2. Codename of the next release +3. Date and revision of Release Candidate +4. Date and revision of Final Release +5. Date and revision of bug-fixes Release + +### Process + +- Proposals are written up and submitted as GitLab merge requests or on the + otb-developers mailing list for discussion and voting, by any interested + party, not just committee members. Proposals are available for review for at + least three days before a vote can be closed. It is acknowledged that some + more complex issues may require more time for discussion and deliberation. +- Respondents may vote “+1†to indicate support for the proposal and a + willingness to support implementation. +- Respondents may vote “-1†to veto a proposal, but must provide + argumented reasoning and alternate approaches to resolve the problem + within the two days. +- A vote of -0 indicates mild disagreement, but has no effect. A 0 + indicates no opinion. A +0 indicates mild support, but has no + effect. +- Anyone may comment and vote on proposals on the list or on the merge request + thread, but only members of the PSC's votes (including the Chair) will be + counted (“eligible votersâ€). +- A proposal will be accepted if it receives at least +2 (including + the proponent) and no vetos (-1) +- If a proposal is vetoed, and it cannot be revised to satisfy all + parties, then it can be resubmitted for an override vote in which a + majority of all eligible voters indicating +1 is sufficient to pass + it. Note that this is a majority of all committee members, not just + those who actively vote. +- The Chair adjudicates in cases of disputes about voting. + +A summary of discussions is published in a dedicated section of the wiki +[Requests for Changes](https://wiki.orfeo-toolbox.org/index.php/Requests_for_Changes). + +## Current members and roles + +In March 2015, CNES nominated 3 persons deeply involved in OTB as +initial PSC members. They are responsible for defining PSC rules and +establishing a fully functioning PSC. PSC has now 4 members. + +**Name** | **Affiliation** | **Email** | **Role** | +----------------------------|------------------|----------------------------------|--------------------------------------------| +Manuel Grizonnet (resigned) | CNES | manuel.grizonnet AT cnes DOT fr | Infrastructure, legal issues | +Rémi Cresson | IRSTEA | cresson.r AT gmail DOT com | Release Manager for release 5.2 | +Guillaume Pasero | CS-SI | guillaume.pasero AT c-s DOT fr | release planner | +Jordi Inglada (resigned) | CNES/CESBIO | jordi.inglada AT cesbio DOT eu | | +Julien Michel | CNES | julien.michel AT cnes DOT fr | Communication, contributions | +Victor Poughon | CNES | victor.poughon AT cnes DOT fr | User support and documentation, roadmaps | + +## Release manager + +A **release manager** is nominated for each release. Nomination is made +shortly after previous release announcement. A **backup release +manager** is also nominated, to assist and possibly step in if the +official release manager is not available. The **release manager** and +his/her backup can be a member of the PSC, but also another member of +otb-developers list willing to take the spot. + +The **release manager** is in charge of : + +1. Listing and tracking all major features proposed for next release + (from call for contribution in the early phase and then approved + RFCs) +2. Planing release date and ensures sync with RFCs execution, +3. Approving feature branch merges (if possible, leave at least 3 days + between RFC submission and merge, so that people have time to do a + review) +4. Actually merging feature branches when authors do not have commit + rights (github pull request for instance) +5. Tracking remote module that can be candidate for official inclusion + in next release, and ensuring they will be included (see + [Contributors guidelines](CONTRIBUTING.md)) +6. Submitting the start of the [release + process](https://wiki.orfeo-toolbox.org/index.php/How_to_Release) to PSC vote +7. Ensuring proper execution of [release + process](https://wiki.orfeo-toolbox.org/index.php/How_to_Release) + +**Feature freeze:** Starting the release process is also called *feature +freeze* which describes the period between the creation of the release +branch and the announcement of the release. It's an important time for +the RM who should ensures the proper execution of the release process +and facilitate the communication between developers. The RM is among +other things responsible of gathering feedback on bugs that need to be +fixed before the release, making a list that is public to be able to +follow progression of the release process. + +**Remember:** all new features must be submitted by Merge Requests and +approved by the PSC. The release manager only approves the feature +branches merge. + +### Feature branch merge acceptance checklist + +1. The feature branch corresponds to an [approved + Merge Request](#process) +2. The feature branch is synched with develop +3. The feature branch is tested on the dashboard + and has no major failure + (compilation errors, tremendous amount of warning or failing tests, + segfault or not executed tests) +4. Feature branch author are available during days following the merge + to analyse dashboard and fix things in case of unexpected issues + after the merge + +It is important to note that a feature branch should be kept relatively +small and does not necessarily correspond to the full implementation of +a RFC. Small consistent branches implementing parts of RFC can be merged +early. Further evolutions and implementations of the RFC can be done by +continuing the feature branch or opening new branches, and approval of +Release Manager should be requested again before merging. diff --git a/Packaging/CMakeLists.txt b/Packaging/CMakeLists.txt index 83d8487151b65a8063dde6f554ad0640d08a2155..3c5220b1f5ce5303b3fb0e5e8cfc19833c960fb1 100644 --- a/Packaging/CMakeLists.txt +++ b/Packaging/CMakeLists.txt @@ -141,6 +141,7 @@ include(install_include_dirs) include(install_importlibs) include(install_python_bindings) include(install_java_bindings) +include(install_qgis_bindings) include(install_share_dirs) include(install_cmake_files) include(install_qtdev_files) @@ -167,9 +168,9 @@ check_cmake_variables() cleanup_package() -set(HAVE_QT4 FALSE CACHE INTERNAL "HAVE_QT4") +set(HAVE_QT FALSE CACHE INTERNAL "HAVE_QT") if(EXISTS "${SUPERBUILD_INSTALL_DIR}/bin/otbApplicationLauncherQt${EXE_EXT}") - set(HAVE_QT4 TRUE) + set(HAVE_QT TRUE) endif() set(HAVE_MVD FALSE CACHE INTERNAL "HAVE_MVD") @@ -192,6 +193,11 @@ if(EXISTS "${SUPERBUILD_INSTALL_DIR}/lib/otb/java/org.otb.application.jar") set(HAVE_JAVA TRUE) endif() +set(HAVE_QGIS FALSE CACHE INTERNAL "QGIS wrappings") +if(IS_DIRECTORY "${SUPERBUILD_INSTALL_DIR}/descriptors") + set(HAVE_QGIS TRUE) +endif() + #only for *nix if(UNIX) file(WRITE ${CMAKE_BINARY_DIR}/make_symlinks "#!/bin/sh\n") @@ -217,6 +223,8 @@ install_python_bindings() install_java_bindings() +install_qgis_bindings() + install_share_dirs() install_cmake_files() diff --git a/Packaging/Files/linux_pkgsetup.in b/Packaging/Files/linux_pkgsetup.in index 93d5a6a082b7010519334e23bf71d8d5ed230588..a7843133d9821082302474c21c471394970be57d 100644 --- a/Packaging/Files/linux_pkgsetup.in +++ b/Packaging/Files/linux_pkgsetup.in @@ -52,7 +52,7 @@ fi unset LD_LIBRARY_PATH # we remove files in $OUT_DIR/lib/gtk which we CANNOT add new rpath -BINARY_FILES=$(find "$OUT_DIR/lib" "$OUT_DIR/bin" -type f -exec file {} \; | grep -v '/lib/gtk/' | grep -i elf|cut -f1 -d':') +BINARY_FILES=$(find "$OUT_DIR/lib" "$OUT_DIR/bin" "$OUT_DIR/plugins" -type f -exec file {} \; | grep -v '/lib/gtk/' | grep -i elf|cut -f1 -d':') # run patchelf for bin_file in $BINARY_FILES; do #echo "adding rpath to $bin_file" @@ -75,7 +75,7 @@ chmod +x "$OUT_DIR/mapla.sh" sed -i -E "s,OUT_DIR,$OUT_DIR,g" "$OUT_DIR/otbenv.profile" chmod +x "$OUT_DIR/otbenv.profile" -sed -i -E "s,../lib,$OUT_DIR/lib,g" "$OUT_DIR/bin/qt.conf" +sed -i -E "s,Prefix=..,Prefix=$OUT_DIR,g" "$OUT_DIR/bin/qt.conf" #echo "Creating symbolic links..." . ./make_symlinks diff --git a/Packaging/Files/macx_pkgsetup.in b/Packaging/Files/macx_pkgsetup.in index 7c4b5c8e941362bbaf7c68364122b5f52917d2c8..242b74fe680a71abb3a2a0bc40fd82c8db7dc10a 100755 --- a/Packaging/Files/macx_pkgsetup.in +++ b/Packaging/Files/macx_pkgsetup.in @@ -51,7 +51,7 @@ unset DYLD_FALLBACK_LIBRARY_PATH echo "Configuring..." -LIB_FILES=$(find "$OUT_DIR/lib" -type f -exec file {} \; | grep -i "Mach-O"|cut -d ':' -f1) +LIB_FILES=$(find "$OUT_DIR/lib" "$OUT_DIR/plugins" -type f -exec file {} \; | grep -i "Mach-O"|cut -d ':' -f1) BIN_FILES=$(find "$OUT_DIR/bin" -type f -exec file {} \; | grep -i "Mach-O*.*executable"|cut -d ':' -f1) # run install_name_tool for input_file in $LIB_FILES $BIN_FILES; do @@ -82,7 +82,7 @@ rm -fr "template.app" LONG_VERSION_STRING=@Monteverdi_VERSION_MAJOR@.@Monteverdi_VERSION_MINOR@.@Monteverdi_VERSION_PATCH@ SHORT_VERSION_STRING=@Monteverdi_VERSION_MAJOR@.@Monteverdi_VERSION_MINOR@ #sed qt.conf -sed -i "" "s,../lib,$OUT_DIR/lib,g" "$OUT_DIR/bin/qt.conf" +sed -i "" "s,Prefix=..,Prefix=$OUT_DIR,g" "$OUT_DIR/bin/qt.conf" cp "$OUT_DIR/bin/qt.conf" "$OUT_DIR/Mapla.app/Contents/Resources/qt.conf" cp "$OUT_DIR/Monteverdi.icns" "Mapla.app/Contents/Resources/" diff --git a/Packaging/Files/qt.conf b/Packaging/Files/qt.conf index 43c4c4fd878c5fb1ad834dcd48bc6461dfb6b0f0..01f4e8c7074b06caacc2ba8bfe0d90edbfd39e0e 100644 --- a/Packaging/Files/qt.conf +++ b/Packaging/Files/qt.conf @@ -1,3 +1,2 @@ [Paths] -Translations=../lib/qt4/translations -Plugins=../lib/qt4/plugins +Prefix=.. diff --git a/Packaging/PackageGlobals.cmake b/Packaging/PackageGlobals.cmake index e945e98f31646c9ee350d1e43d025d513215d0f5..bbc89d610d06b5e00905158a5ff612d488531353 100644 --- a/Packaging/PackageGlobals.cmake +++ b/Packaging/PackageGlobals.cmake @@ -43,30 +43,42 @@ elseif(APPLE) endif() set(WINDOWS_SYSTEM_DLLS - user32.dll - gdi32.dll - shell32.dll - kernel32.dll - ws2_32.dll - wldap32.dll - ole32.dll - comdlg32.dll - shfolder.dll - secur32.dll - wsock32.dll advapi32.dll + comdlg32.dll crypt32.dll - imm32.dll - oleaut32.dll - winmm.dll - opengl32.dll + dnsapi.dll + dwmapi.dll + dwrite.dll + d2d1.dll + d3d9.dll + d3d11.dll + gdi32.dll glu32.dll - rpcrt4.dll - winspool.drv + imm32.dll + iphlpapi.dll + kernel32.dll + netapi32.dll normaliz.dll + mpr.dll odbc32.dll + ole32.dll + oleaut32.dll + opengl32.dll psapi.dll python...dll + rpcrt4.dll + secur32.dll + shell32.dll + shfolder.dll + user32.dll + userenv.dll + uxtheme.dll + version.dll + winmm.dll + winspool.drv + wldap32.dll + ws2_32.dll + wsock32.dll ) set(LINUX_SYSTEM_DLLS @@ -96,6 +108,12 @@ set(LINUX_SYSTEM_DLLS libICE.so* libXrandr.so* libpython* + libxcb.so* + libxcb-glx.so* + libX11-xcb.so* + libmysqlclient.so* + libodbc.so* + libpq.so* ) # libexpat.so.* # libfontconfig.so* @@ -121,6 +139,7 @@ set(APPLE_SYSTEM_DLLS AGL.framework OpenGL.framework libgcc_s.*dylib + libcups.*dylib ) if(WIN32) diff --git a/Packaging/README.md b/Packaging/README.md index e845566c06f9bf557d35e8292c37cf05d97a9769..df83d58b21e469b8a3723b04c7efc6702ae7c32c 100644 --- a/Packaging/README.md +++ b/Packaging/README.md @@ -1 +1 @@ -README +OTB recipes to build standalone binary packages for Windows/Linux/Mac OS X diff --git a/Packaging/install_cmake_files.cmake b/Packaging/install_cmake_files.cmake index ca63afb0f6203fa8295aece0e09dcc8a03f15939..d92d803d8072ea1ea9016c51dd34e052b8f06332 100644 --- a/Packaging/install_cmake_files.cmake +++ b/Packaging/install_cmake_files.cmake @@ -31,4 +31,11 @@ function(install_cmake_files) MATCH_STRING "${CMAKE_INSTALL_PREFIX}" REPLACE_VAR "OTB_INSTALL_PREFIX" ) + + # install Qt5 cmake files (no patching required) + file(GLOB _qt5_cmake_folders "${SUPERBUILD_INSTALL_DIR}/lib/cmake/Qt5*") + foreach(_qt5_folder ${_qt5_cmake_folders}) + install_without_message("${_qt5_folder}" "lib/cmake") + endforeach() + endfunction() diff --git a/Packaging/install_otbapp_wrapper_scripts.cmake b/Packaging/install_otbapp_wrapper_scripts.cmake index bba639a281ffe426390004917e0c366044f20a7d..f2cc43f45885d3b8c8981b088d1d8dd05807b431 100644 --- a/Packaging/install_otbapp_wrapper_scripts.cmake +++ b/Packaging/install_otbapp_wrapper_scripts.cmake @@ -40,8 +40,8 @@ function(install_otbapp_wrapper_scripts otbapp_libfile) DESTINATION ${PKG_STAGE_DIR}/bin ) - #Do the same for otbgui script but only if HAVE_QT4 is set. - if(NOT HAVE_QT4) + #Do the same for otbgui script but only if HAVE_QT is set. + if(NOT HAVE_QT) return() endif() diff --git a/Packaging/install_qgis_bindings.cmake b/Packaging/install_qgis_bindings.cmake new file mode 100644 index 0000000000000000000000000000000000000000..76fd389e75323b62ecfbb26ddc922c18437f30f0 --- /dev/null +++ b/Packaging/install_qgis_bindings.cmake @@ -0,0 +1,26 @@ +# +# 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. +# + +function(install_qgis_bindings) + if(HAVE_QGIS) + install(DIRECTORY ${SUPERBUILD_INSTALL_DIR}/descriptors + DESTINATION ${PKG_STAGE_DIR}) + endif() +endfunction() diff --git a/Packaging/install_qtdev_files.cmake b/Packaging/install_qtdev_files.cmake index a615b02d0a2b28896360888f3b7a59fca9b391f1..dbedf9dda098249f987fb972d01c1ca0372c90fe 100644 --- a/Packaging/install_qtdev_files.cmake +++ b/Packaging/install_qtdev_files.cmake @@ -18,7 +18,7 @@ # limitations under the License. # function(install_qtdev_files) - if(NOT HAVE_QT4) + if(NOT HAVE_QT) return() endif() set(QT_REQ_DIRS) @@ -42,5 +42,8 @@ set(QT_REQ_DIRS) ${CMAKE_CURRENT_SOURCE_DIR}/Files/qt.conf DESTINATION ${PKG_STAGE_DIR}/bin ) - + + if(IS_DIRECTORY "${SUPERBUILD_INSTALL_DIR}/lib/fonts") + install_without_message("${SUPERBUILD_INSTALL_DIR}/lib/fonts" "lib") + endif() endfunction() diff --git a/Packaging/install_rule.cmake b/Packaging/install_rule.cmake index adfdf03c260db17f56a24f567df9243f220c53de..01455727e5517a9b0dcbbe4701cce9c73a12166f 100644 --- a/Packaging/install_rule.cmake +++ b/Packaging/install_rule.cmake @@ -29,6 +29,9 @@ function(install_rule src_file) get_filename_component(src_file_NAME_WE ${src_file} NAME_WE) get_filename_component(src_file_PATH ${src_file} PATH) + get_filename_component(src_file_GPATH ${src_file_PATH} PATH) + get_filename_component(src_file_GNAME ${src_file_GPATH} NAME) + file(GLOB src_file_star "${src_file_PATH}/${src_file_NAME_WE}*") foreach(sfile ${src_file_star}) get_filename_component(sfile_NAME ${sfile} NAME) @@ -51,6 +54,9 @@ function(install_rule src_file) message("SKIP INSTALL for ${sfile_NAME_LOWER}") endif() continue() + elseif(("${sfile_ABS_LOWER}" MATCHES "(\\${LIB_EXT})$") AND (src_file_GNAME STREQUAL "plugins")) + # special case: Qt plugins are installed by install_qtdev_files + continue() elseif("${sfile_ABS_LOWER}" MATCHES "(\\.exe)$") set(install_type PROGRAMS) set(install_dir bin) diff --git a/Packaging/installer_files.cmake b/Packaging/installer_files.cmake index 941f7f8cdfbf8caa17e8f52e3553a65bd25b6ab9..b864b74b7eacbfff0d65cb5ffbf94a26f1a7deff 100644 --- a/Packaging/installer_files.cmake +++ b/Packaging/installer_files.cmake @@ -22,11 +22,11 @@ macro(installer_files) #configure README from rst docs set(RSTDOC_DIR "${PACKAGE_OTB_SRC_DIR}/Documentation/Cookbook/rst") if(APPLE) - set(README_FILE ${RSTDOC_DIR}/Installation_Macx.txt) + set(README_FILE ${RSTDOC_DIR}/Installation_Macos.rst) elseif(LINUX) #not osx - set(README_FILE ${RSTDOC_DIR}/Installation_Linux.txt) + set(README_FILE ${RSTDOC_DIR}/Installation_Linux.rst) elseif(WIN32) #windows - set(README_FILE ${RSTDOC_DIR}/Installation_Windows.txt) + set(README_FILE ${RSTDOC_DIR}/Installation_Windows.rst) endif() configure_file("${README_FILE}" ${CMAKE_BINARY_DIR}/README ) install(FILES ${CMAKE_BINARY_DIR}/README DESTINATION ${PKG_STAGE_DIR} ) diff --git a/Packaging/prepare_file_list.cmake b/Packaging/prepare_file_list.cmake index e9d2a353d4587afe485dce52a4533768378297a7..5f0aaef717dbd748844bf2e452d66c831f4fe972 100644 --- a/Packaging/prepare_file_list.cmake +++ b/Packaging/prepare_file_list.cmake @@ -54,8 +54,10 @@ function(prepare_file_list file_list_result) endforeach() #Qt stuff - if(HAVE_QT4) + if(HAVE_QT) list(APPEND file_list "lrelease${EXE_EXT}") + list(APPEND file_list "lupdate${EXE_EXT}") + list(APPEND file_list "lconvert${EXE_EXT}") list(APPEND file_list "moc${EXE_EXT}") list(APPEND file_list "qmake${EXE_EXT}") list(APPEND file_list "rcc${EXE_EXT}") @@ -90,9 +92,20 @@ function(prepare_file_list file_list_result) # special case for msvc: ucrtbase.dll must be explicitly vetted. # for proj.dll, see Mantis-1424 + # libEGL needed by Qt 5 at runtime if(MSVC) list(APPEND file_list "ucrtbase.dll") list(APPEND file_list "proj.dll") + list(APPEND file_list "libEGL.dll") + endif() + + # Qt plugins + if(HAVE_QT) + file(GLOB _qt_plugins "${SUPERBUILD_INSTALL_DIR}/plugins/*/${LIB_PREFIX}*${LIB_EXT}") + foreach(_qt_plugin ${_qt_plugins}) + get_filename_component(_qt_plugin_name ${_qt_plugin} NAME) + list(APPEND file_list ${_qt_plugin_name}) + endforeach() endif() set(${file_list_result} ${file_list} PARENT_SCOPE) diff --git a/Packaging/prepare_search_dirs.cmake b/Packaging/prepare_search_dirs.cmake index 8f246edd9b072a59ccc4095fccb4718250c1c1bb..3c8c0fa21100173f3ae359c3740b8b13f8ab89c8 100644 --- a/Packaging/prepare_search_dirs.cmake +++ b/Packaging/prepare_search_dirs.cmake @@ -55,5 +55,13 @@ list(APPEND search_dirs "${SUPERBUILD_INSTALL_DIR}/lib/otb/python") #for otbtest executables. list(APPEND search_dirs ${OTB_BINARY_DIR}/bin) +# for Qt plugins +if(EXISTS "${SUPERBUILD_INSTALL_DIR}/plugins") + file(GLOB _qt_plugins_subdirs "${SUPERBUILD_INSTALL_DIR}/plugins/*") + foreach(_subdir ${_qt_plugins_subdirs}) + list(APPEND search_dirs "${_subdir}") + endforeach() +endif() + set(${search_dirs_result} ${search_dirs} PARENT_SCOPE) endfunction() diff --git a/Packaging/process_file_recurse.cmake b/Packaging/process_file_recurse.cmake index b8f31b4ededfb3faa10d848c5a2e0bbc9f4f7155..cc0e9f991e3e96047ac58988b3b3cdc4bac41a47 100644 --- a/Packaging/process_file_recurse.cmake +++ b/Packaging/process_file_recurse.cmake @@ -31,18 +31,18 @@ function(process_file_recurse input_file) if(LINUX) setif_value_in_list(is_gtk_lib "${input_file}" ALLOWED_SYSTEM_DLLS) if(is_gtk_lib) - search_library(${input_file} PKG_GTK_SEARCHDIRS input_file_full_path) - if( NOT input_file_full_path) - message(FATAL_ERROR "${input_file} not found. searched in ${PKG_GTK_SEARCHDIRS}") - endif() + search_library(${input_file} PKG_GTK_SEARCHDIRS input_file_full_path) + if( NOT input_file_full_path) + message(FATAL_ERROR "${input_file} not found. searched in ${PKG_GTK_SEARCHDIRS}") + endif() endif() - if( NOT input_file_full_path) - message(FATAL_ERROR "${input_file} not found. searched in ${PKG_SEARCHDIRS}") - endif() endif(LINUX) - endif() #if(NOT input_file_full_path) + if( NOT input_file_full_path) + message(FATAL_ERROR "${input_file} not found. searched in ${PKG_SEARCHDIRS}") + endif() + if(NOT PKG_DEBUG) message("Processing ${input_file_full_path}") endif() @@ -93,10 +93,14 @@ function(process_file_recurse input_file) set(is_system FALSE) setif_value_in_list(is_system "${raw_item}" SYSTEM_DLLS) if(APPLE AND NOT is_system) - if("${raw_item}" MATCHES "@rpath") - string(REGEX REPLACE "@rpath." "" raw_item "${raw_item}") + if(("${input_file_full_path}" MATCHES "/plugins/") AND ("${raw_item}" MATCHES "${input_file}")) + # ignore the check for @rpath on Qt plugins for the library own name else() - message(FATAL_ERROR "'${raw_item}' does not have @rpath") + if("${raw_item}" MATCHES "@rpath") + string(REGEX REPLACE "@rpath." "" raw_item "${raw_item}") + else() + message(FATAL_ERROR "'${raw_item}' does not have @rpath") + endif() endif() endif() diff --git a/README.md b/README.md index 7ae06474de74ecf4067b6d10a725c8488155d0aa..657504a2dc83be7443ec9802656653346b3f7426 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -#  Orfeo Toolbox +#  Orfeo Toolbox ## Open Source processing of remote sensing images Orfeo ToolBox (OTB) is an open-source project for state-of-the-art remote @@ -23,12 +23,12 @@ not a black box! * [OTB's website](https://www.orfeo-toolbox.org/) * [Documentation](https://www.orfeo-toolbox.org/documentation/) * [Downloads](https://www.orfeo-toolbox.org/download/) -* [Public git repositories](https://git.orfeo-toolbox.org/) +* [Public git repositories](https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb) * [GitHub mirror](https://github.com/orfeotoolbox/) * [Build status](http://dash.orfeo-toolbox.org/index.php?project=OTB) -* [Bug tracker](https://bugs.orfeo-toolbox.org/) +* [Bug tracker](https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/issues?label_name%5B%5D=bug) * [Wiki](http://wiki.orfeo-toolbox.org/index.php/Main_Page) -* [Task tracking](http://scrum.orfeo-toolbox.org) +* [Task tracking](https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/issues) ### Join the community Get help, share your experience and contribute to the Orfeo-Toolbox project by @@ -37,10 +37,13 @@ joining our community and mailing lists. [https://www.orfeo-toolbox.org/community/](https://www.orfeo-toolbox.org/community/) ### Contributing -Please see the wiki for contributors guidelines. +Please see [CONTRIBUTING.md](CONTRIBUTING.md) for contributors guidelines. ### License Please see the license and the Copyright directory for legal issues on the use of the software. ### Issues -Please report any issue you might encouter to [our bugtracker](http://bugs.orfeo-toolbox.org). +Please report any issue you might encouter to [our bugtracker](https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/issues?label_name%5B%5D=bug). + +### Governance +The Orfeo ToolBox project is governed by the [Project Steering Committee](PSC.md) and its members. diff --git a/SuperBuild/CMake/External_itk.cmake b/SuperBuild/CMake/External_itk.cmake index d0337bb39acc561ec6ae2080ed8264de35412f46..e9eb7d0b2ca528ab272a3c818f7705f5bdfee70a 100644 --- a/SuperBuild/CMake/External_itk.cmake +++ b/SuperBuild/CMake/External_itk.cmake @@ -39,6 +39,10 @@ set(ITK_ENABLED_MODULES SpatialObjects #TestKernel Transform + TransformFactory + IOTransformBase + IOTransformInsightLegacy + IOTransformMatlab AnisotropicSmoothing AntiAlias diff --git a/SuperBuild/CMake/External_ossim.cmake b/SuperBuild/CMake/External_ossim.cmake index 04d89d5f3ba6c207b726d4c9cfc4351d06b275b3..819432e851477667238325ad88eae62e9756042d 100644 --- a/SuperBuild/CMake/External_ossim.cmake +++ b/SuperBuild/CMake/External_ossim.cmake @@ -62,6 +62,7 @@ ExternalProject_Add(OSSIM -DBUILD_OSSIM_TESTS:BOOL=OFF -DBUILD_OSSIM_TEST_APPS:BOOL=OFF -DBUILD_OSSIM_FRAMEWORKS:BOOL=OFF + -DBUILD_BUILD_OSSIMQT4:BOOL=OFF -DINSTALL_ARCHIVE_DIR:STRING=lib -DINSTALL_LIBRARY_DIR:STRING=lib ${OSSIM_SB_CONFIG} diff --git a/SuperBuild/CMake/External_otb.cmake b/SuperBuild/CMake/External_otb.cmake index 47af6f552cae711f250e0c58ac750f6c2416bfb1..1f4acfe91db9f86e191a3a3a870772b00b07aed5 100644 --- a/SuperBuild/CMake/External_otb.cmake +++ b/SuperBuild/CMake/External_otb.cmake @@ -91,8 +91,9 @@ if(OTB_WRAP_PYTHON3) ADD_SUPERBUILD_CMAKE_VAR(OTB PYTHON3_EXECUTABLE) endif() -if(OTB_USE_QT4) - ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(OTB QT4) +if(OTB_USE_QT) + ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(OTB QT5) + ADD_SUPERBUILD_CMAKE_VAR(OTB QT_QMAKE_EXECUTABLE) endif() if(OTB_USE_GLEW) @@ -197,7 +198,7 @@ ExternalProject_Add(OTB -DOTB_USE_MUPARSERX:BOOL=${OTB_USE_MUPARSERX} -DOTB_USE_OPENCV:BOOL=${OTB_USE_OPENCV} -DOTB_USE_SHARK:BOOL=${OTB_USE_SHARK} - -DOTB_USE_QT4:BOOL=${OTB_USE_QT4} + -DOTB_USE_QT:BOOL=${OTB_USE_QT} -DOTB_USE_SIFTFAST:BOOL=${OTB_USE_SIFTFAST} -DOTB_USE_OPENGL:BOOL=${OTB_USE_OPENGL} -DOTB_USE_GLEW:BOOL=${OTB_USE_GLEW} diff --git a/SuperBuild/CMake/External_qt4.cmake b/SuperBuild/CMake/External_qt4.cmake deleted file mode 100644 index a0b4eeeae66f759b4ba2e796a500da1472c530bb..0000000000000000000000000000000000000000 --- a/SuperBuild/CMake/External_qt4.cmake +++ /dev/null @@ -1,149 +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_ONCE_MACRO(QT4) - -SETUP_SUPERBUILD(QT4) - -#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 -ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(QT4 ZLIB PNG JPEG FREETYPE) - -#use system libs always for Qt4 as we build them from source or have already in system - -if(SB_INSTALL_PREFIX) - file(TO_NATIVE_PATH ${SB_INSTALL_PREFIX} QT4_INSTALL_PREFIX_NATIVE) - file(TO_NATIVE_PATH ${SB_INSTALL_PREFIX}/include QT4_INCLUDE_PREFIX_NATIVE) - file(TO_NATIVE_PATH ${SB_INSTALL_PREFIX}/lib QT4_LIB_PREFIX_NATIVE) - file(TO_NATIVE_PATH ${SB_INSTALL_PREFIX}/include/freetype2 QT4_INCLUDE_FREETYPE_NATIVE) -endif() - -#Common options for all cases -set(QT4_SB_CONFIG -"-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() - -if(UNIX) - if(APPLE) - set(QT4_SB_CONFIG "${QT4_SB_CONFIG} -no-framework") - else() #Linux - if(QT4_SB_ENABLE_GTK) - message(WARNING "QT4_SB_ENABLE_GTK support is experimental") - set(QT4_SB_CONFIG "${QT4_SB_CONFIG} -sm -xrender -xrandr -gtkstyle") - else() - set(QT4_SB_CONFIG "${QT4_SB_CONFIG} -no-gtkstyle -no-glib -no-fontconfig") - endif() - endif() - #common for all unix - set(QT4_SB_CONFIG "${QT4_SB_CONFIG} -no-dbus -no-nis -no-javascript-jit -no-icu -v") -elseif(MSVC) - set(QT4_SB_CONFIG "${QT4_SB_CONFIG} -mp") -endif() - -if(WIN32) - set(QT4_BIN_EXT ".exe") - file(TO_NATIVE_PATH ${QT4_SB_SRC}/configure.exe QT4_CONFIGURE_SCRIPT) - set(QT4_CONFIGURE_COMMAND ${CMAKE_BINARY_DIR}/configure_qt4.bat) - set(QT4_CONFIGURE_COMMAND_IN ${CMAKE_SOURCE_DIR}/patches/QT4/configure_qt4.bat.in) -else() - set(QT4_BIN_EXT "") - file(TO_NATIVE_PATH ${QT4_SB_SRC}/configure QT4_CONFIGURE_SCRIPT) - set(QT4_CONFIGURE_COMMAND ${CMAKE_BINARY_DIR}/configure_qt4.sh) - set(QT4_CONFIGURE_COMMAND_IN ${CMAKE_SOURCE_DIR}/patches/QT4/configure_qt4.sh.in) -endif() - -if(EXISTS "${QT4_CONFIGURE_COMMAND}") - execute_process(COMMAND ${CMAKE_COMMAND} -E remove -f "${QT4_CONFIGURE_COMMAND}") -endif() - -configure_file(${QT4_CONFIGURE_COMMAND_IN} ${QT4_CONFIGURE_COMMAND} @ONLY ) - -#Remove left over or previous installation from install prefix. -#Existing files in install prefix was disturbing a second installation. -#even 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(QT4 - PREFIX QT4 - URL "http://download.qt.io/official_releases/qt/4.8/4.8.7/qt-everywhere-opensource-src-4.8.7.tar.gz" - URL_MD5 d990ee66bf7ab0c785589776f35ba6ad - BINARY_DIR ${QT4_SB_SRC} - INSTALL_DIR ${SB_INSTALL_PREFIX} - DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - CONFIGURE_COMMAND ${QT4_CONFIGURE_COMMAND} - DEPENDS ${QT4_DEPENDENCIES} - LOG_DOWNLOAD 1 - LOG_CONFIGURE 1 - LOG_BUILD 1 - LOG_INSTALL 1 - ) - -SUPERBUILD_PATCH_SOURCE(QT4) - -set(_SB_QT_QMAKE_EXECUTABLE ${SB_INSTALL_PREFIX}/bin/qmake) diff --git a/SuperBuild/CMake/External_qt5.cmake b/SuperBuild/CMake/External_qt5.cmake new file mode 100644 index 0000000000000000000000000000000000000000..d55e92b39207695c29716b25929bb1204fea3451 --- /dev/null +++ b/SuperBuild/CMake/External_qt5.cmake @@ -0,0 +1,207 @@ +# +# 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_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 +ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(QT5 ZLIB PNG JPEG FREETYPE) + +#use system libs always for Qt5 as we build them from source or have already in system + +if(SB_INSTALL_PREFIX) + file(TO_NATIVE_PATH ${SB_INSTALL_PREFIX} QT5_INSTALL_PREFIX_NATIVE) + file(TO_NATIVE_PATH ${SB_INSTALL_PREFIX}/include QT5_INCLUDE_PREFIX_NATIVE) + file(TO_NATIVE_PATH ${SB_INSTALL_PREFIX}/lib QT5_LIB_PREFIX_NATIVE) + file(TO_NATIVE_PATH ${SB_INSTALL_PREFIX}/include/freetype2 QT5_INCLUDE_FREETYPE_NATIVE) +endif() + +file(TO_NATIVE_PATH ${QT5_SB_SRC} QT5_SB_SRC_NATIVE) + +#Common options for all cases +# -skip qtbase +# -skip qttools (need linguist) +# -skip qttranslations +set(QT5_SB_CONFIG + "-prefix ${QT5_INSTALL_PREFIX_NATIVE} -L ${QT5_LIB_PREFIX_NATIVE} \ + -I ${QT5_INCLUDE_PREFIX_NATIVE} -I ${QT5_INCLUDE_FREETYPE_NATIVE} \ + -opensource -confirm-license -release -shared \ + -nomake examples -make tools -no-openssl \ + -skip qtgamepad \ + -skip qt3d \ + -skip qtactiveqt \ + -skip qtandroidextras \ + -skip qtcanvas3d \ + -skip qtcharts \ + -skip qtconnectivity \ + -skip qtdatavis3d \ + -skip qtdeclarative \ + -skip qtdoc \ + -skip qtgamepad \ + -skip qtgraphicaleffects \ + -skip qtimageformats \ + -skip qtlocation \ + -skip qtmacextras \ + -skip qtmultimedia \ + -skip qtnetworkauth \ + -skip qtpurchasing \ + -skip qtquickcontrols \ + -skip qtquickcontrols2 \ + -skip qtremoteobjects \ + -skip qtscript \ + -skip qtsensors \ + -skip qtserialbus \ + -skip qtserialport \ + -skip qtspeech \ + -skip qtsvg \ + -skip qtvirtualkeyboard \ + -skip qtwayland \ + -skip qtwebchannel \ + -skip qtwebengine \ + -skip qtwebglplugin \ + -skip qtwebsockets \ + -skip qtwebview \ + -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() + +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() + 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") +elseif(MSVC) + set(QT5_SB_CONFIG "${QT5_SB_CONFIG} -mp") +endif() + +if(WIN32) + set(QT5_BIN_EXT ".exe") + file(TO_NATIVE_PATH ${QT5_SB_SRC}/configure.bat QT5_CONFIGURE_SCRIPT) + set(QT5_CONFIGURE_COMMAND ${CMAKE_BINARY_DIR}/configure_qt5.bat) + set(QT5_CONFIGURE_COMMAND_IN ${CMAKE_SOURCE_DIR}/patches/QT5/configure_qt5.bat.in) +else() + set(QT5_BIN_EXT "") + file(TO_NATIVE_PATH ${QT5_SB_SRC}/configure QT5_CONFIGURE_SCRIPT) + set(QT5_CONFIGURE_COMMAND ${CMAKE_BINARY_DIR}/configure_qt5.sh) + set(QT5_CONFIGURE_COMMAND_IN ${CMAKE_SOURCE_DIR}/patches/QT5/configure_qt5.sh.in) +endif() + +if(EXISTS "${QT5_CONFIGURE_COMMAND}") + execute_process(COMMAND ${CMAKE_COMMAND} -E remove -f "${QT5_CONFIGURE_COMMAND}") +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 + ) + +SUPERBUILD_PATCH_SOURCE(QT5) + +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/font_qt.cmake + DEPENDEES install + WORKING_DIRECTORY ${SB_INSTALL_PREFIX} ) +endif() diff --git a/SuperBuild/CMake/External_qwt.cmake b/SuperBuild/CMake/External_qwt.cmake index 3755e3958fa62f91385adf87acfe8a1547faa133..add117b05d65c98fac5bf39b8e310ea33555f2a1 100644 --- a/SuperBuild/CMake/External_qwt.cmake +++ b/SuperBuild/CMake/External_qwt.cmake @@ -23,7 +23,7 @@ INCLUDE_ONCE_MACRO(QWT) SETUP_SUPERBUILD(QWT) # declare dependencies -ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(QWT QT4) +ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(QWT QT5) set(QWT_SB_MAKE_PROGRAM ${CMAKE_MAKE_PROGRAM}) if(MSVC) diff --git a/SuperBuild/CMake/External_shark.cmake b/SuperBuild/CMake/External_shark.cmake index ce8486db084935352b4266fc384f40be3604a29c..33934d4bb943dce00faceb9d6910534197a2342e 100644 --- a/SuperBuild/CMake/External_shark.cmake +++ b/SuperBuild/CMake/External_shark.cmake @@ -30,8 +30,8 @@ ADD_SUPERBUILD_CMAKE_VAR(SHARK BOOST_LIBRARYDIR) ExternalProject_Add(SHARK PREFIX SHARK - URL "https://github.com/Shark-ML/Shark/archive/349f29bd71c370e0f88f7fc9aa66fa5c4768fcb0.zip" - URL_MD5 d6e4310f943e8dda4a0151612b5c62ce + URL "https://github.com/Shark-ML/Shark/archive/2fd55e2b83f0666d05b403b291712668f4b76a13.zip" + URL_MD5 863bb5f0d94b01be5292867beb05a0bb SOURCE_DIR ${SHARK_SB_SRC} BINARY_DIR ${SHARK_SB_BUILD_DIR} INSTALL_DIR ${SB_INSTALL_PREFIX} @@ -45,6 +45,7 @@ ExternalProject_Add(SHARK -DENABLE_HDF5:BOOL=OFF -DENABLE_CBLAS:BOOL=OFF -DENABLE_OPENMP:BOOL=${OTB_USE_OPENMP} + -DSHARK_INSTALL_LIB_DIR:STRING=lib/ ${SHARK_SB_CONFIG} CMAKE_COMMAND ${SB_CMAKE_COMMAND} LOG_DOWNLOAD 1 diff --git a/SuperBuild/CMake/SystemCheckup/CMakeLists.txt b/SuperBuild/CMake/SystemCheckup/CMakeLists.txt index ad59aacde9a74c66815f35581ac427ec8edc6587..1199010eca64b8dc351db3208dabae057f83a15d 100644 --- a/SuperBuild/CMake/SystemCheckup/CMakeLists.txt +++ b/SuperBuild/CMake/SystemCheckup/CMakeLists.txt @@ -228,13 +228,13 @@ SB_CHECKUP_WRITE_RESULT(Ossim) SB_CHECKUP_FIND_PACKAGE(PNG) SB_CHECKUP_WRITE_RESULT(PNG) -# Qt4 -SB_CHECKUP_FIND_PACKAGE(Qt4) -if(_SB_CHECKUP_QT4_FOUND) - set(_SB_CHECKUP_QT4_VERSION "${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}") - SB_CHECKUP_SPLIT_VERSION(Qt4) +# Qt5 +SB_CHECKUP_FIND_PACKAGE(Qt5) +if(_SB_CHECKUP_QT5_FOUND) + set(_SB_CHECKUP_QT5_VERSION "${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}") + SB_CHECKUP_SPLIT_VERSION(Qt5) endif() -SB_CHECKUP_WRITE_RESULT(Qt4) +SB_CHECKUP_WRITE_RESULT(Qt5) # TinyXML SB_CHECKUP_FIND_PACKAGE(TinyXML) diff --git a/SuperBuild/CMake/font_qt.cmake b/SuperBuild/CMake/font_qt.cmake new file mode 100644 index 0000000000000000000000000000000000000000..d88fdbf2e98033df456e29a6bba6b15205acfaa7 --- /dev/null +++ b/SuperBuild/CMake/font_qt.cmake @@ -0,0 +1,38 @@ +# +# 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. +# + +get_filename_component(BUILD_DIR ${BUILD_DIR} DIRECTORY) + +if( NOT DOWNLOAD_LOCATION ) + set (DOWNLOAD_LOCATION ${BUILD_DIR}/src/) +endif() + +file(MAKE_DIRECTORY ${INSTALL_DIR}/lib/fonts/) +file(DOWNLOAD + http://sourceforge.net/projects/dejavu/files/dejavu/2.37/dejavu-fonts-ttf-2.37.tar.bz2 + ${DOWNLOAD_LOCATION}/dejavu-fonts-ttf-2.37.tar.bz2 + EXPECTED_MD5 d0efec10b9f110a32e9b8f796e21782c) + +execute_process( +COMMAND ${CMAKE_COMMAND} -E tar -xf ${DOWNLOAD_LOCATION}/dejavu-fonts-ttf-2.37.tar.bz2 +WORKING_DIRECTORY ${BUILD_DIR} ) + +file( COPY ${BUILD_DIR}/dejavu-fonts-ttf-2.37/ttf/. + DESTINATION ${INSTALL_DIR}/lib/fonts/.) diff --git a/SuperBuild/CMakeLists.txt b/SuperBuild/CMakeLists.txt index 19234b73adac3e617b6c5a053179fa70ee1ae632..72b4b7c780c53be044db3f48d2f072cab08a476a 100644 --- a/SuperBuild/CMakeLists.txt +++ b/SuperBuild/CMakeLists.txt @@ -285,7 +285,7 @@ option(USE_SYSTEM_OPENCV "Use a system build of OpenCV" OFF) option(USE_SYSTEM_LIBSVM "Use a system build of libsvm" OFF) option(USE_SYSTEM_PCRE "Use a system build of PCRE" ON) option(USE_SYSTEM_SWIG "Use a system build of swig" ON) -option(USE_SYSTEM_QT4 "Use a system build of QT4" OFF) +option(USE_SYSTEM_QT "Use a system build of QT5" OFF) option(USE_SYSTEM_QWT "Use a system build of Qwt" OFF) option(USE_SYSTEM_GLEW "Use a system build of GLEW" OFF) option(USE_SYSTEM_GLFW "Use a system build of glfw" OFF) @@ -311,7 +311,7 @@ option(OTB_USE_MAPNIK "Enable module Mapnik in OTB" OFF) option(OTB_USE_MUPARSER "Enable module muparser in OTB" ON) option(OTB_USE_MUPARSERX "Enable module muparserX in OTB" ON) option(OTB_USE_OPENCV "Enable module OpenCV in OTB" ON) -option(OTB_USE_QT4 "Enable module QT4 in OTB" ON) +option(OTB_USE_QT "Enable module QT5 in OTB" ON) option(OTB_USE_SIFTFAST "Enable module Siftfast in OTB" ON) option(OTB_USE_OPENGL "Enable module OpenGL in OTB" ON) option(OTB_USE_GLEW "Enable module GLEW in OTB" ON) diff --git a/SuperBuild/patches/QT5/configure_qt5.bat.in b/SuperBuild/patches/QT5/configure_qt5.bat.in new file mode 100644 index 0000000000000000000000000000000000000000..11737e036b898c4f05837ddef19eada132220f1d --- /dev/null +++ b/SuperBuild/patches/QT5/configure_qt5.bat.in @@ -0,0 +1,9 @@ +setlocal + +set INCLUDE=%INCLUDE%;@QT5_INCLUDE_PREFIX_NATIVE@;@QT5_INCLUDE_PREFIX_NATIVE@\freetype2 +set LIB=%LIB%;@QT5_LIB_PREFIX_NATIVE@ +set PATH=@QT5_SB_SRC_NATIVE@\qtbase\bin;@QT5_SB_SRC_NATIVE@\gnuwin32;%PATH% + +@QT5_CONFIGURE_SCRIPT@ @QT5_SB_CONFIG@ + +endlocal diff --git a/SuperBuild/patches/QT5/configure_qt5.sh.in b/SuperBuild/patches/QT5/configure_qt5.sh.in new file mode 100755 index 0000000000000000000000000000000000000000..c8d027fffc5211021fa0527c45c77ac067380fd2 --- /dev/null +++ b/SuperBuild/patches/QT5/configure_qt5.sh.in @@ -0,0 +1 @@ +@QT5_CONFIGURE_SCRIPT@ @QT5_SB_CONFIG@ diff --git a/SuperBuild/patches/QT5/qt5-1-jpeg-detection-win.diff b/SuperBuild/patches/QT5/qt5-1-jpeg-detection-win.diff new file mode 100644 index 0000000000000000000000000000000000000000..df7bc1e769ac02d3e80c83a45844b7e294a817d5 --- /dev/null +++ b/SuperBuild/patches/QT5/qt5-1-jpeg-detection-win.diff @@ -0,0 +1,12 @@ +--- qt-everywhere-src-5.10.1/qtbase/src/gui/configure.json 2018-02-08 19:24:48.000000000 +0100 ++++ QT5/qtbase/src/gui/configure.json 2018-04-10 11:50:15.631526687 +0200 +@@ -278,8 +278,7 @@ + "main": "jpeg_create_compress(cinfo);" + }, + "sources": [ +- { "libs": "-llibjpeg", "condition": "config.msvc" }, +- { "libs": "-ljpeg", "condition": "!config.msvc" } ++ { "libs": "-ljpeg" } + ] + }, + "libpng": { diff --git a/SuperBuild/patches/QT5/qt5-2-undefVar-macx.diff b/SuperBuild/patches/QT5/qt5-2-undefVar-macx.diff new file mode 100644 index 0000000000000000000000000000000000000000..7fcdd42a699fa80a83b5fb8de33e0d5a5ddeace2 --- /dev/null +++ b/SuperBuild/patches/QT5/qt5-2-undefVar-macx.diff @@ -0,0 +1,70 @@ +--- qt-everywhere-src-5.10.1/qtbase/src/corelib/kernel/qcore_mac_p.h 2018-02-08 19:24:48.000000000 +0100 ++++ QT5/qtbase/src/corelib/kernel/qcore_mac_p.h 2018-04-11 15:26:28.118640978 +0200 +@@ -86,7 +86,7 @@ + QAppleRefCounted(const QAppleRefCounted &other) : value(other.value) { if (value) RetainFunction(value); } + ~QAppleRefCounted() { if (value) ReleaseFunction(value); } + operator T() { return value; } +- void swap(QAppleRefCounted &other) Q_DECL_NOEXCEPT_EXPR(noexcept(qSwap(value, other.value))) ++ void swap(QAppleRefCounted &other) Q_DECL_NOEXCEPT_EXPR(noexcept(qSwap(this->value, other.value))) + { qSwap(value, other.value); } + QAppleRefCounted &operator=(const QAppleRefCounted &other) + { QAppleRefCounted copy(other); swap(copy); return *this; } +--- qt-everywhere-src-5.10.1/qtbase/src/corelib/kernel/qcore_foundation.mm 2018-02-08 19:24:48.000000000 +0100 ++++ QT5/qtbase/src/corelib/kernel/qcore_foundation.mm 2018-04-11 17:03:51.018596589 +0200 +@@ -488,7 +488,7 @@ + */ + NSTimeZone *QTimeZone::toNSTimeZone() const + { +- return [static_cast<NSTimeZone *>(toCFTimeZone()) autorelease]; ++ return [((NSTimeZone *) toCFTimeZone()) autorelease]; + } + #endif + +--- qt-everywhere-src-5.10.1/qtbase/src/platformsupport/clipboard/qmacmime.mm 2018-02-08 19:24:48.000000000 +0100 ++++ QT5/qtbase/src/platformsupport/clipboard/qmacmime.mm 2018-04-11 17:13:54.799982725 +0200 +@@ -853,11 +853,11 @@ + + QImage img = qvariant_cast<QImage>(variant); + NSDictionary *props = @{ +- static_cast<NSString *>(kCGImagePropertyPixelWidth) : [NSNumber numberWithInt:img.width()], +- static_cast<NSString *>(kCGImagePropertyPixelHeight) : [NSNumber numberWithInt:img.height()] ++ ((NSString *) kCGImagePropertyPixelWidth) : [NSNumber numberWithInt:img.width()], ++ ((NSString *) kCGImagePropertyPixelHeight) : [NSNumber numberWithInt:img.height()] + }; + +- CGImageDestinationAddImage(imageDestination, qt_mac_toCGImage(img), static_cast<CFDictionaryRef>(props)); ++ CGImageDestinationAddImage(imageDestination, qt_mac_toCGImage(img), (CFDictionaryRef) props); + CGImageDestinationFinalize(imageDestination); + + return QList<QByteArray>() << QByteArray::fromCFData(data); +--- qt-everywhere-src-5.10.1/qtbase/src/plugins/platforms/cocoa/qcocoawindow.mm 2018-02-08 19:24:48.000000000 +0100 ++++ QT5/qtbase/src/plugins/platforms/cocoa/qcocoawindow.mm 2018-04-11 17:36:09.563188504 +0200 +@@ -1684,7 +1684,7 @@ + + if (!m_drawContentBorderGradient) { + window.styleMask = window.styleMask & ~NSTexturedBackgroundWindowMask; +- [window.contentView.superview setNeedsDisplay:YES]; ++ [[[window contentView] superview] setNeedsDisplay:YES]; + window.titlebarAppearsTransparent = NO; + return; + } +--- qt-everywhere-src-5.10.1/qtbase/src/plugins/platforms/cocoa/qnswindow.mm 2018-02-08 19:24:48.000000000 +0100 ++++ QT5/qtbase/src/plugins/platforms/cocoa/qnswindow.mm 2018-04-11 18:27:43.952730012 +0200 +@@ -231,7 +231,7 @@ + if (pw->frameStrutEventsEnabled() && isMouseEvent(theEvent)) { + NSPoint loc = [theEvent locationInWindow]; + NSRect windowFrame = [self convertRectFromScreen:self.frame]; +- NSRect contentFrame = self.contentView.frame; ++ NSRect contentFrame = [[self contentView] frame]; + if (NSMouseInRect(loc, windowFrame, NO) && !NSMouseInRect(loc, contentFrame, NO)) + [qnsview_cast(pw->view()) handleFrameStrutMouseEvent:theEvent]; + } +@@ -260,7 +260,7 @@ + + (void)applicationActivationChanged:(NSNotification*)notification + { + const id sender = self; +- NSEnumerator<NSWindow*> *windowEnumerator = nullptr; ++ NSEnumerator *windowEnumerator = nullptr; + NSApplication *application = [NSApplication sharedApplication]; + + #if QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_12) diff --git a/SuperBuild/patches/QT5/qt5-3-png-freetype-detection-all.diff b/SuperBuild/patches/QT5/qt5-3-png-freetype-detection-all.diff new file mode 100644 index 0000000000000000000000000000000000000000..1a46b0acd8f10380f052d6c197c51f8ea95f45d4 --- /dev/null +++ b/SuperBuild/patches/QT5/qt5-3-png-freetype-detection-all.diff @@ -0,0 +1,25 @@ +--- qt-everywhere-src-5.10.1/qtbase/src/gui/configure.json 2018-02-08 19:24:48.000000000 +0100 ++++ QT5/src/QT5/qtbase/src/gui/configure.json 2018-04-10 14:34:05.529668610 +0200 +@@ -158,8 +158,8 @@ + ] + }, + "sources": [ +- { "type": "pkgConfig", "args": "freetype2" }, +- { "type": "freetype", "libs": "-lfreetype" } ++ { "type": "freetype", "libs": "-lfreetype" }, ++ { "type": "pkgConfig", "args": "freetype2" } + ] + }, + "fontconfig": { +@@ -289,9 +289,9 @@ + "main": "(void) png_create_read_struct(PNG_LIBPNG_VER_STRING,0,0,0);" + }, + "sources": [ +- { "type": "pkgConfig", "args": "libpng" }, ++ { "libs": "-lpng", "condition": "!config.msvc" }, + { "libs": "-llibpng", "condition": "config.msvc" }, +- { "libs": "-lpng", "condition": "!config.msvc" } ++ { "type": "pkgConfig", "args": "libpng" } + ], + "use": [ + { "lib": "zlib", "condition": "features.system-zlib" } diff --git a/SuperBuild/patches/QWT/qwt-2-dllinstall-win.diff b/SuperBuild/patches/QWT/qwt-2-dllinstall-win.diff new file mode 100644 index 0000000000000000000000000000000000000000..ed89de527cd1e0cf24903532d7b00da1282bc863 --- /dev/null +++ b/SuperBuild/patches/QWT/qwt-2-dllinstall-win.diff @@ -0,0 +1,14 @@ +--- QWT-orig/src/src.pro 2018-04-10 18:10:50.950501905 +0200 ++++ QWT/src/src.pro 2018-04-11 11:01:54.888535304 +0200 +@@ -42,6 +42,11 @@ + target.path = $${QWT_INSTALL_LIBS} + INSTALLS = target + ++win32 { ++ dlltarget.path = $${QWT_INSTALL_BIN} ++ INSTALLS += dlltarget ++} ++ + CONFIG(lib_bundle) { + + FRAMEWORK_HEADERS.version = Versions diff --git a/SuperBuild/patches/QWT/qwt-3-rpath-macx.diff b/SuperBuild/patches/QWT/qwt-3-rpath-macx.diff new file mode 100644 index 0000000000000000000000000000000000000000..ac5e5d96b5b809d30bcbaaf3aed8e49fd69f7c68 --- /dev/null +++ b/SuperBuild/patches/QWT/qwt-3-rpath-macx.diff @@ -0,0 +1,13 @@ +--- QWT-orig/qwtbuild.pri 2018-04-10 18:10:50.306498621 +0200 ++++ QWT/qwtbuild.pri 2018-04-16 16:09:32.980391550 +0200 +@@ -51,6 +51,10 @@ + #QMAKE_LFLAGS += -lrt + } + ++osx { ++ QMAKE_LFLAGS_SONAME = -Wl,-install_name,@rpath/ ++} ++ + ###################################################################### + # paths for building qwt + ###################################################################### diff --git a/SuperBuild/patches/QWT/qwtconfig.pri b/SuperBuild/patches/QWT/qwtconfig.pri index 576a27cdacf5d37260b3a03f04c65816755d6daf..370534077738a1c58baa42064aec2df5476d40f5 100644 --- a/SuperBuild/patches/QWT/qwtconfig.pri +++ b/SuperBuild/patches/QWT/qwtconfig.pri @@ -20,6 +20,7 @@ QWT_INSTALL_PREFIX = @SB_INSTALL_PREFIX@ QWT_INSTALL_DOCS = $${QWT_INSTALL_PREFIX}/doc QWT_INSTALL_HEADERS = $${QWT_INSTALL_PREFIX}/include QWT_INSTALL_LIBS = $${QWT_INSTALL_PREFIX}/lib +QWT_INSTALL_BIN = $${QWT_INSTALL_PREFIX}/bin ###################################################################### # Designer plugin diff --git a/SuperBuild/patches/SHARK/shark-2-ext-num-literals-all.diff b/SuperBuild/patches/SHARK/shark-2-ext-num-literals-all.diff new file mode 100644 index 0000000000000000000000000000000000000000..0b964c1b9ada7aa4409f0f032285a70723caacfe --- /dev/null +++ b/SuperBuild/patches/SHARK/shark-2-ext-num-literals-all.diff @@ -0,0 +1,13 @@ +diff -burN Shark.orig/CMakeLists.txt Shark/CMakeLists.txt +--- Shark.orig/CMakeLists.txt 2018-02-05 18:04:58.012612932 +0100 ++++ Shark/CMakeLists.txt 2018-02-05 18:20:50.032233165 +0100 +@@ -415,6 +415,9 @@ + ##################################################################### + # General Path settings + ##################################################################### ++if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") ++ add_definitions(-fext-numeric-literals) ++endif() + include_directories( ${shark_SOURCE_DIR}/include ) + include_directories( ${shark_BINARY_DIR}/include ) + add_subdirectory( include ) diff --git a/SuperBuild/patches/SHARK/shark-2-find-boost-all.diff b/SuperBuild/patches/SHARK/shark-2-find-boost-all.diff deleted file mode 100644 index a97c1ac4afd1f56118fdba14cf7b993755bb5c00..0000000000000000000000000000000000000000 --- a/SuperBuild/patches/SHARK/shark-2-find-boost-all.diff +++ /dev/null @@ -1,16 +0,0 @@ -diff -burN Shark-349f29bd71c370e0f88f7fc9aa66fa5c4768fcb0.orig/CMakeLists.txt Shark-349f29bd71c370e0f88f7fc9aa66fa5c4768fcb0/CMakeLists.txt ---- Shark-349f29bd71c370e0f88f7fc9aa66fa5c4768fcb0.orig/CMakeLists.txt 2017-08-22 11:31:50.472052695 +0200 -+++ Shark-349f29bd71c370e0f88f7fc9aa66fa5c4768fcb0/CMakeLists.txt 2017-08-22 11:32:36.448358789 +0200 -@@ -141,10 +141,8 @@ - - find_package( - Boost 1.48.0 REQUIRED COMPONENTS -- system date_time filesystem -- program_options serialization thread -- unit_test_framework --) -+ serialization -+ ) - - if(NOT Boost_FOUND) - message(FATAL_ERROR "Please make sure Boost 1.48.0 is installed on your system") diff --git a/Utilities/Maintenance/TravisBuild.cmake b/Utilities/Maintenance/TravisBuild.cmake index b35941ee0834f170f67dde2dd10c1002a941a551..3195783b77e29efea590ff4bfa16afb8cf6da82f 100644 --- a/Utilities/Maintenance/TravisBuild.cmake +++ b/Utilities/Maintenance/TravisBuild.cmake @@ -73,7 +73,7 @@ OTB_USE_OPENCV:BOOL=ON OTB_USE_LIBSVM:BOOL=ON OTB_USE_MUPARSER:BOOL=ON OTB_USE_MUPARSERX:BOOL=ON -OTB_USE_QT4:BOOL=ON +OTB_USE_QT:BOOL=ON OTB_USE_OPENGL:BOOL=ON OTB_USE_GLEW:BOOL=ON CMAKE_C_FLAGS:STRING=-Wextra diff --git a/i18n/CMakeLists.txt b/i18n/CMakeLists.txt index 86fad64e4faa8c8297a2c74d500f5a2beef0ba13..872386759062037d0528df86c232627a39b3ff4e 100644 --- a/i18n/CMakeLists.txt +++ b/i18n/CMakeLists.txt @@ -19,7 +19,7 @@ # ############################################################################# -# Qt4 translations. +# Qt translations. #---------------------------------------------------------------------------- # Locale human-readable translation files. set( OTB_TS_TRANSLATIONS @@ -37,7 +37,7 @@ option( OTB_I18N_MERGE_TS ) #---------------------------------------------------------------------------- -if( OTBQt4_ENABLED ) +if( OTBQt_ENABLED ) # Generate commands to build Qt translations according to option. if( OTB_I18N_MERGE_TS ) message( @@ -49,14 +49,14 @@ if( OTBQt4_ENABLED ) set( OTB_QT_I18N_PRO "${CMAKE_CURRENT_BINARY_DIR}/i18n.pro" ) - generate_qt4_project( ${OTB_QT_I18N_PRO} ) + generate_qt_project( ${OTB_QT_I18N_PRO} ) foreach(_ts_name ${OTB_TS_TRANSLATIONS}) get_filename_component(_abs_ts ${_ts_name} ABSOLUTE) message( STATUS "Merge TS : ${_abs_ts}") add_custom_command(OUTPUT ${_abs_ts} - COMMAND ${QT_LUPDATE_EXECUTABLE} + COMMAND ${Qt5_LUPDATE_EXECUTABLE} ARGS -locations none -pro ${OTB_QT_I18N_PRO} -ts ${_abs_ts} DEPENDS ${OTB_QT_I18N_HEADER_FILES} @@ -67,7 +67,7 @@ if( OTBQt4_ENABLED ) endforeach() endif() - qt4_add_translation(OTB_QM_TRANSLATIONS + qt5_add_translation(OTB_QM_TRANSLATIONS ${OTB_TS_TRANSLATIONS} ) diff --git a/i18n/fr_FR.ts b/i18n/fr_FR.ts index 67a6aa2bdfebed7571dffb53edff50c50a904c56..02606203d18afe178d7d4bb952ddca88c549e8fd 100644 --- a/i18n/fr_FR.ts +++ b/i18n/fr_FR.ts @@ -4067,8 +4067,8 @@ Voulez-vous sauvegarder avant de quitter ?</translation> <translation>Afficher les raccourcis clavier et souris</translation> </message> <message> - <source>Enable OTB_USE_QT4 preprocessor definition at compile time!</source> - <translation type="obsolete">Activer la définition de pré-processeur OTB_USE_QT4 lors de la compilation !</translation> + <source>Enable OTB_USE_QT preprocessor definition at compile time!</source> + <translation type="obsolete">Activer la définition de pré-processeur OTB_USE_QT lors de la compilation !</translation> </message> <message> <source>Layer stack</source> @@ -4240,8 +4240,8 @@ Charger '%1' provoquera l'affichage des couches dans une vue non <translation></translation> </message> <message> - <source>Enable OTB_USE_QT4 preprocessor definition at compile time!</source> - <translation>Activer la définition de pré-processeur OTB_USE_QT4 lors de la compilation !</translation> + <source>Enable OTB_USE_QT preprocessor definition at compile time!</source> + <translation>Activer la définition de pré-processeur OTB_USE_QT lors de la compilation !</translation> </message> </context> <context>