diff --git a/CMake/OTBApplicationMacros.cmake b/CMake/OTBApplicationMacros.cmake index d354b4cf72c5fce9323f4fa44ea6d2e6aa371cdb..49081c7d3988ea4d298d0ccd78c72b228221a199 100644 --- a/CMake/OTBApplicationMacros.cmake +++ b/CMake/OTBApplicationMacros.cmake @@ -67,75 +67,51 @@ macro(otb_create_application) endif() else() install(TARGETS ${APPLICATION_TARGET_NAME} - LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib + LIBRARY DESTINATION lib COMPONENT RuntimeLibraries) endif() - # Generate a quickstart script in the build dir - #if (NOT WIN32) - - # What is the path to the applications - # a MODULE target is always treated as LIBRARY - get_target_property(APPLICATION_BINARY_PATH ${APPLICATION_TARGET_NAME} LIBRARY_OUTPUT_DIRECTORY) - - if (NOT APPLICATION_BINARY_PATH) - set(APPLICATION_BINARY_PATH ${CMAKE_CURRENT_BINARY_DIR}) - endif() - - if (WIN32) - set(SCRIPT_CLI_SOURCE ${OTB_SOURCE_DIR}/CMake/otbcli_app.bat.in) - set(SCRIPT_CLI_INTERMEDIATE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/otbcli_${APPLICATION_NAME}.bat) - set(SCRIPT_CLI_INSTALLABLE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/otbcli_${APPLICATION_NAME}.bat) - else() - set(SCRIPT_CLI_SOURCE ${OTB_SOURCE_DIR}/CMake/otbcli_app.sh.in) - set(SCRIPT_CLI_INTERMEDIATE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/otbcli_${APPLICATION_NAME}) - set(SCRIPT_CLI_INSTALLABLE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/otbcli_${APPLICATION_NAME}) - endif() - - if (EXISTS ${SCRIPT_CLI_SOURCE}) - # Generate a script in the build dir, next to the cli launcher - configure_file( ${SCRIPT_CLI_SOURCE} - ${SCRIPT_CLI_INTERMEDIATE} - @ONLY ) - - # Copy it next to the application shared lib, and give executable rights - file(COPY ${SCRIPT_CLI_INTERMEDIATE} - DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) - - # Install a version of this script if we are inside the OTB build - install(PROGRAMS ${SCRIPT_CLI_INSTALLABLE} - DESTINATION ${OTB_INSTALL_RUNTIME_DIR} - COMPONENT Runtime) - endif() - - if (WIN32) - set(SCRIPT_GUI_SOURCE ${OTB_SOURCE_DIR}/CMake/otbgui_app.bat.in) - set(SCRIPT_GUI_INTERMEDIATE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/otbgui_${APPLICATION_NAME}.bat) - set(SCRIPT_GUI_INSTALLABLE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/otbgui_${APPLICATION_NAME}.bat) - else() - set(SCRIPT_GUI_SOURCE ${OTB_SOURCE_DIR}/CMake/otbgui_app.sh.in) - set(SCRIPT_GUI_INTERMEDIATE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/otbgui_${APPLICATION_NAME}) - set(SCRIPT_GUI_INSTALLABLE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/otbgui_${APPLICATION_NAME}) - endif() - - if (EXISTS ${SCRIPT_GUI_SOURCE}) - # Generate a script in the build dir, next to the cli launcher - configure_file( ${SCRIPT_GUI_SOURCE} - ${SCRIPT_GUI_INTERMEDIATE} - @ONLY ) - - # Copy it next to the application shared lib, and give executable rights - file(COPY ${SCRIPT_GUI_INTERMEDIATE} - DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) - - # Install a version of this script if we are inside the OTB build - install(PROGRAMS ${SCRIPT_GUI_INSTALLABLE} - DESTINATION ${OTB_INSTALL_RUNTIME_DIR} - COMPONENT Runtime) - endif() - #endif() + # What is the path to the applications + # a MODULE target is always treated as LIBRARY + get_target_property(APPLICATION_BINARY_PATH ${APPLICATION_TARGET_NAME} LIBRARY_OUTPUT_DIRECTORY) + + if (NOT APPLICATION_BINARY_PATH) + set(APPLICATION_BINARY_PATH ${CMAKE_CURRENT_BINARY_DIR}) + endif() + + if(CMAKE_RUNTIME_OUTPUT_DIRECTORY) + set(_script_output_dir ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) + else() + set(_script_output_dir ${CMAKE_BINARY_DIR}/bin) + endif() + if(OTB_INSTALL_RUNTIME_DIR) + set(_script_install_dir ${OTB_INSTALL_RUNTIME_DIR}) + else() + set(_script_install_dir bin) + endif() + set(INTERMEDIATE_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}) + set(SCRIPT_EXT "") + if(WIN32) + set(SCRIPT_EXT ".bat") + endif() + + # ----- Create and install launcher scripts ------ + foreach(type CLI GUI) + string(TOLOWER "${type}" type_lower) + set(SCRIPT_NAME otb${type_lower}_${APPLICATION_NAME}${SCRIPT_EXT}) + otb_write_app_launcher( + NAME ${APPLICATION_NAME} + OUTPUT ${INTERMEDIATE_DIR}/${SCRIPT_NAME} + TYPE ${type}) + # Copy it next to the application shared lib, and give executable rights + file(COPY ${INTERMEDIATE_DIR}/${SCRIPT_NAME} + DESTINATION ${_script_output_dir} + FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) + # Install a version of this script if we are inside the OTB build + install(PROGRAMS ${_script_output_dir}/${SCRIPT_NAME} + DESTINATION ${_script_install_dir} + COMPONENT Runtime) + endforeach() list(APPEND OTB_APPLICATIONS_NAME_LIST ${APPLICATION_NAME}) list(REMOVE_DUPLICATES OTB_APPLICATIONS_NAME_LIST) @@ -170,3 +146,56 @@ macro(otb_test_application) -testenv ${TESTAPPLICATION_TESTENVOPTIONS}) endif() endmacro() + +macro(otb_write_app_launcher) + cmake_parse_arguments(APPLAUNCHER "" "NAME;OUTPUT;TYPE" "" ${ARGN} ) + if("${APPLAUNCHER_TYPE}" STREQUAL "CLI") + set(_launcher_type "otbcli") + elseif("${APPLAUNCHER_TYPE}" STREQUAL "GUI") + set(_launcher_type "otbgui") + else() + message(FATAL_ERROR "Unknown launcher type : ${APPLAUNCHER_TYPE}, only support CLI and GUI") + endif() + + if(WIN32) + # Launcher script in Batch format + file(WRITE "${APPLAUNCHER_OUTPUT}" +"@echo off +:: +:: Autogenerated by OTB installation process +:: DO NOT MODIFY +:: +set CURRENT_SCRIPT_DIR=%~dp0 +if exist %CURRENT_SCRIPT_DIR%${_launcher_type}.bat ( + :: Prefer using the launcher inside the script dir + set OTB_LAUNCHER=%CURRENT_SCRIPT_DIR%${_launcher_type}.bat +) else ( + :: Use the one from the PATH + set OTB_LAUNCHER=${_launcher_type}.bat +) + +:: start the application +%OTB_LAUNCHER% ${APPLAUNCHER_NAME} %* +") + else() + # Launcher script in Shell format + file(WRITE "${APPLAUNCHER_OUTPUT}" +"#!/bin/sh +# +# Autogenerated by OTB installation process +# DO NOT MODIFY +# +CURRENT_SCRIPT_DIR=$(dirname \"\$0\") +if [ -e \"\$CURRENT_SCRIPT_DIR/${_launcher_type}\" ] ; then + # Prefer using the launcher inside the script dir + OTB_LAUNCHER=$CURRENT_SCRIPT_DIR/${_launcher_type} +else + # Use the one from the PATH + OTB_LAUNCHER=${_launcher_type} +fi + +# start the application +\$OTB_LAUNCHER ${APPLAUNCHER_NAME} \"$@\" +") + endif() +endmacro() diff --git a/CMake/OTBModuleExternal.cmake b/CMake/OTBModuleExternal.cmake index 8fdf2765147e174cdafcc7a268c1c6afbd3b8246..75ce8c229d97a2420acd0d17bdc06197c7596be3 100644 --- a/CMake/OTBModuleExternal.cmake +++ b/CMake/OTBModuleExternal.cmake @@ -76,6 +76,9 @@ else() if(NOT OTB_INSTALL_PACKAGE_DIR) set(OTB_INSTALL_PACKAGE_DIR "lib/cmake/OTB-${OTB_VERSION_MAJOR}.${OTB_VERSION_MINOR}") endif() + if(NOT OTB_INSTALL_APP_DIR) + set(OTB_INSTALL_APP_DIR lib/otb/applications) + endif() # Use OTB's flags. set(CMAKE_C_FLAGS "${OTB_REQUIRED_C_FLAGS} ${CMAKE_C_FLAGS}") diff --git a/CMake/OTBStandaloneModuleMacros.cmake b/CMake/OTBStandaloneModuleMacros.cmake index 0ae7355212214fb64b6597d5e43ea8667496a57d..b82b04c25609486ef89770d04df889a5a19ca4de 100644 --- a/CMake/OTBStandaloneModuleMacros.cmake +++ b/CMake/OTBStandaloneModuleMacros.cmake @@ -262,7 +262,7 @@ macro(otb_module_impl) set(OTBAPP_BASELINE ${OTB_DATA_ROOT}/Baseline/OTB-Applications/Images) set(OTBAPP_BASELINE_FILES ${OTB_DATA_ROOT}/Baseline/OTB-Applications/Files) - if(${BUILD_TESTING}) + if(BUILD_TESTING) enable_testing() endif() diff --git a/CMake/otbcli_app.bat.in b/CMake/otbcli_app.bat.in deleted file mode 100644 index e4af53d8e5cf0290d45049be10ee673daed9cbb0..0000000000000000000000000000000000000000 --- a/CMake/otbcli_app.bat.in +++ /dev/null @@ -1,18 +0,0 @@ -@echo off -:: -:: Autogenerated by OTB installation process -:: DO NOT MODIFY -:: - -set CURRENT_SCRIPT_DIR=%~dp0 - -if exist %CURRENT_SCRIPT_DIR%otbcli.bat ( - :: Prefer using the launcher inside the script dir - set OTB_CLI_LAUNCHER=%CURRENT_SCRIPT_DIR%otbcli.bat -) else ( - :: Use the one from the PATH - set OTB_CLI_LAUNCHER=otbcli.bat -) - -:: start the application -%OTB_CLI_LAUNCHER% @APPLICATION_NAME@ %* diff --git a/CMake/otbcli_app.sh.in b/CMake/otbcli_app.sh.in deleted file mode 100644 index c073ae192b11e4d34c412835c44bfdf4c4792a25..0000000000000000000000000000000000000000 --- a/CMake/otbcli_app.sh.in +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -# -# Autogenerated by OTB installation process -# DO NOT MODIFY -# - -CURRENT_SCRIPT_DIR=$(dirname "$0") - -if [ -e "$CURRENT_SCRIPT_DIR/otbcli" ] -then - # Prefer using the launcher inside the script dir - OTB_CLI_LAUNCHER=$CURRENT_SCRIPT_DIR/otbcli -else - # Use the one from the PATH - OTB_CLI_LAUNCHER=otbcli -fi - -# start the application -$OTB_CLI_LAUNCHER @APPLICATION_NAME@ "$@" diff --git a/CMake/otbgui_app.bat.in b/CMake/otbgui_app.bat.in deleted file mode 100644 index 5752728a54804cdbd6f06d48ae0c85f97d67ec7b..0000000000000000000000000000000000000000 --- a/CMake/otbgui_app.bat.in +++ /dev/null @@ -1,18 +0,0 @@ -@echo off -:: -:: Autogenerated by OTB installation process -:: DO NOT MODIFY -:: - -set CURRENT_SCRIPT_DIR=%~dp0 - -if exist %CURRENT_SCRIPT_DIR%otbgui.bat ( - :: Prefer using the launcher inside the script dir - set OTB_GUI_LAUNCHER=%CURRENT_SCRIPT_DIR%otbgui.bat -) else ( - :: Use the one from the PATH - set OTB_GUI_LAUNCHER=otbgui.bat -) - -:: start the application -%OTB_GUI_LAUNCHER% @APPLICATION_NAME@ %* diff --git a/CMake/otbgui_app.sh.in b/CMake/otbgui_app.sh.in deleted file mode 100644 index 7243475e300ff137b94203ec698f74d192bd80fa..0000000000000000000000000000000000000000 --- a/CMake/otbgui_app.sh.in +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -# -# Autogenerated by OTB installation process -# DO NOT MODIFY -# - -CURRENT_SCRIPT_DIR=$(dirname "$0") - -if [ -e "$CURRENT_SCRIPT_DIR/otbgui" ] -then - # Prefer using the launcher inside the script dir - OTB_GUI_LAUNCHER=$CURRENT_SCRIPT_DIR/otbgui -else - # Use the one from the PATH - OTB_GUI_LAUNCHER=otbgui -fi - -# start the application -$OTB_GUI_LAUNCHER @APPLICATION_NAME@ "$@" diff --git a/CMakeLists.txt b/CMakeLists.txt index 31310a07f0d1b869ac0f5809d5b8f2b6081c0aab..147b46694827c7899b9b1fd2fda1b0907e2e695e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -110,7 +110,7 @@ set(main_project_name ${_OTBModuleMacros_DEFAULT_LABEL}) #----------------------------------------------------------------------------- # OTB version number. set(OTB_VERSION_MAJOR "6") -set(OTB_VERSION_MINOR "1") +set(OTB_VERSION_MINOR "3") set(OTB_VERSION_PATCH "0") set(OTB_VERSION_STRING "${OTB_VERSION_MAJOR}.${OTB_VERSION_MINOR}.${OTB_VERSION_PATCH}") diff --git a/Documentation/Cookbook/Scripts/otbGenerateWrappersRstDoc.py b/Documentation/Cookbook/Scripts/otbGenerateWrappersRstDoc.py index 59019e33e2a0a35c32134412512a82bbae52ab54..70d55ce7c9490d4998b7db595130d0f917bf5576 100755 --- a/Documentation/Cookbook/Scripts/otbGenerateWrappersRstDoc.py +++ b/Documentation/Cookbook/Scripts/otbGenerateWrappersRstDoc.py @@ -344,8 +344,8 @@ def GetApplicationExamplePythonSnippet(app,idx,expand = False, inputpath="",outp #app.SetParameterString(param,value) output+= "\t" + appname + ".SetParameterString(" + EncloseString(param) + "," + EncloseString(value) + ")" + linesep if paramtype == otbApplication.ParameterType_Empty: - app.SetParameterString(param,"1") - output+= "\t" + appname + ".SetParameterString("+EncloseString(param)+",\"1\")" + linesep + app.EnableParameter(param) + output+= "\t" + appname + ".EnableParameter("+EncloseString(param)+")" + linesep if paramtype == otbApplication.ParameterType_Int \ or paramtype == otbApplication.ParameterType_Radius \ or paramtype == otbApplication.ParameterType_RAM: diff --git a/Documentation/Cookbook/rst/Installation.rst b/Documentation/Cookbook/rst/Installation.rst index 973783f63321df3fded8e591a0dec9846a751304..e37fd817b6046e39319e6502f05f4825a9e7c4da 100644 --- a/Documentation/Cookbook/rst/Installation.rst +++ b/Documentation/Cookbook/rst/Installation.rst @@ -87,7 +87,7 @@ You can add it by using these command-lines: sudo aptitude install add-apt-repository sudo apt-add-repository ppa:ubuntugis/ubuntugis-unstable -After you can run: +You will then need to run: :: @@ -114,8 +114,8 @@ OpenSuse 12.X and higher For OpenSuse 12.X and higher, OTB Applications packages are available through *zypper*. -First, you need to add the appropriate repositories with these -command-lines (please replace :math:`11.4` by your OpenSuse version): +First, you need to add the appropriate repositories with the following +commands (please replace :math:`11.4` with your version of OpenSuse): :: @@ -126,7 +126,7 @@ command-lines (please replace :math:`11.4` by your OpenSuse version): sudo zypper ar http://download.opensuse.org/repositories/home:/tzotsos/openSUSE_11.4/ tzotsos -Now run: +You should then run: :: diff --git a/Documentation/Cookbook/rst/Installation_Linux.txt b/Documentation/Cookbook/rst/Installation_Linux.txt index c4eb913166f05a59ea93471a2f6abac81beddc7b..2f3e127104c4eba1aeb41316996177f8d27a94aa 100644 --- a/Documentation/Cookbook/rst/Installation_Linux.txt +++ b/Documentation/Cookbook/rst/Installation_Linux.txt @@ -1,24 +1,24 @@ We provide a binary package for GNU/Linux x86_64. This package includes -all of OTB applications along with commandline and graphical launchers. -Download it from `OTB's download page +all of the OTB applications along with command line and graphical launchers. +It can be downloaded from `OTB's download page <https://www.orfeo-toolbox.org/download>`__. -This package is a self-extractible archive. You may uncompress it with a -double-click on the file, or with the command line: +This package is a self-extractable archive. You may uncompress it with a +double-click on the file, or from the command line as follows: .. parsed-literal:: chmod +x OTB-|release|-Linux64.run ./OTB-|release|-Linux64.run -The self-extractible archive only needs common tools found on most Linux +The self-extractable archive only needs common tools found on most Linux distributions ("sed", "grep", "find", "cat", "printf", "ln", ...). However, be aware that it requires tools such as "which" and "file" (they are not always present, for instance when building a container). Please note that the resulting installation is not meant to be moved, you should uncompress the archive in its final location. Once the -archive is extracted, the directory structure is made of: +archive is extracted, the directory structure consists of: - ``monteverdi.sh``: A launcher script for Monteverdi @@ -36,11 +36,15 @@ archive is extracted, the directory structure is made of: - ``share``: A folder containing common resources and copyright mentions. +- ``tool``: A folder containing usefull scripts to test the installation or + to uninstall OTB libraries and headers while keeping all the depedencies. + In order to run the command line launchers, this package doesn’t require any special library that is not present in most modern Linux -distributions. There is a small caveat for "expat" though. The binaries depend +distributions. There is a small caveat for "expat" though as these binaries depend on "libexpat.so", which can be supplied by most package managers (apt, yum, ...). -If not already present, look for one of the following packages: +Note that this problem only affects versions 6.0 and older. +If not already present, it is necessary to install one of the following packages: :: @@ -65,14 +69,14 @@ with ``source otbenv.profile``. Python bindings ~~~~~~~~~~~~~~~ -Starting from OTB 5.8.0, OTB python bindings are distributed with binary package. -currently only Python 2.x is supported. If no compatible python is found, installation -notify you about it. If everything works fine, you will be given information about -using python bindings. +Starting from OTB 5.8.0, OTB Python bindings are distributed with binary package. +Currently only Python 2.x is supported and if no compatible Python 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. you can install it locally -without admin rights with "pip install --user numpy". This is to give users to choose -their own existing python installation rather than distributing one in OTB package +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. Notes: @@ -108,9 +112,9 @@ A: This is due to a conflict with system Qt4 (usually seen on KDE) and Qt4 + gtk Q: Monteverdi and Mapla applications look different from my other applications. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -A: By default, Monteverdi, Mapla and otbapplication (otbgui\_\*) uses a the -system gtk theme. If you can't install GTK on your system you can use the -distributed with the OTB package. Note that using system GTK is the preferred +A: In versions 6.0 and older, 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. @@ -122,3 +126,6 @@ To use the distributed GTK libraries you need to set the OTB_USE_LOCAL_GTK: And now start ``monteverdi.sh`` or ``mapla.sh`` from OTB-|release|-Linux64 To get back default behaviour, unset OTB_USE_LOCAL_GTK=1 or set OTB_USE_LOCAL_GTK=0 + +In version 6.2, the Linux binaries are built without GTK support to cut some +dependencies. diff --git a/Documentation/Cookbook/rst/Installation_Macx.txt b/Documentation/Cookbook/rst/Installation_Macx.txt index c142851cefee0ea80700ba48eb020051f05efd29..7389c07754cdfabbbda4154feb49ee32db0cb0f8 100644 --- a/Documentation/Cookbook/rst/Installation_Macx.txt +++ b/Documentation/Cookbook/rst/Installation_Macx.txt @@ -25,6 +25,9 @@ Contents of OTB-|release|-Darwin64 is briefly listed below: - ``share``: A folder containing common resources and copyright mentions. +- ``tool``: A folder containing usefull scripts to test the installation or + to uninstall OTB libraries and headers while keeping all the depedencies. + Python bindings ~~~~~~~~~~~~~~~ @@ -35,7 +38,7 @@ using python bindings. You must have python numpy bindings installed in your system. you can install it locally without admin rights with "pip install --user numpy". This is to give users to choose -their own existing python installation rather than distributing one in OTB package +their own existing python installation rather than distributing one in OTB package. Notes: diff --git a/Documentation/Cookbook/rst/Installation_Windows.txt b/Documentation/Cookbook/rst/Installation_Windows.txt index d9a72803aa4b5a0d61eb2adb4906e2ee4d50415d..8f4741c77d19e0b127ea75b1de5464ad41c07f95 100644 --- a/Documentation/Cookbook/rst/Installation_Windows.txt +++ b/Documentation/Cookbook/rst/Installation_Windows.txt @@ -18,6 +18,9 @@ and their launchers (both command line and graphical launchers are provided): - ``lib``: A folder containing application DLLs. +- ``tool``: A folder containing usefull scripts to test the installation or + to uninstall OTB libraries and headers while keeping all the depedencies. + The applications can be launched from the Mapla launcher. If you want to use the otbcli and otbgui launchers, you can initialize a command prompt with ``otbenv.bat``. @@ -25,14 +28,14 @@ with ``otbenv.bat``. Python bindings ~~~~~~~~~~~~~~~ -Starting from OTB 5.8.0, OTB python bindings are distributed with binary package. -currently only Python 2.x is supported. If no compatible python is found, installation -notify you about it. If everything works fine, you will be given information about -using python bindings. +Starting from OTB 5.8.0, OTB Python bindings are distributed with binary package. +Currently only Python 2.x is supported and if no compatible Python 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. you can install it locally -without admin rights with "pip install --user numpy". This is to give users to choose -their own existing python installation rather than distributing one in OTB package +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. Notes ~~~~~ diff --git a/Documentation/Cookbook/rst/Monteverdi.rst b/Documentation/Cookbook/rst/Monteverdi.rst index 991b4d6e7c5b81ab8ee90fe899aa17de91558734..257ae1a017a0bac15cadf68443a6a5cdf6d236a4 100644 --- a/Documentation/Cookbook/rst/Monteverdi.rst +++ b/Documentation/Cookbook/rst/Monteverdi.rst @@ -72,11 +72,11 @@ Image displaying This part of the main window is intended to display the images loaded by the user. There are many nice keyboard shortcuts or mouse tricks that let the user have a better experience in navigating throughout the -loaded images. These shortcuts and tricks are given within the Help item -of the main menu, by clicking Keymap; here is a short list of the most -useful ones: +loaded images. These shortcuts and tricks are provided within the Help item +of the main menu under Keymap. Here is a short list of the most +commonly used ones: -The classical ones: +The standard ones: - CTRL+O = Open file(s) @@ -108,8 +108,8 @@ Right side dock The dock on the right side is divided into four tabs: -- Quicklook: gives the user a degraded view of the whole extent, - letting him/her easily select the area to be displayed +- Quicklook: provides an overview of the full extent of the image, + and allows one to easily select the area to be displayed. - Histogram: gives the user information about the value distribution of the selected channels. By clicking the mouse’s left button, user @@ -208,21 +208,20 @@ BandMath BandMath application is intended to apply mathematical operations on pixels (launch it with shortcut CTRL+A). In this example, we are going to use this application to change the dynamics of an image, and check -the result by looking at histogram tab, in the right side dock. The +the result by looking at the histogram tab on the right-hand side of the GUI. The formula used is the following: :math:`\text{im1b1} \times 1000`. In the figures below ( [fig:BM]), one can notice that the mode of the distribution is located at position :math:`356.0935`, whereas in the transformed image, the mode is located at position :math:`354737.1454`, -that’s to say 1000 times farther away approximately (the cursors aren’t +that’s to say approximately 1000 times further away (the cursors aren’t placed exactly at the same position in the screenshots). .. figure:: Art/MonteverdiImages/BM.png Segmentation ~~~~~~~~~~~~ - -Now, let’s use the segmentation application (launch it with shortcut -CTRL+A). We let the user take a look at the application’s documentation; +From within Monteverdi, the Segmentation application can be launched using the +shortcut CTRL+A. We let the user take a look at the application’s documentation; let’s simply say that as we wish we could display the segmentation with , we must tell the application to output the segmentation in raster format. Thus, the value of the mode option must be set to raster. The diff --git a/Documentation/Cookbook/rst/OTB-Applications.rst b/Documentation/Cookbook/rst/OTB-Applications.rst index 9d218f15fa2a65c1d52bc691a24a19373b80a737..55d0f53dd1043442aa4ecd488337de5fe774bfbd 100644 --- a/Documentation/Cookbook/rst/OTB-Applications.rst +++ b/Documentation/Cookbook/rst/OTB-Applications.rst @@ -3,15 +3,16 @@ A brief tour of OTB Applications OTB ships with more than 90 ready to use applications for remote sensing tasks. They usually expose existing processing functions from the underlying C++ -library, or compose them into high level pipelines. OTB applications allow to: +library, or integrate them into high level pipelines. OTB applications allow the user +to: -- Combine together two or more functions from the Orfeo Toolbox, +- Combine two or more functions from the Orfeo ToolBox, -- Provide a nice high level interface to handle: parameters, input - data, output data and communication with the user. +- Provide a high level interface to handle: input and output data, + definition of parameters and communication with the user. OTB applications can be launched in different ways, and accessed from different -entry points. The framework can be extended, but Orfeo Toolbox ships with the following: +entry points. While the framework can be extended, the Orfeo ToolBox ships with the following: - A command-line launcher, to call applications from the terminal, @@ -50,16 +51,15 @@ results in the following help to be displayed: Usage: ./otbApplicationLauncherCommandLine module_name [MODULEPATH] [arguments] The ``module_name`` parameter corresponds to the application name. The -``[MODULEPATH]`` argument is optional and allows to pass to the launcher -a path where the shared library (or plugin) corresponding to -``module_name`` is. +``[MODULEPATH]`` argument is optional and allows the path to the shared library +(or plugin) correpsonding to the ``module_name`` to be passed to the launcher. It is also possible to set this path with the environment variable ``OTB_APPLICATION_PATH``, making the ``[MODULEPATH]`` optional. This variable is checked by default when no ``[MODULEPATH]`` argument is given. When using multiple paths in ``OTB_APPLICATION_PATH``, one must make sure to use the standard path separator of the target system, which -is ``:`` on Unix, and ``;`` on Windows. +is ``:`` on Unix and ``;`` on Windows. An error in the application name (i.e. in parameter ``module_name``) will make the ``otbApplicationLauncherCommandLine`` lists the name of @@ -73,12 +73,12 @@ standard application installation path to the ``OTB_APPLICATION_PATH`` environment variable. These scripts are named ``otbcli_<ApplicationName>`` and do not need any -path settings. For example you can start the Orthorectification +path settings. For example, you can start the Orthorectification application with the script called ``otbcli_Orthorectification``. -Launching an application with no or incomplete parameters will make the -launcher display a summary of the parameters, indicating the mandatory -parameters missing to allow for application execution. Here is an +Launching an application without parameters, or with incomplete parameters, will cause the +launcher to display a summary of the parameters. This summary will display the minimum set +of parameters that are required to execute the application. Here is an example with the OrthoRectification application: :: @@ -129,7 +129,7 @@ chapter [chap:apprefdoc], page or follow the ``DOCUMENTATION`` hyperlink provided in ``otbApplicationLauncherCommandLine`` output. Parameters are passed to the application using the parameter key (which might include one or several ``.`` character), prefixed by a ``-``. -Command-line examples are provided in chapter [chap:apprefdoc], page . +Command-line examples are provided in chapter [chap:apprefdoc], page. Graphical launcher ------------------ @@ -138,8 +138,7 @@ The graphical interface for the applications provides a useful interactive user interface to set the parameters, choose files, and monitor the execution progress. -This launcher needs the same two arguments as the command line launcher -: +This launcher needs the same two arguments as the command line launcher: :: @@ -207,10 +206,10 @@ configured automatically so you don’t need to tweak In the ``otbApplication`` module, two main classes can be manipulated : - ``Registry``, which provides access to the list of available - applications, and can create applications + applications, and can create applications. - ``Application``, the base class for all applications. This allows to - interact with an application instance created by the ``Registry`` + interact with an application instance created by the ``Registry``. Here is one example of how to use Python to run the ``Smoothing`` application, changing the algorithm at each iteration. @@ -372,7 +371,7 @@ The processing toolbox OTB applications are available from QGIS. Use them from the processing toolbox, which is accessible with Processing :math:`\rightarrow` -Toolbox. Switch to “advanced interface†in the bottom of the application +ToolBox. Switch to “advanced interface†in the bottom of the application widget and OTB applications will be there. .. figure:: Art/QtImages/qgis-otb.png @@ -492,7 +491,7 @@ Here is an example of MPI call on a cluster:: ------------ END JOB INFO 1043196.tu-adm01 --------- One can see that the registration and pan-sharpening of the -panchromatic and multi-spectral bands of a Pleiades image has bee split +panchromatic and multi-spectral bands of a Pleiades image has been split among 560 cpus and took only 56 seconds. Note that this MPI parallel invocation of applications is only diff --git a/Documentation/Cookbook/rst/Recipes.rst b/Documentation/Cookbook/rst/Recipes.rst index 6550a09b2623d76c4f334f0d69bf01ee9ae81ac6..fa9478d5abf7698b4abbdcf806d625a0ab220cba 100644 --- a/Documentation/Cookbook/rst/Recipes.rst +++ b/Documentation/Cookbook/rst/Recipes.rst @@ -1,11 +1,10 @@ Recipes ======= -This chapter presents guideline to perform various remote sensing and +This chapter presents guidelines to perform various remote sensing and image processing tasks with either , or both. Its goal is not to be -exhaustive, but rather to help the non-developer user to get familiar -with these two packages, so that he can use and explore them for his -future needs. +exhaustive, but rather to familiarise users with the OTB package functionality +and demonstrate how the can be applied. .. toctree:: :maxdepth: 6 diff --git a/Documentation/Cookbook/rst/recipes/featextract.rst b/Documentation/Cookbook/rst/recipes/featextract.rst index 3d5e1af59d23df22aff23be8ce7d3d67f5727252..4bf18f042a688a55d7bf16ec4a99e66a18404a45 100644 --- a/Documentation/Cookbook/rst/recipes/featextract.rst +++ b/Documentation/Cookbook/rst/recipes/featextract.rst @@ -139,8 +139,8 @@ relevant channels in brackets are: Soil:BI - Brightness index (Red, Green) Soil:BI2 - Brightness index 2 (NIR, Red, Green) -The application can be used like this, which leads to an output image -with 3 bands, respectively with the Vegetation:NDVI, Vegetation:RVI and +The application can be used as follows, which would produce an output image +containing 3 bands, respectively with the Vegetation:NDVI, Vegetation:RVI and Vegetation:IPVI radiometric indices in this exact order: :: @@ -153,8 +153,8 @@ Vegetation:IPVI radiometric indices in this exact order: -list Vegetation:NDVI Vegetation:RVI Vegetation:IPVI -or like this, which leads to a single band output image with the -Water:NDWI2 radiometric indice: +or as follows, which would produce a single band output image with the +Water:NDWI2 radiometric index: :: diff --git a/Documentation/Cookbook/rst/recipes/improc.rst b/Documentation/Cookbook/rst/recipes/improc.rst index 0cfeb5b9f3be8f810325be5b1fa0797ebbaf536f..6e9e94e97714f6884113dfd1c75bea8c731d7a94 100644 --- a/Documentation/Cookbook/rst/recipes/improc.rst +++ b/Documentation/Cookbook/rst/recipes/improc.rst @@ -124,7 +124,6 @@ segmentation of very large image with theoretical guarantees of getting identical results to those without tiling. It has been developed by David Youssefi and Julien Michel during David - internship at CNES. For more a complete description of the LSMS method, please refer to the @@ -262,6 +261,35 @@ set the tile size using the *tilesizex* and *tilesizey* parameters. However unlike the *LSMSSegmentation* application, it does not require to write any temporary file to disk. +All-in-one +~~~~~~~~~~ + +The *LargeScaleMeanShift* application is a composite application that chains +all the previous steps: + +- Mean-Shift Smoothing +- Segmentation +- Small region merging +- Vectorization + +Most of the settings from the previous applications are also exposed in this +composite application. The range and spatial radius used for the segmentation +step are half the values used for Mean-Shift smooting, which are obtained from +LargeScaleMeanShift parameters. There are two output modes: vector (default) +and raster. When the raster output is chosen, last step (vectorization) is +skipped. + +:: + + otbcli_LargeScaleMeanShift -in input_image.tif + -spatialr 5 + -ranger 30 + -minsize 10 + -mode.vector.out segmentation_merged.shp + +There is a cleanup option that can be disabled in order to check intermediate +outputs of this composite application. + Dempster Shafer based Classifier Fusion --------------------------------------- diff --git a/Documentation/Cookbook/rst/recipes/optpreproc.rst b/Documentation/Cookbook/rst/recipes/optpreproc.rst index b6b1f2ba2d09713bf1f1541a58f9b663cd15686a..013152ad9282ab62b163555ee0fe34ae0ac232f5 100644 --- a/Documentation/Cookbook/rst/recipes/optpreproc.rst +++ b/Documentation/Cookbook/rst/recipes/optpreproc.rst @@ -2,14 +2,14 @@ From raw image to calibrated product ==================================== This section presents various pre-processing tasks that are presented in -a classical order to obtain a calibrated, pan-sharpened image. +a standard order to obtain a calibrated, pan-sharpened image. Optical radiometric calibration ------------------------------- -In remote sensing imagery, pixel values are called DN (for Digital -Numbers) and can not be physically interpreted and compared: they are -influenced by various factors such as the amount of light flowing trough +In remote sensing imagery, pixel values are referred to as Digital +Numbers (DN) and they cannot be physically interpreted or compared. They are +influenced by various factors such as the amount of light flowing through the sensor, the gain of the detectors and the analogic to numeric converter. @@ -87,14 +87,14 @@ Pan-sharpening Because of physical constrains on the sensor design, it is difficult to achieve high spatial and spectral resolution at the same time: a better -spatial resolution means a smaller detector, which in turns means lesser +spatial resolution means a smaller detector, which in turn means lesser optical flow on the detector surface. On the contrary, spectral bands are obtained through filters applied on the detector surface, that lowers the optical flow, so that it is necessary to increase the detector size to achieve an acceptable signal to noise ratio. For these reasons, many high resolution satellite payload are composed -of two sets of detectors, which in turns delivers two different kind of +of two sets of detectors, which in turn delivers two different kind of images: - The multi-spectral (XS) image, composed of 3 to 8 spectral bands @@ -194,7 +194,7 @@ Figure 5: Pan-sharpened image using Orfeo ToolBox. Please also note that since registration and zooming of the multi-spectral image with the panchromatic image relies on sensor modelling, this tool will work only for images whose sensor models is -available in **Orfeo Toolbox** (see :ref:`section3` for a detailed +available in **Orfeo ToolBox** (see :ref:`section3` for a detailed list). It will also work with ortho-ready products in cartographic projection. @@ -207,37 +207,37 @@ A Digital Elevation Model (DEM) is a georeferenced image (or collection of images) where each pixel corresponds to a local elevation. DEM are useful for tasks involving sensor to ground and ground to sensor coordinate transforms, like during ortho-rectification (see :ref:`section3`). These transforms need to find the intersection -between the line of sight of the sensor and the earth geoid. If a simple -spheroid is used as the earth model, potentially high localisation +between the line of sight of the sensor and the Earth geoid. If a simple +spheroid is used as the Earth model, potentially high localisation errors can be made in areas where elevation is high or perturbed. Of course, DEM accuracy and resolution have a great impact on the precision -of these transforms. +of these transformations. Two main available DEM, free of charges, and with worldwide cover, are both delivered as 1 degree by 1 degree tiles: - `The Shuttle Radar topographic Mission - (SRTM) <http://www2.jpl.nasa.gov/srtm/>`_ is a 90 meters resolution - DEM, obtained by radar interferometry during a campaign of the + (SRTM) <http://www2.jpl.nasa.gov/srtm/>`_ is a DEM with a resolution of 90 metres, + obtained by radar interferometry during a campaign of the Endeavour space shuttle from NASA in 2000. - The `Advanced Spaceborne Thermal Emission and Reflection Radiometer - (ASTER) <http://www.ersdac.or.jp/GDEM/E/2.html>`_ is a 30 meters - resolution DEM obtained by stereoscopic processing of the archive of + (ASTER) <http://www.ersdac.or.jp/GDEM/E/2.html>`_ is a DEM with a resolution of + 30 metres obtained by stereoscopic processing of the archive of the ASTER instrument. -The **Orfeo Toolbox** relies on `OSSIM <http://www.ossim.org/>`_ +The **Orfeo ToolBox** relies on `OSSIM <http://www.ossim.org/>`_ capabilities for sensor modelling and DEM handling. Tiles of a given DEM are supposed to be located within a single directory. General elevation support is also supported from GeoTIFF files. Whenever an application or **Monteverdi** module requires a DEM, the option **elev.dem** allows set the DEM directory. This directory must -contains the DEM tiles, either in DTED or SRTM format, either as GeoTIFF -files. Subdirectories are not supported. +contain the DEM tiles, either in DTED or SRTM format or as a GeoTIFF. +Subdirectories are not supported. Depending on the reference of the elevation, you also need to use a -geoid to manage elevation accurately. For this, you need to specify a +geoid to accurately manage the elevation. For this, you need to specify a path to a file which contains the geoid. `Geoid <http://en.wikipedia.org/wiki/Geoid>`_ corresponds to the equipotential surface that would coincide with the mean ocean surface of the Earth. @@ -290,7 +290,7 @@ Ortho-rectification can be performed either with **OTB Applications** or **Monteverdi** . Sensor parameters and image meta-data are seamlessly read from the image files without needing any user interaction, provided that all auxiliary files are available. The sensor for which **Orfeo -Toolbox** supports ortho-rectification of raw products are the +ToolBox** supports ortho-rectification of raw products are the following: - Pleiades @@ -306,7 +306,7 @@ following: - WorldView In addition, GeoTiff and other file format with geographical information -are seamlessly read by **Orfeo Toolbox** , and the ortho-rectification +are seamlessly read by **Orfeo ToolBox** , and the ortho-rectification tools can be used to re-sample these images in another map projection. Beware of “ortho-ready†products @@ -331,7 +331,7 @@ it. Obviously, this map projection is not as accurate as the sensor parameters of the raw geometry. In addition, the impact of the elevation model can’t be observed if the map projection is used. In order to perform an ortho-rectification on this type of product, the map -projection has to be hidden from **Orfeo Toolbox** . +projection has to be hidden from **Orfeo ToolBox** . You can see if a product is an “ortho-ready†product by using ``gdalinfo`` or OTB ReadImageInfo application. @@ -343,7 +343,7 @@ Check if your product verifies following two conditions: - The product has a map projection: you should see a projection name with physical origin and spacing. -In that case, you can hide the map projection from the **Orfeo Toolbox** +In that case, you can hide the map projection from the **Orfeo ToolBox** by using *extended* filenames. Instead of using the plain input image path, you append a specific key at the end: diff --git a/Documentation/Cookbook/rst/recipes/pbclassif.rst b/Documentation/Cookbook/rst/recipes/pbclassif.rst index 320e3e4796e3429d43d74820c70b8b63b04b7b92..73ab8409d7c8a807f9113ead842c1bbdfeeb5f94 100644 --- a/Documentation/Cookbook/rst/recipes/pbclassif.rst +++ b/Documentation/Cookbook/rst/recipes/pbclassif.rst @@ -33,7 +33,7 @@ model algorithm to train. You have the possibility to do the unsupervised classification,for it, you must to choose the Shark kmeans classifier. Please refer to the ``TrainVectorClassifier`` application reference documentation. -In case of multiple samples files, you can add them to the ``-io.vd`` +In case of multiple sample files, you can add them to the ``-io.vd`` parameter. The feature to be used for training must be explicitly listed using @@ -49,14 +49,14 @@ can be set using the ``-cfield`` option. By default, the application will estimate the trained classifier performances on the same set of samples that has been used for -training. The ``-io.vd`` parameter allows to specify a different -samples file for this purpose, for a more fair estimation of the -performances. Note that this performances estimation scheme can also -be estimated afterward (see `Validating the classification model`_ +training. The ``-io.vd`` parameter allows for the specification of different +sample files for this purpose, for a more fair estimation of the +performances. Note that this scheme to estimate the performance can also +be carried out afterwards (see `Validating the classification model`_ section). -Features classification +Feature classification ~~~~~~~~~~~~~~~~~~~~~~~ Once the classifier has been trained, one can apply the model to @@ -71,9 +71,16 @@ classify a set of features on a new vector data file using the -cfield predicted -out classifiedData.shp -This application output a vector data file storing sample values -and classification label. The output is optional, in this case the -input vector data classification label field is updated. +This application outputs a vector data file storing sample values +and classification labels. The output vector file is optional. If no output is +given to the application, the input vector data classification label field is +updated. If a statistics file was used to normalize the features during +training, it shall also be used here, during classification. + +Note that with this application, the machine learning model may come from a +training on image or vector data, it doesn't matter. The only requirement is +that the chosen features to use should be the same as the one used during +training. Validating classification ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -83,7 +90,7 @@ or *TrainImagesClassifier* applications is directly estimated by the application itself, which displays the precision, recall and F-score of each class, and can generate the global confusion matrix for supervised algorithms. For unsupervised algorithms a contingency table -is generated. Those results are output as an \*.CSV file. +is generated. These results are output as an \*.CSV file. Pixel based classification -------------------------- @@ -173,13 +180,13 @@ The output XML file will look like this:: -Samples selection +Sample selection ~~~~~~~~~~~~~~~~~ Now, we know exactly how many samples are available in the image for -each class and each geometry in the training set. From this +each class and each geometry in the training set. From these statistics, we can now compute the sampling rates to apply for each -classes, and perform the sample selection. This will be done by the +class, and perform the sample selection. This will be done by the ``SampleSelection`` application. There are several strategies to compute those sampling rates: @@ -192,27 +199,27 @@ There are several strategies to compute those sampling rates: * **Percent strategy:** Each class will be sampled with a user-defined percentage (same value for all classes) of samples available in this class. -* **Total strategy:** A global number of samples to generate is - divided proportionally among each class (classes proportions are +* **Total strategy:** A global number of samples to select is + divided proportionally among each class (class proportions are enforced). -* **Take all strategy:** Take all the available samples +* **Take all strategy:** Take all the available samples. * **By class strategy:** Set a target number of samples for each class. The number of samples for each class is read from a CSV file. To actually select the sample positions, there are two available -sampler: +sampling techniques: * **Random:** Randomly select samples while respecting the sampling - rate -* **Periodic:** Sample periodically using the sampling rate + rate. +* **Periodic:** Sample periodically using the sampling rate. The application will make sure that samples spans the whole training set extent by adjusting the sampling rate. Depending on the strategy to determine the sampling rate, some geometries of the training set -might not be sampled. +may not be sampled. The application will accept as input the input image and training -geometries, as well class statistics XML file computed during previous +geometries, as well class statistics XML file computed during the previous step. It will output a vector file containing point geometries which indicate the location of the samples. @@ -227,7 +234,7 @@ indicate the location of the samples. -out samples.sqlite The csv file written by the optional ``-outrates`` parameter sums-up what -has been done during samples selection:: +has been done during sample selection:: #className requiredSamples totalSamples rate 11 941 56774 0.0165745 @@ -253,8 +260,8 @@ has been done during samples selection:: Samples extraction ~~~~~~~~~~~~~~~~~~ -Now that we selected the location of the samples, we will attach -measurement to them. This is the purpose of the ``SampleExtraction`` +Now that the locations of the samples are selected, we will attach +measurements to them. This is the purpose of the ``SampleExtraction`` application. It will walk through the list of samples and extract the underlying pixel values. If no ``-out`` parameter is given, the ``SampleExtraction`` application can work in update mode, thus allowing @@ -286,8 +293,7 @@ Working with several images If the training set spans several images, the ``MultiImageSamplingRate`` application allows to compute the appropriate sampling rates per image -and per class, in order to get samples that spans the whole images -coverage. +and per class, in order to get samples that span the entire extents of the images. It is first required to run the ``PolygonClassStatistics`` application on each image of the set separately. The ``MultiImageSamplingRate`` @@ -536,6 +542,53 @@ and this image is produced with the commands inside this Figure 2: From left to right: Original image, result image with fusion (with monteverdi viewer) of original image and fancy classification and input image with fancy color classification from labeled image. +Unsupervised learning +--------------------- + +Using the same machine learning framework, it is also possible to perform +unsupervised classification. In this case, the main difference is that +the training samples don't need a real class label. However, in order to use +the same *TrainImagesClassifier* application, you still need to +provide a vector data file with a label field. This vector file will be +used to extract samples for the training. Each label value is can be considered +as a source area for samples, the same logic as in supervised learning is +applied for the computation of extracted samples per area. Hence, for +unsupervised classification, the samples are selected based on classes that are +not actually used during the training. For the moment, only the KMeans +algorithm is proposed in this framework. + +:: + + otbcli_TrainImageClassifier + -io.il image.tif + -io.vd training_areas.shp + -io.out model.txt + -sample.vfn Class + -classifier sharkkm + -classifier.sharkkm.k 4 + +If your training samples are in a vector data file, you can use the application +*TrainVectorClassifier*. In this case, you don't need a fake label field. You +just need to specify which fields shall be used to do the training. + +:: + + otbcli_TrainVectorClassifier + -io.vd training_samples.shp + -io.out model.txt + -feat perimeter area width red nir + -classifier sharkkm + -classifier.sharkkm.k 4 + +Once you have the model file, the actual classification step is the same as +the supervised case. The model will predict labels on your input data. + +:: + + otbcli_ImageClassifier + -in input_image.tif + -model model.txt + -out kmeans_labels.tif Fusion of classification maps ----------------------------- diff --git a/Documentation/Cookbook/rst/recipes/residual_registration.rst b/Documentation/Cookbook/rst/recipes/residual_registration.rst index 5bae14b3d6b46e1a295a36d1338448abff80a41f..d01cb0734b615db35257263a17a50e82271ae13e 100644 --- a/Documentation/Cookbook/rst/recipes/residual_registration.rst +++ b/Documentation/Cookbook/rst/recipes/residual_registration.rst @@ -173,7 +173,7 @@ Orthorecrtify image using the affine geometry Now we will show how we can use this new sensor model. In our case we’ll use this sensor model to orthorectify the image over the Pléiades -reference. **Orfeo Toolbox** offers since version 3.16 the possibility +reference. **Orfeo ToolBox** offers since version 3.16 the possibility to use hrefhttp://wiki.orfeo-toolbox.org/index.php/ExtendedFileNameextend image path to use different metadata file as input. That’s what we are going diff --git a/Documentation/Cookbook/rst/recipes/sarprocessing.rst b/Documentation/Cookbook/rst/recipes/sarprocessing.rst index f61bbb4a90e32e0c00ae732d9b2e7cca4fb347b4..9d74c1bbc7b364f5c62d36e0c824de85b94ba528 100644 --- a/Documentation/Cookbook/rst/recipes/sarprocessing.rst +++ b/Documentation/Cookbook/rst/recipes/sarprocessing.rst @@ -20,7 +20,7 @@ If SARimg.tif is a TerraSAR-X or a COSMO-SkyMed image: otbcli_SarRadiometricCalibration -in SARimg.tif -out SARimg-calibrated.tif -If SARimg.tif is a RadarSat2 or a Sentinel1 image, it ’s possible to +If SARimg.tif is a RadarSat2 or a Sentinel1 image, it is possible to specify the look-up table (automatically found in the metadata provided with such image): diff --git a/Documentation/Cookbook/rst/recipes/stereo.rst b/Documentation/Cookbook/rst/recipes/stereo.rst index 2c868a753698214beaec22e8a1836b381647f890..c25b3f74a880296bf8053cdd1737fbfa2b8f412b 100644 --- a/Documentation/Cookbook/rst/recipes/stereo.rst +++ b/Documentation/Cookbook/rst/recipes/stereo.rst @@ -194,7 +194,7 @@ can be directly linked to the local elevation An almost complete spectrum of `stereo correspondence algorithms <http://vision.middlebury.edu/stereo/eval3/>`_ has been published and it is still augmented at a significant rate! -The **Orfeo Toolbox** implements different local strategies for block +The **Orfeo ToolBox** implements different local strategies for block matching: - Sum of Square Distances block-matching (SSD) diff --git a/Documentation/Latex/listings.sty b/Documentation/Latex/listings.sty deleted file mode 100644 index 08c19ceb95917e0ffdf47549827e3ce27497def4..0000000000000000000000000000000000000000 --- a/Documentation/Latex/listings.sty +++ /dev/null @@ -1,2237 +0,0 @@ -%% -%% This is file `listings.sty', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% listings.dtx (with options: `kernel') -%% -%% Please read the software license in listings-1.3.dtx or listings-1.3.pdf. -%% -%% (w)(c) 1996--2004 Carsten Heinz and/or any other author listed -%% elsewhere in this file. -%% (c) 2006 Brooks Moses -%% -%% Send comments and ideas on the package, error reports and additional -%% programming languages to <bmoses@dpdx.net>. -%% -\def\filedate{2007/02/22} -\def\fileversion{1.4} -\NeedsTeXFormat{LaTeX2e} -\AtEndOfPackage{\ProvidesPackage{listings} - [\filedate\space\fileversion\space(Carsten Heinz)]} -\def\lst@CheckVersion#1{\edef\reserved@a{#1}% - \ifx\lst@version\reserved@a \expandafter\@gobble - \else \expandafter\@firstofone \fi} -\let\lst@version\fileversion -\def\lst@InputCatcodes{% - \makeatletter \catcode`\"12% - \catcode`\^^@\active - \catcode`\^^I9% - \catcode`\^^L9% - \catcode`\^^M9% - \catcode`\%14% - \catcode`\~\active} -\def\lst@RestoreCatcodes#1{% - \ifx\relax#1\else - \noexpand\catcode`\noexpand#1\the\catcode`#1\relax - \expandafter\lst@RestoreCatcodes - \fi} -\edef\lst@RestoreCatcodes{% - \noexpand\lccode`\noexpand\/`\noexpand\/% - \lst@RestoreCatcodes\"\^^I\^^M\~\^^@\relax - \catcode12\active} -\lst@InputCatcodes -\AtEndOfPackage{\lst@RestoreCatcodes} -\def\@lst{lst} -\def\lst@IfSubstring#1#2{% - \def\lst@temp##1#1##2##3\relax{% - \ifx \@empty##2\expandafter\@secondoftwo - \else \expandafter\@firstoftwo \fi}% - \expandafter\lst@temp#2#1\@empty\relax} -\def\lst@IfOneOf#1\relax#2{% - \def\lst@temp##1,#1,##2##3\relax{% - \ifx \@empty##2\expandafter\@secondoftwo - \else \expandafter\@firstoftwo \fi}% - \expandafter\lst@temp\expandafter,#2,#1,\@empty\relax} -\def\lst@DeleteKeysIn#1#2{% - \expandafter\lst@DeleteKeysIn@\expandafter#1#2,\relax,} -\def\lst@DeleteKeysIn@#1#2,{% - \ifx\relax#2\@empty - \expandafter\@firstoftwo\expandafter\lst@RemoveCommas - \else - \ifx\@empty#2\@empty\else - \def\lst@temp##1,#2,##2{% - ##1% - \ifx\@empty##2\@empty\else - \expandafter\lst@temp\expandafter,% - \fi ##2}% - \edef#1{\expandafter\lst@temp\expandafter,#1,#2,\@empty}% - \fi - \fi - \lst@DeleteKeysIn@#1} -\def\lst@RemoveCommas#1{\edef#1{\expandafter\lst@RC@#1\@empty}} -\def\lst@RC@#1{\ifx,#1\expandafter\lst@RC@ \else #1\fi} -\def\lst@ReplaceIn#1#2{% - \expandafter\lst@ReplaceIn@\expandafter#1#2\@empty\@empty} -\def\lst@ReplaceInArg#1#2{\lst@ReplaceIn@#1#2\@empty\@empty} -\def\lst@ReplaceIn@#1#2#3{% - \ifx\@empty#3\relax\else - \def\lst@temp##1#2##2{% - \ifx\@empty##2% - \lst@lAddTo#1{##1}% - \else - \lst@lAddTo#1{##1#3}\expandafter\lst@temp - \fi ##2}% - \let\@tempa#1\let#1\@empty - \expandafter\lst@temp\@tempa#2\@empty - \expandafter\lst@ReplaceIn@\expandafter#1% - \fi} -\providecommand*\@gobblethree[3]{} -\def\lst@GobbleNil#1\@nil{} -\def\lst@Swap#1#2{#2#1} -\def\lst@true{\let\lst@if\iftrue} -\def\lst@false{\let\lst@if\iffalse} -\lst@false -\def\lst@IfNextCharsArg#1{% - \def\lst@tofind{#1}\lst@IfNextChars\lst@tofind} -\def\lst@IfNextChars#1#2#3{% - \let\lst@tofind#1\def\@tempa{#2}\def\@tempb{#3}% - \let\lst@eaten\@empty \lst@IfNextChars@} -\def\lst@IfNextChars@{\expandafter\lst@IfNextChars@@\lst@tofind\relax} -\def\lst@IfNextChars@@#1#2\relax#3{% - \def\lst@tofind{#2}\lst@lAddTo\lst@eaten{#3}% - \ifx#1#3% - \ifx\lst@tofind\@empty - \let\lst@next\@tempa - \else - \let\lst@next\lst@IfNextChars@ - \fi - \expandafter\lst@next - \else - \expandafter\@tempb - \fi} -\def\lst@IfNextCharActive#1#2#3{% - \begingroup \lccode`\~=`#3\lowercase{\endgroup - \ifx~}#3% - \def\lst@next{#1}% - \else - \def\lst@next{#2}% - \fi \lst@next #3} -\def\lst@for#1\do#2{% - \def\lst@forbody##1{#2}% - \def\@tempa{#1}% - \ifx\@tempa\@empty\else\expandafter\lst@f@r#1,\@nil,\fi -} -\def\lst@f@r#1,{% - \def\@tempa{#1}% - \ifx\@tempa\@nnil\else\lst@forbody{#1}\expandafter\lst@f@r\fi -} -\def\lst@MakeActive#1{% - \let\lst@temp\@empty \lst@MakeActive@#1% - \relax\relax\relax\relax\relax\relax\relax\relax\relax} -\begingroup -\catcode`\^^@=\active \catcode`\^^A=\active \catcode`\^^B=\active -\catcode`\^^C=\active \catcode`\^^D=\active \catcode`\^^E=\active -\catcode`\^^F=\active \catcode`\^^G=\active \catcode`\^^H=\active -\gdef\lst@MakeActive@#1#2#3#4#5#6#7#8#9{\let\lst@next\relax - \ifx#1\relax - \else \lccode`\^^@=`#1% - \ifx#2\relax - \lowercase{\lst@lAddTo\lst@temp{^^@}}% - \else \lccode`\^^A=`#2% - \ifx#3\relax - \lowercase{\lst@lAddTo\lst@temp{^^@^^A}}% - \else \lccode`\^^B=`#3% - \ifx#4\relax - \lowercase{\lst@lAddTo\lst@temp{^^@^^A^^B}}% - \else \lccode`\^^C=`#4% - \ifx#5\relax - \lowercase{\lst@lAddTo\lst@temp{^^@^^A^^B^^C}}% - \else \lccode`\^^D=`#5% - \ifx#6\relax - \lowercase{\lst@lAddTo\lst@temp{^^@^^A^^B^^C^^D}}% - \else \lccode`\^^E=`#6% - \ifx#7\relax - \lowercase{\lst@lAddTo\lst@temp{^^@^^A^^B^^C^^D^^E}}% - \else \lccode`\^^F=`#7% - \ifx#8\relax - \lowercase{\lst@lAddTo\lst@temp{^^@^^A^^B^^C^^D^^E^^F}}% - \else \lccode`\^^G=`#8% - \ifx#9\relax - \lowercase{\lst@lAddTo\lst@temp{^^@^^A^^B^^C^^D^^E^^F^^G}}% - \else \lccode`\^^H=`#9% - \lowercase{\lst@lAddTo\lst@temp{^^@^^A^^B^^C^^D^^E^^F^^G^^H}}% - \let\lst@next\lst@MakeActive@ - \fi \fi \fi \fi \fi \fi \fi \fi \fi - \lst@next} -\endgroup -\def\lst@DefActive#1#2{\lst@MakeActive{#2}\let#1\lst@temp} -\def\lst@DefOther#1#2{% - \begingroup \def#1{#2}\escapechar\m@ne \expandafter\endgroup - \expandafter\lst@DefOther@\meaning#1\relax#1} -\def\lst@DefOther@#1>#2\relax#3{\edef#3{\zap@space#2 \@empty}} -\def\lst@InsideConvert#1{% - \lst@ifmathescape - \lst@InsideConvert@e#1$\@nil - \lst@if - \lst@InsideConvert@ey#1\@nil - \else - \lst@InsideConvert@#1 \@empty - \expandafter\@gobbletwo - \fi - \expandafter\lst@next - \else - \lst@InsideConvert@#1 \@empty - \fi} -\begingroup \lccode`\~=`\ \relax \lowercase{% -\gdef\lst@InsideConvert@#1 #2{% - \lst@MakeActive{#1}% - \ifx\@empty#2% - \lst@lExtend\lst@arg{\lst@temp}% - \else - \lst@lExtend\lst@arg{\lst@temp~}% - \expandafter\lst@InsideConvert@ - \fi #2} -}\endgroup -\def\lst@InsideConvert@e#1$#2\@nil{% - \ifx\@empty#2\@empty \lst@false \else \lst@true \fi} -\def\lst@InsideConvert@ey#1$#2$#3\@nil{% - \lst@InsideConvert@#1 \@empty - \lst@lAddTo\lst@arg{% - \lst@ifdropinput\else - \lst@TrackNewLines\lst@OutputLostSpace \lst@XPrintToken - \setbox\@tempboxa=\hbox\bgroup$\lst@escapebegin - #2% - \lst@escapeend$\egroup \lst@CalcLostSpaceAndOutput - \lst@whitespacefalse - \fi}% - \def\lst@next{\lst@InsideConvert{#3}}% -} -\def\lst@XConvert{\@ifnextchar\bgroup \lst@XConvertArg\lst@XConvert@} -\def\lst@XConvertArg#1{% - {\lst@false \let\lst@arg\@empty - \lst@XConvert#1\@nil - \global\let\@gtempa\lst@arg}% - \lst@lExtend\lst@arg{\expandafter{\@gtempa}}% - \lst@XConvertNext} -\def\lst@XConvert@#1{% - \ifx\@nil#1\else - \begingroup\lccode`\~=`#1\lowercase{\endgroup - \lst@lAddTo\lst@arg~}% - \expandafter\lst@XConvertNext - \fi} -\def\lst@XConvertNext{% - \lst@if \expandafter\lst@XConvertX - \else \expandafter\lst@XConvert \fi} -\def\lst@XConvertX#1{% - \ifx\@nil#1\else - \lst@XConvertX@#1\relax - \expandafter\lst@XConvert - \fi} -\def\lst@XConvertX@#1#2\relax{% - \begingroup\lccode`\~=`#1\lowercase{\endgroup - \lst@XCConvertX@@~}{#2}} -\def\lst@XCConvertX@@#1#2{\lst@lAddTo\lst@arg{{#1#2}}} -\def\lst@Require#1#2#3#4#5{% - \begingroup - \aftergroup\lst@true - \ifx\@empty#3\@empty\else - \def\lst@prefix{#2}\let\lst@require\@empty - \edef\lst@temp{\expandafter\zap@space#3 \@empty}% - \lst@for\lst@temp\do{% - \ifx\@empty##1\@empty\else \lstKV@OptArg[]{##1}{% - #4[####1]{####2}% - \@ifundefined{\@lst\lst@prefix @\lst@malias $\lst@oalias}% - {\edef\lst@require{\lst@require,\lst@malias $\lst@oalias}}% - {}}% - \fi}% - \global\let\lst@loadaspects\@empty - \lst@InputCatcodes - \ifx\lst@require\@empty\else - \lst@for{#5}\do{% - \ifx\lst@require\@empty\else - \InputIfFileExists{##1}{}{}% - \fi}% - \fi - \ifx\lst@require\@empty\else - \PackageError{Listings}{Couldn't load requested #1}% - {The following #1s weren't loadable:^^J\@spaces - \lst@require^^JThis may cause errors in the sequel.}% - \aftergroup\lst@false - \fi - \ifx\lst@loadaspects\@empty\else - \lst@RequireAspects\lst@loadaspects - \fi - \fi - \endgroup} -\def\lst@IfRequired[#1]#2{% - \lst@NormedDef\lst@temp{[#1]#2}% - \expandafter\lst@IfRequired@\lst@temp\relax} -\def\lst@IfRequired@[#1]#2\relax#3{% - \lst@IfOneOf #2$#1\relax\lst@require - {\lst@DeleteKeysIn@\lst@require#2$#1,\relax,% - \global\expandafter\let - \csname\@lst\lst@prefix @#2$#1\endcsname\@empty - #3}} -\let\lst@require\@empty -\def\lst@NoAlias[#1]#2{% - \lst@NormedDef\lst@oalias{#1}\lst@NormedDef\lst@malias{#2}} -\gdef\lst@LAS#1#2#3#4#5#6#7{% - \lst@Require{#1}{#2}{#3}#4#5% - #4#3% - \@ifundefined{lst#2@\lst@malias$\lst@oalias}% - {\PackageError{Listings}% - {#1 \ifx\@empty\lst@oalias\else \lst@oalias\space of \fi - \lst@malias\space undefined}% - {The #1 is not loadable. \@ehc}}% - {#6\csname\@lst#2@\lst@malias $\lst@oalias\endcsname #7}} -\def\lst@RequireAspects#1{% - \lst@Require{aspect}{asp}{#1}\lst@NoAlias\lstaspectfiles} -\let\lstloadaspects\lst@RequireAspects -\@ifundefined{lstaspectfiles} - {\newcommand\lstaspectfiles{lstmisc0.sty,lstmisc.sty}}{} -\gdef\lst@DefDriver#1#2#3#4{% - \@ifnextchar[{\lst@DefDriver@{#1}{#2}#3#4}% - {\lst@DefDriver@{#1}{#2}#3#4[]}} -\gdef\lst@DefDriver@#1#2#3#4[#5]#6{% - \def\lst@name{#1}\let\lst@if#4% - \lst@NormedDef\lst@driver{\@lst#2@#6$#5}% - \lst@IfRequired[#5]{#6}{\begingroup \lst@true}% - {\begingroup}% - \lst@setcatcodes - \@ifnextchar[{\lst@XDefDriver{#1}#3}{\lst@DefDriver@@#3}} -\gdef\lst@DefDriver@@#1#2{% - \lst@if - \global\@namedef{\lst@driver}{#1{#2}}% - \fi - \endgroup - \@ifnextchar[\lst@XXDefDriver\@empty} -\gdef\lst@XXDefDriver[#1]{% - \ifx\@empty#1\@empty\else - \lst@if - \lstloadaspects{#1}% - \else - \@ifundefined{\lst@driver}{}% - {\xdef\lst@loadaspects{\lst@loadaspects,#1}}% - \fi - \fi} -\gdef\lst@XDefDriver#1#2[#3]#4#5{\lst@DefDriver@@#2{also#1=[#3]#4,#5}} -\let\lst@UserCommand\gdef -\newcommand*\lst@BeginAspect[2][]{% - \def\lst@curraspect{#2}% - \ifx \lst@curraspect\@empty - \expandafter\lst@GobbleAspect - \else - \let\lst@next\@empty - \lst@IfRequired[]{#2}% - {\lst@RequireAspects{#1}% - \lst@if\else \let\lst@next\lst@GobbleAspect \fi}% - {\let\lst@next\lst@GobbleAspect}% - \expandafter\lst@next - \fi} -\def\lst@EndAspect{% - \csname\@lst patch@\lst@curraspect\endcsname - \let\lst@curraspect\@empty} -\long\def\lst@GobbleAspect#1\lst@EndAspect{\let\lst@curraspect\@empty} -\def\lst@Key#1#2{% - \@ifnextchar[{\lstKV@def{#1}{#2}}% - {\def\lst@temp{\lst@Key@{#1}{#2}} - \afterassignment\lst@temp - \global\@namedef{KV@\@lst @#1}####1}} -\def\lstKV@def#1#2[#3]{% - \global\@namedef{KV@\@lst @#1@default\expandafter}\expandafter - {\csname KV@\@lst @#1\endcsname{#3}}% - \def\lst@temp{\lst@Key@{#1}{#2}}\afterassignment\lst@temp - \global\@namedef{KV@\@lst @#1}##1} -\def\lst@Key@#1#2{% - \ifx\relax#2\@empty\else - \begingroup \globaldefs\@ne - \csname KV@\@lst @#1\endcsname{#2}% - \endgroup - \fi} -\def\lst@UseHook#1{\csname\@lst hk@#1\endcsname} -\def\lst@AddToHook{\lst@ATH@\iffalse\lst@AddTo} -\def\lst@AddToHookExe{\lst@ATH@\iftrue\lst@AddTo} -\def\lst@AddToHookAtTop{\lst@ATH@\iffalse\lst@AddToAtTop} -\long\def\lst@ATH@#1#2#3#4{% - \@ifundefined{\@lst hk@#3}{% - \expandafter\gdef\csname\@lst hk@#3\endcsname{}}{}% - \expandafter#2\csname\@lst hk@#3\endcsname{#4}% - \def\lst@temp{#4}% - #1% \iftrue|false - \begingroup \globaldefs\@ne \lst@temp \endgroup - \fi} -\long\def\lst@AddTo#1#2{% - \expandafter\gdef\expandafter#1\expandafter{#1#2}} -\def\lst@AddToAtTop#1#2{\def\lst@temp{#2}% - \expandafter\expandafter\expandafter\gdef - \expandafter\expandafter\expandafter#1% - \expandafter\expandafter\expandafter{\expandafter\lst@temp#1}} -\def\lst@lAddTo#1#2{\expandafter\def\expandafter#1\expandafter{#1#2}} -\def\lst@Extend#1#2{% - \expandafter\lst@AddTo\expandafter#1\expandafter{#2}} -\def\lst@lExtend#1#2{% - \expandafter\lst@lAddTo\expandafter#1\expandafter{#2}} -\RequirePackage{keyval}[1997/11/10] -\def\lstKV@TwoArg#1#2{\gdef\@gtempa##1##2{#2}\@gtempa#1{}{}} -\def\lstKV@ThreeArg#1#2{\gdef\@gtempa##1##2##3{#2}\@gtempa#1{}{}{}} -\def\lstKV@FourArg#1#2{\gdef\@gtempa##1##2##3##4{#2}\@gtempa#1{}{}{}{}} -\def\lstKV@OptArg[#1]#2#3{% - \gdef\@gtempa[##1]##2{#3}\lstKV@OptArg@{#1}#2\@} -\def\lstKV@OptArg@#1{\@ifnextchar[\lstKV@OptArg@@{\lstKV@OptArg@@[#1]}} -\def\lstKV@OptArg@@[#1]#2\@{\@gtempa[#1]{#2}} -\def\lstKV@XOptArg[#1]#2#3{% - \global\let\@gtempa#3\lstKV@OptArg@{#1}#2\@} -\def\lstKV@CSTwoArg#1#2{% - \gdef\@gtempa##1,##2,##3\relax{#2}% - \@gtempa#1,,\relax} -\def\lstKV@SetIf#1{\lstKV@SetIf@#1\relax} -\def\lstKV@SetIf@#1#2\relax#3{\lowercase{% - \expandafter\let\expandafter#3% - \csname if\ifx #1t}true\else false\fi\endcsname} -\def\lstKV@SwitchCases#1#2#3{% - \def\lst@temp##1\\#1&##2\\##3##4\@nil{% - \ifx\@empty##3% - #3% - \else - ##2% - \fi - }% - \lst@temp\\#2\\#1&\\\@empty\@nil} -\lst@UserCommand\lstset{\begingroup \lst@setcatcodes \lstset@} -\def\lstset@#1{\endgroup \ifx\@empty#1\@empty\else\setkeys{lst}{#1}\fi} -\def\lst@setcatcodes{\makeatletter \catcode`\==12\relax} -\def\lst@NewMode#1{% - \ifx\@undefined#1% - \lst@mode\lst@newmode\relax \advance\lst@mode\@ne - \xdef\lst@newmode{\the\lst@mode}% - \global\chardef#1=\lst@mode - \lst@mode\lst@nomode - \fi} -\newcount\lst@mode -\def\lst@newmode{\m@ne}% init -\lst@NewMode\lst@nomode % init (of \lst@mode :-) -\def\lst@UseDynamicMode{% - \@tempcnta\lst@dynamicmode\relax \advance\@tempcnta\@ne - \edef\lst@dynamicmode{\the\@tempcnta}% - \expandafter\lst@Swap\expandafter{\expandafter{\lst@dynamicmode}}} -\lst@AddToHook{InitVars}{\let\lst@dynamicmode\lst@newmode} -\def\lst@EnterMode#1#2{% - \bgroup \lst@mode=#1\relax #2% - \lst@FontAdjust - \lst@lAddTo\lst@entermodes{\lst@EnterMode{#1}{#2}}} -\lst@AddToHook{InitVars}{\let\lst@entermodes\@empty} -\let\lst@entermodes\@empty % init -\def\lst@LeaveMode{% - \ifnum\lst@mode=\lst@nomode\else - \egroup \expandafter\lsthk@EndGroup - \fi} -\lst@AddToHook{EndGroup}{}% init -\def\lst@InterruptModes{% - \lst@Extend\lst@modestack{\expandafter{\lst@entermodes}}% - \lst@LeaveAllModes} -\lst@AddToHook{InitVars}{\global\let\lst@modestack\@empty} -\def\lst@ReenterModes{% - \ifx\lst@modestack\@empty\else - \lst@LeaveAllModes - \global\let\@gtempa\lst@modestack - \global\let\lst@modestack\@empty - \expandafter\lst@ReenterModes@\@gtempa\relax - \fi} -\def\lst@ReenterModes@#1#2{% - \ifx\relax#2\@empty - \gdef\@gtempa##1{#1}% - \expandafter\@gtempa - \else - \lst@AddTo\lst@modestack{{#1}}% - \expandafter\lst@ReenterModes@ - \fi - {#2}} -\def\lst@LeaveAllModes{% - \ifnum\lst@mode=\lst@nomode - \expandafter\lsthk@EndGroup - \else - \expandafter\egroup\expandafter\lst@LeaveAllModes - \fi} -\lst@AddToHook{ExitVars}{\lst@LeaveAllModes} -\lst@NewMode\lst@Pmode -\lst@NewMode\lst@GPmode -\def\lst@modetrue{\let\lst@ifmode\iftrue \lsthk@ModeTrue} -\let\lst@ifmode\iffalse % init -\lst@AddToHook{ModeTrue}{}% init -\def\lst@Lmodetrue{\let\lst@ifLmode\iftrue} -\let\lst@ifLmode\iffalse % init -\lst@AddToHook{EOL}{\@whilesw \lst@ifLmode\fi \lst@LeaveMode} -\def\lst@NormedDef#1#2{\lowercase{\edef#1{\zap@space#2 \@empty}}} -\def\lst@NormedNameDef#1#2{% - \lowercase{\edef\lst@temp{\zap@space#1 \@empty}% - \expandafter\xdef\csname\lst@temp\endcsname{\zap@space#2 \@empty}}} -\def\lst@GetFreeMacro#1{% - \@tempcnta\z@ \def\lst@freemacro{#1\the\@tempcnta}% - \lst@GFM@} -\def\lst@GFM@{% - \expandafter\ifx \csname\lst@freemacro\endcsname \relax - \edef\lst@freemacro{\csname\lst@freemacro\endcsname}% - \else - \advance\@tempcnta\@ne - \expandafter\lst@GFM@ - \fi} -\newbox\lst@gtempboxa -\newtoks\lst@token \newcount\lst@length -\def\lst@ResetToken{\lst@token{}\lst@length\z@} -\lst@AddToHook{InitVarsBOL}{\lst@ResetToken \let\lst@lastother\@empty} -\lst@AddToHook{EndGroup}{\lst@ResetToken \let\lst@lastother\@empty} -\def\lst@lettertrue{\let\lst@ifletter\iftrue} -\def\lst@letterfalse{\let\lst@ifletter\iffalse} -\lst@AddToHook{InitVars}{\lst@letterfalse} -\def\lst@Append#1{\advance\lst@length\@ne - \lst@token=\expandafter{\the\lst@token#1}} -\def\lst@AppendOther{% - \lst@ifletter \lst@Output\lst@letterfalse \fi - \futurelet\lst@lastother\lst@Append} -\def\lst@AppendLetter{% - \lst@ifletter\else \lst@OutputOther\lst@lettertrue \fi - \lst@Append} -\def\lst@SaveToken{% - \global\let\lst@gthestyle\lst@thestyle - \global\let\lst@glastother\lst@lastother - \xdef\lst@RestoreToken{\noexpand\lst@token{\the\lst@token}% - \noexpand\lst@length\the\lst@length\relax - \noexpand\let\noexpand\lst@thestyle - \noexpand\lst@gthestyle - \noexpand\let\noexpand\lst@lastother - \noexpand\lst@glastother}} -\def\lst@IfLastOtherOneOf#1{\lst@IfLastOtherOneOf@ #1\relax} -\def\lst@IfLastOtherOneOf@#1{% - \ifx #1\relax - \expandafter\@secondoftwo - \else - \ifx\lst@lastother#1% - \lst@IfLastOtherOneOf@t - \else - \expandafter\expandafter\expandafter\lst@IfLastOtherOneOf@ - \fi - \fi} -\def\lst@IfLastOtherOneOf@t#1\fi\fi#2\relax{\fi\fi\@firstoftwo} -\newdimen\lst@currlwidth % \global -\newcount\lst@column \newcount\lst@pos % \global -\lst@AddToHook{InitVarsBOL} - {\global\lst@currlwidth\z@ \global\lst@pos\z@ \global\lst@column\z@} -\def\lst@CalcColumn{% - \@tempcnta\lst@column - \advance\@tempcnta\lst@length - \advance\@tempcnta-\lst@pos} -\newdimen\lst@lostspace % \global -\lst@AddToHook{InitVarsBOL}{\global\lst@lostspace\z@} -\def\lst@UseLostSpace{\ifdim\lst@lostspace>\z@ \lst@InsertLostSpace \fi} -\def\lst@InsertLostSpace{% - \lst@Kern\lst@lostspace \global\lst@lostspace\z@} -\def\lst@InsertHalfLostSpace{% - \global\lst@lostspace.5\lst@lostspace \lst@Kern\lst@lostspace} -\newdimen\lst@width -\lst@Key{basewidth}{0.6em,0.45em}{\lstKV@CSTwoArg{#1}% - {\def\lst@widthfixed{##1}\def\lst@widthflexible{##2}% - \ifx\lst@widthflexible\@empty - \let\lst@widthflexible\lst@widthfixed - \fi - \def\lst@temp{\PackageError{Listings}% - {Negative value(s) treated as zero}% - \@ehc}% - \let\lst@error\@empty - \ifdim \lst@widthfixed<\z@ - \let\lst@error\lst@temp \let\lst@widthfixed\z@ - \fi - \ifdim \lst@widthflexible<\z@ - \let\lst@error\lst@temp \let\lst@widthflexible\z@ - \fi - \lst@error}} -\lst@AddToHook{FontAdjust} - {\lst@width=\lst@ifflexible\lst@widthflexible - \else\lst@widthfixed\fi \relax} -\lst@Key{fontadjust}{false}[t]{\lstKV@SetIf{#1}\lst@iffontadjust} -\def\lst@FontAdjust{\lst@iffontadjust \lsthk@FontAdjust \fi} -\lst@AddToHook{InitVars}{\lsthk@FontAdjust} -\def\lst@OutputBox#1{\lst@alloverstyle{\box#1}} -\def\lst@alloverstyle#1{#1}% init -\def\lst@Kern#1{% - \setbox\z@\hbox{{\lst@currstyle{\kern#1}}}% - \global\advance\lst@currlwidth \wd\z@ - \lst@OutputBox\z@} -\def\lst@CalcLostSpaceAndOutput{% - \global\advance\lst@lostspace \lst@length\lst@width - \global\advance\lst@lostspace-\wd\@tempboxa - \global\advance\lst@currlwidth \wd\@tempboxa - \global\advance\lst@pos -\lst@length - \setbox\@tempboxa\hbox{\let\lst@OutputBox\box - \ifdim\lst@lostspace>\z@ \lst@leftinsert \fi - \box\@tempboxa - \ifdim\lst@lostspace>\z@ \lst@rightinsert \fi}% - \lst@OutputBox\@tempboxa \lsthk@PostOutput} -\lst@AddToHook{PostOutput}{}% init -\def\lst@OutputToken{% - \lst@TrackNewLines \lst@OutputLostSpace - \lst@ifgobbledws - \lst@gobbledwhitespacefalse - \lst@@discretionary - \fi - \lst@CheckMerge - {\lst@thestyle{\lst@FontAdjust - \setbox\@tempboxa\lst@hbox - {\lsthk@OutputBox - \lst@lefthss - \expandafter\lst@FillOutputBox\the\lst@token\@empty - \lst@righthss}% - \lst@CalcLostSpaceAndOutput}}% - \lst@ResetToken} -\lst@AddToHook{OutputBox}{}% init -\def\lst@gobbledwhitespacetrue{\global\let\lst@ifgobbledws\iftrue} -\def\lst@gobbledwhitespacefalse{\global\let\lst@ifgobbledws\iffalse} -\lst@AddToHookExe{InitBOL}{\lst@gobbledwhitespacefalse}% init -\def\lst@Delay#1{% - \lst@CheckDelay - #1% - \lst@GetOutputMacro\lst@delayedoutput - \edef\lst@delayed{\the\lst@token}% - \edef\lst@delayedlength{\the\lst@length}% - \lst@ResetToken} -\def\lst@Merge#1{% - \lst@CheckMerge - #1% - \edef\lst@merged{\the\lst@token}% - \edef\lst@mergedlength{\the\lst@length}% - \lst@ResetToken} -\def\lst@MergeToken#1#2{% - \advance\lst@length#2% - \lst@lExtend#1{\the\lst@token}% - \expandafter\lst@token\expandafter{#1}% - \let#1\@empty} -\def\lst@CheckDelay{% - \ifx\lst@delayed\@empty\else - \lst@GetOutputMacro\@gtempa - \ifx\lst@delayedoutput\@gtempa - \lst@MergeToken\lst@delayed\lst@delayedlength - \else - {\lst@ResetToken - \lst@MergeToken\lst@delayed\lst@delayedlength - \lst@delayedoutput}% - \let\lst@delayed\@empty - \fi - \fi} -\def\lst@CheckMerge{% - \ifx\lst@merged\@empty\else - \lst@MergeToken\lst@merged\lst@mergedlength - \fi} -\let\lst@delayed\@empty % init -\let\lst@merged\@empty % init -\def\lst@column@fixed{% - \lst@flexiblefalse - \lst@width\lst@widthfixed\relax - \let\lst@OutputLostSpace\lst@UseLostSpace - \let\lst@FillOutputBox\lst@FillFixed - \let\lst@hss\hss - \def\lst@hbox{\hbox to\lst@length\lst@width}} -\def\lst@FillFixed#1{#1\lst@FillFixed@} -\def\lst@FillFixed@#1{% - \ifx\@empty#1\else \lst@hss#1\expandafter\lst@FillFixed@ \fi} -\def\lst@column@flexible{% - \lst@flexibletrue - \lst@width\lst@widthflexible\relax - \let\lst@OutputLostSpace\lst@UseLostSpace - \let\lst@FillOutputBox\@empty - \let\lst@hss\@empty - \let\lst@hbox\hbox} -\def\lst@column@fullflexible{% - \lst@column@flexible - \def\lst@OutputLostSpace{\lst@ifnewline \lst@UseLostSpace\fi}% - \let\lst@leftinsert\@empty - \let\lst@rightinsert\@empty} -\def\lst@column@spaceflexible{% - \lst@column@flexible - \def\lst@OutputLostSpace{% - \lst@ifwhitespace - \ifx\lst@outputspace\lst@visiblespace - \else - \lst@UseLostSpace - \fi - \else - \lst@ifnewline \lst@UseLostSpace\fi - \fi}% - \let\lst@leftinsert\@empty - \let\lst@rightinsert\@empty} -\def\lst@outputpos#1#2\relax{% - \def\lst@lefthss{\lst@hss}\let\lst@righthss\lst@lefthss - \let\lst@rightinsert\lst@InsertLostSpace - \ifx #1c% - \let\lst@leftinsert\lst@InsertHalfLostSpace - \else\ifx #1r% - \let\lst@righthss\@empty - \let\lst@leftinsert\lst@InsertLostSpace - \let\lst@rightinsert\@empty - \else - \let\lst@lefthss\@empty - \let\lst@leftinsert\@empty - \ifx #1l\else \PackageWarning{Listings}% - {Unknown positioning for output boxes}% - \fi - \fi\fi} -\def\lst@flexibletrue{\let\lst@ifflexible\iftrue} -\def\lst@flexiblefalse{\let\lst@ifflexible\iffalse} -\lst@Key{columns}{[c]fixed}{\lstKV@OptArg[]{#1}{% - \ifx\@empty##1\@empty\else \lst@outputpos##1\relax\relax \fi - \expandafter\let\expandafter\lst@arg - \csname\@lst @column@##2\endcsname - \lst@arg - \ifx\lst@arg\relax - \PackageWarning{Listings}{Unknown column format `##2'}% - \else - \lst@ifflexible - \let\lst@columnsflexible\lst@arg - \else - \let\lst@columnsfixed\lst@arg - \fi - \fi}} -\let\lst@columnsfixed\lst@column@fixed % init -\let\lst@columnsflexible\lst@column@flexible % init -\lst@Key{flexiblecolumns}\relax[t]{% - \lstKV@SetIf{#1}\lst@ifflexible - \lst@ifflexible \lst@columnsflexible - \else \lst@columnsfixed \fi} -\newcount\lst@newlines -\lst@AddToHook{InitVars}{\global\lst@newlines\z@} -\lst@AddToHook{InitVarsBOL}{\global\advance\lst@newlines\@ne} -\def\lst@NewLine{% - \ifx\lst@OutputBox\@gobble\else - \par\noindent \hbox{}% - \fi - \global\advance\lst@newlines\m@ne - \lst@newlinetrue} -\def\lst@newlinetrue{\global\let\lst@ifnewline\iftrue} -\lst@AddToHookExe{PostOutput}{\global\let\lst@ifnewline\iffalse}% init -\def\lst@TrackNewLines{% - \ifnum\lst@newlines>\z@ - \lsthk@OnNewLine - \lst@DoNewLines - \fi} -\lst@AddToHook{OnNewLine}{}% init -\lst@Key{emptylines}\maxdimen{% - \@ifstar{\lst@true\@tempcnta\@gobble#1\relax\lst@GobbleNil}% - {\lst@false\@tempcnta#1\relax\lst@GobbleNil}#1\@nil - \advance\@tempcnta\@ne - \edef\lst@maxempty{\the\@tempcnta\relax}% - \let\lst@ifpreservenumber\lst@if} -\def\lst@DoNewLines{ - \@whilenum\lst@newlines>\lst@maxempty \do - {\lst@ifpreservenumber - \lsthk@OnEmptyLine - \global\advance\c@lstnumber\lst@advancelstnum - \fi - \global\advance\lst@newlines\m@ne}% - \@whilenum \lst@newlines>\@ne \do - {\lsthk@OnEmptyLine \lst@NewLine}% - \ifnum\lst@newlines>\z@ \lst@NewLine \fi} -\lst@AddToHook{OnEmptyLine}{}% init -\lst@Key{identifierstyle}{}{\def\lst@identifierstyle{#1}} -\lst@AddToHook{EmptyStyle}{\let\lst@identifierstyle\@empty} -\def\lst@GotoTabStop{% - \ifnum\lst@newlines=\z@ - \setbox\@tempboxa\hbox{\lst@outputspace}% - \setbox\@tempboxa\hbox to\wd\@tempboxa{{\lst@currstyle{\hss}}}% - \lst@CalcLostSpaceAndOutput - \else - \global\advance\lst@lostspace \lst@length\lst@width - \global\advance\lst@column\lst@length \lst@length\z@ - \fi} -\def\lst@OutputOther{% - \lst@CheckDelay - \ifnum\lst@length=\z@\else - \let\lst@thestyle\lst@currstyle - \lsthk@OutputOther - \lst@OutputToken - \fi} -\lst@AddToHook{OutputOther}{}% init -\let\lst@currstyle\relax % init -\def\lst@Output{% - \lst@CheckDelay - \ifnum\lst@length=\z@\else - \ifx\lst@currstyle\relax - \let\lst@thestyle\lst@identifierstyle - \else - \let\lst@thestyle\lst@currstyle - \fi - \lsthk@Output - \lst@OutputToken - \fi - \let\lst@lastother\relax} -\lst@AddToHook{Output}{}% init -\def\lst@GetOutputMacro#1{% - \lst@ifletter \global\let#1\lst@Output - \else \global\let#1\lst@OutputOther\fi} -\def\lst@PrintToken{% - \lst@ifletter \lst@Output \lst@letterfalse - \else \lst@OutputOther \let\lst@lastother\@empty \fi} -\def\lst@XPrintToken{% - \lst@PrintToken \lst@CheckMerge - \ifnum\lst@length=\z@\else \lst@PrintToken \fi} -\def\lst@BeginDropOutput#1{% - \xdef\lst@BDOnewlines{\the\lst@newlines}% - \global\let\lst@BDOifnewline\lst@ifnewline - \lst@EnterMode{#1}% - {\lst@modetrue - \let\lst@OutputBox\@gobble - \aftergroup\lst@BDORestore}} -\def\lst@BDORestore{% - \global\lst@newlines\lst@BDOnewlines - \global\let\lst@ifnewline\lst@BDOifnewline} -\let\lst@EndDropOutput\lst@LeaveMode -\def\lst@ProcessLetter{\lst@whitespacefalse \lst@AppendLetter} -\def\lst@ProcessOther{\lst@whitespacefalse \lst@AppendOther} -\def\lst@ProcessDigit{% - \lst@whitespacefalse - \lst@ifletter \expandafter\lst@AppendLetter - \else \expandafter\lst@AppendOther\fi} -\def\lst@whitespacetrue{\global\let\lst@ifwhitespace\iftrue} -\def\lst@whitespacefalse{\global\let\lst@ifwhitespace\iffalse} -\lst@AddToHook{InitVarsBOL}{\lst@whitespacetrue} -\lst@Key{tabsize}{8} - {\ifnum#1>\z@ \def\lst@tabsize{#1}\else - \PackageError{Listings}{Strict positive integer expected}% - {You can't use `#1' as tabsize. \@ehc}% - \fi} -\lst@Key{showtabs}f[t]{\lstKV@SetIf{#1}\lst@ifshowtabs} -\lst@Key{tab}{\kern.06em\hbox{\vrule\@height.3ex}% - \hrulefill\hbox{\vrule\@height.3ex}} - {\def\lst@tab{#1}} -\def\lst@ProcessTabulator{% - \lst@XPrintToken \lst@whitespacetrue - \global\advance\lst@column -\lst@pos - \@whilenum \lst@pos<\@ne \do - {\global\advance\lst@pos\lst@tabsize}% - \lst@length\lst@pos - \lst@PreGotoTabStop} -\def\lst@PreGotoTabStop{% - \lst@ifshowtabs - \lst@TrackNewLines - \setbox\@tempboxa\hbox to\lst@length\lst@width - {{\lst@currstyle{\hss\lst@tab}}}% - \lst@CalcLostSpaceAndOutput - \else - \lst@ifkeepspaces - \@tempcnta\lst@length \lst@length\z@ - \@whilenum \@tempcnta>\z@ \do - {\lst@AppendOther\lst@outputspace - \advance\@tempcnta\m@ne}% - \lst@OutputOther - \else - \lst@GotoTabStop - \fi - \fi - \lst@length\z@ \global\lst@pos\z@} -\def\lst@outputspace{\ } -\def\lst@visiblespace{\lst@ttfamily{\char32}\textvisiblespace} -\lst@Key{showspaces}{false}[t]{\lstKV@SetIf{#1}\lst@ifshowspaces} -\lst@Key{keepspaces}{false}[t]{\lstKV@SetIf{#1}\lst@ifkeepspaces} -\lst@AddToHook{Init} - {\lst@ifshowspaces - \let\lst@outputspace\lst@visiblespace - \lst@keepspacestrue - \fi} -\def\lst@keepspacestrue{\let\lst@ifkeepspaces\iftrue} -\def\lst@ProcessSpace{% - \lst@ifkeepspaces - \lst@PrintToken - \lst@whitespacetrue - \lst@AppendOther\lst@outputspace - \lst@PrintToken - \else \ifnum\lst@newlines=\z@ - \lst@AppendSpecialSpace - \else \ifnum\lst@length=\z@ - \global\advance\lst@lostspace\lst@width - \global\advance\lst@pos\m@ne - \lst@whitespacetrue - \else - \lst@AppendSpecialSpace - \fi - \fi \fi} -\def\lst@AppendSpecialSpace{% - \lst@ifwhitespace - \lst@PrintToken - \global\advance\lst@lostspace\lst@width - \global\advance\lst@pos\m@ne - \lst@gobbledwhitespacetrue - \else - \lst@PrintToken - \lst@whitespacetrue - \lst@AppendOther\lst@outputspace - \lst@PrintToken - \fi} -\lst@Key{formfeed}{\bigbreak}{\def\lst@formfeed{#1}} -\def\lst@ProcessFormFeed{% - \lst@XPrintToken - \ifnum\lst@newlines=\z@ - \lst@EOLUpdate \lsthk@InitVarsBOL - \fi - \lst@formfeed - \lst@whitespacetrue} -\def\lst@Def#1{\lccode`\~=#1\lowercase{\def~}} -\def\lst@Let#1{\lccode`\~=#1\lowercase{\let~}} -\lst@AddToAtTop{\try@load@fontshape}{\def\space{ }} -\def\lst@SelectStdCharTable{% - \lst@Def{9}{\lst@ProcessTabulator}% - \lst@Def{12}{\lst@ProcessFormFeed}% - \lst@Def{32}{\lst@ProcessSpace}} -\def\lst@CCPut#1#2{% - \ifnum#2=\z@ - \expandafter\@gobbletwo - \else - \lccode`\~=#2\lccode`\/=#2\lowercase{\lst@CCPut@~{#1/}}% - \fi - \lst@CCPut#1} -\def\lst@CCPut@#1#2{\lst@lAddTo\lst@SelectStdCharTable{\def#1{#2}}} -\lst@CCPut \lst@ProcessOther - {"21}{"22}{"28}{"29}{"2B}{"2C}{"2E}{"2F} - {"3A}{"3B}{"3D}{"3F}{"5B}{"5D} - \z@ -\lst@CCPut \lst@ProcessDigit - {"30}{"31}{"32}{"33}{"34}{"35}{"36}{"37}{"38}{"39} - \z@ -\lst@CCPut \lst@ProcessLetter - {"40}{"41}{"42}{"43}{"44}{"45}{"46}{"47} - {"48}{"49}{"4A}{"4B}{"4C}{"4D}{"4E}{"4F} - {"50}{"51}{"52}{"53}{"54}{"55}{"56}{"57} - {"58}{"59}{"5A} - {"61}{"62}{"63}{"64}{"65}{"66}{"67} - {"68}{"69}{"6A}{"6B}{"6C}{"6D}{"6E}{"6F} - {"70}{"71}{"72}{"73}{"74}{"75}{"76}{"77} - {"78}{"79}{"7A} - \z@ -\def\lst@CCPutMacro#1#2#3{% - \ifnum#2=\z@ \else - \begingroup\lccode`\~=#2\relax \lccode`\/=#2\relax - \lowercase{\endgroup\expandafter\lst@CCPutMacro@ - \csname\@lst @um/\expandafter\endcsname - \csname\@lst @um/@\endcsname /~}#1{#3}% - \expandafter\lst@CCPutMacro - \fi} -\def\lst@CCPutMacro@#1#2#3#4#5#6{% - \lst@lAddTo\lst@SelectStdCharTable{\def#4{#5#1}}% - \def#1{\lst@UM#3}% - \def#2{#6}} -\def\lst@UM#1{\csname\@lst @um#1@\endcsname} -\lst@CCPutMacro - \lst@ProcessOther {"23}\# - \lst@ProcessLetter{"24}\textdollar - \lst@ProcessOther {"25}\% - \lst@ProcessOther {"26}\& - \lst@ProcessOther {"27}{\lst@ifupquote \textquotesingle - \else \char39\relax \fi} - \lst@ProcessOther {"2A}{\lst@ttfamily*\textasteriskcentered} - \lst@ProcessOther {"2D}{\lst@ttfamily{-{}}{$-$}} - \lst@ProcessOther {"3C}{\lst@ttfamily<\textless} - \lst@ProcessOther {"3E}{\lst@ttfamily>\textgreater} - \lst@ProcessOther {"5C}{\lst@ttfamily{\char92}\textbackslash} - \lst@ProcessOther {"5E}\textasciicircum - \lst@ProcessLetter{"5F}{\lst@ttfamily{\char95}\textunderscore} - \lst@ProcessOther {"60}{\lst@ifupquote \textasciigrave - \else \char96\relax \fi} - \lst@ProcessOther {"7B}{\lst@ttfamily{\char123}\textbraceleft} - \lst@ProcessOther {"7C}{\lst@ttfamily|\textbar} - \lst@ProcessOther {"7D}{\lst@ttfamily{\char125}\textbraceright} - \lst@ProcessOther {"7E}\textasciitilde - \lst@ProcessOther {"7F}- - \@empty\z@\@empty -\def\lst@ttfamily#1#2{\ifx\f@family\ttdefault#1\relax\else#2\fi} -\lst@AddToHook{Init}{\edef\ttdefault{\ttdefault}} -\lst@Key{upquote}{false}[t]{\lstKV@SetIf{#1}\lst@ifupquote - \lst@ifupquote - \@ifundefined{textasciigrave}% - {\let\KV@lst@upquote\@gobble - \lstKV@SetIf f\lst@ifupquote \@gobble\fi - \PackageError{Listings}{Option `upquote' requires `textcomp' - package.\MessageBreak The option has been disabled}% - {Add \string\usepackage{textcomp} to your preamble.}}% - {}% - \fi} -\AtBeginDocument{% - \@ifpackageloaded{upquote}{\RequirePackage{textcomp}% - \lstset{upquote}}{}% - \@ifpackageloaded{upquote2}{\lstset{upquote}}{}} -\def\lst@activecharstrue{\let\lst@ifactivechars\iftrue} -\def\lst@activecharsfalse{\let\lst@ifactivechars\iffalse} -\lst@activecharstrue -\def\lst@SelectCharTable{% - \lst@SelectStdCharTable - \lst@ifactivechars - \catcode9\active \catcode12\active \catcode13\active - \@tempcnta=32\relax - \@whilenum\@tempcnta<128\do - {\catcode\@tempcnta\active\advance\@tempcnta\@ne}% - \fi - \lst@ifec \lst@DefEC \fi - \let\do\lst@do@noligs \verbatim@nolig@list - \lsthk@SelectCharTable - \lst@DeveloperSCT -\lst@DefRange - \ifx\lst@Backslash\relax\else - \lst@LetSaveDef{"5C}\lsts@backslash\lst@Backslash - \fi} -\lst@Key{SelectCharTable}{}{\def\lst@DeveloperSCT{#1}} -\lst@Key{MoreSelectCharTable}\relax{\lst@lAddTo\lst@DeveloperSCT{#1}} -\lst@AddToHook{SetLanguage}{\let\lst@DeveloperSCT\@empty} -\def\lst@do@noligs#1{% - \begingroup \lccode`\~=`#1\lowercase{\endgroup - \lst@do@noligs@~}} -\def\lst@do@noligs@#1{% - \expandafter\expandafter\expandafter\def - \expandafter\expandafter\expandafter#1% - \expandafter\expandafter\expandafter{\expandafter\lst@NoLig#1}} -\def\lst@NoLig{\advance\lst@length\m@ne \lst@Append\lst@nolig} -\def\lst@nolig{\lst@UM\@empty}% -\@namedef{\@lst @um@}{\leavevmode\kern\z@} -\def\lst@SaveOutputDef#1#2{% - \begingroup \lccode`\~=#1\relax \lowercase{\endgroup - \def\lst@temp##1\def~##2##3\relax}{% - \global\expandafter\let\expandafter#2\@gobble##2\relax}% - \expandafter\lst@temp\lst@SelectStdCharTable\relax} -\lst@SaveOutputDef{"5C}\lstum@backslash -\lst@Key{extendedchars}{true}[t]{\lstKV@SetIf{#1}\lst@ifec} -\def\lst@DefEC{% - \lst@CCECUse \lst@ProcessLetter - ^^80^^81^^82^^83^^84^^85^^86^^87^^88^^89^^8a^^8b^^8c^^8d^^8e^^8f% - ^^90^^91^^92^^93^^94^^95^^96^^97^^98^^99^^9a^^9b^^9c^^9d^^9e^^9f% - ^^a0^^a1^^a2^^a3^^a4^^a5^^a6^^a7^^a8^^a9^^aa^^ab^^ac^^ad^^ae^^af% - ^^b0^^b1^^b2^^b3^^b4^^b5^^b6^^b7^^b8^^b9^^ba^^bb^^bc^^bd^^be^^bf% - ^^c0^^c1^^c2^^c3^^c4^^c5^^c6^^c7^^c8^^c9^^ca^^cb^^cc^^cd^^ce^^cf% - ^^d0^^d1^^d2^^d3^^d4^^d5^^d6^^d7^^d8^^d9^^da^^db^^dc^^dd^^de^^df% - ^^e0^^e1^^e2^^e3^^e4^^e5^^e6^^e7^^e8^^e9^^ea^^eb^^ec^^ed^^ee^^ef% - ^^f0^^f1^^f2^^f3^^f4^^f5^^f6^^f7^^f8^^f9^^fa^^fb^^fc^^fd^^fe^^ff% - ^^00} -\def\lst@CCECUse#1#2{% - \ifnum`#2=\z@ - \expandafter\@gobbletwo - \else - \ifnum\catcode`#2=\active - \lccode`\~=`#2\lccode`\/=`#2\lowercase{\lst@CCECUse@#1~/}% - \else - \lst@ifactivechars \catcode`#2=\active \fi - \lccode`\~=`#2\lccode`\/=`#2\lowercase{\def~{#1/}}% - \fi - \fi - \lst@CCECUse#1} -\def\lst@CCECUse@#1#2#3{% - \expandafter\def\csname\@lst @EC#3\endcsname{\lst@UM#3}% - \expandafter\let\csname\@lst @um#3@\endcsname #2% - \edef#2{\noexpand#1% - \expandafter\noexpand\csname\@lst @EC#3\endcsname}} -\lst@AddToHook{Init} - {\let\lsts@nfss@catcodes\nfss@catcodes - \let\nfss@catcodes\lst@nfss@catcodes} -\def\lst@nfss@catcodes{% - \lst@makeletter - ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\relax - \@makeother (\@makeother )\@makeother ,\@makeother :\@makeother\&% - \@makeother 0\@makeother 1\@makeother 2\@makeother 3\@makeother 4% - \@makeother 5\@makeother 6\@makeother 7\@makeother 8\@makeother 9% - \@makeother =\lsts@nfss@catcodes} -\def\lst@makeletter#1{% - \ifx\relax#1\else\catcode`#111\relax \expandafter\lst@makeletter\fi} -\lst@Key{useoutput}{2}{\edef\lst@useoutput{\ifcase0#1 0\or 1\else 2\fi}} -\lst@AddToHook{Init} -{\edef\lst@OrgOutput{\the\output}% -\ifcase\lst@useoutput\relax -\or - \output{\global\setbox\lst@gtempboxa\box\@cclv - \expandafter\egroup - \lst@SaveToken - \lst@InterruptModes - \setbox\@cclv\box\lst@gtempboxa - \bgroup\lst@OrgOutput\egroup - \bgroup - \aftergroup\pagegoal\aftergroup\vsize - \aftergroup\lst@ReenterModes\aftergroup\lst@RestoreToken}% -\else - \output{\lst@RestoreOrigCatcodes - \lst@ifec \lst@RestoreOrigExtendedCatcodes \fi - \lst@OrgOutput}% -\fi} -\def\lst@GetChars#1#2#3{% - \let#1\@empty - \@tempcnta#2\relax \@tempcntb#3\relax - \loop \ifnum\@tempcnta<\@tempcntb\relax - \lst@lExtend#1{\expandafter\catcode\the\@tempcnta=}% - \lst@lExtend#1{\the\catcode\@tempcnta\relax}% - \ifnum\the\catcode\@tempcnta=\active - \begingroup\lccode`\~=\@tempcnta - \lowercase{\endgroup - \lst@lExtend#1{\expandafter\let\expandafter~\csname - lstecs@\the\@tempcnta\endcsname}% - \expandafter\let\csname lstecs@\the\@tempcnta\endcsname~}% - \fi - \advance\@tempcnta\@ne - \repeat} -\begingroup \catcode12=\active\let^^L\@empty -\gdef\lst@ScanChars{% - \let\lsts@ssL^^L% - \def^^L{\par}% - \lst@GetChars\lst@RestoreOrigCatcodes\@ne {128}% - \let^^L\lsts@ssL - \lst@GetChars\lst@RestoreOrigExtendedCatcodes{128}{256}} -\endgroup -\lst@Key{rescanchars}\relax{\lst@ScanChars} -\AtBeginDocument{\lst@ScanChars} -\lst@Key{alsoletter}\relax{% - \lst@DoAlso{#1}\lst@alsoletter\lst@ProcessLetter} -\lst@Key{alsodigit}\relax{% - \lst@DoAlso{#1}\lst@alsodigit\lst@ProcessDigit} -\lst@Key{alsoother}\relax{% - \lst@DoAlso{#1}\lst@alsoother\lst@ProcessOther} -\lst@AddToHook{SelectCharTable} - {\lst@alsoother \lst@alsodigit \lst@alsoletter} -\lst@AddToHookExe{SetLanguage}% init - {\let\lst@alsoletter\@empty - \let\lst@alsodigit\@empty - \let\lst@alsoother\@empty} -\def\lst@DoAlso#1#2#3{% - \lst@DefOther\lst@arg{#1}\let#2\@empty - \expandafter\lst@DoAlso@\expandafter#2\expandafter#3\lst@arg\relax} -\def\lst@DoAlso@#1#2#3{% - \ifx\relax#3\expandafter\@gobblethree \else - \begingroup \lccode`\~=`#3\relax \lowercase{\endgroup - \def\lst@temp##1\def~##2##3\relax{% - \edef\lst@arg{\def\noexpand~{\noexpand#2\expandafter - \noexpand\@gobble##2}}}}% - \expandafter\lst@temp\lst@SelectStdCharTable\relax - \lst@lExtend#1{\lst@arg}% - \fi - \lst@DoAlso@#1#2} -\def\lst@SaveDef#1#2{% - \begingroup \lccode`\~=#1\relax \lowercase{\endgroup\let#2~}} -\def\lst@DefSaveDef#1#2{% - \begingroup \lccode`\~=#1\relax \lowercase{\endgroup\let#2~\def~}} -\def\lst@LetSaveDef#1#2{% - \begingroup \lccode`\~=#1\relax \lowercase{\endgroup\let#2~\let~}} -\def\lst@CDef#1{\lst@CDef@#1} -\def\lst@CDef@#1#2#3#4{\lst@CDefIt#1{#2}{#3}{#4#2#3}#4} -\def\lst@CDefX#1{\lst@CDefX@#1} -\def\lst@CDefX@#1#2#3{\lst@CDefIt#1{#2}{#3}{}} -\def\lst@CDefIt#1#2#3#4#5#6#7#8{% - \ifx\@empty#2\@empty - \def#1{#6\def\lst@next{#7#4#8}\lst@next}% - \else \ifx\@empty#3\@empty - \def#1##1{% - #6% - \ifx##1#2\def\lst@next{#7#4#8}\else - \def\lst@next{#5##1}\fi - \lst@next}% - \else - \def#1{% - #6% - \lst@IfNextCharsArg{#2#3}{#7#4#8}% - {\expandafter#5\lst@eaten}}% - \fi \fi} -\def\lst@CArgX#1#2\relax{% - \lst@DefActive\lst@arg{#1#2}% - \expandafter\lst@CArg\lst@arg\relax} -\def\lst@CArg#1#2\relax{% - \lccode`\/=`#1\lowercase{\def\lst@temp{/}}% - \lst@GetFreeMacro{lst@c\lst@temp}% - \expandafter\lst@CArg@\lst@freemacro#1#2\@empty\@empty\relax} -\def\lst@CArg@#1#2#3#4\@empty#5\relax#6{% - \let#1#2% - \ifx\@empty#3\@empty - \def\lst@next{#6{#2{}{}}}% - \else - \def\lst@next{#6{#2#3{#4}}}% - \fi - \lst@next #1} -\def\lst@CArgEmpty#1\@empty{#1} -\lst@Key{excludedelims}\relax - {\lsthk@ExcludeDelims \lst@NormedDef\lst@temp{#1}% - \expandafter\lst@for\lst@temp\do - {\expandafter\let\csname\@lst @ifex##1\endcsname\iftrue}} -\def\lst@DelimPrint#1#2{% - #1% - \begingroup - \lst@mode\lst@nomode \lst@modetrue - #2\lst@XPrintToken - \endgroup - \lst@ResetToken - \fi} -\def\lst@DelimOpen#1#2#3#4#5#6\@empty{% - \lst@TrackNewLines \lst@XPrintToken - \lst@DelimPrint#1{#6}% - \lst@EnterMode{#4}{\def\lst@currstyle#5}% - \lst@DelimPrint{#1#2}{#6}% - #3} -\def\lst@DelimClose#1#2#3\@empty{% - \lst@TrackNewLines \lst@XPrintToken - \lst@DelimPrint{#1#2}{#3}% - \lst@LeaveMode - \lst@DelimPrint{#1}{#3}} -\def\lst@BeginDelim{\lst@DelimOpen\iffalse\else{}} -\def\lst@EndDelim{\lst@DelimClose\iffalse\else} -\def\lst@BeginIDelim{\lst@DelimOpen\iffalse{}{}} -\def\lst@EndIDelim{\lst@DelimClose\iffalse{}} -\lst@AddToHook{SelectCharTable}{\lst@DefDelims} -\lst@AddToHookExe{SetLanguage}{\let\lst@DefDelims\@empty} -\def\lst@Delim#1{% - \lst@false \let\lst@cumulative\@empty \let\lst@arg\@empty - \@ifstar{\@ifstar{\lst@Delim@{#1}}% - {\let\lst@cumulative\relax - \lst@Delim@{#1}}}% - {\lst@true\lst@Delim@{#1}}} -\def\lst@Delim@#1[#2]{% - \gdef\lst@delimtype{#2}% - \@ifnextchar[\lst@Delim@sty - {\lst@Delim@sty[#1]}} -\def\lst@Delim@sty[#1]{% - \def\lst@delimstyle{#1}% - \ifx\@empty#1\@empty\else - \lst@Delim@sty@ #1\@nil - \fi - \@ifnextchar[\lst@Delim@option - \lst@Delim@delim} -\def\lst@Delim@option[#1]{\def\lst@arg{[#1]}\lst@Delim@delim} -\def\lst@Delim@sty@#1#2\@nil{% - \if\relax\noexpand#1\else - \edef\lst@delimstyle{\expandafter\noexpand - \csname\@lst @\lst@delimstyle\endcsname}% - \fi} -\def\lst@Delim@delim#1\relax#2#3#4#5#6#7#8{% - \ifx #4\@empty \lst@Delim@delall{#2}\fi - \ifx\@empty#1\@empty - \ifx #4\@nil - \@ifundefined{\@lst @#2DM@\lst@delimtype}% - {\lst@Delim@delall{#2@\lst@delimtype}}% - {\lst@Delim@delall{#2DM@\lst@delimtype}}% - \fi - \else - \expandafter\lst@Delim@args\expandafter - {\lst@delimtype}{#1}{#5}#6{#7}{#8}#4% - \let\lst@delim\@empty - \expandafter\lst@IfOneOf\lst@delimtype\relax#3% - {\@ifundefined{\@lst @#2DM@\lst@delimtype}% - {\lst@lExtend\lst@delim{\csname\@lst @#2@\lst@delimtype - \expandafter\endcsname\lst@arg}}% - {\lst@lExtend\lst@delim{\expandafter\lst@UseDynamicMode - \csname\@lst @#2DM@\lst@delimtype - \expandafter\endcsname\lst@arg}}% - \ifx #4\@nil - \let\lst@temp\lst@DefDelims \let\lst@DefDelims\@empty - \expandafter\lst@Delim@del\lst@temp\@empty\@nil\@nil\@nil - \else - \lst@lExtend\lst@DefDelims\lst@delim - \fi}% - {\PackageError{Listings}{Illegal type `\lst@delimtype'}% - {#2 types are #3.}}% - \fi} -\def\lst@Delim@args#1#2#3#4#5#6#7{% - \begingroup - \lst@false \let\lst@next\lst@XConvert - \@ifnextchar #4{\xdef\lst@delimtype{\expandafter\@gobble - \lst@delimtype}% - #5\lst@next#2\@nil - \lst@lAddTo\lst@arg{\@empty#6}% - \lst@GobbleNil}% - {\lst@next#2\@nil - \lst@lAddTo\lst@arg{\@empty#3}% - \lst@GobbleNil}% - #1\@nil - \global\let\@gtempa\lst@arg - \endgroup - \let\lst@arg\@gtempa - \ifx #7\@nil\else - \expandafter\lst@Delim@args@\expandafter{\lst@delimstyle}% - \fi} -\def\lst@Delim@args@#1{% - \lst@if - \lst@lAddTo\lst@arg{{{#1}\lst@modetrue}}% - \else - \ifx\lst@cumulative\@empty - \lst@lAddTo\lst@arg{{{}#1}}% - \else - \lst@lAddTo\lst@arg{{{#1}}}% - \fi - \fi} -\def\lst@Delim@del#1\@empty#2#3#4{% - \ifx #2\@nil\else - \def\lst@temp{#1\@empty#2#3}% - \ifx\lst@temp\lst@delim\else - \lst@lAddTo\lst@DefDelims{#1\@empty#2#3{#4}}% - \fi - \expandafter\lst@Delim@del - \fi} -\def\lst@Delim@delall#1{% - \begingroup - \edef\lst@delim{\expandafter\string\csname\@lst @#1\endcsname}% - \lst@false \global\let\@gtempa\@empty - \expandafter\lst@Delim@delall@\lst@DefDelims\@empty - \endgroup - \let\lst@DefDelims\@gtempa} -\def\lst@Delim@delall@#1{% - \ifx #1\@empty\else - \ifx #1\lst@UseDynamicMode - \lst@true - \let\lst@next\lst@Delim@delall@do - \else - \def\lst@next{\lst@Delim@delall@do#1}% - \fi - \expandafter\lst@next - \fi} -\def\lst@Delim@delall@do#1#2\@empty#3#4#5{% - \expandafter\lst@IfSubstring\expandafter{\lst@delim}{\string#1}% - {}% - {\lst@if \lst@AddTo\@gtempa\lst@UseDynamicMode \fi - \lst@AddTo\@gtempa{#1#2\@empty#3#4{#5}}}% - \lst@false \lst@Delim@delall@} -\gdef\lst@DefDelimB#1#2#3#4#5#6#7#8{% - \lst@CDef{#1}#2% - {#3}% - {\let\lst@bnext\lst@CArgEmpty - \lst@ifmode #4\else - #5% - \def\lst@bnext{#6{#7}{#8}}% - \fi - \lst@bnext}% - \@empty} -\gdef\lst@DefDelimE#1#2#3#4#5#6#7{% - \lst@CDef{#1}#2% - {#3}% - {\let\lst@enext\lst@CArgEmpty - \ifnum #7=\lst@mode% - #4% - \let\lst@enext#6% - \else - #5% - \fi - \lst@enext}% - \@empty} -\lst@AddToHook{Init}{\let\lst@bnext\relax \let\lst@enext\relax} -\gdef\lst@DefDelimBE#1#2#3#4#5#6#7#8#9{% - \lst@CDef{#1}#2% - {#3}% - {\let\lst@bnext\lst@CArgEmpty - \ifnum #7=\lst@mode - #4% - \let\lst@bnext#9% - \else - \lst@ifmode\else - #5% - \def\lst@bnext{#6{#7}{#8}}% - \fi - \fi - \lst@bnext}% - \@empty} -\gdef\lst@delimtypes{s,l} -\gdef\lst@DelimKey#1#2{% - \lst@Delim{}#2\relax - {Delim}\lst@delimtypes #1% - {\lst@BeginDelim\lst@EndDelim} - i\@empty{\lst@BeginIDelim\lst@EndIDelim}} -\lst@Key{delim}\relax{\lst@DelimKey\@empty{#1}} -\lst@Key{moredelim}\relax{\lst@DelimKey\relax{#1}} -\lst@Key{deletedelim}\relax{\lst@DelimKey\@nil{#1}} -\gdef\lst@DelimDM@l#1#2\@empty#3#4#5{% - \lst@CArg #2\relax\lst@DefDelimB{}{}{}#3{#1}{#5\lst@Lmodetrue}} -\gdef\lst@DelimDM@s#1#2#3\@empty#4#5#6{% - \lst@CArg #2\relax\lst@DefDelimB{}{}{}#4{#1}{#6}% - \lst@CArg #3\relax\lst@DefDelimE{}{}{}#5{#1}} -\def\lst@ReplaceInput#1{\lst@CArgX #1\relax\lst@CDefX{}{}} -\def\lst@Literatekey#1\@nil@{\let\lst@ifxliterate\lst@if - \def\lst@literate{#1}} -\lst@Key{literate}{}{\@ifstar{\lst@true \lst@Literatekey} - {\lst@false\lst@Literatekey}#1\@nil@} -\lst@AddToHook{SelectCharTable} - {\ifx\lst@literate\@empty\else - \expandafter\lst@Literate\lst@literate{}\relax\z@ - \fi} -\def\lst@Literate#1#2#3{% - \ifx\relax#2\@empty\else - \lst@CArgX #1\relax\lst@CDef - {} - {\let\lst@next\@empty - \lst@ifxliterate - \lst@ifmode \let\lst@next\lst@CArgEmpty \fi - \fi - \ifx\lst@next\@empty - \ifx\lst@OutputBox\@gobble\else - \lst@XPrintToken \let\lst@scanmode\lst@scan@m - \lst@token{#2}\lst@length#3\relax - \lst@XPrintToken - \fi - \let\lst@next\lst@CArgEmptyGobble - \fi - \lst@next}% - \@empty - \expandafter\lst@Literate - \fi} -\def\lst@CArgEmptyGobble#1\@empty{} -\def\lst@BeginDropInput#1{% - \lst@EnterMode{#1}% - {\lst@modetrue - \let\lst@OutputBox\@gobble - \let\lst@ifdropinput\iftrue - \let\lst@ProcessLetter\@gobble - \let\lst@ProcessDigit\@gobble - \let\lst@ProcessOther\@gobble - \let\lst@ProcessSpace\@empty - \let\lst@ProcessTabulator\@empty - \let\lst@ProcessFormFeed\@empty}} -\let\lst@ifdropinput\iffalse % init -\lst@Key{basicstyle}\relax{\def\lst@basicstyle{#1}} -\lst@Key{inputencoding}\relax{\def\lst@inputenc{#1}} -\lst@AddToHook{Init} - {\lst@basicstyle - \ifx\lst@inputenc\@empty\else - \@ifundefined{inputencoding}{}% - {\inputencoding\lst@inputenc}% - \fi} -\lst@AddToHookExe{EmptyStyle} - {\let\lst@basicstyle\@empty - \let\lst@inputenc\@empty} -\lst@Key{multicols}{}{\@tempcnta=0#1\relax\def\lst@multicols{#1}} -\def\lst@parshape{\parshape\@ne \z@ \linewidth} -\lst@AddToHookAtTop{EveryLine}{\lst@parshape} -\lst@AddToHookAtTop{EndGroup}{\lst@parshape} -\newcount\lst@lineno % \global -\lst@AddToHook{InitVars}{\global\lst@lineno\@ne} -\lst@Key{print}{true}[t]{\lstKV@SetIf{#1}\lst@ifprint} -\lst@Key{firstline}\relax{\def\lst@firstline{#1\relax}} -\lst@Key{lastline}\relax{\def\lst@lastline{#1\relax}} -\lst@AddToHook{PreSet} - {\let\lst@firstline\@ne \def\lst@lastline{9999999\relax}} -\lst@Key{linerange}\relax{\lstKV@OptArg[]{#1}{% - \def\lst@interrange{##1}\def\lst@linerange{##2,}}} -\lst@Key{rangeprefix}\relax{\def\lst@rangebeginprefix{#1}% - \def\lst@rangeendprefix{#1}} -\lst@Key{rangesuffix}\relax{\def\lst@rangebeginsuffix{#1}% - \def\lst@rangeendsuffix{#1}} -\lst@Key{rangebeginprefix}{}{\def\lst@rangebeginprefix{#1}} -\lst@Key{rangebeginsuffix}{}{\def\lst@rangebeginsuffix{#1}} -\lst@Key{rangeendprefix}{}{\def\lst@rangeendprefix{#1}} -\lst@Key{rangeendsuffix}{}{\def\lst@rangeendsuffix{#1}} -\lst@Key{includerangemarker}{true}[t]{\lstKV@SetIf{#1}\lst@ifincluderangemarker} -\lst@AddToHook{PreSet}{\def\lst@firstline{1\relax}% - \let\lst@linerange\@empty} -\lst@AddToHook{Init} -{\ifx\lst@linerange\@empty - \edef\lst@linerange{{\lst@firstline}-{\lst@lastline},}% - \fi - \lst@GetLineInterval}% -\def\lst@GetLineInterval{\expandafter\lst@GLI\lst@linerange\@nil} -\def\lst@GLI#1,#2\@nil{\def\lst@linerange{#2}\lst@GLI@#1--\@nil} -\def\lst@GLI@#1-#2-#3\@nil{% - \lst@IfNumber{#1}% - {\ifx\@empty#1\@empty - \let\lst@firstline\@ne - \else - \def\lst@firstline{#1\relax}% - \fi - \ifx\@empty#3\@empty - \def\lst@lastline{9999999\relax}% - \else - \ifx\@empty#2\@empty - \let\lst@lastline\lst@firstline - \else - \def\lst@lastline{#2\relax}% - \fi - \fi}% - {\def\lst@firstline{9999999\relax}% - \let\lst@lastline\lst@firstline - \let\lst@rangebegin\lst@rangebeginprefix - \lst@AddTo\lst@rangebegin{#1}\lst@Extend\lst@rangebegin\lst@rangebeginsuffix - \ifx\@empty#3\@empty - \let\lst@rangeend\lst@rangeendprefix - \lst@AddTo\lst@rangeend{#1}\lst@Extend\lst@rangeend\lst@rangeendsuffix - \else - \ifx\@empty#2\@empty - \let\lst@rangeend\@empty - \else - \let\lst@rangeend\lst@rangeendprefix - \lst@AddTo\lst@rangeend{#2}\lst@Extend\lst@rangeend\lst@rangeendsuffix - \fi - \fi - \global\def\lst@DefRange{\expandafter\lst@CArgX\lst@rangebegin\relax\lst@DefRangeB}% - \ifnum\lst@mode=\lst@Pmode \expandafter\lst@DefRange \fi}} -\lst@AddToHookExe{DeInit}{\global\let\lst@DefRange\@empty} -\def\lst@DefRangeB#1#2{\lst@DefRangeB@#1#2} -\def\lst@DefRangeB@#1#2#3#4{% - \lst@CDef{#1{#2}{#3}}#4{}% - {\lst@ifincluderangemarker - \lst@LeaveMode - \let#1#4% - \lst@DefRangeEnd - \lst@InitLstNumber - \else - \@tempcnta\lst@lineno \advance\@tempcnta\@ne - \edef\lst@firstline{\the\@tempcnta\relax}% - \gdef\lst@OnceAtEOL{\let#1#4\lst@DefRangeEnd}% - \lst@InitLstNumber - \fi - \global\let\lst@DefRange\lst@DefRangeEnd - \lst@CArgEmpty}% - \@empty} -\def\lstpatch@labels{% -\gdef\lst@SetFirstNumber{% - \ifx\lst@firstnumber\@undefined - \@tempcnta 0\csname\@lst no@\lst@intname\endcsname\relax - \ifnum\@tempcnta=\z@ \else - \lst@nololtrue - \advance\@tempcnta\lst@advancenumber - \edef\lst@firstnumber{\the\@tempcnta\relax}% - \fi - \fi}% -} -\def\lst@InitLstNumber{% - \global\c@lstnumber\lst@firstnumber - \global\advance\c@lstnumber\lst@advancenumber - \global\advance\c@lstnumber-\lst@advancelstnum - \ifx \lst@firstnumber\c@lstnumber - \global\advance\c@lstnumber-\lst@advancelstnum - \fi} -\def\lst@DefRangeEnd{% - \ifx\lst@rangeend\@empty\else - \expandafter\lst@CArgX\lst@rangeend\relax\lst@DefRangeE - \fi} -\def\lst@DefRangeE#1#2{\lst@DefRangeE@#1#2} -\def\lst@DefRangeE@#1#2#3#4{% - \lst@CDef{#1#2{#3}}#4{}% - {\let#1#4% - \edef\lst@lastline{\the\lst@lineno\relax}% - \lst@DefRangeE@@}% - \@empty} -\def\lst@DefRangeE@@#1\@empty{% - \lst@ifincluderangemarker - #1\lst@XPrintToken - \fi - \lst@LeaveModeToPmode - \lst@BeginDropInput{\lst@Pmode}} -\def\lst@LeaveModeToPmode{% - \ifnum\lst@mode=\lst@Pmode - \expandafter\lsthk@EndGroup - \else - \expandafter\egroup\expandafter\lst@LeaveModeToPmode - \fi} -\lst@AddToHook{EOL}{\lst@OnceAtEOL\global\let\lst@OnceAtEOL\@empty} -\gdef\lst@OnceAtEOL{}% Init -\def\lst@MSkipToFirst{% - \global\advance\lst@lineno\@ne - \ifnum \lst@lineno=\lst@firstline - \def\lst@next{\lst@LeaveMode \global\lst@newlines\z@ - \lst@OnceAtEOL \global\let\lst@OnceAtEOL\@empty - \lst@InitLstNumber % Added to work with modified \lsthk@PreInit. - \lsthk@InitVarsBOL - \lst@BOLGobble}% - \expandafter\lst@next - \fi} -\def\lst@SkipToFirst{% - \ifnum \lst@lineno<\lst@firstline - \def\lst@next{\lst@BeginDropInput\lst@Pmode - \lst@Let{13}\lst@MSkipToFirst - \lst@Let{10}\lst@MSkipToFirst}% - \expandafter\lst@next - \else - \expandafter\lst@BOLGobble - \fi} -\def\lst@IfNumber#1{% - \ifx\@empty#1\@empty - \let\lst@next\@firstoftwo - \else - \lst@IfNumber@#1\@nil - \fi - \lst@next} -\def\lst@IfNumber@#1#2\@nil{% - \let\lst@next\@secondoftwo - \ifnum`#1>47\relax \ifnum`#1>57\relax\else - \let\lst@next\@firstoftwo - \fi\fi} -\lst@Key{nolol}{false}[t]{\lstKV@SetIf{#1}\lst@ifnolol} -\def\lst@nololtrue{\let\lst@ifnolol\iftrue} -\let\lst@ifnolol\iffalse % init -\lst@Key{captionpos}{t}{\def\lst@captionpos{#1}} -\lst@Key{abovecaptionskip}\smallskipamount{\def\lst@abovecaption{#1}} -\lst@Key{belowcaptionskip}\smallskipamount{\def\lst@belowcaption{#1}} -\lst@Key{label}\relax{\def\lst@label{#1}} -\lst@Key{title}\relax{\def\lst@title{#1}\let\lst@caption\relax} -\lst@Key{caption}\relax{\lstKV@OptArg[{#1}]{#1}% - {\def\lst@caption{##2}\def\lst@@caption{##1}}% - \let\lst@title\@empty} -\lst@AddToHookExe{TextStyle} - {\let\lst@caption\@empty \let\lst@@caption\@empty - \let\lst@title\@empty \let\lst@label\@empty} -\AtBeginDocument{ - \@ifundefined{thechapter}{\let\lst@ifnumberbychapter\iffalse}{} - \lst@ifnumberbychapter - \newcounter{lstlisting}[chapter] - \gdef\thelstlisting% - {\ifnum \c@chapter>\z@ \thechapter.\fi \@arabic\c@lstlisting} - \else - \newcounter{lstlisting} - \gdef\thelstlisting{\@arabic\c@lstlisting} - \fi} -\lst@UserCommand\lstlistingname{Listing} -\lst@Key{numberbychapter}{true}[t]{\lstKV@SetIf{#1}\lst@ifnumberbychapter} -\@ifundefined{abovecaptionskip} -{\newskip\abovecaptionskip - \newskip\belowcaptionskip}{} -\@ifundefined{@makecaption} -{\long\def\@makecaption#1#2{% - \vskip\abovecaptionskip - \sbox\@tempboxa{#1: #2}% - \ifdim \wd\@tempboxa >\hsize - #1: #2\par - \else - \global \@minipagefalse - \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}% - \fi - \vskip\belowcaptionskip}% -}{} -\def\fnum@lstlisting{% - \lstlistingname - \ifx\lst@@caption\@empty\else~\thelstlisting\fi}% -\def\lst@MakeCaption#1{% - \lst@ifdisplaystyle - \ifx #1t% - \ifx\lst@@caption\@empty\expandafter\lst@HRefStepCounter \else - \expandafter\refstepcounter - \fi {lstlisting}% - \ifx\lst@label\@empty\else \label{\lst@label}\fi - \let\lst@arg\lst@intname \lst@ReplaceIn\lst@arg\lst@filenamerpl - \global\let\lst@name\lst@arg \global\let\lstname\lst@name - \lst@ifnolol\else - \ifx\lst@@caption\@empty - \ifx\lst@caption\@empty - \ifx\lst@intname\@empty \else \def\lst@temp{ }% - \ifx\lst@intname\lst@temp \else - \addcontentsline{lol}{lstlisting}\lst@name - \fi\fi - \fi - \else - \addcontentsline{lol}{lstlisting}% - {\protect\numberline{\thelstlisting}\lst@@caption}% - \fi - \fi - \fi - \ifx\lst@caption\@empty\else - \lst@IfSubstring #1\lst@captionpos - {\begingroup \let\@@vskip\vskip - \def\vskip{\afterassignment\lst@vskip \@tempskipa}% - \def\lst@vskip{\nobreak\@@vskip\@tempskipa\nobreak}% - \par\@parboxrestore\normalsize\normalfont % \noindent (AS) - \ifx #1t\allowbreak \fi - \ifx\lst@title\@empty - \lst@makecaption\fnum@lstlisting{\ignorespaces \lst@caption} - \else - \lst@maketitle\lst@title % (AS) - \fi - \ifx #1b\allowbreak \fi - \endgroup}{}% - \fi - \fi} -\def\lst@makecaption{\@makecaption} -\def\lst@maketitle{\@makecaption\lst@title@dropdelim} -\def\lst@title@dropdelim#1{\ignorespaces} -\AtBeginDocument{% -\@ifundefined{captionlabelfalse}{}{% - \def\lst@maketitle{\captionlabelfalse\@makecaption\@empty}}% -\@ifundefined{caption@startrue}{}{% - \def\lst@maketitle{\caption@startrue\@makecaption\@empty}}% -} -\def\lst@HRefStepCounter#1{% - \begingroup - \c@lstlisting\lst@neglisting - \advance\c@lstlisting\m@ne \xdef\lst@neglisting{\the\c@lstlisting}% - \ifx\hyper@refstepcounter\@undefined\else - \hyper@refstepcounter{#1}% - \fi - \endgroup} -\gdef\lst@neglisting{\z@}% init -\lst@Key{boxpos}{c}{\def\lst@boxpos{#1}} -\def\lst@boxtrue{\let\lst@ifbox\iftrue} -\let\lst@ifbox\iffalse -\lst@Key{float}\relax[\lst@floatplacement]{% - \lstKV@SwitchCases{#1}% - {true&\let\lst@floatdefault\lst@floatplacement - \let\lst@float\lst@floatdefault\\% - false&\let\lst@floatdefault\relax - \let\lst@float\lst@floatdefault - }{\def\lst@next{\@ifstar{\let\lst@beginfloat\@dblfloat - \let\lst@endfloat\end@dblfloat - \lst@KFloat}% - {\let\lst@beginfloat\@float - \let\lst@endfloat\end@float - \lst@KFloat}} - \edef\lst@float{#1}% - \expandafter\lst@next\lst@float\relax}} -\def\lst@KFloat#1\relax{% - \ifx\@empty#1\@empty - \let\lst@float\lst@floatplacement - \else - \def\lst@float{#1}% - \fi} -\lst@Key{floatplacement}{tbp}{\def\lst@floatplacement{#1}} -\lst@AddToHook{PreSet}{\let\lst@float\lst@floatdefault} -\lst@AddToHook{TextStyle}{\let\lst@float\relax} -\let\lst@floatdefault\relax % init -\lst@AddToHook{DeInit}{% - \ifx\lst@float\relax - \global\let\lst@doendpe\@doendpe - \else - \global\let\lst@doendpe\@empty - \fi} -\AtBeginDocument{% -\@ifundefined{c@float@type}% - {\edef\ftype@lstlisting{\ifx\c@figure\@undefined 1\else 4\fi}} - {\edef\ftype@lstlisting{\the\c@float@type}% - \addtocounter{float@type}{\value{float@type}}}% -} -\lst@Key{aboveskip}\medskipamount{\def\lst@aboveskip{#1}} -\lst@Key{belowskip}\medskipamount{\def\lst@belowskip{#1}} -\lst@AddToHook{TextStyle} - {\let\lst@aboveskip\z@ \let\lst@belowskip\z@} -\lst@Key{everydisplay}{}{\def\lst@EveryDisplay{#1}} -\lst@AddToHook{TextStyle}{\let\lst@ifdisplaystyle\iffalse} -\lst@AddToHook{DisplayStyle}{\let\lst@ifdisplaystyle\iftrue} -\let\lst@ifdisplaystyle\iffalse -\def\lst@Init#1{% - \begingroup - \ifx\lst@float\relax\else - \edef\@tempa{\noexpand\lst@beginfloat{lstlisting}[\lst@float]}% - \expandafter\@tempa - \fi - \ifx\lst@multicols\@empty\else - \edef\lst@next{\noexpand\multicols{\lst@multicols}} - \expandafter\lst@next - \fi - \ifhmode\ifinner \lst@boxtrue \fi\fi - \lst@ifbox - \lsthk@BoxUnsafe - \hbox to\z@\bgroup - $\if t\lst@boxpos \vtop - \else \if b\lst@boxpos \vbox - \else \vcenter \fi\fi - \bgroup \par\noindent - \else - \lst@ifdisplaystyle - \lst@EveryDisplay - \par\penalty-50\relax - \vspace\lst@aboveskip - \fi - \fi - \normalbaselines - \abovecaptionskip\lst@abovecaption\relax - \belowcaptionskip\lst@belowcaption\relax - \lst@MakeCaption t% - \lsthk@PreInit \lsthk@Init - \lst@ifdisplaystyle - \global\let\lst@ltxlabel\@empty - \if@inlabel - \lst@ifresetmargins - \leavevmode - \else - \xdef\lst@ltxlabel{\the\everypar}% - \lst@AddTo\lst@ltxlabel{% - \global\let\lst@ltxlabel\@empty - \everypar{\lsthk@EveryLine\lsthk@EveryPar}}% - \fi - \fi - \everypar\expandafter{\lst@ltxlabel - \lsthk@EveryLine\lsthk@EveryPar}% - \else - \everypar{}\let\lst@NewLine\@empty - \fi - \lsthk@InitVars \lsthk@InitVarsBOL - \lst@Let{13}\lst@MProcessListing - \let\lst@Backslash#1% - \lst@EnterMode{\lst@Pmode}{\lst@SelectCharTable}% - \lst@InitFinalize} -\let\lst@InitFinalize\@empty % init -\lst@AddToHook{PreInit} - {\rightskip\z@ \leftskip\z@ \parfillskip=\z@ plus 1fil - \let\par\@@par} -\lst@AddToHook{EveryLine}{}% init -\lst@AddToHook{EveryPar}{}% init -\lst@Key{showlines}f[t]{\lstKV@SetIf{#1}\lst@ifshowlines} -\def\lst@DeInit{% - \lst@XPrintToken \lst@EOLUpdate - \global\advance\lst@newlines\m@ne - \lst@ifshowlines - \lst@DoNewLines - \else - \setbox\@tempboxa\vbox{\lst@DoNewLines}% - \fi - \lst@ifdisplaystyle \par\removelastskip \fi - \lsthk@ExitVars\everypar{}\lsthk@DeInit\normalbaselines\normalcolor - \lst@MakeCaption b% - \lst@ifbox - \egroup $\hss \egroup - \vrule\@width\lst@maxwidth\@height\z@\@depth\z@ - \else - \lst@ifdisplaystyle - \par\penalty-50\vspace\lst@belowskip - \fi - \fi - \ifx\lst@multicols\@empty\else - \def\lst@next{\global\let\@checkend\@gobble - \endmulticols - \global\let\@checkend\lst@@checkend} - \expandafter\lst@next - \fi - \ifx\lst@float\relax\else - \expandafter\lst@endfloat - \fi - \endgroup} -\let\lst@@checkend\@checkend -\newdimen\lst@maxwidth % \global -\lst@AddToHook{InitVars}{\global\lst@maxwidth\z@} -\lst@AddToHook{InitVarsEOL} - {\ifdim\lst@currlwidth>\lst@maxwidth - \global\lst@maxwidth\lst@currlwidth - \fi} -\def\lst@EOLUpdate{\lsthk@EOL \lsthk@InitVarsEOL} -\def\lst@MProcessListing{% - \lst@XPrintToken \lst@EOLUpdate \lsthk@InitVarsBOL - \global\advance\lst@lineno\@ne - \ifnum \lst@lineno>\lst@lastline - \lst@ifdropinput \lst@LeaveMode \fi - \ifx\lst@linerange\@empty - \expandafter\expandafter\expandafter\lst@EndProcessListing - \else - \lst@interrange - \lst@GetLineInterval - \expandafter\expandafter\expandafter\lst@SkipToFirst - \fi - \else - \expandafter\lst@BOLGobble - \fi} -\let\lst@EndProcessListing\endinput -\lst@Key{gobble}{0}{\def\lst@gobble{#1}} -\def\lst@BOLGobble{% - \ifnum\lst@gobble>\z@ - \@tempcnta\lst@gobble\relax - \expandafter\lst@BOLGobble@ -\fi} -\def\lst@BOLGobble@@{% - \ifnum\@tempcnta>\z@ - \expandafter\lst@BOLGobble@ - \fi} -\def\lstenv@BOLGobble@@{% - \lst@IfNextChars\lstenv@endstring{\lstenv@End}% - {\advance\@tempcnta\m@ne \expandafter\lst@BOLGobble@@\lst@eaten}} -\def\lst@BOLGobble@#1{% - \let\lst@next#1% - \ifx \lst@next\relax\else - \ifx \lst@next\lst@MProcessListing\else - \ifx \lst@next\lst@processformfeed\else - \ifx \lst@next\lstenv@backslash - \let\lst@next\lstenv@BOLGobble@@ - \else - \let\lst@next\lst@BOLGobble@@ - \ifx #1\lst@processtabulator - \advance\@tempcnta-\lst@tabsize\relax - \ifnum\@tempcnta<\z@ - \lst@length-\@tempcnta \lst@PreGotoTabStop - \fi - \else - \advance\@tempcnta\m@ne - \fi - \fi \fi \fi \fi - \lst@next} -\def\lst@processformfeed{\lst@ProcessFormFeed} -\def\lst@processtabulator{\lst@ProcessTabulator} -\lst@Key{name}\relax{\def\lst@intname{#1}} -\lst@AddToHookExe{PreSet}{\global\let\lst@intname\@empty} -\lst@AddToHook{PreInit}{% - \let\lst@arg\lst@intname \lst@ReplaceIn\lst@arg\lst@filenamerpl - \global\let\lst@name\lst@arg \global\let\lstname\lst@name} -\def\lst@filenamerpl{_\textunderscore $\textdollar -\textendash} -\def\l@lstlisting#1#2{\@dottedtocline{1}{1.5em}{2.3em}{#1}{#2}} -\lst@UserCommand\lstlistlistingname{Listings} -\lst@UserCommand\lstlistoflistings{\bgroup - \let\contentsname\lstlistlistingname - \let\lst@temp\@starttoc \def\@starttoc##1{\lst@temp{lol}}% - \tableofcontents \egroup} -\@ifundefined{float@listhead}{}{% - \renewcommand*{\lstlistoflistings}{% - \begingroup - \@ifundefined{@restonecoltrue}{}{% - \if@twocolumn - \@restonecoltrue\onecolumn - \else - \@restonecolfalse - \fi - }% - \float@listhead{\lstlistlistingname}% - \parskip\z@\parindent\z@\parfillskip \z@ \@plus 1fil% - \@starttoc{lol}% - \@ifundefined{@restonecoltrue}{}{% - \if@restonecol\twocolumn\fi - }% - \endgroup - }% -} -\AtBeginDocument{% - \@ifundefined{float@addtolists}% - {\gdef\float@addtolists#1{\addtocontents{lol}{#1}}}% - {\let\orig@float@addtolists\float@addtolists - \gdef\float@addtolists#1{% - \addtocontents{lol}{#1}% - \orig@float@addtolists{#1}}}% -}% -\newcommand\lstinline[1][]{% - \leavevmode\bgroup % \hbox\bgroup --> \bgroup - \def\lst@boxpos{b}% - \lsthk@PreSet\lstset{flexiblecolumns,#1}% - \lsthk@TextStyle - \@ifnextchar\bgroup{\afterassignment\lst@InlineG \let\@let@token}% - \lstinline@} -\def\lstinline@#1{% - \lst@Init\relax - \lst@IfNextCharActive{\lst@InlineM#1}{\lst@InlineJ#1}} -\lst@AddToHook{TextStyle}{}% init -\lst@AddToHook{SelectCharTable}{\lst@inlinechars} -\global\let\lst@inlinechars\@empty -\def\lst@InlineM#1{\gdef\lst@inlinechars{% - \lst@Def{`#1}{\lst@DeInit\egroup\global\let\lst@inlinechars\@empty}% - \lst@Def{13}{\lst@DeInit\egroup \global\let\lst@inlinechars\@empty - \PackageError{Listings}{lstinline ended by EOL}\@ehc}}% - \lst@inlinechars} -\def\lst@InlineJ#1{% - \def\lst@temp##1#1{% - \let\lst@arg\@empty \lst@InsideConvert{##1}\lst@arg - \lst@DeInit\egroup}% - \lst@temp} -\def\lst@InlineG{% - \lst@Init\relax - \lst@IfNextCharActive{\lst@InlineM\}}% - {\let\lst@arg\@empty \lst@InlineGJ}} -\def\lst@InlineGJ{\futurelet\@let@token\lst@InlineGJTest} -\def\lst@InlineGJTest{% - \ifx\@let@token\egroup - \afterassignment\lst@InlineGJEnd - \expandafter\let\expandafter\@let@token - \else - \ifx\@let@token\@sptoken - \let\lst@next\lst@InlineGJReadSp - \else - \let\lst@next\lst@InlineGJRead - \fi - \expandafter\lst@next - \fi} -\def\lst@InlineGJEnd{\lst@arg\lst@DeInit\egroup} -\def\lst@InlineGJRead#1{% - \lccode`\~=`#1\lowercase{\lst@lAddTo\lst@arg~}% - \lst@InlineGJ} -\def\lst@InlineGJReadSp#1{% - \lccode`\~=`\ \lowercase{\lst@lAddTo\lst@arg~}% - \lst@InlineGJ#1} -\newcommand\lstMakeShortInline[1][]{% - \def\lst@shortinlinedef{\lstinline[#1]}% - \lstMakeShortInline@}% -\def\lstMakeShortInline@#1{% - \expandafter\ifx\csname lst@ShortInlineOldCatcode\string#1\endcsname\relax - \lst@shortlstinlineinfo{Made }{#1}% - \lst@add@special{#1}% - \expandafter - \xdef\csname lst@ShortInlineOldCatcode\string#1\endcsname{\the\catcode`#1}% - \begingroup - \catcode`\~\active \lccode`\~`#1% - \lowercase{% - \global\expandafter\let - \csname lst@ShortInlineOldMeaning\string#1\endcsname~% - \expandafter\gdef\expandafter~\expandafter{\lst@shortinlinedef#1}}% - \endgroup - \global\catcode`#1\active - \else - \PackageError{Listings}% - {\string\lstMakeShorterInline\ definitions cannot be nested}% - {Use \string\lstDeleteShortInline first.}% - {}% - \fi} -\def\lstDeleteShortInline#1{% - \expandafter\ifx\csname lst@ShortInlineOldCatcode\string#1\endcsname\relax - \PackageError{Listings}% - {#1 is not a short reference for \string\lstinline}% - {Use \string\lstMakeShortInline first.}% - {}% - \else - \lst@shortlstinlineinfo{Deleted }{#1 as}% - \lst@rem@special{#1}% - \global\catcode`#1\csname lst@ShortInlineOldCatcode\string#1\endcsname - \global \expandafter\let% - \csname lst@ShortInlineOldCatcode\string#1\endcsname \relax - \ifnum\catcode`#1=\active - \begingroup - \catcode`\~\active \lccode`\~`#1% - \lowercase{% - \global\expandafter\let\expandafter~% - \csname lst@ShortInlineOldMeaning\string#1\endcsname}% - \endgroup - \fi - \fi} -\def\lst@shortlstinlineinfo#1#2{% - \PackageInfo{Listings}{% - #1\string#2 a short reference for \string\lstinline}} -\def\lst@add@special#1{% - \lst@rem@special{#1}% - \expandafter\gdef\expandafter\dospecials\expandafter - {\dospecials \do #1}% - \expandafter\gdef\expandafter\@sanitize\expandafter - {\@sanitize \@makeother #1}} -\def\lst@rem@special#1{% - \def\do##1{% - \ifnum`#1=`##1 \else \noexpand\do\noexpand##1\fi}% - \xdef\dospecials{\dospecials}% - \begingroup - \def\@makeother##1{% - \ifnum`#1=`##1 \else \noexpand\@makeother\noexpand##1\fi}% - \xdef\@sanitize{\@sanitize}% - \endgroup} -\def\lst@MakePath#1{\ifx\@empty#1\@empty\else\lst@MakePath@#1/\@nil/\fi} -\def\lst@MakePath@#1/{#1/\lst@MakePath@@} -\def\lst@MakePath@@#1/{% - \ifx\@nil#1\expandafter\@gobble - \else \ifx\@empty#1\else #1/\fi \fi - \lst@MakePath@@} -\lst@Key{inputpath}{}{\edef\lst@inputpath{\lst@MakePath{#1}}} -\def\lstinputlisting{% - \begingroup \lst@setcatcodes \lst@inputlisting} -\newcommand\lst@inputlisting[2][]{% - \endgroup - \def\lst@set{#1}% - \IfFileExists{\lst@inputpath#2}% - {\expandafter\lst@InputListing\expandafter{\lst@inputpath#2}}% - {\filename@parse{\lst@inputpath#2}% - \edef\reserved@a{\noexpand\lst@MissingFileError - {\filename@area\filename@base}% - {\ifx\filename@ext\relax tex\else\filename@ext\fi}}% - \reserved@a}% - \lst@doendpe \@newlistfalse \ignorespaces} -\def\lst@MissingFileError#1#2{% - \typeout{^^J! Package Listings Error: File `#1(.#2)' not found.^^J% - ^^JType X to quit or <RETURN> to proceed,^^J% - or enter new name. (Default extension: #2)^^J}% - \message{Enter file name: }% - {\endlinechar\m@ne \global\read\m@ne to\@gtempa}% - \ifx\@gtempa\@empty \else - \def\reserved@a{x}\ifx\reserved@a\@gtempa\batchmode\@@end\fi - \def\reserved@a{X}\ifx\reserved@a\@gtempa\batchmode\@@end\fi - \filename@parse\@gtempa - \edef\filename@ext{% - \ifx\filename@ext\relax#2\else\filename@ext\fi}% - \edef\reserved@a{\noexpand\IfFileExists % - {\filename@area\filename@base.\filename@ext}% - {\noexpand\lst@InputListing % - {\filename@area\filename@base.\filename@ext}}% - {\noexpand\lst@MissingFileError - {\filename@area\filename@base}{\filename@ext}}}% - \expandafter\reserved@a % - \fi} -\let\lst@ifdraft\iffalse -\DeclareOption{draft}{\let\lst@ifdraft\iftrue} -\DeclareOption{final}{\let\lst@ifdraft\iffalse} -\lst@AddToHook{PreSet} - {\lst@ifdraft - \let\lst@ifprint\iffalse - \@gobbletwo\fi\fi - \fi} -\def\lst@InputListing#1{% - \begingroup - \lsthk@PreSet \gdef\lst@intname{#1}% - \expandafter\lstset\expandafter{\lst@set}% - \lsthk@DisplayStyle - \catcode\active=\active - \lst@Init\relax \let\lst@gobble\z@ - \lst@SkipToFirst - \lst@ifprint \def\lst@next{\input{#1}}% - \else \let\lst@next\@empty \fi - \lst@next - \lst@DeInit - \endgroup} -\def\lst@SkipToFirst{% - \ifnum \lst@lineno<\lst@firstline - \lst@BeginDropInput\lst@Pmode - \lst@Let{13}\lst@MSkipToFirst - \lst@Let{10}\lst@MSkipToFirst - \else - \expandafter\lst@BOLGobble - \fi} -\def\lst@MSkipToFirst{% - \global\advance\lst@lineno\@ne - \ifnum \lst@lineno=\lst@firstline - \lst@LeaveMode \global\lst@newlines\z@ - \lsthk@InitVarsBOL - \expandafter\lst@BOLGobble - \fi} -\def\lstenv@DroppedWarning{% - \ifx\lst@dropped\@undefined\else - \PackageWarning{Listings}{Text dropped after begin of listing}% - \fi} -\let\lst@dropped\@undefined % init -\begingroup \lccode`\~=`\^^M\lowercase{% -\gdef\lstenv@Process#1{% - \ifx~#1% - \lstenv@DroppedWarning \let\lst@next\lst@SkipToFirst - \else\ifx^^J#1% - \lstenv@DroppedWarning \let\lst@next\lstenv@ProcessJ - \else - \let\lst@dropped#1\let\lst@next\lstenv@Process - \fi \fi - \lst@next} -}\endgroup -\def\lstenv@ProcessJ{% - \let\lst@arg\@empty - \ifx\@currenvir\lstenv@name - \expandafter\lstenv@ProcessJEnv - \else - \expandafter\def\expandafter\lst@temp\expandafter##1% - \csname end\lstenv@name\endcsname - {\lst@InsideConvert{##1}\lstenv@ProcessJ@}% - \expandafter\lst@temp - \fi} -\begingroup \lccode`\~=`\\\lowercase{% -\gdef\lstenv@ProcessJ@{% - \lst@lExtend\lst@arg - {\expandafter\ \expandafter~\lstenv@endstring}% - \catcode10=\active \lst@Let{10}\lst@MProcessListing - \lst@SkipToFirst \lst@arg} -}\endgroup -\def\lstenv@ProcessJEnv#1\end#2{\def\lst@temp{#2}% - \ifx\lstenv@name\lst@temp - \lst@InsideConvert{#1}% - \expandafter\lstenv@ProcessJ@ - \else - \lst@InsideConvert{#1\\end\{#2\}}% - \expandafter\lstenv@ProcessJEnv - \fi} -\def\lstenv@backslash{% - \lst@IfNextChars\lstenv@endstring - {\lstenv@End}% - {\expandafter\lsts@backslash \lst@eaten}}% -\def\lstenv@End{% - \ifx\@currenvir\lstenv@name - \edef\lst@next{\noexpand\end{\lstenv@name}}% - \else - \def\lst@next{\csname end\lstenv@name\endcsname}% - \fi - \lst@next} -\lst@UserCommand\lstnewenvironment#1#2#{% - \@ifundefined{#1}% - {\let\lst@arg\@empty - \lst@XConvert{#1}\@nil - \expandafter\lstnewenvironment@\lst@arg{#1}{#2}}% - {\PackageError{Listings}{Environment `#1' already defined}\@eha - \@gobbletwo}} -\def\@tempa#1#2#3{% -\gdef\lstnewenvironment@##1##2##3##4##5{% - \begingroup - \global\@namedef{end##2}{\lstenv@Error{##2}}% - \global\@namedef{##2}{\def\lstenv@name{##2}% - \begingroup \lst@setcatcodes \catcode\active=\active - \csname##2@\endcsname}% - \let\l@ngrel@x\global - \let\@xargdef\lstenv@xargdef - \expandafter\new@command\csname##2@\endcsname##3% - {\lsthk@PreSet ##4% - \ifx\@currenvir\lstenv@name - \def\lstenv@endstring{#1#2##1#3}% - \else - \def\lstenv@endstring{#1##1}% - \fi - \@namedef{end##2}{\lst@DeInit ##5\endgroup - \lst@doendpe \@ignoretrue}% - \lsthk@DisplayStyle - \let\lst@EndProcessListing\lstenv@SkipToEnd - \lst@Init\lstenv@backslash - \lst@ifprint - \expandafter\expandafter\expandafter\lstenv@Process - \else - \expandafter\lstenv@SkipToEnd - \fi - \lst@insertargs}% - \endgroup}% -} -\let\lst@arg\@empty \lst@XConvert{end}\{\}\@nil -\expandafter\@tempa\lst@arg -\let\lst@insertargs\@empty -\def\lstenv@xargdef#1{ - \expandafter\lstenv@xargdef@\csname\string#1\endcsname#1} -\def\lstenv@xargdef@#1#2[#3][#4]#5{% - \@ifdefinable#2{% - \gdef#2{% - \ifx\protect\@typeset@protect - \expandafter\lstenv@testopt - \else - \@x@protect#2% - \fi - #1% - {#4}}% - \@yargdef - #1% - \tw@ - {#3}% - {#5}}} -\long\def\lstenv@testopt#1#2{% - \@ifnextchar[{\catcode\active5\relax \lstenv@testopt@#1}% - {#1[{#2}]}} -\def\lstenv@testopt@#1[#2]{% - \catcode\active\active - #1[#2]} -\begingroup \lccode`\~=`\\\lowercase{% -\gdef\lstenv@SkipToEnd{% - \long\expandafter\def\expandafter\lst@temp\expandafter##\expandafter - 1\expandafter~\lstenv@endstring{\lstenv@End}% - \lst@temp} -}\endgroup -\def\lstenv@Error#1{\PackageError{Listings}{Extra \string\end#1}% - {I'm ignoring this, since I wasn't doing a \csname#1\endcsname.}} -\begingroup \lccode`\~=`\^^M\lowercase{% -\gdef\lst@TestEOLChar#1{% - \def\lst@insertargs{#1}% - \ifx ~#1\@empty \else - \ifx^^J#1\@empty \else - \global\let\lst@intname\lst@insertargs - \let\lst@insertargs\@empty - \fi \fi} -}\endgroup -\lstnewenvironment{lstlisting}[2][] - {\lst@TestEOLChar{#2}% - \lstset{#1}% - \csname\@lst @SetFirstNumber\endcsname} - {\csname\@lst @SaveFirstNumber\endcsname} -\lst@Key{fancyvrb}\relax[t]{% - \lstKV@SetIf{#1}\lst@iffancyvrb - \lstFV@fancyvrb} -\ifx\lstFV@fancyvrb\@undefined - \gdef\lstFV@fancyvrb{\lst@RequireAspects{fancyvrb}\lstFV@fancyvrb} -\fi -\@ifundefined{ocp}{} - {\lst@AddToHook{OutputBox}% - {\let\lst@ProcessLetter\@firstofone - \let\lst@ProcessDigit\@firstofone - \let\lst@ProcessOther\@firstofone}} -\DeclareOption*{\expandafter\lst@ProcessOption\CurrentOption\relax} -\def\lst@ProcessOption#1#2\relax{% - \ifx #1!% - \lst@DeleteKeysIn\lst@loadaspects{#2}% - \else - \lst@lAddTo\lst@loadaspects{,#1#2}% - \fi} -\@ifundefined{lst@loadaspects} - {\def\lst@loadaspects{strings,comments,escape,style,language,% - keywords,labels,lineshape,frames,emph,index}% - }{} -\InputIfFileExists{lstpatch.sty}{}{} -\let\lst@ifsavemem\iffalse -\DeclareOption{savemem}{\let\lst@ifsavemem\iftrue} -\DeclareOption{noaspects}{\let\lst@loadaspects\@empty} -\ProcessOptions -\lst@RequireAspects\lst@loadaspects -\let\lst@loadaspects\@empty -\lst@UseHook{SetStyle}\lst@UseHook{EmptyStyle} -\lst@UseHook{SetLanguage}\lst@UseHook{EmptyLanguage} -\InputIfFileExists{listings.cfg}{}{} -\InputIfFileExists{lstlocal.cfg}{}{} -\endinput -%% -%% End of file `listings.sty'. diff --git a/Documentation/SoftwareGuide/LaTeXWrapper.sh.in b/Documentation/SoftwareGuide/LaTeXWrapper.sh.in index f6b0104cd94def7e3b997d772623c4d66ec1930c..9abe22e71a086e0eea6e84b4f8c7c89e647fea83 100644 --- a/Documentation/SoftwareGuide/LaTeXWrapper.sh.in +++ b/Documentation/SoftwareGuide/LaTeXWrapper.sh.in @@ -3,4 +3,4 @@ TEXINPUTS=$TEXINPUTS:${ITK_TEXINPUTS} export TEXINPUTS -${LATEX_COMPILER} -file-line-error -halt-on-error "$@" +${LATEX_COMPILER} -file-line-error -halt-on-error -shell-escape "$@" diff --git a/Documentation/SoftwareGuide/Latex/CMakeLists.txt b/Documentation/SoftwareGuide/Latex/CMakeLists.txt index 3999ce795c20b579574e7ba49f80ff212ac025a1..5b04644722c4da5fa9b35047d32813fecc19db2d 100644 --- a/Documentation/SoftwareGuide/Latex/CMakeLists.txt +++ b/Documentation/SoftwareGuide/Latex/CMakeLists.txt @@ -89,7 +89,7 @@ SET(DVIPS_CONVERTER_OPTIONS -D600) # Option for html generation -SET(TEX4HT_OPTIONS html,2,sections+) +SET(TEX4HT_OPTIONS "html,2,sections+ \"\" \"\" -shell-escape") SET (HTML_OUTPUT "SoftwareGuide-${OTB_VERSION_MAJOR}.${OTB_VERSION_MINOR}") # Copy RELEASE_NOTES.txt from OTB source tree to Software Guide build directory diff --git a/Documentation/SoftwareGuide/Latex/Classification.tex b/Documentation/SoftwareGuide/Latex/Classification.tex index 90e4b41d462b8f717722d811ffcf49a5cd8bad7f..1ff8502157758e3c04540583c2c71933a8168db9 100644 --- a/Documentation/SoftwareGuide/Latex/Classification.tex +++ b/Documentation/SoftwareGuide/Latex/Classification.tex @@ -111,7 +111,7 @@ the later case, it creates several threads using OpenMP. There is a factory mechanism on top of the model class (see \doxygen{otb}{MachineLearningModelFactory}). Given an input file, the static function \code{CreateMachineLearningModel(...)} is able -to instanciate a model of the right type. +to instantiate a model of the right type. For unsupervised models, the target samples \textbf{still have to be set}. They won't be used so you can fill a ListSample with zeros. diff --git a/Documentation/SoftwareGuide/Latex/ContributorList.tex b/Documentation/SoftwareGuide/Latex/ContributorList.tex index 347a2bd7cfc0ccb656576f3f6e6abf27a78ac74b..8f34a6e134c565737bfa4edc4313219968fb53b2 100644 --- a/Documentation/SoftwareGuide/Latex/ContributorList.tex +++ b/Documentation/SoftwareGuide/Latex/ContributorList.tex @@ -13,6 +13,7 @@ Christophe Lay, Christophe Palmann (CS), Conrad Bielski (JRC), Cyrille Valladeau (CS), +Daniel McInerney, David Dubois, David Youssefi (CNES Intern, then CS), Edouard Barthelet (Telecom Bretagne and Thales Communications), diff --git a/Documentation/SoftwareGuide/Latex/Installation.tex b/Documentation/SoftwareGuide/Latex/Installation.tex index 3b5fa2ded7cfdb8943edbdc22c2b1896d0a256c8..a5521be83db8be2685853792a2dadc55017cd4a9 100644 --- a/Documentation/SoftwareGuide/Latex/Installation.tex +++ b/Documentation/SoftwareGuide/Latex/Installation.tex @@ -128,7 +128,7 @@ See table \ref{tab:otb-dependencies} for the full list of dependencies. \hline \textbf{Qt} & \url{http://qt-project.org} & no & 4 \\ \hline -\textbf{QWT} & \url{http://qwt.sourceforge.net} & no & 5 \\ +\textbf{QWT} & \url{http://qwt.sourceforge.net} & no & 6 \\ \hline \textbf{Shark} & \url{http://image.diku.dk/shark/} & no & 3.1 \\ \hline @@ -404,15 +404,23 @@ $ make install \hline \textbf{OTB\_USE\_QT4} & OTBQt4 & OTBQtWidget \\ \hline -\textbf{OTB\_USE\_OPENCV} & OTBOpenCV & \\ +\textbf{OTB\_USE\_QWT} & OTBQwt & OTBMonteverdiGUI OTBMonteverdi \\ \hline -\textbf{OTB\_USE\_MUPARSERX} & OTBMuParserX & OTBMathParserX OTBAppMathParserX \\ +\textbf{OTB\_USE\_GLEW} & OTBGlew & OTBIce OTBMonteverdiGUI OTBMonteverdi \\ +\hline +\textbf{OTB\_USE\_OPENGL} & OTBOpenGL & OTBIce OTBMonteverdiGUI OTBMonteverdi \\ \hline \textbf{OTB\_USE\_CURL} & OTBCurl & \\ \hline \textbf{OTB\_USE\_MUPARSER} & OTBMuParser & OTBMathParser OTBDempsterShafer OTBAppClassification OTBAppMathParser OTBAppStereo OTBAppProjection OTBAppSegmentation OTBAppClassification OTBRoadExtraction OTBRCC8 OTBCCOBIA OTBAppSegmentation OTBMeanShift OTBAppSegmentation OTBMeanShift OTBAppSegmentation \\ \hline -\textbf{OTB\_USE\_LIBSVM} & OTBLibSVM & OTBSVMLearning \\ +\textbf{OTB\_USE\_MUPARSERX} & OTBMuParserX & OTBMathParserX OTBAppMathParserX \\ +\hline +\textbf{OTB\_USE\_LIBSVM} & OTBLibSVM & optional for OTBSupervised OTBAppClassification \\ +\hline +\textbf{OTB\_USE\_OPENCV} & OTBOpenCV & optional for OTBSupervised OTBAppClassification \\ +\hline +\textbf{OTB\_USE\_SHARK} & OTBShark & optional for OTBSupervised OTBAppClassification \\ \hline \textbf{OTB\_USE\_MAPNIK} & OTBMapnik & OTBVectorDataRendering \\ \hline diff --git a/Documentation/SoftwareGuide/Latex/Persistent.tex b/Documentation/SoftwareGuide/Latex/Persistent.tex index 240725fcdf71e9c88a9c00f2f7eed68eb55e2049..5474815669d596f2c934908274a8d6d1b5dab4a5 100644 --- a/Documentation/SoftwareGuide/Latex/Persistent.tex +++ b/Documentation/SoftwareGuide/Latex/Persistent.tex @@ -112,17 +112,17 @@ section~\ref{chapter:WriteAFilter}, page~\pageref{chapter:WriteAFilter}. The first step is to write a persistent mean image filter. We need to include the appropriate header : -\begin{lstlisting} +\begin{cppcode} #include "otbPersistentImageFilter.h" -\end{lstlisting} +\end{cppcode} Then, we declare the class prototype as follows: -\begin{lstlisting} +\begin{cppcode} template<class TInputImage > class ITK_EXPORT PersistentMeanImageFilter : public PersistentImageFilter<TInputImage, TInputImage> -\end{lstlisting} +\end{cppcode} Since the output image will only be used for streaming purpose, we do not need to declare different input and output template types. @@ -131,14 +131,14 @@ In the \emph{private} section of the class, we will declare a member which will be used to store temporary results, and a member which will be used to store the final result. -\begin{lstlisting} +\begin{cppcode} private: // Temporary results container std::vector<PixelType> m_TemporarySums; // Final result member double m_Mean; -\end{lstlisting} +\end{cppcode} Next, we will write the \verb?Reset()? method implementation in the \emph{protected} section of the class. Proper allocation of the @@ -146,7 +146,7 @@ temporary results container with respect to the number of threads is handled here. -\begin{lstlisting} +\begin{cppcode} protected: virtual void Reset() { @@ -160,13 +160,13 @@ protected: // Reset the final result m_Mean = 0.; } -\end{lstlisting} +\end{cppcode} Now, we need to write the \verb?ThreadedGenerateData()? methods (also in the \emph{protected} section), were temporary results will be computed for each piece of stream. -\begin{lstlisting} +\begin{cppcode} virtual void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId) { @@ -190,12 +190,12 @@ for (it.GoToBegin(); !it.IsAtEnd(); ++it, progress.CompletedPixel()) m_TemporarySums[threadId]+= value; } -\end{lstlisting} +\end{cppcode} Last, we need to define the \verb?Synthetize()? method (still in the \emph{protected} section), which will yield the final results: -\begin{lstlisting} +\begin{cppcode} virtual void Synthetize() { // For each thread @@ -214,7 +214,7 @@ if(nbPixels!=0) m_Mean/=nbPixels; } } -\end{lstlisting} +\end{cppcode} \subsection{Second step: Decorating the filter and using it} @@ -222,41 +222,41 @@ Now, to use the filter, one only has to decorate it with the \doxygen{otb}{PersistentFilterStreamingDecorator}. First step is to include the appropriate header: -\begin{lstlisting} +\begin{cppcode} #include "otbPersistentMeanImageFilter.h" #include "otbPersistentFilterStreamingDecorator.h" -\end{lstlisting} +\end{cppcode} Then, we decorate the filter with some typedefs: -\begin{lstlisting} +\begin{cppcode} typedef otb::PersistentMeanImageFilter<ImageType> PersitentMeanFilterType; typedef otb::PersistentFilterStreamingDecorator < PersitentMeanFilterType> StreamingMeanFilterType; -\end{lstlisting} +\end{cppcode} Now, the decorated filter can be used like any standard filter: -\begin{lstlisting} +\begin{cppcode} StreamingMeanFilterType::Pointer filter = StreamingMeanFilterType::New(); filter->SetInput(reader->GetOutput()); filter->Update(); -\end{lstlisting} +\end{cppcode} \subsection{Third step: one class to rule them all} It is often convenient to avoid the few typedefs of the previous section by deriving a new class from the decorated filter: -\begin{lstlisting} +\begin{cppcode} template<class TInputImage > class ITK_EXPORT StreamingMeanImageFilter : public PersistentFilterStreamingDecorator< PersistentImageFilter<TInputImage, TInputImage> > -\end{lstlisting} +\end{cppcode} This also allows to redefine setters and getters for parameters, avoiding to call the \verb?GetFilter()? method to set them. diff --git a/Documentation/SoftwareGuide/Latex/SoftwareGuide.tex b/Documentation/SoftwareGuide/Latex/SoftwareGuide.tex index dee1a21317409da5cdf59dc1b945e6b680d7bf41..c5bd1dff8218ca02c31995c44a83913874e97c27 100644 --- a/Documentation/SoftwareGuide/Latex/SoftwareGuide.tex +++ b/Documentation/SoftwareGuide/Latex/SoftwareGuide.tex @@ -32,40 +32,14 @@ \definecolor{listlightgray}{gray}{0.955} \definecolor{listwhite}{gray}{1.0} -\usepackage{listings} -\newcommand{\lstsetcpp} -{ -\lstset{frame = tb, - framerule = 0.25pt, - float, - fontadjust, - backgroundcolor={\color{listlightgray}}, - basicstyle = {\ttfamily\footnotesize}, - keywordstyle = {\ttfamily\color{listkeyword}\textbf}, - identifierstyle = {\ttfamily}, - commentstyle = {\ttfamily\color{listcomment}\textit}, - stringstyle = {\ttfamily}, - showstringspaces = false, - showtabs = false, - numbers = none, - numbersep = 6pt, - numberstyle={\ttfamily\color{listnumbers}}, - tabsize = 2, - language=[ANSI]C++, - floatplacement=!h - } -} -\newcommand{\lstsetpython} -{ -\lstset{language=Python - } -} -\newcommand{\lstsetjava} -{ -\lstset{language=Java - } -} +\usepackage{minted} +\newminted{cpp}{fontsize=\small} +\newminted{cmake}{fontsize=\small} +\newminted{bat}{fontsize=\small} +\usepackage{mdframed} +\BeforeBeginEnvironment{cppcode}{\begin{mdframed}[leftline=false,rightline=false,backgroundcolor=listlightgray]} +\AfterEndEnvironment{cppcode}{\end{mdframed}} \newif\ifitkFullVersion \itkFullVersiontrue @@ -170,8 +144,6 @@ colorlinks,linkcolor={blue},citecolor={blue},urlcolor={blue}, \hyperbaseurl{http://www.orfeo-toolbox.org} -\lstsetcpp - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % diff --git a/Documentation/SoftwareGuide/Latex/Tutorial.tex b/Documentation/SoftwareGuide/Latex/Tutorial.tex index ba304a541b6614212a2f07a9cdc47e1d43000e00..be8cd232fc53ecfb8dfe51e5fbae91cb0424fca6 100644 --- a/Documentation/SoftwareGuide/Latex/Tutorial.tex +++ b/Documentation/SoftwareGuide/Latex/Tutorial.tex @@ -36,9 +36,7 @@ directory. The \code{CMakeLists.txt} will be very similar between your projects. Open the \code{CMakeLists.txt} file and write in the few lines: - -\begin{small} -\begin{verbatim} +\begin{cmakecode} PROJECT(Tutorials) cmake_minimum_required(VERSION 2.6) @@ -53,8 +51,7 @@ ENDIF(OTB_FOUND) ADD_EXECUTABLE(HelloWorldOTB HelloWorldOTB.cxx ) TARGET_LINK_LIBRARIES(HelloWorldOTB ${OTB_LIBRARIES}) -\end{verbatim} -\end{small} +\end{cmakecode} The first line defines the name of your project as it appears in Visual Studio @@ -102,8 +99,7 @@ Follow the following steps: \item Create a CMakeLists.txt into the src repository with the following lines: -\begin{verbatim} - +\begin{cmakecode} project(MyFirstProcessing) cmake_minimum_required(VERSION 2.8) @@ -114,10 +110,11 @@ include(${OTB_USE_FILE}) add_executable(MyFirstProcessing MyFirstProcessing.cxx ) target_link_libraries(MyFirstProcessing ${OTB_LIBRARIES} ) -\end{verbatim} +\end{cmakecode} \item Create a MyFirstProcessing.cxx into the src repository with the following lines: -\begin{verbatim} + +\begin{cppcode} #include "otbImage.h" #include "otbVectorImage.h" #include "otbImageFileReader.h" @@ -151,9 +148,9 @@ int main(int argc, char* argv[]) return EXIT_SUCCESS; } -\end{verbatim} +\end{cppcode} \item create a file named BuildMyFirstProcessing.bat into the MyFirstCode directory with the following lines: -\begin{verbatim} +\begin{batcode} @echo off set /A ARGS_COUNT=0 @@ -193,7 +190,7 @@ echo You need to run this script from an OSGeo4W shell GOTO :END :END -\end{verbatim} +\end{batcode} \item into a OSGEo4W shell, run the configure.bat with the right arguments: full path to your src directory, full path to your build directory, full path to the place where find OTBConfig.cmake file (should be C:\textbackslash path\textbackslash to\textbackslash MyOTBDir\textbackslash install\textbackslash lib\textbackslash otb). \item into the OSGeo4W shell, open the MyFirstProcessing.sln \item build the solution @@ -212,12 +209,10 @@ write images and the basics of the pipeline system. First, let's add the following lines at the end of the \code{CMakeLists.txt} file: -\begin{small} -\begin{verbatim} +\begin{cmakecode} ADD_EXECUTABLE(Pipeline Pipeline.cxx ) TARGET_LINK_LIBRARIES(Pipeline ${OTB_LIBRARIES}) -\end{verbatim} -\end{small} +\end{cmakecode} Now, create a \code{Pipeline.cxx} file. @@ -264,12 +259,10 @@ reader and the writer. Let's first add the 2 following lines to the \code{CMakeLists.txt} file: -\begin{small} -\begin{verbatim} +\begin{cmakecode} ADD_EXECUTABLE(FilteringPipeline FilteringPipeline.cxx ) TARGET_LINK_LIBRARIES(FilteringPipeline ${OTB_LIBRARIES}) -\end{verbatim} -\end{small} +\end{cmakecode} \input{FilteringPipeline.tex} @@ -303,12 +296,10 @@ To realize this conversion, we will use the Add the two lines to the \code{CMakeLists.txt} file: -\begin{small} -\begin{verbatim} +\begin{cmakecode} ADD_EXECUTABLE(ScalingPipeline ScalingPipeline.cxx ) TARGET_LINK_LIBRARIES(ScalingPipeline ${OTB_LIBRARIES}) -\end{verbatim} -\end{small} +\end{cmakecode} \input{ScalingPipeline} @@ -331,12 +322,10 @@ process multispectral images. Add the following lines in the \code{CMakeLists.txt} file: -\begin{small} -\begin{verbatim} +\begin{cmakecode} ADD_EXECUTABLE(Multispectral Multispectral.cxx ) TARGET_LINK_LIBRARIES(Multispectral ${OTB_LIBRARIES}) -\end{verbatim} -\end{small} +\end{cmakecode} \input{Multispectral} @@ -355,12 +344,10 @@ try it! Add the following lines in the \code{CMakeLists.txt} file: -\begin{small} -\begin{verbatim} +\begin{cmakecode} ADD_EXECUTABLE(SmarterFilteringPipeline SmarterFilteringPipeline.cxx ) TARGET_LINK_LIBRARIES(SmarterFilteringPipeline ${OTB_LIBRARIES}) -\end{verbatim} -\end{small} +\end{cmakecode} \input{SmarterFilteringPipeline} @@ -410,12 +397,10 @@ To get the best of the image processing algorithms, you want to combine these da First you need to add the following lines in the \code{CMakeLists.txt} file: -\begin{small} -\begin{verbatim} +\begin{cmakecode} ADD_EXECUTABLE(OrthoFusion OrthoFusion.cxx) TARGET_LINK_LIBRARIES(OrthoFusion ${OTB_LIBRARIES}) -\end{verbatim} -\end{small} +\end{cmakecode} \input{OrthoFusion} diff --git a/Documentation/SoftwareGuide/Latex/WriteAnApplication.tex b/Documentation/SoftwareGuide/Latex/WriteAnApplication.tex index b4029d13e7dce361ba0a43fb1e5c4306fd3d3cf0..0408cedb434f7fbebf2b916dfa5b07b2cfe9aa60 100644 --- a/Documentation/SoftwareGuide/Latex/WriteAnApplication.tex +++ b/Documentation/SoftwareGuide/Latex/WriteAnApplication.tex @@ -248,14 +248,12 @@ in order to launch each internal application. The order should be compatible wit image parameter connexions. If you want to do "in-memory" connexions, you can do it between two calls to \code{ExecuteInternal()}, for instance : -\small -\begin{lstlisting} +\begin{cppcode} ExecuteInternal("a"); GetInternalApplication("b")->SetParameterInputImage("in", GetInternalApplication("a")->GetParameterOutputImage("out")); ExecuteInternal("b"); -\end{lstlisting} -\normalsize +\end{cppcode} The application BundleToPerfectSensor is a simple example of composite applications. For a more complex example, you can check the application TrainImagesClassifier. diff --git a/Documentation/SoftwareGuide/ParseCxxExamples.pl b/Documentation/SoftwareGuide/ParseCxxExamples.pl index b483b746d57415758580f98720295b531288d1a1..ae880834033fd30504324bbbaf4a13d5045db2e7 100644 --- a/Documentation/SoftwareGuide/ParseCxxExamples.pl +++ b/Documentation/SoftwareGuide/ParseCxxExamples.pl @@ -92,8 +92,7 @@ sub ParseCxxFile { $tagfound = 1; $dumpinglatex = 0; $dumpingcode = 1; - print OUTFILE "\\small\n"; - print OUTFILE "\\begin{lstlisting}\n"; + print OUTFILE "\\begin{cppcode}\n"; } elsif( /$endlatextag/ ) { $tagfound = 1; @@ -102,8 +101,7 @@ sub ParseCxxFile { elsif( /$endcodesnippettag/ ) { $tagfound = 1; $dumpingcode = 0; - print OUTFILE "\\end{lstlisting}\n"; - print OUTFILE "\\normalsize\n"; + print OUTFILE "\\end{cppcode}\n"; } if( !$tagfound ) { if( $dumpinglatex ) { diff --git a/Documentation/SoftwareGuide/Tex4htWrapper.sh.in b/Documentation/SoftwareGuide/Tex4htWrapper.sh.in index a9cb522fdbd7efe91b1ae5244ac583cd15bb42ec..9fec6e8a781c4fd9bcac87f9e3c4e19ef1cc2e0f 100644 --- a/Documentation/SoftwareGuide/Tex4htWrapper.sh.in +++ b/Documentation/SoftwareGuide/Tex4htWrapper.sh.in @@ -4,7 +4,7 @@ TEXINPUTS=$TEXINPUTS:${ITK_TEXINPUTS} export TEXINPUTS -mkdir ${HTML_OUTPUT} +mkdir -p ${HTML_OUTPUT} cd ${HTML_OUTPUT} ${TEX4HT_COMPILER} "$@" ${TEX4HT_OPTIONS} diff --git a/Examples/Radiometry/AtmosphericCorrectionSequencement.cxx b/Examples/Radiometry/AtmosphericCorrectionSequencement.cxx index a0656056d40be1dea298da8fd4ed14f5b72e7405..9fa1862ed227a563c131ae46d90d981cfe5424c9 100644 --- a/Examples/Radiometry/AtmosphericCorrectionSequencement.cxx +++ b/Examples/Radiometry/AtmosphericCorrectionSequencement.cxx @@ -38,8 +38,8 @@ // an optical multispectral image similar to Pleiades. // These corrections are made in four steps : // \begin{itemize} -// \item digital number to luminance correction; -// \item luminance to refletance image conversion; +// \item digital number to radiance correction; +// \item radiance to refletance image conversion; // \item atmospheric correction for TOA (top of atmosphere) to TOC (top of canopy) // reflectance estimation; // \item correction of the adjacency effects taking into account the neighborhood contribution. @@ -61,15 +61,15 @@ // Let's look at the minimal code required to use this // algorithm. First, the following header defining the // \doxygen{otb}{AtmosphericCorrectionSequencement} class must be -// included. For the numerical to luminance image, luminance to +// included. For the numerical to radiance image, radiance to // refletance image, and reflectance to atmospheric correction image // corrections and the neighborhood correction, four header files are // required. // Software Guide : EndLatex // Software Guide : BeginCodeSnippet -#include "otbImageToLuminanceImageFilter.h" -#include "otbLuminanceToReflectanceImageFilter.h" +#include "otbImageToRadianceImageFilter.h" +#include "otbRadianceToReflectanceImageFilter.h" #include "otbReflectanceToSurfaceReflectanceImageFilter.h" #include "otbSurfaceAdjacencyEffectCorrectionSchemeFilter.h" // Software Guide : EndCodeSnippet @@ -178,7 +178,7 @@ int main(int argc, char *argv[]) //------------------------------- // Software Guide : BeginLatex // - // The \doxygen{otb}{ImageToLuminanceImageFilter} + // The \doxygen{otb}{ImageToRadianceImageFilter} // type is defined and instancied. This class uses a functor applied // to each component of each pixel ($\mathbf{X^{k}}$) whose formula is: // @@ -188,7 +188,7 @@ int main(int argc, char *argv[]) // // Where : // \begin{itemize} - // \item $\mathbf{L_{TOA}^{k}}$ is the incident luminance (in + // \item $\mathbf{L_{TOA}^{k}}$ is the incident radiance (in // $W.m^{-2}.sr^{-1}.\mu m^{-1}$); // \item $\mathbf{X^{k}}$ is the measured digital number (ie. the input image pixel component); // \item $\alpha_{k}$ is the absolute calibration gain for the channel k; @@ -198,13 +198,13 @@ int main(int argc, char *argv[]) // Software Guide : EndLatex // Software Guide : BeginCodeSnippet - typedef otb::ImageToLuminanceImageFilter<ImageType, ImageType> - ImageToLuminanceImageFilterType; + typedef otb::ImageToRadianceImageFilter<ImageType, ImageType> + ImageToRadianceImageFilterType; - ImageToLuminanceImageFilterType::Pointer filterImageToLuminance - = ImageToLuminanceImageFilterType::New(); + ImageToRadianceImageFilterType::Pointer filterImageToRadiance + = ImageToRadianceImageFilterType::New(); // Software Guide : EndCodeSnippet - typedef ImageToLuminanceImageFilterType::VectorType VectorType; + typedef ImageToRadianceImageFilterType::VectorType VectorType; VectorType alpha(nbOfComponent); VectorType beta(nbOfComponent); alpha.Fill(0); @@ -227,17 +227,17 @@ int main(int argc, char *argv[]) // Software Guide : EndLatex // Software Guide : BeginCodeSnippet - filterImageToLuminance->SetAlpha(alpha); - filterImageToLuminance->SetBeta(beta); + filterImageToRadiance->SetAlpha(alpha); + filterImageToRadiance->SetBeta(beta); // Software Guide : EndCodeSnippet //------------------------------- // Software Guide : BeginLatex // - // The \doxygen{otb}{LuminanceToReflectanceImageFilter} + // The \doxygen{otb}{RadianceToReflectanceImageFilter} // type is defined and instancied. // This class used a functor applied to each component of each pixel - // of the luminance filter output ($\mathbf{L_{TOA}^{k}}$): + // of the radiance filter output ($\mathbf{L_{TOA}^{k}}$): // // \begin{equation} // \rho_{TOA}^{k} = \frac{ \pi.\mathbf{L_{TOA}^{k}} } { E_{S}^{k}.cos(\theta_{S}).d/d_{0} }. @@ -259,13 +259,13 @@ int main(int argc, char *argv[]) // Software Guide : EndLatex // Software Guide : BeginCodeSnippet - typedef otb::LuminanceToReflectanceImageFilter<ImageType, ImageType> - LuminanceToReflectanceImageFilterType; - LuminanceToReflectanceImageFilterType::Pointer filterLuminanceToReflectance - = LuminanceToReflectanceImageFilterType::New(); + typedef otb::RadianceToReflectanceImageFilter<ImageType, ImageType> + RadianceToReflectanceImageFilterType; + RadianceToReflectanceImageFilterType::Pointer filterRadianceToReflectance + = RadianceToReflectanceImageFilterType::New(); // Software Guide : EndCodeSnippet - typedef LuminanceToReflectanceImageFilterType::VectorType VectorType; + typedef RadianceToReflectanceImageFilterType::VectorType VectorType; VectorType solarIllumination(nbOfComponent); solarIllumination.Fill(0); @@ -287,11 +287,11 @@ int main(int argc, char *argv[]) // Software Guide : EndLatex // Software Guide : BeginCodeSnippet - filterLuminanceToReflectance->SetZenithalSolarAngle( + filterRadianceToReflectance->SetZenithalSolarAngle( static_cast<double>(atof(argv[6]))); - filterLuminanceToReflectance->SetDay(atoi(argv[7])); - filterLuminanceToReflectance->SetMonth(atoi(argv[8])); - filterLuminanceToReflectance->SetSolarIllumination(solarIllumination); + filterRadianceToReflectance->SetDay(atoi(argv[7])); + filterRadianceToReflectance->SetMonth(atoi(argv[8])); + filterRadianceToReflectance->SetSolarIllumination(solarIllumination); // Software Guide : EndCodeSnippet //------------------------------- @@ -635,10 +635,10 @@ int main(int argc, char *argv[]) // Software Guide : BeginCodeSnippet writer->SetFileName(argv[2]); - filterImageToLuminance->SetInput(reader->GetOutput()); - filterLuminanceToReflectance->SetInput(filterImageToLuminance->GetOutput()); + filterImageToRadiance->SetInput(reader->GetOutput()); + filterRadianceToReflectance->SetInput(filterImageToRadiance->GetOutput()); filterReflectanceToSurfaceReflectanceImageFilter->SetInput( - filterLuminanceToReflectance->GetOutput()); + filterRadianceToReflectance->GetOutput()); filterSurfaceAdjacencyEffectCorrectionSchemeFilter->SetInput( filterReflectanceToSurfaceReflectanceImageFilter->GetOutput()); diff --git a/Examples/Radiometry/test/CMakeLists.txt b/Examples/Radiometry/test/CMakeLists.txt index 67e6f396bbf2c1eb68104d7ab70717ade2a4f4da..43c5edcffc2988d6bb2a30135536085e731f78c8 100644 --- a/Examples/Radiometry/test/CMakeLists.txt +++ b/Examples/Radiometry/test/CMakeLists.txt @@ -84,8 +84,8 @@ otb_add_test(NAME raTeAtmosphericCorrectionSequencementTest COMMAND ${OTB_TEST_D ${INPUTDATA}/atmosphericCorrectionSequencement_solar_illumination.txt ${INPUTDATA}/atmosphericCorrectionSequencement_wavelength_spectral_bands_spot4_1.txt - # ImageToLuminance parameters - # LuminanceToReflectance parameters + # ImageToRadiance parameters + # RadianceToReflectance parameters 27.3 #solar azimuthal elevation 4 #day 12 #month diff --git a/Modules/Adapters/OSSIMAdapters/src/otbMapProjectionAdapter.cxx b/Modules/Adapters/OSSIMAdapters/src/otbMapProjectionAdapter.cxx index cf7fe71ce79c926b768a23522beef1f84edf009f..54785258d096842fabd6e2692fcf0033fd3edb6f 100644 --- a/Modules/Adapters/OSSIMAdapters/src/otbMapProjectionAdapter.cxx +++ b/Modules/Adapters/OSSIMAdapters/src/otbMapProjectionAdapter.cxx @@ -195,9 +195,16 @@ std::string MapProjectionAdapter::GetParameter(const std::string& key) const if (projectionName.compare("ossimTransMercatorProjection") == 0) { const ossimTransMercatorProjection* tmProjection = dynamic_cast<const ossimTransMercatorProjection*>(this->GetMapProjection()); - if (key.compare("ScaleFactor") == 0) + if (!tmProjection) { - return Utils::ConvertToString(tmProjection->getScaleFactor()); + itkExceptionMacro("Error casting object to ossimTransMercatorProjection."); + } + else + { + if (key.compare("ScaleFactor") == 0) + { + return Utils::ConvertToString(tmProjection->getScaleFactor()); + } } } diff --git a/Modules/Applications/AppClassification/app/otbComputeOGRLayersFeaturesStatistics.cxx b/Modules/Applications/AppClassification/app/otbComputeOGRLayersFeaturesStatistics.cxx index c9afc715e9f28a85260245a65d0a354bdcc26264..5f108a9a13e1ee408449082bb89f980b00761c94 100644 --- a/Modules/Applications/AppClassification/app/otbComputeOGRLayersFeaturesStatistics.cxx +++ b/Modules/Applications/AppClassification/app/otbComputeOGRLayersFeaturesStatistics.cxx @@ -94,12 +94,23 @@ private: otb::ogr::Feature feature = layer.ogr().GetNextFeature(); ClearChoices("feat"); + + std::vector<std::string> choiceKeys; + for(int iField=0; iField<feature.ogr().GetFieldCount(); iField++) { std::string key, item = feature.ogr().GetFieldDefnRef(iField)->GetNameRef(); key = item; - key.erase(std::remove(key.begin(), key.end(), ' '), key.end()); + + // Transform chain : lowercase and alphanumerical + key.erase(std::remove_if(key.begin(), key.end(), std::not1(std::ptr_fun(::isalnum))), key.end()); std::transform(key.begin(), key.end(), key.begin(), tolower); + + // Key must be unique + choiceKeys = GetChoiceKeys("feat"); + while(choiceKeys.end() != std::find(choiceKeys.begin(), choiceKeys.end(), key) ) + key.append("0"); + key="feat."+key; AddChoice(key,item); } diff --git a/Modules/Applications/AppClassification/app/otbKMeansClassification.cxx b/Modules/Applications/AppClassification/app/otbKMeansClassification.cxx index 173daeec99126cd7cf288890d5c6d009b3a41b71..d8e234214bff46edfd1d5604390788f735a248b2 100644 --- a/Modules/Applications/AppClassification/app/otbKMeansClassification.cxx +++ b/Modules/Applications/AppClassification/app/otbKMeansClassification.cxx @@ -110,7 +110,7 @@ protected: "By default, hidden pixels will have the assigned label 0 in the output image. " "It's possible to define the label mask by another value, " "but be careful to not take a label from another class. " - "This application initalize the labels from 0 to N-1, " + "This application initialize the labels from 0 to N-1, " "N is the number of class (defined by 'nc' parameter)."); } diff --git a/Modules/Applications/AppClassification/app/otbOGRLayerClassifier.cxx b/Modules/Applications/AppClassification/app/otbOGRLayerClassifier.cxx index 971c79a427a44e1064f75c194e2630ebfa73affb..eb58a7e0ac4371d6c0fa4830f457bf36c11d426f 100644 --- a/Modules/Applications/AppClassification/app/otbOGRLayerClassifier.cxx +++ b/Modules/Applications/AppClassification/app/otbOGRLayerClassifier.cxx @@ -113,12 +113,22 @@ private: otb::ogr::Feature feature = layer.ogr().GetNextFeature(); ClearChoices("feat"); + std::vector<std::string> choiceKeys; + for(int iField=0; iField<feature.ogr().GetFieldCount(); iField++) { std::string key, item = feature.ogr().GetFieldDefnRef(iField)->GetNameRef(); key = item; - key.erase(std::remove(key.begin(), key.end(), ' '), key.end()); + + // Transform chain : lowercase and alphanumerical + key.erase(std::remove_if(key.begin(), key.end(), std::not1(std::ptr_fun(::isalnum))), key.end()); std::transform(key.begin(), key.end(), key.begin(), tolower); + + // Key must be unique + choiceKeys = GetChoiceKeys("feat"); + while(choiceKeys.end() != std::find(choiceKeys.begin(), choiceKeys.end(), key) ) + key.append("0"); + key="feat."+key; AddChoice(key,item); } diff --git a/Modules/Applications/AppClassification/app/otbVectorClassifier.cxx b/Modules/Applications/AppClassification/app/otbVectorClassifier.cxx index 042c4f450434c96de5367033f2c42ccde851dfe8..b8ecd88713eb985b25f935741268a17f8f955edf 100644 --- a/Modules/Applications/AppClassification/app/otbVectorClassifier.cxx +++ b/Modules/Applications/AppClassification/app/otbVectorClassifier.cxx @@ -62,7 +62,7 @@ public: itkTypeMacro(Self, Application) /** Filters typedef */ - typedef double ValueType; + typedef float ValueType; typedef unsigned int LabelType; typedef itk::FixedArray<LabelType,1> LabelSampleType; typedef itk::Statistics::ListSample<LabelSampleType> LabelListSampleType; @@ -223,7 +223,7 @@ private: unsigned int itemIndex = GetSelectedItems("feat")[idx]; std::string fieldName = GetChoiceNames( "feat" )[itemIndex]; - mv[idx] = (*it)[fieldName].GetValue<double>(); + mv[idx] = static_cast<ValueType>((*it)[fieldName].GetValue<double>()); } input->PushBack(mv); } diff --git a/Modules/Applications/AppClassification/include/otbTrainImagesBase.txx b/Modules/Applications/AppClassification/include/otbTrainImagesBase.txx index 325d3b9c38b658755999af8d7626293f571e22c8..a646cea9539fc3c8b6dcc5f013a6996ed7bf2a9d 100644 --- a/Modules/Applications/AppClassification/include/otbTrainImagesBase.txx +++ b/Modules/Applications/AppClassification/include/otbTrainImagesBase.txx @@ -128,7 +128,7 @@ void TrainImagesBase::InitClassification() AddApplication( "TrainVectorClassifier", "training", "Model training" ); AddParameter( ParameterType_InputVectorDataList, "io.valid", "Validation Vector Data List" ); - SetParameterDescription( "io.valid", "A list of vector data to select the training samples." ); + SetParameterDescription( "io.valid", "A list of vector data to select the validation samples." ); MandatoryOff( "io.valid" ); ShareClassificationParams(); diff --git a/Modules/Applications/AppClassification/include/otbTrainNeuralNetwork.txx b/Modules/Applications/AppClassification/include/otbTrainNeuralNetwork.txx index 2bcd26f3a7f08dbae692c8e36e75e6713e8bacc8..4081034a5f0fead34f03f3f0325f0ad6294b5582 100644 --- a/Modules/Applications/AppClassification/include/otbTrainNeuralNetwork.txx +++ b/Modules/Applications/AppClassification/include/otbTrainNeuralNetwork.txx @@ -48,7 +48,7 @@ LearningApplicationBase<TInputValue,TOutputValue> "in the network to optimize the result."); AddChoice("classifier.ann.t.reg", "Resilient Back-propagation algorithm"); SetParameterDescription("classifier.ann.t.reg", - "Almost the same as the Back-prop algorithm exept that it does not " + "Almost the same as the Back-prop algorithm except that it does not " "take into account the magnitude of the partial derivative (coordinate " "of the gradient) but only its sign."); diff --git a/Modules/Applications/AppHyperspectral/app/otbHyperspectralUnmixing.cxx b/Modules/Applications/AppHyperspectral/app/otbHyperspectralUnmixing.cxx index 3ed9b7c18996e89e4be9c11a0e942a334d4e0077..8d510460a6892d3a64124625e3288b8d107a476e 100644 --- a/Modules/Applications/AppHyperspectral/app/otbHyperspectralUnmixing.cxx +++ b/Modules/Applications/AppHyperspectral/app/otbHyperspectralUnmixing.cxx @@ -103,7 +103,7 @@ private: "spectrum associated with each pixel is a linear combination of pure" "materials in the recovery area, commonly known as endmembers. Endmembers can" "be estimated using the VertexComponentAnalysis application.\n\n" - "The application allows to estimate the abundance maps with several algorithms :\n" + "The application allows estimating the abundance maps with several algorithms :\n" " * Unconstrained Least Square (ucls)\n" //" * Fully Constrained Least Square (fcls)\n" " * Image Space Reconstruction Algorithm (isra)\n" diff --git a/Modules/Applications/AppImageUtils/app/otbConvert.cxx b/Modules/Applications/AppImageUtils/app/otbConvert.cxx index 8298c8877aa3355a71df8138f65413b2ee976bab..51ce7f3eebd9995e9f0a694c1bb27506b5f9292f 100644 --- a/Modules/Applications/AppImageUtils/app/otbConvert.cxx +++ b/Modules/Applications/AppImageUtils/app/otbConvert.cxx @@ -21,17 +21,16 @@ #include "otbWrapperApplication.h" #include "otbWrapperApplicationFactory.h" -#include "itkCastImageFilter.h" - - #include "otbVectorRescaleIntensityImageFilter.h" -#include "itkCastImageFilter.h" #include "otbUnaryImageFunctorWithVectorImageFilter.h" #include "otbStreamingShrinkImageFilter.h" #include "itkListSample.h" #include "otbListSampleToHistogramListGenerator.h" #include "itkImageRegionConstIterator.h" +#include "otbImageListToVectorImageFilter.h" +#include "otbMultiToMonoChannelExtractROI.h" +#include "otbImageList.h" namespace otb { @@ -71,13 +70,19 @@ public: /** Filters typedef */ typedef itk::Statistics::ListSample<FloatVectorImageType::PixelType> ListSampleType; typedef itk::Statistics::DenseFrequencyContainer2 DFContainerType; - typedef ListSampleToHistogramListGenerator<ListSampleType, FloatVectorImageType::InternalPixelType, DFContainerType> HistogramsGeneratorType; - typedef StreamingShrinkImageFilter<FloatVectorImageType, FloatVectorImageType> ShrinkFilterType; + typedef ListSampleToHistogramListGenerator<ListSampleType, + FloatVectorImageType::InternalPixelType, + DFContainerType> HistogramsGeneratorType; + typedef StreamingShrinkImageFilter<FloatVectorImageType, + FloatVectorImageType> ShrinkFilterType; typedef Functor::LogFunctor<FloatVectorImageType::InternalPixelType> TransferLogFunctor; - typedef UnaryImageFunctorWithVectorImageFilter<FloatVectorImageType, FloatVectorImageType, TransferLogFunctor> TransferLogType; + typedef UnaryImageFunctorWithVectorImageFilter<FloatVectorImageType, + FloatVectorImageType, + TransferLogFunctor> TransferLogType; private: + void DoInit() ITK_OVERRIDE { SetName("Convert"); @@ -85,16 +90,26 @@ private: " and/or changing the pixel type."); // Documentation SetDocName("Image Conversion"); - SetDocLongDescription("This application performs an image pixel type conversion (short, ushort, uchar, int, uint, float and double types are handled). The output image is written in the specified format (ie. that corresponds to the given extension).\n The conversion can include a rescale using the image 2 percent minimum and maximum values. The rescale can be linear or log2."); + SetDocLongDescription("This application performs an image pixel type conversion " + "(short, ushort, uchar, int, uint, float and double types are handled). " + "The output image is written in the specified format (ie. that corresponds " + "to the given extension).\n The conversion can include a rescale of the data range, " + "by default it's set from 2% to 98% of the data values. The rescale can be linear or log2. \n " + "The choice of the output channels can be done with the extended filename, " + "but less easy to handle. To do this, a 'channels' parameter allows you to select " + "the desired bands at the output. There are 3 modes, the available choices are: \n" + " * grayscale : to display mono image as standard color image \n" + " * rgb : select 3 bands in the input image (multi-bands) \n" + " * all : keep all bands."); SetDocLimitations("None"); SetDocAuthors("OTB-Team"); SetDocSeeAlso("Rescale"); - AddDocTag(Tags::Manip); + AddDocTag(Tags::Manip); AddDocTag("Conversion"); AddDocTag("Image Dynamic"); - AddParameter(ParameterType_InputImage, "in", "Input image"); + AddParameter(ParameterType_InputImage, "in", "Input image"); SetParameterDescription("in", "Input image"); AddParameter(ParameterType_Choice, "type", "Rescale type"); @@ -110,7 +125,8 @@ private: MandatoryOff("type.linear.gamma"); AddParameter(ParameterType_InputImage, "mask", "Input mask"); - SetParameterDescription("mask", "The masked pixels won't be used to adapt the dynamic (the mask must have the same dimensions as the input image)"); + SetParameterDescription("mask", "The masked pixels won't be used to adapt the dynamic " + "(the mask must have the same dimensions as the input image)"); MandatoryOff("mask"); DisableParameter("mask"); @@ -118,40 +134,98 @@ private: SetParameterDescription("hcp","Parameters to cut the histogram edges before rescaling"); AddParameter(ParameterType_Float, "hcp.high", "High Cut Quantile"); - SetParameterDescription("hcp.high", "Quantiles to cut from histogram high values before computing min/max rescaling (in percent, 2 by default)"); + SetParameterDescription("hcp.high", "Quantiles to cut from histogram high values " + "before computing min/max rescaling (in percent, 2 by default)"); MandatoryOff("hcp.high"); SetDefaultParameterFloat("hcp.high", 2.0); DisableParameter("hcp.high"); AddParameter(ParameterType_Float, "hcp.low", "Low Cut Quantile"); - SetParameterDescription("hcp.low", "Quantiles to cut from histogram low values before computing min/max rescaling (in percent, 2 by default)"); + SetParameterDescription("hcp.low", "Quantiles to cut from histogram low values " + "before computing min/max rescaling (in percent, 2 by default)"); MandatoryOff("hcp.low"); SetDefaultParameterFloat("hcp.low", 2.0); DisableParameter("hcp.low"); AddParameter(ParameterType_OutputImage, "out", "Output Image"); SetParameterDescription("out", "Output image"); + SetDefaultOutputPixelType("out",ImagePixelType_uint8); + + AddParameter(ParameterType_Choice, "channels", "Channels selection"); + SetParameterDescription("channels", "It's possible to select the channels " + "of the output image. There are 3 modes, the available choices are:"); + + AddChoice("channels.all", "Default mode"); + SetParameterDescription("channels.all", "Select all bands in the input image, (1,...,n)."); + + AddChoice("channels.grayscale", "Grayscale mode"); + SetParameterDescription("channels.grayscale", "Display single channel as standard color image."); + AddParameter(ParameterType_Int, "channels.grayscale.channel", "Grayscale channel"); + SetDefaultParameterInt("channels.grayscale.channel", 1); + SetMinimumParameterIntValue("channels.grayscale.channel", 1); + + AddChoice("channels.rgb", "RGB composition"); + SetParameterDescription("channels.rgb", "Select 3 bands in the input image " + "(multi-bands), by default (1,2,3)."); + + AddParameter(ParameterType_Int, "channels.rgb.red", "Red Channel"); + SetParameterDescription("channels.rgb.red", "Red channel index."); + SetMinimumParameterIntValue("channels.rgb.red", 1); + AddParameter(ParameterType_Int, "channels.rgb.green", "Green Channel"); + SetParameterDescription("channels.rgb.green", "Green channel index."); + SetMinimumParameterIntValue("channels.rgb.green", 1); + AddParameter(ParameterType_Int, "channels.rgb.blue", "Blue Channel"); + SetParameterDescription("channels.rgb.blue", "Blue channel index."); + SetMinimumParameterIntValue("channels.rgb.blue", 1); AddRAMParameter(); // Doc example parameter settings SetDocExampleParameterValue("in", "QB_Toulouse_Ortho_XS.tif"); - SetDocExampleParameterValue("out", "otbConvertWithScalingOutput.png uint8"); + SetDocExampleParameterValue("out", "otbConvertWithScalingOutput.png"); SetDocExampleParameterValue("type", "linear"); + SetDocExampleParameterValue("channels", "rgb"); SetOfficialDocLink(); } void DoUpdateParameters() ITK_OVERRIDE { - // Nothing to do here for the parameters : all are independent + // Read information + if ( HasValue("in") ) + { + typedef otb::ImageMetadataInterfaceBase ImageMetadataInterfaceType; + ImageMetadataInterfaceType::Pointer metadataInterface = + ImageMetadataInterfaceFactory::CreateIMI(GetParameterImage("in")->GetMetaDataDictionary()); + + int nbBand = GetParameterImage("in")->GetNumberOfComponentsPerPixel(); + SetMaximumParameterIntValue("channels.grayscale.channel", nbBand); + SetMaximumParameterIntValue("channels.rgb.red", nbBand); + SetMaximumParameterIntValue("channels.rgb.green", nbBand); + SetMaximumParameterIntValue("channels.rgb.blue", nbBand); + + if (nbBand > 1) + { + // get band index : Red/Green/Blue + int bandRed = metadataInterface->GetDefaultDisplay()[0] + 1; + int bandGreen = metadataInterface->GetDefaultDisplay()[1] + 1; + int bandBlue = metadataInterface->GetDefaultDisplay()[2] + 1; + SetDefaultParameterInt("channels.rgb.red", bandRed); + SetDefaultParameterInt("channels.rgb.green", bandGreen); + SetDefaultParameterInt("channels.rgb.blue", bandBlue); + } + } + + } template<class TImageType> void GenericDoExecute() { - typename TImageType::Pointer castIm; + // Clear previously registered filters + m_Filters.clear(); + std::string rescaleType = this->GetParameterString("type"); if( (rescaleType != "none") && (rescaleType != "linear") && (rescaleType != "log2") ) @@ -161,21 +235,24 @@ private: if( rescaleType == "none" ) { - castIm = this->GetParameterImage<TImageType>("in"); + // selected channel + typename TImageType::Pointer tempImage; + tempImage = GetSelectedChannels<TImageType>(); + + SetParameterOutputImage<TImageType>("out", tempImage); + } - else + else // linear or log2 { - FloatVectorImageType::Pointer input = this->GetParameterImage("in"); - FloatVectorImageType::Pointer mask; - bool useMask = false; - if (IsParameterEnabled("mask")) - { - mask = this->GetParameterImage("mask"); - useMask = true; - } - const unsigned int nbComp(input->GetNumberOfComponentsPerPixel()); + if (IsParameterEnabled("mask")) mask = this->GetParameterImage("mask"); + + // selected channel + typename FloatVectorImageType::Pointer tempImage; + tempImage = GetSelectedChannels<FloatVectorImageType>(); + + const unsigned int nbComp(tempImage->GetNumberOfComponentsPerPixel()); typedef otb::VectorRescaleIntensityImageFilter<FloatVectorImageType, TImageType> RescalerType; typename TImageType::PixelType minimum; @@ -197,8 +274,9 @@ private: // Shrink factor is computed so as to load a quicklook of 1000 // pixels square at most - typename FloatVectorImageType::SizeType imageSize = input->GetLargestPossibleRegion().GetSize(); - unsigned int shrinkFactor = std::max(imageSize[0], imageSize[1]) < 1000 ? 1 : std::max(imageSize[0], imageSize[1])/1000; + typename FloatVectorImageType::SizeType imageSize = tempImage->GetLargestPossibleRegion().GetSize(); + unsigned int shrinkFactor = + std::max(imageSize[0], imageSize[1]) < 1000 ? 1 : std::max(imageSize[0], imageSize[1])/1000; otbAppLogDEBUG( << "Shrink factor used to compute Min/Max: "<<shrinkFactor ); @@ -212,7 +290,7 @@ private: { //define the transfer log m_TransferLog = TransferLogType::New(); - m_TransferLog->SetInput(input); + m_TransferLog->SetInput(tempImage); m_TransferLog->UpdateOutputInformation(); shrinkFilter->SetInput(m_TransferLog->GetOutput()); @@ -221,37 +299,32 @@ private: } else { - shrinkFilter->SetInput(input); - rescaler->SetInput(input); + shrinkFilter->SetInput(tempImage); + rescaler->SetInput(tempImage); shrinkFilter->Update(); } ShrinkFilterType::Pointer maskShrinkFilter = ShrinkFilterType::New(); - if (useMask) - { - maskShrinkFilter->SetShrinkFactor(shrinkFactor); - maskShrinkFilter->SetInput(mask); - maskShrinkFilter->GetStreamer()->SetAutomaticAdaptativeStreaming(GetParameterInt("ram")); - maskShrinkFilter->Update(); - } - - otbAppLogDEBUG( << "Shrink done" ); - otbAppLogDEBUG( << "Evaluating input Min/Max..." ); - itk::ImageRegionConstIterator<FloatVectorImageType> it(shrinkFilter->GetOutput(), shrinkFilter->GetOutput()->GetLargestPossibleRegion()); + itk::ImageRegionConstIterator<FloatVectorImageType> + it(shrinkFilter->GetOutput(), shrinkFilter->GetOutput()->GetLargestPossibleRegion()); itk::ImageRegionConstIterator<FloatVectorImageType> itMask; - if (useMask) - { - itMask = itk::ImageRegionConstIterator<FloatVectorImageType>(maskShrinkFilter->GetOutput(),maskShrinkFilter->GetOutput()->GetLargestPossibleRegion()); - } typename ListSampleType::Pointer listSample = ListSampleType::New(); - listSample->SetMeasurementVectorSize(input->GetNumberOfComponentsPerPixel()); + listSample->SetMeasurementVectorSize(tempImage->GetNumberOfComponentsPerPixel()); // Now we generate the list of samples - if (useMask) + if (IsParameterEnabled("mask")) { + maskShrinkFilter->SetShrinkFactor(shrinkFactor); + maskShrinkFilter->SetInput(mask); + maskShrinkFilter->GetStreamer()->SetAutomaticAdaptativeStreaming(GetParameterInt("ram")); + maskShrinkFilter->Update(); + + itMask = itk::ImageRegionConstIterator<FloatVectorImageType>( + maskShrinkFilter->GetOutput(),maskShrinkFilter->GetOutput()->GetLargestPossibleRegion()); + // Remove masked pixels it.GoToBegin(); itMask.GoToBegin(); @@ -265,19 +338,16 @@ private: ++it; ++itMask; } - } - else - { - for(it.GoToBegin(); !it.IsAtEnd(); ++it) + if (listSample->Size() == 0) { - listSample->PushBack(it.Get()); + otbAppLogINFO( << "All pixels were masked, the application assume a wrong mask " + "and include all the image"); } } - // if all pixels were masked, we assume a wrong mask and then include all image - if (listSample->Size() == 0) + // if mask is disable and all pixels were masked + if ((!IsParameterEnabled("mask")) || (listSample->Size() == 0)) { - otbAppLogINFO( << "All pixels were masked, the application assume a wrong mask and include all the image"); for(it.GoToBegin(); !it.IsAtEnd(); ++it) { listSample->PushBack(it.Get()); @@ -294,10 +364,15 @@ private: // And extract the lower and upper quantile typename FloatVectorImageType::PixelType inputMin(nbComp), inputMax(nbComp); + auto histOutput = histogramsGenerator->GetOutput(); + assert(histOutput); + for(unsigned int i = 0; i < nbComp; ++i) { - inputMin[i] = histogramsGenerator->GetOutput()->GetNthElement(i)->Quantile(0, 0.01 * GetParameterFloat("hcp.low")); - inputMax[i] = histogramsGenerator->GetOutput()->GetNthElement(i)->Quantile(0, 1.0 - 0.01 * GetParameterFloat("hcp.high")); + auto && elm = histOutput->GetNthElement(i); + assert(elm); + inputMin[i] = elm->Quantile(0, 0.01 * GetParameterFloat("hcp.low")); + inputMax[i] = elm->Quantile(0, 1.0 - 0.01 * GetParameterFloat("hcp.high")); } otbAppLogDEBUG( << std::setprecision(5) << "Min/Max computation done : min=" << inputMin @@ -312,16 +387,99 @@ private: rescaler->SetGamma(GetParameterFloat("type.linear.gamma")); } - m_TmpFilter = rescaler; - castIm = rescaler->GetOutput(); + m_Filters.push_back(rescaler.GetPointer()); + + SetParameterOutputImage<TImageType>("out", rescaler->GetOutput()); } + } + + // Get the bands order + std::vector<int> GetChannels() + { + std::vector<int> channels; + int nbChan = GetParameterImage("in")->GetNumberOfComponentsPerPixel(); + std::string channelMode = GetParameterString("channels"); - SetParameterOutputImage<TImageType>("out", castIm); + if(channelMode == "grayscale") + { + if (GetParameterInt("channels.grayscale.channel") <= nbChan) + { + channels = {GetParameterInt("channels.grayscale.channel"), + GetParameterInt("channels.grayscale.channel"), + GetParameterInt("channels.grayscale.channel")}; + } + else + { + itkExceptionMacro(<< "The channel has an invalid index"); + } + } + else if (channelMode == "rgb") + { + if ((GetParameterInt("channels.rgb.red") <= nbChan) + && ( GetParameterInt("channels.rgb.green") <= nbChan) + && ( GetParameterInt("channels.rgb.blue") <= nbChan)) + { + channels = {GetParameterInt("channels.rgb.red"), + GetParameterInt("channels.rgb.green"), + GetParameterInt("channels.rgb.blue")}; + } + else + { + itkExceptionMacro(<< "At least one needed channel has an invalid index"); + } + } + else if (channelMode == "all") + { + // take all bands + channels.resize(nbChan); + std::iota(channels.begin(), channels.end(), 1); + } + return channels; + } + + // return an image with the bands order modified of the input image + template<class TImageType> + typename TImageType::Pointer GetSelectedChannels() + { + typedef MultiToMonoChannelExtractROI<FloatVectorImageType::InternalPixelType, + typename TImageType::InternalPixelType> ExtractROIFilterType; + typedef otb::ImageList<otb::Image<typename TImageType::InternalPixelType> > ImageListType; + typedef ImageListToVectorImageFilter<ImageListType, + TImageType > ListConcatenerFilterType; + + typename ImageListType::Pointer imageList; + typename ListConcatenerFilterType::Pointer concatener; + + imageList = ImageListType::New(); + concatener = ListConcatenerFilterType::New(); + + //m_Filters.push_back(imageList.GetPointer()); + m_Filters.push_back(concatener.GetPointer()); + + const bool monoChannel = IsParameterEnabled("channels.grayscale"); + + // get band order + std::vector<int> channels = GetChannels(); + + for (auto && channel : channels) + { + typename ExtractROIFilterType::Pointer extractROIFilter = ExtractROIFilterType::New(); + m_Filters.push_back(extractROIFilter.GetPointer()); + extractROIFilter->SetInput(GetParameterImage("in")); + if (!monoChannel) extractROIFilter->SetChannel(channel); + extractROIFilter->UpdateOutputInformation(); + imageList->PushBack(extractROIFilter->GetOutput()); + } + + concatener->SetInput(imageList); + concatener->UpdateOutputInformation(); + + return concatener->GetOutput(); } - void DoExecute() ITK_OVERRIDE + void DoExecute() ITK_OVERRIDE { switch ( this->GetParameterOutputImagePixelType("out") ) { @@ -352,8 +510,8 @@ private: } } - itk::ProcessObject::Pointer m_TmpFilter; TransferLogType::Pointer m_TransferLog; + std::vector<itk::LightObject::Pointer> m_Filters; }; } diff --git a/Modules/Applications/AppImageUtils/app/otbDownloadSRTMTiles.cxx b/Modules/Applications/AppImageUtils/app/otbDownloadSRTMTiles.cxx index 1004b4c628a6a5b0591560d05be9d96bb492f419..813fa5c2d043ed1e4abdc84d2c6af1a4217ec679 100644 --- a/Modules/Applications/AppImageUtils/app/otbDownloadSRTMTiles.cxx +++ b/Modules/Applications/AppImageUtils/app/otbDownloadSRTMTiles.cxx @@ -21,6 +21,7 @@ #include "otbWrapperApplication.h" #include "otbWrapperApplicationFactory.h" #include "otbGenericRSTransform.h" +#include "otbOGRDataSourceWrapper.h" #include "otbCurlHelper.h" namespace otb @@ -34,17 +35,14 @@ enum const std::string SRTMServerPath = "http://dds.cr.usgs.gov/srtm/version2_1/SRTM3/"; -const char* USGSContinentDir[] = {"Africa", - "Australia", - "Eurasia", - "Islands", - "North_America", - "South_America"}; - -const std::vector<std::string> USGSContinentList(USGSContinentDir, USGSContinentDir + sizeof(USGSContinentDir)/sizeof(USGSContinentDir[0])); - -const std::string HGTExtension = ".hgt.zip"; -const std::string HGTExtensionSimulation = ".hgt"; +const std::string HGTZIPExtension = ".hgt.zip"; +const std::string HGTExtension = ".hgt"; +const std::string ZIPExtension = ".zip"; +#ifdef _WIN32 +const char Sep = '\\'; +#else +const char Sep = '/'; +#endif namespace Wrapper { @@ -57,47 +55,143 @@ public: typedef itk::SmartPointer<Self> Pointer; typedef itk::SmartPointer<const Self> ConstPointer; - typedef otb::GenericRSTransform<> RSTransformType; + using RSTransformType = otb::GenericRSTransform<>; + using IndexType = FloatVectorImageType::IndexType; + using PointType = FloatVectorImageType::PointType; + using SizeType = FloatVectorImageType::SizeType; + using SpacingType = FloatVectorImageType::SpacingType; - typedef FloatVectorImageType::IndexType IndexType; - typedef FloatVectorImageType::PointType PointType; - typedef FloatVectorImageType::SizeType SizeType; - typedef FloatVectorImageType::SpacingType SpacingType; /** Standard macro */ itkNewMacro(Self); itkTypeMacro(DownloadSRTMTiles, otb::Application); + typedef struct + { + int Lon : 9; + int Lat : 8; + unsigned int Conti : 3; + } SRTMTileId; + private: + DownloadSRTMTiles(); - int m_Mode; - - DownloadSRTMTiles() : m_Mode(Mode_Download) {} + class TileIdComparator + { + public: + bool operator() (const SRTMTileId & a, const SRTMTileId & b) const + { + if (a.Lat < b.Lat) + return true; + if (a.Lat == b.Lat && a.Lon < b.Lon) + return true; + return false; + } + }; + + typedef std::set<SRTMTileId,TileIdComparator> SRTMTileSet; + + std::string SRTMIdToName(const SRTMTileId &id) const + { + char name[8]; + sprintf(name,"%c%02d%c%03d", + (id.Lat < 0 ? 'S' : 'N'), + vcl_abs(id.Lat), + (id.Lon < 0 ? 'W' : 'E'), + vcl_abs(id.Lon)); + return std::string(name); + } + + std::string SRTMIdToContinent(const SRTMTileId &id) const + { + switch (id.Conti) + { + case 0: + // this tile is unknown, return an empty string. + break; + case 1: + return std::string("Africa"); + case 2: + return std::string("Australia"); + case 3: + return std::string("Eurasia"); + case 4: + return std::string("Islands"); + case 5: + return std::string("North_America"); + case 6: + return std::string("South_America"); + default: + break; + } + return std::string(); + } - bool SRTMTileExists(const std::string & url) const + bool SRTMTileExists(const SRTMTileId & tile, std::string & continent) const { - switch ( m_Mode ) + auto pos = m_SRTMTileList.find(tile); + if (pos != m_SRTMTileList.end()) { - case Mode_Download: + continent = this->SRTMIdToContinent(*pos); + return true; + } + return false; + } + + bool SRTMTileDownloaded(const std::string & name, const std::string & tileDir) const + { + std::string path(tileDir); + if (!path.empty() && path.back() != Sep) { - CurlHelper::Pointer curl = CurlHelper::New(); - curl->SetTimeout(0); - return !curl->IsCurlReturnHttpError(url); + path += Sep; } - break; - case Mode_List: + // try different filenames + std::string filepath(path+name+HGTExtension); + bool exists = itksys::SystemTools::FileExists(filepath.c_str()); + if (!exists) { - return itksys::SystemTools::FileExists(url.c_str()); + filepath += ZIPExtension; + exists = itksys::SystemTools::FileExists(filepath.c_str()); } - default : - break; + + if (!exists) + { + std::string lowerName(name); + std::transform(name.begin(), name.end(), lowerName.begin(), ::tolower); + filepath = path + lowerName + HGTExtension; + exists = itksys::SystemTools::FileExists(filepath.c_str()); + if (!exists) + { + filepath += ZIPExtension; + exists = itksys::SystemTools::FileExists(filepath.c_str()); + } } - return false; + return exists; } - void DoInit() ITK_OVERRIDE + + bool CheckPermissions(const std::string &dir) const + { + std::string path(dir); + if (!path.empty() && path.back() != Sep) + { + path += Sep; + } + path += "foo"; + if( itksys::SystemTools::Touch( path.c_str(), true ) ) + { + itksys::SystemTools::RemoveFile( path.c_str() ); + } + else + { + return false; + } + return true; + } + + void DoInit() override { SetName("DownloadSRTMTiles"); - SetDescription("Download or list SRTM tiles related to a set of images"); + SetDescription("Download or list SRTM tiles"); // Documentation SetDocName("Download or list SRTM tiles related to a set of images"); @@ -107,368 +201,2080 @@ private: SetDocSeeAlso(" "); AddDocTag(Tags::Manip); - AddDocTag("Utilities"); + AddDocTag("Utilities"); AddParameter(ParameterType_InputImageList, "il", "Input images list"); - SetParameterDescription("il", "The list of images on which you want to determine corresponding SRTM tiles."); + SetParameterDescription("il", "List of images on which you want to " + "determine corresponding SRTM tiles."); + MandatoryOff("il"); + + AddParameter(ParameterType_InputVectorDataList, "vl", "Input vector data list"); + SetParameterDescription("vl", "List of vector data files on which you want " + "to determine corresponding SRTM tiles."); + MandatoryOff("vl"); + + AddParameter(ParameterType_StringList, "names", "Input tile names"); + SetParameterDescription("names", "List of SRTM tile names to download. " + "This list is added to the tiles derived from input images or vectors." + "The names should follow the SRTM tile naming convention, for instance " + "N43E001."); + MandatoryOff("names"); + + AddParameter(ParameterType_Directory, "tiledir", "Tiles directory"); + SetParameterDescription("tiledir", "Directory where SRTM tiles " + "are stored. In download mode, the zipped archives will be downloaded to " + "this directory. You'll need to unzip all tile files before using them in" + " your application. In any case, this directory will be inspected to " + "check which tiles are already downloaded."); // UserDefined values AddParameter(ParameterType_Choice, "mode", "Download/List corresponding SRTM tiles."); - //MandatoryOn("mode"); AddChoice("mode.download", "Download"); SetParameterDescription("mode.download","Download corresponding tiles on USGE server."); - AddParameter(ParameterType_Directory, "mode.download.outdir", "Output directory"); - SetParameterDescription("mode.download.outdir", "Directory where zipped tiles will be save. You'll need to unzip all tile files before using them in your application."); - AddChoice("mode.list", "List tiles"); SetParameterDescription("mode.list","List tiles in an existing local directory."); - AddParameter(ParameterType_Directory, "mode.list.indir", "Input directory"); - SetParameterDescription("mode.list.indir", "Input directory where SRTM tiles can are located."); - // Doc example parameter settings SetDocExampleParameterValue("il", "QB_Toulouse_Ortho_XS.tif"); SetDocExampleParameterValue("mode", "list"); - SetDocExampleParameterValue("mode.list.indir", "/home/user/srtm_dir/"); + SetDocExampleParameterValue("tiledir", "/home/user/srtm_dir/"); SetOfficialDocLink(); } - void DoUpdateParameters() ITK_OVERRIDE + void DoUpdateParameters() override { // Nothing to do here : all parameters are independent } - void DoExecute() ITK_OVERRIDE + void DoExecute() override { - //Get the mode - m_Mode = GetParameterInt("mode"); + int mode = GetParameterInt("mode"); - // Get the input image list - FloatVectorImageListType::Pointer inList = this->GetParameterImageList("il"); + // Get the inputs + auto inList = FloatVectorImageListType::New(); + std::vector<std::string> vectorDataList; + std::vector<std::string> nameList; - if( inList->Size() == 0 ) - { - itkExceptionMacro("No input Image set..."); - } + if (IsParameterEnabled("il") && HasValue("il")) + inList = this->GetParameterImageList("il"); + if (IsParameterEnabled("vl") && HasValue("vl")) + vectorDataList = this->GetParameterStringList("vl"); + if (IsParameterEnabled("names") && HasValue("names")) + nameList = this->GetParameterStringList("names"); - inList->GetNthElement(0)->UpdateOutputInformation(); + std::string tileDir = this->GetParameterString("tiledir"); - std::set<std::string> listTilesVector; - std::set<std::string> tiles; + if( inList->Size() + vectorDataList.size() + nameList.size() == 0 ) + { + itkExceptionMacro("No input image/vector/name set..."); + } + SRTMTileSet tiles; + //-------------------------------------------------------------------------- + // Check input images for( unsigned int i=0; i<inList->Size(); i++ ) { - FloatVectorImageType::Pointer inImage = inList->GetNthElement(i); - inImage->UpdateOutputInformation(); - - RSTransformType::Pointer rsTransformToWGS84 = RSTransformType::New(); - rsTransformToWGS84->SetInputKeywordList(inImage->GetImageKeywordlist()); - rsTransformToWGS84->SetInputProjectionRef(inImage->GetProjectionRef()); - rsTransformToWGS84->SetOutputProjectionRef(static_cast<std::string> (otb::GeoInformationConversion::ToWKT(4326))); - - rsTransformToWGS84->InstantiateTransform(); - - const SizeType size = inImage->GetLargestPossibleRegion().GetSize(); - const PointType origin=inImage->GetOrigin(); - const SpacingType spacing=inImage->GetSpacing(); - PointType upperLeft; - upperLeft[0] = origin[0]; - upperLeft[1] = origin[1]; - PointType upperLeftWGS84 = rsTransformToWGS84->TransformPoint(upperLeft); - otbAppLogDEBUG(<< "upperLeftWGS84 " << upperLeftWGS84); - - PointType upperRight; - upperRight[0] = origin[0]+ (size[0] - 1) * spacing[0]; - upperRight[1] = origin[1]; - PointType upperRightWGS84 = rsTransformToWGS84->TransformPoint(upperRight); - otbAppLogDEBUG(<< "upperRightWGS84 " << upperRightWGS84); - - PointType lowerLeft; - lowerLeft[0] = origin[0]; - lowerLeft[1] = origin[1]+ (size[1] - 1) * spacing[1]; - PointType lowerLeftWGS84 = rsTransformToWGS84->TransformPoint(lowerLeft); - otbAppLogDEBUG(<< "lowerLeftWGS84 " << lowerLeftWGS84); - - PointType lowerRight; - lowerRight[0] = origin[0] + (size[0] - 1) * spacing[0]; - lowerRight[1] = origin[1] + (size[1] - 1) * spacing[1]; - PointType lowerRightWGS84 = rsTransformToWGS84->TransformPoint(lowerRight); - otbAppLogDEBUG(<< "lowerRightWGS84 " << lowerRightWGS84); - - // the iterator constructor can also be used to construct from arrays: - const double Longitude[] = {upperLeftWGS84[0],upperRightWGS84[0],lowerLeftWGS84[0],lowerRightWGS84[0]}; - const double Latitude[] = {upperLeftWGS84[1],upperRightWGS84[1],lowerLeftWGS84[1],lowerRightWGS84[1]}; - - std::vector<double> vecLong (Longitude, Longitude + sizeof(Longitude) / sizeof(double) ); - std::vector<double> vecLat (Latitude, Latitude + sizeof(Latitude) / sizeof(double) ); - - std::vector<double> absVecLong; - absVecLong.resize(vecLong.size()); // allocate space - - std::vector<double> absVecLat; - absVecLat.resize(vecLat.size()); // allocate space - - std::vector<double>::iterator AbsLongit=absVecLong.begin(); - - for (std::vector<double>::const_iterator it=vecLong.begin(); it!=vecLong.end(); ++it) - { - *AbsLongit = vcl_abs(*it); - ++AbsLongit; - } + auto inImage = inList->GetNthElement(i); + + auto rsTransformToWGS84 = RSTransformType::New(); + rsTransformToWGS84->SetInputKeywordList(inImage->GetImageKeywordlist()); + rsTransformToWGS84->SetInputProjectionRef(inImage->GetProjectionRef()); + rsTransformToWGS84->SetOutputProjectionRef(static_cast<std::string> (otb::GeoInformationConversion::ToWKT(4326))); + rsTransformToWGS84->InstantiateTransform(); + + const SizeType size = inImage->GetLargestPossibleRegion().GetSize(); + const IndexType start = inImage->GetLargestPossibleRegion().GetIndex(); + PointType tmpPoint; + itk::ContinuousIndex<double,2> index(start); + index[0] += -0.5; + index[1] += -0.5; + inImage->TransformContinuousIndexToPhysicalPoint(index,tmpPoint); + PointType ul = rsTransformToWGS84->TransformPoint(tmpPoint); + index[0] += size[0]; + inImage->TransformContinuousIndexToPhysicalPoint(index,tmpPoint); + PointType ur = rsTransformToWGS84->TransformPoint(tmpPoint); + index[1] += size[1]; + inImage->TransformContinuousIndexToPhysicalPoint(index,tmpPoint); + PointType lr = rsTransformToWGS84->TransformPoint(tmpPoint); + index[0] -= (double)size[0]; + inImage->TransformContinuousIndexToPhysicalPoint(index,tmpPoint); + PointType ll = rsTransformToWGS84->TransformPoint(tmpPoint); + + int floorMinLong = std::floor(std::min( {ul[0],ur[0],ll[0],lr[0]} )); + int floorMaxLong = std::floor(std::max( {ul[0],ur[0],ll[0],lr[0]} )); + int floorMinLat = std::floor(std::min( {ul[1],ur[1],ll[1],lr[1]} )); + int floorMaxLat = std::floor(std::max( {ul[1],ur[1],ll[1],lr[1]} )); - std::vector<double>::iterator AbsLatit=absVecLat.begin(); - - for (std::vector<double>::const_iterator it=vecLat.begin(); it!=vecLat.end(); ++it) + //Construct SRTM tile filename based on min/max lat/long + for (int k = floorMinLat; k <= floorMaxLat; ++k) { - *AbsLatit = vcl_abs(*it); - ++AbsLatit; + for (int j = floorMinLong; j <= floorMaxLong; ++j) + { + tiles.insert(SRTMTileId({j,k,0})); + } } - - const unsigned int distMinLong = - std::distance(absVecLong.begin(), min_element (absVecLong.begin(),absVecLong.end())); - const unsigned int distMaxLong = - std::distance(absVecLong.begin(), max_element (absVecLong.begin(),absVecLong.end())); - - const unsigned int distMinLat = - std::distance(absVecLat.begin(), min_element (absVecLat.begin(),absVecLat.end())); - const unsigned int distMaxLat = - std::distance(absVecLat.begin(), max_element (absVecLat.begin(),absVecLat.end())); - - //find corresponding tiled for initialization - //FIXME recode this properly - - int floorMinLong = 0; - int floorMaxLong = 0; - int floorMinLat = 0; - int floorMaxLat = 0; - - if (vecLong.at(distMinLong) <= vecLong.at(distMaxLong)) + } + //-------------------------------------------------------------------------- + // Check input vector files + for( unsigned int i=0; i<vectorDataList.size(); i++ ) + { + auto source = ogr::DataSource::New( + vectorDataList[i], + ogr::DataSource::Modes::Read); + OGREnvelope envelope; + std::string currentWkt(""); + try { - floorMinLong = std::floor(vecLong.at(distMinLong)); - floorMaxLong = std::floor(vecLong.at(distMaxLong)); + envelope = source->GetGlobalExtent(false,¤tWkt); } - else + catch(...) {} + if (currentWkt.empty()) { - floorMinLong = std::floor(vecLong.at(distMaxLong)); - floorMaxLong = std::floor(vecLong.at(distMinLong)); + try + { + envelope = source->GetGlobalExtent(true,¤tWkt); + } + catch(...) + { + otbAppLogWARNING("Can't get envelope of vector file : "<<vectorDataList[i]); + continue; + } } - if (vecLat.at(distMinLat) <= vecLat.at(distMaxLat)) - { - floorMinLat = std::floor(vecLat.at(distMinLat)); - floorMaxLat = std::floor(vecLat.at(distMaxLat)); - } - else - { - floorMinLat = std::floor(vecLat.at(distMaxLat)); - floorMaxLat = std::floor(vecLat.at(distMinLat)); - } + auto rsTransformToWGS84 = RSTransformType::New(); + rsTransformToWGS84->SetInputProjectionRef(currentWkt); + rsTransformToWGS84->SetOutputProjectionRef(static_cast<std::string> (otb::GeoInformationConversion::ToWKT(4326))); + rsTransformToWGS84->InstantiateTransform(); + PointType tmpPoint; + tmpPoint[0] = envelope.MinX; + tmpPoint[1] = envelope.MinY; + PointType ll = rsTransformToWGS84->TransformPoint(tmpPoint); + tmpPoint[0] = envelope.MaxX; + tmpPoint[1] = envelope.MaxY; + PointType ur = rsTransformToWGS84->TransformPoint(tmpPoint); + int floorMinLong = std::floor(ll[0]); + int floorMaxLong = std::floor(ur[0]); + int floorMinLat = std::floor(ll[1]); + int floorMaxLat = std::floor(ur[1]); //Construct SRTM tile filename based on min/max lat/long for (int k = floorMinLat; k <= floorMaxLat; ++k) { for (int j = floorMinLong; j <= floorMaxLong; ++j) { - std::ostringstream ossOutput; - if (k < 0) - { - ossOutput << "S"; - } - else - { - ossOutput << "N"; - } - - if (vcl_abs(k) <= 9) - { - ossOutput << "0"; - } - ossOutput << vcl_abs(k); - - if (j < 0) - { - ossOutput << "W"; - } - else - { - ossOutput << "E"; - } - if (vcl_abs(j) >= 10 && vcl_abs(j) < 100) - { - ossOutput << "0"; - } - else if (vcl_abs(j) <= 9) - { - ossOutput << "00"; - } - - ossOutput << vcl_abs(j); - - tiles.insert(ossOutput.str()); + tiles.insert(SRTMTileId({j,k,0})); } } - } - - //iterate over all tiles to build URLs - for(std::set<std::string>::const_iterator it= tiles.begin(); it!=tiles.end(); ++it) + //-------------------------------------------------------------------------- + // Check input names + for( unsigned int i=0; i<nameList.size(); i++ ) { - switch ( m_Mode ) + if (nameList[i].size() >= 7) { - case Mode_Download: - { - //Build URL - bool findURL = false; - std::string url; - for(std::vector<std::string>::const_iterator contIt= USGSContinentList.begin(); contIt!=USGSContinentList.end(); ++contIt) + int lon = 0, lat = 0; + try { - std::ostringstream urlStream; - CurlHelper::Pointer curl = CurlHelper::New(); - curl->SetTimeout(0); - urlStream << SRTMServerPath; - urlStream << *contIt; - urlStream << "/"; - urlStream << *it; - urlStream << HGTExtension; - - url = urlStream.str(); - - if (!curl->IsCurlReturnHttpError( urlStream.str())) - { - findURL = true; - break; - } - else - { - //try down casing the url - std::string lowerIt = *it; - std::transform(it->begin(), it->end(), lowerIt.begin(), ::tolower); - - urlStream.clear(); - urlStream << SRTMServerPath; - urlStream << *contIt; - urlStream << "/"; - urlStream << lowerIt; - urlStream << HGTExtension; - if (!curl->IsCurlReturnHttpError( urlStream.str())) - { - tiles.erase(*it); - tiles.insert(lowerIt); - //urls.insert(urlStream.str()); - findURL = true; - break; - } - else - { - //upcase all - std::string upperIt = *it; - std::transform(it->begin(), it->end(), upperIt.begin(), ::toupper); - - urlStream.clear(); - urlStream << SRTMServerPath; - urlStream << *contIt; - urlStream << "/"; - urlStream << upperIt; - urlStream << HGTExtension; - - if (!curl->IsCurlReturnHttpError( urlStream.str())) - { - tiles.erase(*it); - tiles.insert(upperIt); - //urls.insert(urlStream.str()); - findURL = true; - break; - } - } - } - + lat = boost::lexical_cast<int>(nameList[i].substr(1,2)); } - - if (!findURL) + catch(boost::bad_lexical_cast &) { - itkExceptionMacro(<< url <<" not found!"); + otbAppLogWARNING(<< "Wrong longitude in tile name : "<<nameList[i]); + continue; } - - otbAppLogINFO(<< "Found Tile on USGS server at URL: " << url); - // TODO use the RetrieveUrlInMemory? In this case need to adapt the - // timeout - - const std::string outDir = GetParameterString("mode.download.outdir"); - - std::ostringstream oss; - oss<<outDir<<"/foo"; - - if( itksys::SystemTools::Touch( oss.str().c_str(), true ) == false ) + try { - itkExceptionMacro( "Error, no write permission in given output directory "<< outDir <<"."); + lon = boost::lexical_cast<int>(nameList[i].substr(4,3)); } - else + catch(boost::bad_lexical_cast &) { - itksys::SystemTools::RemoveFile( oss.str().c_str() ); + otbAppLogWARNING(<< "Wrong latitude in tile name : "<<nameList[i]); + continue; } - - CurlHelper::Pointer curlReq = CurlHelper::New(); - curlReq->SetTimeout(0); - curlReq->RetrieveFile(url, GetParameterString("mode.download.outdir") + "/" + *it + HGTExtension); - //TODO unzip here (can do this in memory?) + if (nameList[i][0] == 's' || nameList[i][0] == 'S') + lat = -lat; + else if (nameList[i][0] != 'n' && nameList[i][0] != 'N') + { + otbAppLogWARNING(<< "Wrong northing in tile name : "<<nameList[i]); + continue; + } + if (nameList[i][3] == 'w' || nameList[i][3] == 'W') + lon = -lon; + else if (nameList[i][3] != 'e' && nameList[i][3] != 'E') + { + otbAppLogWARNING(<< "Wrong easting in tile name : "<<nameList[i]); + continue; + } + tiles.insert(SRTMTileId({lon,lat,0})); } - break; - case Mode_List: + else + { + otbAppLogWARNING(<< "Tile name should have at least 7 characters : "<<nameList[i]); + } + } + + if (tiles.empty()) + { + otbAppLogWARNING(<< "No tile found for the given input(s)!"); + return; + } + + //iterate over all tiles to build URLs + std::vector<std::string> nonSRTMTiles; + std::vector<std::string> localTiles; + std::vector<std::string> missingTiles; + std::vector<std::string> continentList; + for(auto const& tileId : tiles) + { + std::string curName(this->SRTMIdToName(tileId)); + std::string continent; + // Check 1 : does the tile exists in SRTM ? If yes, get the continent + if (SRTMTileExists(tileId,continent)) { - bool findURL = false; - std::ostringstream listStream; - listStream << "Corresponding SRTM tiles: "; - listStream << GetParameterString("mode.list.indir") + "/"; - if ( this->SRTMTileExists(GetParameterString("mode.list.indir") + "/" + *it + HGTExtensionSimulation) ) + // Check 2 : is the tile already downloaded + if (SRTMTileDownloaded(curName,tileDir)) { - listStream << *it + HGTExtensionSimulation << " "; - findURL = true; + localTiles.push_back(curName); } else { - //try down casing the url - std::string lowerIt = *it; - std::transform(it->begin(), it->end(), lowerIt.begin(), ::tolower); - - if ( this->SRTMTileExists(GetParameterString("mode.list.indir") + "/" + lowerIt + HGTExtensionSimulation) ) - { - tiles.erase(*it); - tiles.insert(lowerIt); - findURL = true; - } - else - { - //upcase all - std::string upperIt = *it; - std::transform(it->begin(), it->end(), upperIt.begin(), ::toupper); - - if (this->SRTMTileExists(GetParameterString("mode.list.indir") + "/" + lowerIt + HGTExtensionSimulation) ) - { - tiles.erase(*it); - tiles.insert(upperIt); - findURL = true; - } - } + missingTiles.push_back(curName); + continentList.push_back(continent); } + } + else + { + nonSRTMTiles.push_back(curName); + } + } - if (!findURL) + otbAppLogINFO(<<"Total candidate tiles: "<< tiles.size()); + // If download mode : try to get missing tiles + int srtmHitRatio = ( 100 * (tiles.size() - nonSRTMTiles.size() ) ) / + tiles.size(); + otbAppLogINFO(<<" --> "<< nonSRTMTiles.size() << " missing tiles in SRTM (coverage ratio is "<< srtmHitRatio << "%)"); + otbAppLogINFO(<<" --> "<< localTiles.size()<< " tiles already in the directory"); + otbAppLogINFO(<<" --> "<< missingTiles.size()<< " tiles to download"); + if (mode == Mode_List) + { + std::ostringstream oss; + for (auto const& tileName : nonSRTMTiles) + { + oss << " " << tileName << " = NotSRTM\n"; + } + for (auto const& tileName : localTiles) + { + oss << " " << tileName << " = Local\n"; + } + for (auto const& tileName : missingTiles) + { + oss << " " << tileName << " = Missing\n"; + } + otbAppLogINFO(<< "Status of each tile (NotSRTM/Local/Missing):\n" << oss.str()); + } + if (mode == Mode_Download) + { + // Check permissions first + if ( !CheckPermissions(tileDir) ) + { + otbAppLogFATAL(<< "Can't write into directory : '"<< tileDir <<"'"); + } + std::vector<std::string>::const_iterator it,itConti; + auto curl = CurlHelper::New(); + curl->SetTimeout(0); + std::string request; + if (!tileDir.empty() && tileDir.back() != Sep) + { + tileDir += Sep; + } + for (it=missingTiles.begin(), itConti=continentList.begin() ; + it!=missingTiles.end() && itConti!=continentList.end() ; + ++it, ++itConti) + { + otbAppLogINFO(<< "Downloading tile "<<*it << " ..."); + request = SRTMServerPath + *itConti + "/" + *it + HGTZIPExtension; + if (curl->IsCurlReturnHttpError( request )) { - itkExceptionMacro(<< "Tile " << *it + HGTExtensionSimulation <<" not found in " << GetParameterString("mode.list.indir") << " !"); + otbAppLogWARNING(<< "Can't access tile : "<< request); + continue; } - otbAppLogINFO( << listStream.str()); - } - break; + curl->RetrieveFile(request, std::string(tileDir + *it + HGTZIPExtension)); } } } + + SRTMTileSet m_SRTMTileList; +}; + +} // end of namespace Wrapper +} // end of namespace otb + +const otb::Wrapper::DownloadSRTMTiles::SRTMTileId staticTileList[] = +{{6,0,1},{9,0,1},{10,0,1},{11,0,1},{12,0,1},{13,0,1},{14,0,1},{15,0,1} +,{16,0,1},{17,0,1},{18,0,1},{19,0,1},{20,0,1},{21,0,1},{22,0,1},{23,0,1} +,{24,0,1},{25,0,1},{26,0,1},{27,0,1},{28,0,1},{29,0,1},{30,0,1},{31,0,1} +,{32,0,1},{33,0,1},{34,0,1},{35,0,1},{36,0,1},{37,0,1},{38,0,1},{39,0,1} +,{40,0,1},{41,0,1},{42,0,1},{43,0,1},{7,1,1},{9,1,1},{10,1,1},{11,1,1} +,{12,1,1},{13,1,1},{14,1,1},{15,1,1},{16,1,1},{17,1,1},{18,1,1},{19,1,1} +,{20,1,1},{21,1,1},{22,1,1},{23,1,1},{24,1,1},{25,1,1},{26,1,1},{27,1,1} +,{28,1,1},{29,1,1},{30,1,1},{31,1,1},{32,1,1},{33,1,1},{34,1,1},{35,1,1} +,{36,1,1},{37,1,1},{38,1,1},{39,1,1},{40,1,1},{41,1,1},{42,1,1},{43,1,1} +,{44,1,1},{45,1,1},{9,2,1},{10,2,1},{11,2,1},{12,2,1},{13,2,1},{14,2,1} +,{15,2,1},{16,2,1},{17,2,1},{18,2,1},{19,2,1},{20,2,1},{21,2,1},{22,2,1} +,{23,2,1},{24,2,1},{25,2,1},{26,2,1},{27,2,1},{28,2,1},{29,2,1},{30,2,1} +,{31,2,1},{32,2,1},{33,2,1},{34,2,1},{35,2,1},{36,2,1},{37,2,1},{38,2,1} +,{39,2,1},{40,2,1},{41,2,1},{42,2,1},{43,2,1},{44,2,1},{45,2,1},{46,2,1} +,{8,3,1},{9,3,1},{10,3,1},{11,3,1},{12,3,1},{13,3,1},{14,3,1},{15,3,1} +,{16,3,1},{17,3,1},{18,3,1},{19,3,1},{20,3,1},{21,3,1},{22,3,1},{23,3,1} +,{24,3,1},{25,3,1},{26,3,1},{27,3,1},{28,3,1},{29,3,1},{30,3,1},{31,3,1} +,{32,3,1},{33,3,1},{34,3,1},{35,3,1},{36,3,1},{37,3,1},{38,3,1},{39,3,1} +,{40,3,1},{41,3,1},{42,3,1},{43,3,1},{44,3,1},{45,3,1},{46,3,1},{47,3,1} +,{5,4,1},{6,4,1},{7,4,1},{8,4,1},{9,4,1},{10,4,1},{11,4,1},{12,4,1} +,{13,4,1},{14,4,1},{15,4,1},{16,4,1},{17,4,1},{18,4,1},{19,4,1},{20,4,1} +,{21,4,1},{22,4,1},{23,4,1},{24,4,1},{25,4,1},{26,4,1},{27,4,1},{28,4,1} +,{29,4,1},{30,4,1},{31,4,1},{32,4,1},{33,4,1},{34,4,1},{35,4,1},{36,4,1} +,{37,4,1},{38,4,1},{39,4,1},{40,4,1},{41,4,1},{42,4,1},{43,4,1},{44,4,1} +,{45,4,1},{46,4,1},{47,4,1},{48,4,1},{-2,4,1},{-3,4,1},{-6,4,1},{-7,4,1} +,{-8,4,1},{-9,4,1},{-10,4,1},{0,5,1},{1,5,1},{4,5,1},{5,5,1},{6,5,1} +,{7,5,1},{8,5,1},{9,5,1},{10,5,1},{11,5,1},{12,5,1},{13,5,1},{14,5,1} +,{15,5,1},{16,5,1},{17,5,1},{18,5,1},{19,5,1},{20,5,1},{21,5,1},{22,5,1} +,{23,5,1},{24,5,1},{25,5,1},{26,5,1},{27,5,1},{28,5,1},{29,5,1},{30,5,1} +,{31,5,1},{32,5,1},{33,5,1},{34,5,1},{35,5,1},{36,5,1},{37,5,1},{38,5,1} +,{39,5,1},{40,5,1},{41,5,1},{42,5,1},{43,5,1},{44,5,1},{45,5,1},{46,5,1} +,{47,5,1},{48,5,1},{-1,5,1},{-2,5,1},{-3,5,1},{-4,5,1},{-5,5,1},{-6,5,1} +,{-7,5,1},{-8,5,1},{-9,5,1},{-10,5,1},{-11,5,1},{0,6,1},{1,6,1},{2,6,1} +,{3,6,1},{4,6,1},{5,6,1},{6,6,1},{7,6,1},{8,6,1},{9,6,1},{10,6,1} +,{11,6,1},{12,6,1},{13,6,1},{14,6,1},{15,6,1},{16,6,1},{17,6,1},{18,6,1} +,{19,6,1},{20,6,1},{21,6,1},{22,6,1},{23,6,1},{24,6,1},{25,6,1},{26,6,1} +,{27,6,1},{28,6,1},{29,6,1},{30,6,1},{31,6,1},{32,6,1},{33,6,1},{34,6,1} +,{35,6,1},{36,6,1},{37,6,1},{38,6,1},{39,6,1},{40,6,1},{41,6,1},{42,6,1} +,{43,6,1},{44,6,1},{45,6,1},{46,6,1},{47,6,1},{48,6,1},{49,6,1},{-1,6,1} +,{-2,6,1},{-3,6,1},{-4,6,1},{-5,6,1},{-6,6,1},{-7,6,1},{-8,6,1},{-9,6,1} +,{-10,6,1},{-11,6,1},{-12,6,1},{0,7,1},{1,7,1},{2,7,1},{3,7,1},{4,7,1} +,{5,7,1},{6,7,1},{7,7,1},{8,7,1},{9,7,1},{10,7,1},{11,7,1},{12,7,1} +,{13,7,1},{14,7,1},{15,7,1},{16,7,1},{17,7,1},{18,7,1},{19,7,1},{20,7,1} +,{21,7,1},{22,7,1},{23,7,1},{24,7,1},{25,7,1},{26,7,1},{27,7,1},{28,7,1} +,{29,7,1},{30,7,1},{31,7,1},{32,7,1},{33,7,1},{34,7,1},{35,7,1},{36,7,1} +,{37,7,1},{38,7,1},{39,7,1},{40,7,1},{41,7,1},{42,7,1},{43,7,1},{44,7,1} +,{45,7,1},{46,7,1},{47,7,1},{48,7,1},{49,7,1},{-1,7,1},{-2,7,1},{-3,7,1} +,{-4,7,1},{-5,7,1},{-6,7,1},{-7,7,1},{-8,7,1},{-9,7,1},{-10,7,1},{-11,7,1} +,{-12,7,1},{-13,7,1},{-14,7,1},{0,8,1},{1,8,1},{2,8,1},{3,8,1},{4,8,1} +,{5,8,1},{6,8,1},{7,8,1},{8,8,1},{9,8,1},{10,8,1},{11,8,1},{12,8,1} +,{13,8,1},{14,8,1},{15,8,1},{16,8,1},{17,8,1},{18,8,1},{19,8,1},{20,8,1} +,{21,8,1},{22,8,1},{23,8,1},{24,8,1},{25,8,1},{26,8,1},{27,8,1},{28,8,1} +,{29,8,1},{30,8,1},{31,8,1},{32,8,1},{33,8,1},{34,8,1},{35,8,1},{36,8,1} +,{37,8,1},{38,8,1},{39,8,1},{40,8,1},{41,8,1},{42,8,1},{43,8,1},{44,8,1} +,{45,8,1},{46,8,1},{47,8,1},{48,8,1},{49,8,1},{50,8,1},{-1,8,1},{-2,8,1} +,{-3,8,1},{-4,8,1},{-5,8,1},{-6,8,1},{-7,8,1},{-8,8,1},{-9,8,1},{-10,8,1} +,{-11,8,1},{-12,8,1},{-13,8,1},{-14,8,1},{0,9,1},{1,9,1},{2,9,1},{3,9,1} +,{4,9,1},{5,9,1},{6,9,1},{7,9,1},{8,9,1},{9,9,1},{10,9,1},{11,9,1} +,{12,9,1},{13,9,1},{14,9,1},{15,9,1},{16,9,1},{17,9,1},{18,9,1},{19,9,1} +,{20,9,1},{21,9,1},{22,9,1},{23,9,1},{24,9,1},{25,9,1},{26,9,1},{27,9,1} +,{28,9,1},{29,9,1},{30,9,1},{31,9,1},{32,9,1},{33,9,1},{34,9,1},{35,9,1} +,{36,9,1},{37,9,1},{38,9,1},{39,9,1},{40,9,1},{41,9,1},{42,9,1},{43,9,1} +,{44,9,1},{45,9,1},{46,9,1},{47,9,1},{48,9,1},{49,9,1},{50,9,1},{-1,9,1} +,{-2,9,1},{-3,9,1},{-4,9,1},{-5,9,1},{-6,9,1},{-7,9,1},{-8,9,1},{-9,9,1} +,{-10,9,1},{-11,9,1},{-12,9,1},{-13,9,1},{-14,9,1},{-15,9,1},{0,10,1},{1,10,1} +,{2,10,1},{3,10,1},{4,10,1},{5,10,1},{6,10,1},{7,10,1},{8,10,1},{9,10,1} +,{10,10,1},{11,10,1},{12,10,1},{13,10,1},{14,10,1},{15,10,1},{16,10,1},{17,10,1} +,{18,10,1},{19,10,1},{20,10,1},{21,10,1},{22,10,1},{23,10,1},{24,10,1},{25,10,1} +,{26,10,1},{27,10,1},{28,10,1},{29,10,1},{30,10,1},{31,10,1},{32,10,1},{33,10,1} +,{34,10,1},{35,10,1},{36,10,1},{37,10,1},{38,10,1},{39,10,1},{40,10,1},{41,10,1} +,{42,10,1},{43,10,1},{44,10,1},{45,10,1},{46,10,1},{47,10,1},{48,10,1},{49,10,1} +,{50,10,1},{51,10,1},{-1,10,1},{-2,10,1},{-3,10,1},{-4,10,1},{-5,10,1},{-6,10,1} +,{-7,10,1},{-8,10,1},{-9,10,1},{-10,10,1},{-11,10,1},{-12,10,1},{-13,10,1},{-14,10,1} +,{-15,10,1},{-16,10,1},{0,11,1},{1,11,1},{2,11,1},{3,11,1},{4,11,1},{5,11,1} +,{6,11,1},{7,11,1},{8,11,1},{9,11,1},{10,11,1},{11,11,1},{12,11,1},{13,11,1} +,{14,11,1},{15,11,1},{16,11,1},{17,11,1},{18,11,1},{19,11,1},{20,11,1},{21,11,1} +,{22,11,1},{23,11,1},{24,11,1},{25,11,1},{26,11,1},{27,11,1},{28,11,1},{29,11,1} +,{30,11,1},{31,11,1},{32,11,1},{33,11,1},{34,11,1},{35,11,1},{36,11,1},{37,11,1} +,{38,11,1},{39,11,1},{40,11,1},{41,11,1},{42,11,1},{43,11,1},{47,11,1},{48,11,1} +,{49,11,1},{50,11,1},{51,11,1},{-1,11,1},{-2,11,1},{-3,11,1},{-4,11,1},{-5,11,1} +,{-6,11,1},{-7,11,1},{-8,11,1},{-9,11,1},{-10,11,1},{-11,11,1},{-12,11,1},{-13,11,1} +,{-14,11,1},{-15,11,1},{-16,11,1},{-17,11,1},{0,12,1},{1,12,1},{2,12,1},{3,12,1} +,{4,12,1},{5,12,1},{6,12,1},{7,12,1},{8,12,1},{9,12,1},{10,12,1},{11,12,1} +,{12,12,1},{13,12,1},{14,12,1},{15,12,1},{16,12,1},{17,12,1},{18,12,1},{19,12,1} +,{20,12,1},{21,12,1},{22,12,1},{23,12,1},{24,12,1},{25,12,1},{26,12,1},{27,12,1} +,{28,12,1},{29,12,1},{30,12,1},{31,12,1},{32,12,1},{33,12,1},{34,12,1},{35,12,1} +,{36,12,1},{37,12,1},{38,12,1},{39,12,1},{40,12,1},{41,12,1},{42,12,1},{43,12,1} +,{44,12,1},{45,12,1},{52,12,1},{53,12,1},{54,12,1},{-1,12,1},{-2,12,1},{-3,12,1} +,{-4,12,1},{-5,12,1},{-6,12,1},{-7,12,1},{-8,12,1},{-9,12,1},{-10,12,1},{-11,12,1} +,{-12,12,1},{-13,12,1},{-14,12,1},{-15,12,1},{-16,12,1},{-17,12,1},{0,13,1},{1,13,1} +,{2,13,1},{3,13,1},{4,13,1},{5,13,1},{6,13,1},{7,13,1},{8,13,1},{9,13,1} +,{10,13,1},{11,13,1},{12,13,1},{13,13,1},{14,13,1},{15,13,1},{16,13,1},{17,13,1} +,{18,13,1},{19,13,1},{20,13,1},{21,13,1},{22,13,1},{23,13,1},{24,13,1},{25,13,1} +,{26,13,1},{27,13,1},{28,13,1},{29,13,1},{30,13,1},{31,13,1},{32,13,1},{33,13,1} +,{34,13,1},{35,13,1},{36,13,1},{37,13,1},{38,13,1},{39,13,1},{40,13,1},{41,13,1} +,{42,13,1},{43,13,1},{44,13,1},{45,13,1},{46,13,1},{47,13,1},{48,13,1},{-1,13,1} +,{-2,13,1},{-3,13,1},{-4,13,1},{-5,13,1},{-6,13,1},{-7,13,1},{-8,13,1},{-9,13,1} +,{-10,13,1},{-11,13,1},{-12,13,1},{-13,13,1},{-14,13,1},{-15,13,1},{-16,13,1},{-17,13,1} +,{0,14,1},{1,14,1},{2,14,1},{3,14,1},{4,14,1},{5,14,1},{6,14,1},{7,14,1} +,{8,14,1},{9,14,1},{10,14,1},{11,14,1},{12,14,1},{13,14,1},{14,14,1},{15,14,1} +,{16,14,1},{17,14,1},{18,14,1},{19,14,1},{20,14,1},{21,14,1},{22,14,1},{23,14,1} +,{24,14,1},{25,14,1},{26,14,1},{27,14,1},{28,14,1},{29,14,1},{30,14,1},{31,14,1} +,{32,14,1},{33,14,1},{34,14,1},{35,14,1},{36,14,1},{37,14,1},{38,14,1},{39,14,1} +,{40,14,1},{41,14,1},{42,14,1},{43,14,1},{44,14,1},{45,14,1},{46,14,1},{47,14,1} +,{48,14,1},{49,14,1},{50,14,1},{-1,14,1},{-2,14,1},{-3,14,1},{-4,14,1},{-5,14,1} +,{-6,14,1},{-7,14,1},{-8,14,1},{-9,14,1},{-10,14,1},{-11,14,1},{-12,14,1},{-13,14,1} +,{-14,14,1},{-15,14,1},{-16,14,1},{-17,14,1},{-18,14,1},{-24,14,1},{-25,14,1},{0,15,1} +,{1,15,1},{2,15,1},{3,15,1},{4,15,1},{5,15,1},{6,15,1},{7,15,1},{8,15,1} +,{9,15,1},{10,15,1},{11,15,1},{12,15,1},{13,15,1},{14,15,1},{15,15,1},{16,15,1} +,{17,15,1},{18,15,1},{19,15,1},{20,15,1},{21,15,1},{22,15,1},{23,15,1},{24,15,1} +,{25,15,1},{26,15,1},{27,15,1},{28,15,1},{29,15,1},{30,15,1},{31,15,1},{32,15,1} +,{33,15,1},{34,15,1},{35,15,1},{36,15,1},{37,15,1},{38,15,1},{39,15,1},{40,15,1} +,{41,15,1},{42,15,1},{43,15,1},{44,15,1},{45,15,1},{46,15,1},{47,15,1},{48,15,1} +,{49,15,1},{50,15,1},{51,15,1},{52,15,1},{-1,15,1},{-2,15,1},{-3,15,1},{-4,15,1} +,{-5,15,1},{-6,15,1},{-7,15,1},{-8,15,1},{-9,15,1},{-10,15,1},{-11,15,1},{-12,15,1} +,{-13,15,1},{-14,15,1},{-15,15,1},{-16,15,1},{-17,15,1},{-18,15,1},{-23,15,1},{-24,15,1} +,{-25,15,1},{0,16,1},{1,16,1},{2,16,1},{3,16,1},{4,16,1},{5,16,1},{6,16,1} +,{7,16,1},{8,16,1},{9,16,1},{10,16,1},{11,16,1},{12,16,1},{13,16,1},{14,16,1} +,{15,16,1},{16,16,1},{17,16,1},{18,16,1},{19,16,1},{20,16,1},{21,16,1},{22,16,1} +,{23,16,1},{24,16,1},{25,16,1},{26,16,1},{27,16,1},{28,16,1},{29,16,1},{30,16,1} +,{31,16,1},{32,16,1},{33,16,1},{34,16,1},{35,16,1},{36,16,1},{37,16,1},{38,16,1} +,{39,16,1},{40,16,1},{41,16,1},{42,16,1},{43,16,1},{44,16,1},{45,16,1},{46,16,1} +,{47,16,1},{48,16,1},{49,16,1},{50,16,1},{51,16,1},{52,16,1},{53,16,1},{54,16,1} +,{55,16,1},{-1,16,1},{-2,16,1},{-3,16,1},{-4,16,1},{-5,16,1},{-6,16,1},{-7,16,1} +,{-8,16,1},{-9,16,1},{-10,16,1},{-11,16,1},{-12,16,1},{-13,16,1},{-14,16,1},{-15,16,1} +,{-16,16,1},{-17,16,1},{-23,16,1},{-25,16,1},{-26,16,1},{0,17,1},{1,17,1},{2,17,1} +,{3,17,1},{4,17,1},{5,17,1},{6,17,1},{7,17,1},{8,17,1},{9,17,1},{10,17,1} +,{11,17,1},{12,17,1},{13,17,1},{14,17,1},{15,17,1},{16,17,1},{17,17,1},{18,17,1} +,{19,17,1},{20,17,1},{21,17,1},{22,17,1},{23,17,1},{24,17,1},{25,17,1},{26,17,1} +,{27,17,1},{28,17,1},{29,17,1},{30,17,1},{31,17,1},{32,17,1},{33,17,1},{34,17,1} +,{35,17,1},{36,17,1},{37,17,1},{38,17,1},{39,17,1},{41,17,1},{42,17,1},{43,17,1} +,{44,17,1},{45,17,1},{46,17,1},{47,17,1},{48,17,1},{49,17,1},{50,17,1},{51,17,1} +,{52,17,1},{53,17,1},{54,17,1},{55,17,1},{56,17,1},{-1,17,1},{-2,17,1},{-3,17,1} +,{-4,17,1},{-5,17,1},{-6,17,1},{-7,17,1},{-8,17,1},{-9,17,1},{-10,17,1},{-11,17,1} +,{-12,17,1},{-13,17,1},{-14,17,1},{-15,17,1},{-16,17,1},{-17,17,1},{-25,17,1},{-26,17,1} +,{0,18,1},{1,18,1},{2,18,1},{3,18,1},{4,18,1},{5,18,1},{6,18,1},{7,18,1} +,{8,18,1},{9,18,1},{10,18,1},{11,18,1},{12,18,1},{13,18,1},{14,18,1},{15,18,1} +,{16,18,1},{17,18,1},{18,18,1},{19,18,1},{20,18,1},{21,18,1},{22,18,1},{23,18,1} +,{24,18,1},{25,18,1},{26,18,1},{27,18,1},{28,18,1},{29,18,1},{30,18,1},{31,18,1} +,{32,18,1},{33,18,1},{34,18,1},{35,18,1},{36,18,1},{37,18,1},{38,18,1},{40,18,1} +,{41,18,1},{42,18,1},{43,18,1},{44,18,1},{45,18,1},{46,18,1},{47,18,1},{48,18,1} +,{49,18,1},{50,18,1},{51,18,1},{52,18,1},{53,18,1},{54,18,1},{55,18,1},{56,18,1} +,{57,18,1},{-1,18,1},{-2,18,1},{-3,18,1},{-4,18,1},{-5,18,1},{-6,18,1},{-7,18,1} +,{-8,18,1},{-9,18,1},{-10,18,1},{-11,18,1},{-12,18,1},{-13,18,1},{-14,18,1},{-15,18,1} +,{-16,18,1},{-17,18,1},{0,19,1},{1,19,1},{2,19,1},{3,19,1},{4,19,1},{5,19,1} +,{6,19,1},{7,19,1},{8,19,1},{9,19,1},{10,19,1},{11,19,1},{12,19,1},{13,19,1} +,{14,19,1},{15,19,1},{16,19,1},{17,19,1},{18,19,1},{19,19,1},{20,19,1},{21,19,1} +,{22,19,1},{23,19,1},{24,19,1},{25,19,1},{26,19,1},{27,19,1},{28,19,1},{29,19,1} +,{30,19,1},{31,19,1},{32,19,1},{33,19,1},{34,19,1},{35,19,1},{36,19,1},{37,19,1} +,{38,19,1},{39,19,1},{40,19,1},{41,19,1},{42,19,1},{43,19,1},{44,19,1},{45,19,1} +,{46,19,1},{47,19,1},{48,19,1},{49,19,1},{50,19,1},{51,19,1},{52,19,1},{53,19,1} +,{54,19,1},{55,19,1},{56,19,1},{57,19,1},{-1,19,1},{-2,19,1},{-3,19,1},{-4,19,1} +,{-5,19,1},{-6,19,1},{-7,19,1},{-8,19,1},{-9,19,1},{-10,19,1},{-11,19,1},{-12,19,1} +,{-13,19,1},{-14,19,1},{-15,19,1},{-16,19,1},{-17,19,1},{0,20,1},{1,20,1},{2,20,1} +,{3,20,1},{4,20,1},{5,20,1},{6,20,1},{7,20,1},{8,20,1},{9,20,1},{10,20,1} +,{11,20,1},{12,20,1},{13,20,1},{14,20,1},{15,20,1},{16,20,1},{17,20,1},{18,20,1} +,{19,20,1},{20,20,1},{21,20,1},{22,20,1},{23,20,1},{24,20,1},{25,20,1},{26,20,1} +,{27,20,1},{28,20,1},{29,20,1},{30,20,1},{31,20,1},{32,20,1},{33,20,1},{34,20,1} +,{35,20,1},{36,20,1},{37,20,1},{39,20,1},{40,20,1},{41,20,1},{42,20,1},{43,20,1} +,{44,20,1},{45,20,1},{46,20,1},{47,20,1},{48,20,1},{49,20,1},{50,20,1},{51,20,1} +,{52,20,1},{53,20,1},{54,20,1},{55,20,1},{56,20,1},{57,20,1},{58,20,1},{-1,20,1} +,{-2,20,1},{-3,20,1},{-4,20,1},{-5,20,1},{-6,20,1},{-7,20,1},{-8,20,1},{-9,20,1} +,{-10,20,1},{-11,20,1},{-12,20,1},{-13,20,1},{-14,20,1},{-15,20,1},{-16,20,1},{-17,20,1} +,{-18,20,1},{0,21,1},{1,21,1},{2,21,1},{3,21,1},{4,21,1},{5,21,1},{6,21,1} +,{7,21,1},{8,21,1},{9,21,1},{10,21,1},{11,21,1},{12,21,1},{13,21,1},{14,21,1} +,{15,21,1},{16,21,1},{17,21,1},{18,21,1},{19,21,1},{20,21,1},{21,21,1},{22,21,1} +,{23,21,1},{24,21,1},{25,21,1},{26,21,1},{27,21,1},{28,21,1},{29,21,1},{30,21,1} +,{31,21,1},{32,21,1},{33,21,1},{34,21,1},{35,21,1},{36,21,1},{37,21,1},{38,21,1} +,{39,21,1},{40,21,1},{41,21,1},{42,21,1},{43,21,1},{44,21,1},{45,21,1},{46,21,1} +,{47,21,1},{48,21,1},{49,21,1},{50,21,1},{51,21,1},{52,21,1},{53,21,1},{54,21,1} +,{55,21,1},{56,21,1},{57,21,1},{58,21,1},{59,21,1},{-1,21,1},{-2,21,1},{-3,21,1} +,{-4,21,1},{-5,21,1},{-6,21,1},{-7,21,1},{-8,21,1},{-9,21,1},{-10,21,1},{-11,21,1} +,{-12,21,1},{-13,21,1},{-14,21,1},{-15,21,1},{-16,21,1},{-17,21,1},{-18,21,1},{0,22,1} +,{1,22,1},{2,22,1},{3,22,1},{4,22,1},{5,22,1},{6,22,1},{7,22,1},{8,22,1} +,{9,22,1},{10,22,1},{11,22,1},{12,22,1},{13,22,1},{14,22,1},{15,22,1},{16,22,1} +,{17,22,1},{18,22,1},{19,22,1},{20,22,1},{21,22,1},{22,22,1},{23,22,1},{24,22,1} +,{25,22,1},{26,22,1},{27,22,1},{28,22,1},{29,22,1},{30,22,1},{31,22,1},{32,22,1} +,{33,22,1},{34,22,1},{35,22,1},{36,22,1},{38,22,1},{39,22,1},{40,22,1},{41,22,1} +,{42,22,1},{43,22,1},{44,22,1},{45,22,1},{46,22,1},{47,22,1},{48,22,1},{49,22,1} +,{50,22,1},{51,22,1},{52,22,1},{53,22,1},{54,22,1},{55,22,1},{56,22,1},{57,22,1} +,{58,22,1},{59,22,1},{-1,22,1},{-2,22,1},{-3,22,1},{-4,22,1},{-5,22,1},{-6,22,1} +,{-7,22,1},{-8,22,1},{-9,22,1},{-10,22,1},{-11,22,1},{-12,22,1},{-13,22,1},{-14,22,1} +,{-15,22,1},{-16,22,1},{-17,22,1},{0,23,1},{1,23,1},{2,23,1},{3,23,1},{4,23,1} +,{5,23,1},{6,23,1},{7,23,1},{8,23,1},{9,23,1},{10,23,1},{11,23,1},{12,23,1} +,{13,23,1},{14,23,1},{15,23,1},{16,23,1},{17,23,1},{18,23,1},{19,23,1},{20,23,1} +,{21,23,1},{22,23,1},{23,23,1},{24,23,1},{25,23,1},{26,23,1},{27,23,1},{28,23,1} +,{29,23,1},{30,23,1},{31,23,1},{32,23,1},{33,23,1},{34,23,1},{35,23,1},{36,23,1} +,{38,23,1},{39,23,1},{40,23,1},{41,23,1},{42,23,1},{43,23,1},{44,23,1},{45,23,1} +,{46,23,1},{47,23,1},{48,23,1},{49,23,1},{50,23,1},{51,23,1},{52,23,1},{53,23,1} +,{54,23,1},{55,23,1},{56,23,1},{57,23,1},{58,23,1},{59,23,1},{-1,23,1},{-2,23,1} +,{-3,23,1},{-4,23,1},{-5,23,1},{-6,23,1},{-7,23,1},{-8,23,1},{-9,23,1},{-10,23,1} +,{-11,23,1},{-12,23,1},{-13,23,1},{-14,23,1},{-15,23,1},{-16,23,1},{-17,23,1},{0,24,1} +,{1,24,1},{2,24,1},{3,24,1},{4,24,1},{5,24,1},{6,24,1},{7,24,1},{8,24,1} +,{9,24,1},{10,24,1},{11,24,1},{12,24,1},{13,24,1},{14,24,1},{15,24,1},{16,24,1} +,{17,24,1},{18,24,1},{19,24,1},{20,24,1},{21,24,1},{22,24,1},{23,24,1},{24,24,1} +,{25,24,1},{26,24,1},{27,24,1},{28,24,1},{29,24,1},{30,24,1},{31,24,1},{32,24,1} +,{33,24,1},{34,24,1},{35,24,1},{37,24,1},{38,24,1},{39,24,1},{40,24,1},{41,24,1} +,{42,24,1},{43,24,1},{44,24,1},{45,24,1},{46,24,1},{47,24,1},{48,24,1},{49,24,1} +,{50,24,1},{51,24,1},{52,24,1},{53,24,1},{54,24,1},{55,24,1},{56,24,1},{57,24,1} +,{-1,24,1},{-2,24,1},{-3,24,1},{-4,24,1},{-5,24,1},{-6,24,1},{-7,24,1},{-8,24,1} +,{-9,24,1},{-10,24,1},{-11,24,1},{-12,24,1},{-13,24,1},{-14,24,1},{-15,24,1},{-16,24,1} +,{0,25,1},{1,25,1},{2,25,1},{3,25,1},{4,25,1},{5,25,1},{6,25,1},{7,25,1} +,{8,25,1},{9,25,1},{10,25,1},{11,25,1},{12,25,1},{13,25,1},{14,25,1},{15,25,1} +,{16,25,1},{17,25,1},{18,25,1},{19,25,1},{20,25,1},{21,25,1},{22,25,1},{23,25,1} +,{24,25,1},{25,25,1},{26,25,1},{27,25,1},{28,25,1},{29,25,1},{30,25,1},{31,25,1} +,{32,25,1},{33,25,1},{34,25,1},{36,25,1},{37,25,1},{38,25,1},{39,25,1},{40,25,1} +,{41,25,1},{42,25,1},{43,25,1},{44,25,1},{45,25,1},{46,25,1},{47,25,1},{48,25,1} +,{49,25,1},{50,25,1},{51,25,1},{52,25,1},{54,25,1},{55,25,1},{56,25,1},{57,25,1} +,{58,25,1},{59,25,1},{-1,25,1},{-2,25,1},{-3,25,1},{-4,25,1},{-5,25,1},{-6,25,1} +,{-7,25,1},{-8,25,1},{-9,25,1},{-10,25,1},{-11,25,1},{-12,25,1},{-13,25,1},{-14,25,1} +,{-15,25,1},{0,26,1},{1,26,1},{2,26,1},{3,26,1},{4,26,1},{5,26,1},{6,26,1} +,{7,26,1},{8,26,1},{9,26,1},{10,26,1},{11,26,1},{12,26,1},{13,26,1},{14,26,1} +,{15,26,1},{16,26,1},{17,26,1},{18,26,1},{19,26,1},{20,26,1},{21,26,1},{22,26,1} +,{23,26,1},{24,26,1},{25,26,1},{26,26,1},{27,26,1},{28,26,1},{29,26,1},{30,26,1} +,{31,26,1},{32,26,1},{33,26,1},{34,26,1},{35,26,1},{36,26,1},{37,26,1},{38,26,1} +,{39,26,1},{40,26,1},{41,26,1},{42,26,1},{43,26,1},{44,26,1},{45,26,1},{46,26,1} +,{47,26,1},{48,26,1},{49,26,1},{50,26,1},{51,26,1},{53,26,1},{54,26,1},{55,26,1} +,{56,26,1},{57,26,1},{58,26,1},{59,26,1},{-1,26,1},{-2,26,1},{-3,26,1},{-4,26,1} +,{-5,26,1},{-6,26,1},{-7,26,1},{-8,26,1},{-9,26,1},{-10,26,1},{-11,26,1},{-12,26,1} +,{-13,26,1},{-14,26,1},{-15,26,1},{0,27,1},{1,27,1},{2,27,1},{3,27,1},{4,27,1} +,{5,27,1},{6,27,1},{7,27,1},{8,27,1},{9,27,1},{10,27,1},{11,27,1},{12,27,1} +,{13,27,1},{14,27,1},{15,27,1},{16,27,1},{17,27,1},{18,27,1},{19,27,1},{20,27,1} +,{21,27,1},{22,27,1},{23,27,1},{24,27,1},{25,27,1},{26,27,1},{27,27,1},{28,27,1} +,{29,27,1},{30,27,1},{31,27,1},{32,27,1},{33,27,1},{34,27,1},{35,27,1},{36,27,1} +,{37,27,1},{38,27,1},{39,27,1},{40,27,1},{41,27,1},{42,27,1},{43,27,1},{44,27,1} +,{45,27,1},{46,27,1},{47,27,1},{48,27,1},{49,27,1},{50,27,1},{51,27,1},{52,27,1} +,{53,27,1},{54,27,1},{55,27,1},{56,27,1},{57,27,1},{58,27,1},{59,27,1},{-1,27,1} +,{-2,27,1},{-3,27,1},{-4,27,1},{-5,27,1},{-6,27,1},{-7,27,1},{-8,27,1},{-9,27,1} +,{-10,27,1},{-11,27,1},{-12,27,1},{-13,27,1},{-14,27,1},{-16,27,1},{-17,27,1},{-18,27,1} +,{-19,27,1},{0,28,1},{1,28,1},{2,28,1},{3,28,1},{4,28,1},{5,28,1},{6,28,1} +,{7,28,1},{8,28,1},{9,28,1},{10,28,1},{11,28,1},{12,28,1},{13,28,1},{14,28,1} +,{15,28,1},{16,28,1},{17,28,1},{18,28,1},{19,28,1},{20,28,1},{21,28,1},{22,28,1} +,{23,28,1},{24,28,1},{25,28,1},{26,28,1},{27,28,1},{28,28,1},{29,28,1},{30,28,1} +,{31,28,1},{32,28,1},{33,28,1},{34,28,1},{35,28,1},{36,28,1},{37,28,1},{38,28,1} +,{39,28,1},{40,28,1},{41,28,1},{42,28,1},{43,28,1},{44,28,1},{45,28,1},{46,28,1} +,{47,28,1},{48,28,1},{50,28,1},{51,28,1},{52,28,1},{53,28,1},{54,28,1},{55,28,1} +,{56,28,1},{57,28,1},{58,28,1},{59,28,1},{-1,28,1},{-2,28,1},{-3,28,1},{-4,28,1} +,{-5,28,1},{-6,28,1},{-7,28,1},{-8,28,1},{-9,28,1},{-10,28,1},{-11,28,1},{-12,28,1} +,{-13,28,1},{-14,28,1},{-15,28,1},{-16,28,1},{-17,28,1},{-18,28,1},{-19,28,1},{0,29,1} +,{1,29,1},{2,29,1},{3,29,1},{4,29,1},{5,29,1},{6,29,1},{7,29,1},{8,29,1} +,{9,29,1},{10,29,1},{11,29,1},{12,29,1},{13,29,1},{14,29,1},{15,29,1},{16,29,1} +,{17,29,1},{18,29,1},{19,29,1},{20,29,1},{21,29,1},{22,29,1},{23,29,1},{24,29,1} +,{25,29,1},{26,29,1},{27,29,1},{28,29,1},{29,29,1},{30,29,1},{31,29,1},{32,29,1} +,{33,29,1},{34,29,1},{35,29,1},{36,29,1},{37,29,1},{38,29,1},{39,29,1},{40,29,1} +,{41,29,1},{42,29,1},{43,29,1},{44,29,1},{45,29,1},{46,29,1},{47,29,1},{48,29,1} +,{49,29,1},{50,29,1},{51,29,1},{52,29,1},{53,29,1},{54,29,1},{55,29,1},{56,29,1} +,{57,29,1},{58,29,1},{59,29,1},{-1,29,1},{-2,29,1},{-3,29,1},{-4,29,1},{-5,29,1} +,{-6,29,1},{-7,29,1},{-8,29,1},{-9,29,1},{-10,29,1},{-11,29,1},{-14,29,1},{0,30,1} +,{1,30,1},{2,30,1},{3,30,1},{4,30,1},{5,30,1},{6,30,1},{7,30,1},{8,30,1} +,{9,30,1},{10,30,1},{11,30,1},{12,30,1},{13,30,1},{14,30,1},{15,30,1},{16,30,1} +,{17,30,1},{18,30,1},{19,30,1},{20,30,1},{21,30,1},{22,30,1},{23,30,1},{24,30,1} +,{25,30,1},{26,30,1},{27,30,1},{28,30,1},{29,30,1},{30,30,1},{31,30,1},{32,30,1} +,{33,30,1},{34,30,1},{35,30,1},{36,30,1},{37,30,1},{38,30,1},{39,30,1},{40,30,1} +,{41,30,1},{42,30,1},{43,30,1},{44,30,1},{45,30,1},{46,30,1},{47,30,1},{48,30,1} +,{49,30,1},{50,30,1},{51,30,1},{52,30,1},{53,30,1},{54,30,1},{55,30,1},{56,30,1} +,{57,30,1},{58,30,1},{59,30,1},{-1,30,1},{-2,30,1},{-3,30,1},{-4,30,1},{-5,30,1} +,{-6,30,1},{-7,30,1},{-8,30,1},{-9,30,1},{-10,30,1},{-16,30,1},{-17,30,1},{0,31,1} +,{1,31,1},{2,31,1},{3,31,1},{4,31,1},{5,31,1},{6,31,1},{7,31,1},{8,31,1} +,{9,31,1},{10,31,1},{11,31,1},{12,31,1},{13,31,1},{14,31,1},{15,31,1},{16,31,1} +,{17,31,1},{19,31,1},{20,31,1},{21,31,1},{22,31,1},{23,31,1},{24,31,1},{25,31,1} +,{26,31,1},{27,31,1},{28,31,1},{29,31,1},{30,31,1},{31,31,1},{32,31,1},{33,31,1} +,{34,31,1},{35,31,1},{36,31,1},{37,31,1},{38,31,1},{39,31,1},{40,31,1},{41,31,1} +,{42,31,1},{43,31,1},{44,31,1},{45,31,1},{46,31,1},{47,31,1},{48,31,1},{49,31,1} +,{50,31,1},{51,31,1},{52,31,1},{53,31,1},{54,31,1},{55,31,1},{56,31,1},{57,31,1} +,{58,31,1},{59,31,1},{-1,31,1},{-2,31,1},{-3,31,1},{-4,31,1},{-5,31,1},{-6,31,1} +,{-7,31,1},{-8,31,1},{-9,31,1},{-10,31,1},{0,32,1},{1,32,1},{2,32,1},{3,32,1} +,{4,32,1},{5,32,1},{6,32,1},{7,32,1},{8,32,1},{9,32,1},{10,32,1},{11,32,1} +,{12,32,1},{13,32,1},{14,32,1},{15,32,1},{19,32,1},{20,32,1},{21,32,1},{22,32,1} +,{23,32,1},{24,32,1},{34,32,1},{35,32,1},{36,32,1},{37,32,1},{38,32,1},{39,32,1} +,{40,32,1},{41,32,1},{42,32,1},{43,32,1},{44,32,1},{45,32,1},{46,32,1},{47,32,1} +,{48,32,1},{49,32,1},{50,32,1},{51,32,1},{52,32,1},{53,32,1},{54,32,1},{55,32,1} +,{56,32,1},{57,32,1},{58,32,1},{59,32,1},{-1,32,1},{-2,32,1},{-3,32,1},{-4,32,1} +,{-5,32,1},{-6,32,1},{-7,32,1},{-8,32,1},{-9,32,1},{-10,32,1},{-17,32,1},{-18,32,1} +,{0,33,1},{1,33,1},{2,33,1},{3,33,1},{4,33,1},{5,33,1},{6,33,1},{7,33,1} +,{8,33,1},{9,33,1},{10,33,1},{11,33,1},{35,33,1},{36,33,1},{37,33,1},{38,33,1} +,{39,33,1},{40,33,1},{41,33,1},{42,33,1},{43,33,1},{44,33,1},{45,33,1},{46,33,1} +,{47,33,1},{48,33,1},{49,33,1},{50,33,1},{51,33,1},{52,33,1},{53,33,1},{54,33,1} +,{55,33,1},{56,33,1},{57,33,1},{58,33,1},{59,33,1},{-1,33,1},{-2,33,1},{-3,33,1} +,{-4,33,1},{-5,33,1},{-6,33,1},{-7,33,1},{-8,33,1},{-9,33,1},{-17,33,1},{0,34,1} +,{1,34,1},{2,34,1},{3,34,1},{4,34,1},{5,34,1},{6,34,1},{7,34,1},{8,34,1} +,{9,34,1},{10,34,1},{11,34,1},{23,34,1},{24,34,1},{25,34,1},{26,34,1},{32,34,1} +,{33,34,1},{34,34,1},{35,34,1},{36,34,1},{37,34,1},{38,34,1},{39,34,1},{40,34,1} +,{41,34,1},{42,34,1},{43,34,1},{44,34,1},{45,34,1},{46,34,1},{47,34,1},{48,34,1} +,{49,34,1},{50,34,1},{51,34,1},{52,34,1},{53,34,1},{54,34,1},{55,34,1},{56,34,1} +,{57,34,1},{58,34,1},{59,34,1},{-1,34,1},{-2,34,1},{-3,34,1},{-4,34,1},{-5,34,1} +,{-6,34,1},{-7,34,1},{-26,36,1},{-25,37,1},{-26,37,1},{-28,38,1},{-29,38,1},{-28,39,1} +,{-29,39,1},{-32,39,1},{6,-1,1},{8,-1,1},{9,-1,1},{10,-1,1},{11,-1,1},{12,-1,1} +,{13,-1,1},{14,-1,1},{15,-1,1},{16,-1,1},{17,-1,1},{18,-1,1},{19,-1,1},{20,-1,1} +,{21,-1,1},{22,-1,1},{23,-1,1},{24,-1,1},{25,-1,1},{26,-1,1},{27,-1,1},{28,-1,1} +,{29,-1,1},{30,-1,1},{31,-1,1},{32,-1,1},{33,-1,1},{34,-1,1},{35,-1,1},{36,-1,1} +,{37,-1,1},{38,-1,1},{39,-1,1},{40,-1,1},{41,-1,1},{42,-1,1},{5,-2,1},{8,-2,1} +,{9,-2,1},{10,-2,1},{11,-2,1},{12,-2,1},{13,-2,1},{14,-2,1},{15,-2,1},{16,-2,1} +,{17,-2,1},{18,-2,1},{19,-2,1},{20,-2,1},{21,-2,1},{22,-2,1},{23,-2,1},{24,-2,1} +,{25,-2,1},{26,-2,1},{27,-2,1},{28,-2,1},{29,-2,1},{30,-2,1},{31,-2,1},{32,-2,1} +,{33,-2,1},{34,-2,1},{35,-2,1},{36,-2,1},{37,-2,1},{38,-2,1},{39,-2,1},{40,-2,1} +,{41,-2,1},{42,-2,1},{9,-3,1},{10,-3,1},{11,-3,1},{12,-3,1},{13,-3,1},{14,-3,1} +,{15,-3,1},{16,-3,1},{17,-3,1},{18,-3,1},{19,-3,1},{20,-3,1},{21,-3,1},{22,-3,1} +,{23,-3,1},{24,-3,1},{25,-3,1},{26,-3,1},{27,-3,1},{28,-3,1},{29,-3,1},{30,-3,1} +,{31,-3,1},{32,-3,1},{33,-3,1},{34,-3,1},{35,-3,1},{36,-3,1},{37,-3,1},{38,-3,1} +,{39,-3,1},{40,-3,1},{41,-3,1},{10,-4,1},{11,-4,1},{12,-4,1},{13,-4,1},{14,-4,1} +,{15,-4,1},{16,-4,1},{17,-4,1},{18,-4,1},{19,-4,1},{20,-4,1},{21,-4,1},{22,-4,1} +,{23,-4,1},{24,-4,1},{25,-4,1},{26,-4,1},{27,-4,1},{28,-4,1},{29,-4,1},{30,-4,1} +,{31,-4,1},{32,-4,1},{33,-4,1},{34,-4,1},{35,-4,1},{36,-4,1},{37,-4,1},{38,-4,1} +,{39,-4,1},{40,-4,1},{55,-4,1},{11,-5,1},{12,-5,1},{13,-5,1},{14,-5,1},{15,-5,1} +,{16,-5,1},{17,-5,1},{18,-5,1},{19,-5,1},{20,-5,1},{21,-5,1},{22,-5,1},{23,-5,1} +,{24,-5,1},{25,-5,1},{26,-5,1},{27,-5,1},{28,-5,1},{29,-5,1},{30,-5,1},{31,-5,1} +,{32,-5,1},{33,-5,1},{34,-5,1},{35,-5,1},{36,-5,1},{37,-5,1},{38,-5,1},{39,-5,1} +,{53,-5,1},{55,-5,1},{11,-6,1},{12,-6,1},{13,-6,1},{14,-6,1},{15,-6,1},{16,-6,1} +,{17,-6,1},{18,-6,1},{19,-6,1},{20,-6,1},{21,-6,1},{22,-6,1},{23,-6,1},{24,-6,1} +,{25,-6,1},{26,-6,1},{27,-6,1},{28,-6,1},{29,-6,1},{30,-6,1},{31,-6,1},{32,-6,1} +,{33,-6,1},{34,-6,1},{35,-6,1},{36,-6,1},{37,-6,1},{38,-6,1},{39,-6,1},{53,-6,1} +,{55,-6,1},{12,-7,1},{13,-7,1},{14,-7,1},{15,-7,1},{16,-7,1},{17,-7,1},{18,-7,1} +,{19,-7,1},{20,-7,1},{21,-7,1},{22,-7,1},{23,-7,1},{24,-7,1},{25,-7,1},{26,-7,1} +,{27,-7,1},{28,-7,1},{29,-7,1},{30,-7,1},{31,-7,1},{32,-7,1},{33,-7,1},{34,-7,1} +,{35,-7,1},{36,-7,1},{37,-7,1},{38,-7,1},{39,-7,1},{52,-7,1},{53,-7,1},{12,-8,1} +,{13,-8,1},{14,-8,1},{15,-8,1},{16,-8,1},{17,-8,1},{18,-8,1},{19,-8,1},{20,-8,1} +,{21,-8,1},{22,-8,1},{23,-8,1},{24,-8,1},{25,-8,1},{26,-8,1},{27,-8,1},{28,-8,1} +,{29,-8,1},{30,-8,1},{31,-8,1},{32,-8,1},{33,-8,1},{34,-8,1},{35,-8,1},{36,-8,1} +,{37,-8,1},{38,-8,1},{39,-8,1},{52,-8,1},{56,-8,1},{13,-9,1},{14,-9,1},{15,-9,1} +,{16,-9,1},{17,-9,1},{18,-9,1},{19,-9,1},{20,-9,1},{21,-9,1},{22,-9,1},{23,-9,1} +,{24,-9,1},{25,-9,1},{26,-9,1},{27,-9,1},{28,-9,1},{29,-9,1},{30,-9,1},{31,-9,1} +,{32,-9,1},{33,-9,1},{34,-9,1},{35,-9,1},{36,-9,1},{37,-9,1},{38,-9,1},{39,-9,1} +,{12,-10,1},{13,-10,1},{14,-10,1},{15,-10,1},{16,-10,1},{17,-10,1},{18,-10,1},{19,-10,1} +,{20,-10,1},{21,-10,1},{22,-10,1},{23,-10,1},{24,-10,1},{25,-10,1},{26,-10,1},{27,-10,1} +,{28,-10,1},{29,-10,1},{30,-10,1},{31,-10,1},{32,-10,1},{33,-10,1},{34,-10,1},{35,-10,1} +,{36,-10,1},{37,-10,1},{38,-10,1},{39,-10,1},{46,-10,1},{47,-10,1},{50,-10,1},{51,-10,1} +,{13,-11,1},{14,-11,1},{15,-11,1},{16,-11,1},{17,-11,1},{18,-11,1},{19,-11,1},{20,-11,1} +,{21,-11,1},{22,-11,1},{23,-11,1},{24,-11,1},{25,-11,1},{26,-11,1},{27,-11,1},{28,-11,1} +,{29,-11,1},{30,-11,1},{31,-11,1},{32,-11,1},{33,-11,1},{34,-11,1},{35,-11,1},{36,-11,1} +,{37,-11,1},{38,-11,1},{39,-11,1},{40,-11,1},{47,-11,1},{51,-11,1},{56,-11,1},{13,-12,1} +,{14,-12,1},{15,-12,1},{16,-12,1},{17,-12,1},{18,-12,1},{19,-12,1},{20,-12,1},{21,-12,1} +,{22,-12,1},{23,-12,1},{24,-12,1},{25,-12,1},{26,-12,1},{27,-12,1},{28,-12,1},{29,-12,1} +,{30,-12,1},{31,-12,1},{32,-12,1},{33,-12,1},{34,-12,1},{35,-12,1},{36,-12,1},{37,-12,1} +,{38,-12,1},{39,-12,1},{40,-12,1},{43,-12,1},{47,-12,1},{49,-12,1},{12,-13,1},{13,-13,1} +,{14,-13,1},{15,-13,1},{16,-13,1},{17,-13,1},{18,-13,1},{19,-13,1},{20,-13,1},{21,-13,1} +,{22,-13,1},{23,-13,1},{24,-13,1},{25,-13,1},{26,-13,1},{27,-13,1},{28,-13,1},{29,-13,1} +,{30,-13,1},{31,-13,1},{32,-13,1},{33,-13,1},{34,-13,1},{35,-13,1},{36,-13,1},{37,-13,1} +,{38,-13,1},{39,-13,1},{40,-13,1},{43,-13,1},{44,-13,1},{45,-13,1},{48,-13,1},{49,-13,1} +,{12,-14,1},{13,-14,1},{14,-14,1},{15,-14,1},{16,-14,1},{17,-14,1},{18,-14,1},{19,-14,1} +,{20,-14,1},{21,-14,1},{22,-14,1},{23,-14,1},{24,-14,1},{25,-14,1},{26,-14,1},{27,-14,1} +,{28,-14,1},{29,-14,1},{30,-14,1},{31,-14,1},{32,-14,1},{33,-14,1},{34,-14,1},{35,-14,1} +,{36,-14,1},{37,-14,1},{38,-14,1},{39,-14,1},{40,-14,1},{45,-14,1},{47,-14,1},{48,-14,1} +,{49,-14,1},{50,-14,1},{12,-15,1},{13,-15,1},{14,-15,1},{15,-15,1},{16,-15,1},{17,-15,1} +,{18,-15,1},{19,-15,1},{20,-15,1},{21,-15,1},{22,-15,1},{23,-15,1},{24,-15,1},{25,-15,1} +,{26,-15,1},{27,-15,1},{28,-15,1},{29,-15,1},{30,-15,1},{31,-15,1},{32,-15,1},{33,-15,1} +,{34,-15,1},{35,-15,1},{36,-15,1},{37,-15,1},{38,-15,1},{39,-15,1},{40,-15,1},{47,-15,1} +,{48,-15,1},{49,-15,1},{50,-15,1},{11,-16,1},{12,-16,1},{13,-16,1},{14,-16,1},{15,-16,1} +,{16,-16,1},{17,-16,1},{18,-16,1},{19,-16,1},{20,-16,1},{21,-16,1},{22,-16,1},{23,-16,1} +,{24,-16,1},{25,-16,1},{26,-16,1},{27,-16,1},{28,-16,1},{29,-16,1},{30,-16,1},{31,-16,1} +,{32,-16,1},{33,-16,1},{34,-16,1},{35,-16,1},{36,-16,1},{37,-16,1},{38,-16,1},{39,-16,1} +,{40,-16,1},{45,-16,1},{46,-16,1},{47,-16,1},{48,-16,1},{49,-16,1},{50,-16,1},{54,-16,1} +,{11,-17,1},{12,-17,1},{13,-17,1},{14,-17,1},{15,-17,1},{16,-17,1},{17,-17,1},{18,-17,1} +,{19,-17,1},{20,-17,1},{21,-17,1},{22,-17,1},{23,-17,1},{24,-17,1},{25,-17,1},{26,-17,1} +,{27,-17,1},{28,-17,1},{29,-17,1},{30,-17,1},{31,-17,1},{32,-17,1},{33,-17,1},{34,-17,1} +,{35,-17,1},{36,-17,1},{37,-17,1},{38,-17,1},{39,-17,1},{40,-17,1},{43,-17,1},{44,-17,1} +,{45,-17,1},{46,-17,1},{47,-17,1},{48,-17,1},{49,-17,1},{50,-17,1},{59,-17,1},{11,-18,1} +,{12,-18,1},{13,-18,1},{14,-18,1},{15,-18,1},{16,-18,1},{17,-18,1},{18,-18,1},{19,-18,1} +,{20,-18,1},{21,-18,1},{22,-18,1},{23,-18,1},{24,-18,1},{25,-18,1},{26,-18,1},{27,-18,1} +,{28,-18,1},{29,-18,1},{30,-18,1},{31,-18,1},{32,-18,1},{33,-18,1},{34,-18,1},{35,-18,1} +,{36,-18,1},{37,-18,1},{38,-18,1},{39,-18,1},{42,-18,1},{43,-18,1},{44,-18,1},{45,-18,1} +,{46,-18,1},{47,-18,1},{48,-18,1},{49,-18,1},{11,-19,1},{12,-19,1},{13,-19,1},{14,-19,1} +,{15,-19,1},{16,-19,1},{17,-19,1},{18,-19,1},{19,-19,1},{20,-19,1},{21,-19,1},{22,-19,1} +,{23,-19,1},{24,-19,1},{25,-19,1},{26,-19,1},{27,-19,1},{28,-19,1},{29,-19,1},{30,-19,1} +,{31,-19,1},{32,-19,1},{33,-19,1},{34,-19,1},{35,-19,1},{36,-19,1},{37,-19,1},{43,-19,1} +,{44,-19,1},{45,-19,1},{46,-19,1},{47,-19,1},{48,-19,1},{49,-19,1},{12,-20,1},{13,-20,1} +,{14,-20,1},{15,-20,1},{16,-20,1},{17,-20,1},{18,-20,1},{19,-20,1},{20,-20,1},{21,-20,1} +,{22,-20,1},{23,-20,1},{24,-20,1},{25,-20,1},{26,-20,1},{27,-20,1},{28,-20,1},{29,-20,1} +,{30,-20,1},{31,-20,1},{32,-20,1},{33,-20,1},{34,-20,1},{35,-20,1},{44,-20,1},{45,-20,1} +,{46,-20,1},{47,-20,1},{48,-20,1},{49,-20,1},{57,-20,1},{63,-20,1},{13,-21,1},{14,-21,1} +,{15,-21,1},{16,-21,1},{17,-21,1},{18,-21,1},{19,-21,1},{20,-21,1},{21,-21,1},{22,-21,1} +,{23,-21,1},{24,-21,1},{25,-21,1},{26,-21,1},{27,-21,1},{28,-21,1},{29,-21,1},{30,-21,1} +,{31,-21,1},{32,-21,1},{33,-21,1},{34,-21,1},{35,-21,1},{43,-21,1},{44,-21,1},{45,-21,1} +,{46,-21,1},{47,-21,1},{48,-21,1},{55,-21,1},{57,-21,1},{13,-22,1},{14,-22,1},{15,-22,1} +,{16,-22,1},{17,-22,1},{18,-22,1},{19,-22,1},{20,-22,1},{21,-22,1},{22,-22,1},{23,-22,1} +,{24,-22,1},{25,-22,1},{26,-22,1},{27,-22,1},{28,-22,1},{29,-22,1},{30,-22,1},{31,-22,1} +,{32,-22,1},{33,-22,1},{34,-22,1},{35,-22,1},{43,-22,1},{44,-22,1},{45,-22,1},{46,-22,1} +,{47,-22,1},{48,-22,1},{55,-22,1},{14,-23,1},{15,-23,1},{16,-23,1},{17,-23,1},{18,-23,1} +,{19,-23,1},{20,-23,1},{21,-23,1},{22,-23,1},{23,-23,1},{24,-23,1},{25,-23,1},{26,-23,1} +,{27,-23,1},{28,-23,1},{29,-23,1},{30,-23,1},{31,-23,1},{32,-23,1},{33,-23,1},{34,-23,1} +,{35,-23,1},{40,-23,1},{43,-23,1},{44,-23,1},{45,-23,1},{46,-23,1},{47,-23,1},{48,-23,1} +,{14,-24,1},{15,-24,1},{16,-24,1},{17,-24,1},{18,-24,1},{19,-24,1},{20,-24,1},{21,-24,1} +,{22,-24,1},{23,-24,1},{24,-24,1},{25,-24,1},{26,-24,1},{27,-24,1},{28,-24,1},{29,-24,1} +,{30,-24,1},{31,-24,1},{32,-24,1},{33,-24,1},{34,-24,1},{35,-24,1},{43,-24,1},{44,-24,1} +,{45,-24,1},{46,-24,1},{47,-24,1},{14,-25,1},{15,-25,1},{16,-25,1},{17,-25,1},{18,-25,1} +,{19,-25,1},{20,-25,1},{21,-25,1},{22,-25,1},{23,-25,1},{24,-25,1},{25,-25,1},{26,-25,1} +,{27,-25,1},{28,-25,1},{29,-25,1},{30,-25,1},{31,-25,1},{32,-25,1},{33,-25,1},{34,-25,1} +,{35,-25,1},{43,-25,1},{44,-25,1},{45,-25,1},{46,-25,1},{47,-25,1},{14,-26,1},{15,-26,1} +,{16,-26,1},{17,-26,1},{18,-26,1},{19,-26,1},{20,-26,1},{21,-26,1},{22,-26,1},{23,-26,1} +,{24,-26,1},{25,-26,1},{26,-26,1},{27,-26,1},{28,-26,1},{29,-26,1},{30,-26,1},{31,-26,1} +,{32,-26,1},{33,-26,1},{34,-26,1},{44,-26,1},{45,-26,1},{46,-26,1},{47,-26,1},{14,-27,1} +,{15,-27,1},{16,-27,1},{17,-27,1},{18,-27,1},{19,-27,1},{20,-27,1},{21,-27,1},{22,-27,1} +,{23,-27,1},{24,-27,1},{25,-27,1},{26,-27,1},{27,-27,1},{28,-27,1},{29,-27,1},{30,-27,1} +,{31,-27,1},{32,-27,1},{15,-28,1},{16,-28,1},{17,-28,1},{18,-28,1},{19,-28,1},{20,-28,1} +,{21,-28,1},{22,-28,1},{23,-28,1},{24,-28,1},{25,-28,1},{26,-28,1},{27,-28,1},{28,-28,1} +,{29,-28,1},{30,-28,1},{31,-28,1},{32,-28,1},{15,-29,1},{16,-29,1},{17,-29,1},{18,-29,1} +,{19,-29,1},{20,-29,1},{21,-29,1},{22,-29,1},{23,-29,1},{24,-29,1},{25,-29,1},{26,-29,1} +,{27,-29,1},{28,-29,1},{29,-29,1},{30,-29,1},{31,-29,1},{32,-29,1},{16,-30,1},{17,-30,1} +,{18,-30,1},{19,-30,1},{20,-30,1},{21,-30,1},{22,-30,1},{23,-30,1},{24,-30,1},{25,-30,1} +,{26,-30,1},{27,-30,1},{28,-30,1},{29,-30,1},{30,-30,1},{31,-30,1},{17,-31,1},{18,-31,1} +,{19,-31,1},{20,-31,1},{21,-31,1},{22,-31,1},{23,-31,1},{24,-31,1},{25,-31,1},{26,-31,1} +,{27,-31,1},{28,-31,1},{29,-31,1},{30,-31,1},{17,-32,1},{18,-32,1},{19,-32,1},{20,-32,1} +,{21,-32,1},{22,-32,1},{23,-32,1},{24,-32,1},{25,-32,1},{26,-32,1},{27,-32,1},{28,-32,1} +,{29,-32,1},{30,-32,1},{17,-33,1},{18,-33,1},{19,-33,1},{20,-33,1},{21,-33,1},{22,-33,1} +,{23,-33,1},{24,-33,1},{25,-33,1},{26,-33,1},{27,-33,1},{28,-33,1},{29,-33,1},{17,-34,1} +,{18,-34,1},{19,-34,1},{20,-34,1},{21,-34,1},{22,-34,1},{23,-34,1},{24,-34,1},{25,-34,1} +,{26,-34,1},{27,-34,1},{18,-35,1},{19,-35,1},{20,-35,1},{21,-35,1},{22,-35,1},{23,-35,1} +,{24,-35,1},{25,-35,1},{119,-11,2},{120,-11,2},{121,-11,2},{122,-11,2},{123,-11,2},{124,-11,2} +,{132,-11,2},{133,-11,2},{141,-11,2},{142,-11,2},{143,-11,2},{147,-11,2},{148,-11,2},{149,-11,2} +,{150,-11,2},{151,-11,2},{152,-11,2},{153,-11,2},{161,-11,2},{162,-11,2},{165,-11,2},{166,-11,2} +,{179,-11,2},{-140,-11,2},{-151,-11,2},{-161,-11,2},{-162,-11,2},{-166,-11,2},{122,-12,2},{130,-12,2} +,{131,-12,2},{132,-12,2},{133,-12,2},{134,-12,2},{135,-12,2},{136,-12,2},{141,-12,2},{142,-12,2} +,{143,-12,2},{144,-12,2},{151,-12,2},{152,-12,2},{153,-12,2},{154,-12,2},{159,-12,2},{160,-12,2} +,{166,-12,2},{169,-12,2},{170,-12,2},{-152,-12,2},{-166,-12,2},{-172,-12,2},{122,-13,2},{123,-13,2} +,{130,-13,2},{131,-13,2},{132,-13,2},{133,-13,2},{134,-13,2},{135,-13,2},{136,-13,2},{141,-13,2} +,{142,-13,2},{143,-13,2},{168,-13,2},{176,-13,2},{177,-13,2},{125,-14,2},{126,-14,2},{127,-14,2} +,{129,-14,2},{130,-14,2},{131,-14,2},{132,-14,2},{133,-14,2},{134,-14,2},{135,-14,2},{136,-14,2} +,{141,-14,2},{142,-14,2},{143,-14,2},{144,-14,2},{166,-14,2},{167,-14,2},{-164,-14,2},{-172,-14,2} +,{-173,-14,2},{-177,-14,2},{121,-15,2},{123,-15,2},{124,-15,2},{125,-15,2},{126,-15,2},{127,-15,2} +,{128,-15,2},{129,-15,2},{130,-15,2},{131,-15,2},{132,-15,2},{133,-15,2},{134,-15,2},{135,-15,2} +,{136,-15,2},{141,-15,2},{142,-15,2},{143,-15,2},{144,-15,2},{145,-15,2},{166,-15,2},{167,-15,2} +,{168,-15,2},{-139,-15,2},{-142,-15,2},{-145,-15,2},{-146,-15,2},{-147,-15,2},{-148,-15,2},{-149,-15,2} +,{-169,-15,2},{-170,-15,2},{-171,-15,2},{-172,-15,2},{-178,-15,2},{-179,-15,2},{123,-16,2},{124,-16,2} +,{125,-16,2},{126,-16,2},{127,-16,2},{128,-16,2},{129,-16,2},{130,-16,2},{131,-16,2},{132,-16,2} +,{133,-16,2},{134,-16,2},{135,-16,2},{136,-16,2},{137,-16,2},{141,-16,2},{142,-16,2},{143,-16,2} +,{144,-16,2},{145,-16,2},{166,-16,2},{167,-16,2},{168,-16,2},{-141,-16,2},{-143,-16,2},{-145,-16,2} +,{-146,-16,2},{-147,-16,2},{-148,-16,2},{-149,-16,2},{-155,-16,2},{-174,-16,2},{-176,-16,2},{-180,-16,2} +,{122,-17,2},{123,-17,2},{124,-17,2},{125,-17,2},{126,-17,2},{127,-17,2},{128,-17,2},{129,-17,2} +,{130,-17,2},{131,-17,2},{132,-17,2},{133,-17,2},{134,-17,2},{135,-17,2},{136,-17,2},{137,-17,2} +,{138,-17,2},{139,-17,2},{140,-17,2},{141,-17,2},{142,-17,2},{143,-17,2},{144,-17,2},{145,-17,2} +,{146,-17,2},{149,-17,2},{150,-17,2},{167,-17,2},{168,-17,2},{177,-17,2},{178,-17,2},{179,-17,2} +,{-141,-17,2},{-142,-17,2},{-143,-17,2},{-144,-17,2},{-145,-17,2},{-146,-17,2},{-147,-17,2},{-150,-17,2} +,{-151,-17,2},{-152,-17,2},{-153,-17,2},{-154,-17,2},{-155,-17,2},{-180,-17,2},{118,-18,2},{119,-18,2} +,{122,-18,2},{123,-18,2},{124,-18,2},{125,-18,2},{126,-18,2},{127,-18,2},{128,-18,2},{129,-18,2} +,{130,-18,2},{131,-18,2},{132,-18,2},{133,-18,2},{134,-18,2},{135,-18,2},{136,-18,2},{137,-18,2} +,{138,-18,2},{139,-18,2},{140,-18,2},{141,-18,2},{142,-18,2},{143,-18,2},{144,-18,2},{145,-18,2} +,{146,-18,2},{148,-18,2},{155,-18,2},{168,-18,2},{176,-18,2},{177,-18,2},{178,-18,2},{179,-18,2} +,{-139,-18,2},{-141,-18,2},{-142,-18,2},{-143,-18,2},{-144,-18,2},{-145,-18,2},{-146,-18,2},{-149,-18,2} +,{-150,-18,2},{-151,-18,2},{-179,-18,2},{-180,-18,2},{121,-19,2},{122,-19,2},{123,-19,2},{124,-19,2} +,{125,-19,2},{126,-19,2},{127,-19,2},{128,-19,2},{129,-19,2},{130,-19,2},{131,-19,2},{132,-19,2} +,{133,-19,2},{134,-19,2},{135,-19,2},{136,-19,2},{137,-19,2},{138,-19,2},{139,-19,2},{140,-19,2} +,{141,-19,2},{142,-19,2},{143,-19,2},{144,-19,2},{145,-19,2},{146,-19,2},{162,-19,2},{163,-19,2} +,{168,-19,2},{169,-19,2},{177,-19,2},{178,-19,2},{179,-19,2},{-137,-19,2},{-138,-19,2},{-139,-19,2} +,{-140,-19,2},{-141,-19,2},{-142,-19,2},{-143,-19,2},{-160,-19,2},{-164,-19,2},{-170,-19,2},{-174,-19,2} +,{-175,-19,2},{-179,-19,2},{-180,-19,2},{118,-20,2},{119,-20,2},{120,-20,2},{121,-20,2},{122,-20,2} +,{123,-20,2},{124,-20,2},{125,-20,2},{126,-20,2},{127,-20,2},{128,-20,2},{129,-20,2},{130,-20,2} +,{131,-20,2},{132,-20,2},{133,-20,2},{134,-20,2},{135,-20,2},{136,-20,2},{137,-20,2},{138,-20,2} +,{139,-20,2},{140,-20,2},{141,-20,2},{142,-20,2},{143,-20,2},{144,-20,2},{145,-20,2},{146,-20,2} +,{147,-20,2},{148,-20,2},{158,-20,2},{163,-20,2},{169,-20,2},{170,-20,2},{177,-20,2},{178,-20,2} +,{179,-20,2},{-139,-20,2},{-140,-20,2},{-141,-20,2},{-142,-20,2},{-145,-20,2},{-146,-20,2},{-158,-20,2} +,{-159,-20,2},{-170,-20,2},{-175,-20,2},{-176,-20,2},{-179,-20,2},{-180,-20,2},{115,-21,2},{116,-21,2} +,{117,-21,2},{118,-21,2},{119,-21,2},{120,-21,2},{121,-21,2},{122,-21,2},{123,-21,2},{124,-21,2} +,{125,-21,2},{126,-21,2},{127,-21,2},{128,-21,2},{129,-21,2},{130,-21,2},{131,-21,2},{132,-21,2} +,{133,-21,2},{134,-21,2},{135,-21,2},{136,-21,2},{137,-21,2},{138,-21,2},{139,-21,2},{140,-21,2} +,{141,-21,2},{142,-21,2},{143,-21,2},{144,-21,2},{145,-21,2},{146,-21,2},{147,-21,2},{148,-21,2} +,{149,-21,2},{150,-21,2},{154,-21,2},{163,-21,2},{164,-21,2},{165,-21,2},{166,-21,2},{167,-21,2} +,{169,-21,2},{-139,-21,2},{-140,-21,2},{-144,-21,2},{-158,-21,2},{-159,-21,2},{-175,-21,2},{-176,-21,2} +,{-179,-21,2},{113,-22,2},{114,-22,2},{115,-22,2},{116,-22,2},{117,-22,2},{118,-22,2},{119,-22,2} +,{120,-22,2},{121,-22,2},{122,-22,2},{123,-22,2},{124,-22,2},{125,-22,2},{126,-22,2},{127,-22,2} +,{128,-22,2},{129,-22,2},{130,-22,2},{131,-22,2},{132,-22,2},{133,-22,2},{134,-22,2},{135,-22,2} +,{136,-22,2},{137,-22,2},{138,-22,2},{139,-22,2},{140,-22,2},{141,-22,2},{142,-22,2},{143,-22,2} +,{144,-22,2},{145,-22,2},{146,-22,2},{147,-22,2},{148,-22,2},{149,-22,2},{150,-22,2},{151,-22,2} +,{152,-22,2},{153,-22,2},{154,-22,2},{155,-22,2},{158,-22,2},{164,-22,2},{165,-22,2},{166,-22,2} +,{167,-22,2},{168,-22,2},{-136,-22,2},{-137,-22,2},{-139,-22,2},{-140,-22,2},{-141,-22,2},{-155,-22,2} +,{-158,-22,2},{-160,-22,2},{-175,-22,2},{-176,-22,2},{-179,-22,2},{113,-23,2},{114,-23,2},{115,-23,2} +,{116,-23,2},{117,-23,2},{118,-23,2},{119,-23,2},{120,-23,2},{121,-23,2},{122,-23,2},{123,-23,2} +,{124,-23,2},{125,-23,2},{126,-23,2},{127,-23,2},{128,-23,2},{129,-23,2},{130,-23,2},{131,-23,2} +,{132,-23,2},{133,-23,2},{134,-23,2},{135,-23,2},{136,-23,2},{137,-23,2},{138,-23,2},{139,-23,2} +,{140,-23,2},{141,-23,2},{142,-23,2},{143,-23,2},{144,-23,2},{145,-23,2},{146,-23,2},{147,-23,2} +,{148,-23,2},{149,-23,2},{150,-23,2},{152,-23,2},{155,-23,2},{165,-23,2},{166,-23,2},{167,-23,2} +,{168,-23,2},{171,-23,2},{172,-23,2},{-135,-23,2},{-137,-23,2},{-139,-23,2},{-152,-23,2},{-153,-23,2} +,{-177,-23,2},{113,-24,2},{114,-24,2},{115,-24,2},{116,-24,2},{117,-24,2},{118,-24,2},{119,-24,2} +,{120,-24,2},{121,-24,2},{122,-24,2},{123,-24,2},{124,-24,2},{125,-24,2},{126,-24,2},{127,-24,2} +,{128,-24,2},{129,-24,2},{130,-24,2},{131,-24,2},{132,-24,2},{133,-24,2},{134,-24,2},{135,-24,2} +,{136,-24,2},{137,-24,2},{138,-24,2},{139,-24,2},{140,-24,2},{141,-24,2},{142,-24,2},{143,-24,2} +,{144,-24,2},{145,-24,2},{146,-24,2},{147,-24,2},{148,-24,2},{149,-24,2},{150,-24,2},{151,-24,2} +,{152,-24,2},{155,-24,2},{-131,-24,2},{-135,-24,2},{-136,-24,2},{-138,-24,2},{-148,-24,2},{-150,-24,2} +,{113,-25,2},{114,-25,2},{115,-25,2},{116,-25,2},{117,-25,2},{118,-25,2},{119,-25,2},{120,-25,2} +,{121,-25,2},{122,-25,2},{123,-25,2},{124,-25,2},{125,-25,2},{126,-25,2},{127,-25,2},{128,-25,2} +,{129,-25,2},{130,-25,2},{131,-25,2},{132,-25,2},{133,-25,2},{134,-25,2},{135,-25,2},{136,-25,2} +,{137,-25,2},{138,-25,2},{139,-25,2},{140,-25,2},{141,-25,2},{142,-25,2},{143,-25,2},{144,-25,2} +,{145,-25,2},{146,-25,2},{147,-25,2},{148,-25,2},{149,-25,2},{150,-25,2},{151,-25,2},{152,-25,2} +,{153,-25,2},{-125,-25,2},{-129,-25,2},{112,-26,2},{113,-26,2},{114,-26,2},{115,-26,2},{116,-26,2} +,{117,-26,2},{118,-26,2},{119,-26,2},{120,-26,2},{121,-26,2},{122,-26,2},{123,-26,2},{124,-26,2} +,{125,-26,2},{126,-26,2},{127,-26,2},{128,-26,2},{129,-26,2},{130,-26,2},{131,-26,2},{132,-26,2} +,{133,-26,2},{134,-26,2},{135,-26,2},{136,-26,2},{137,-26,2},{138,-26,2},{139,-26,2},{140,-26,2} +,{141,-26,2},{142,-26,2},{143,-26,2},{144,-26,2},{145,-26,2},{146,-26,2},{147,-26,2},{148,-26,2} +,{149,-26,2},{150,-26,2},{151,-26,2},{152,-26,2},{153,-26,2},{-131,-26,2},{113,-27,2},{114,-27,2} +,{115,-27,2},{116,-27,2},{117,-27,2},{118,-27,2},{119,-27,2},{120,-27,2},{121,-27,2},{122,-27,2} +,{123,-27,2},{124,-27,2},{125,-27,2},{126,-27,2},{127,-27,2},{128,-27,2},{129,-27,2},{130,-27,2} +,{131,-27,2},{132,-27,2},{133,-27,2},{134,-27,2},{135,-27,2},{136,-27,2},{137,-27,2},{138,-27,2} +,{139,-27,2},{140,-27,2},{141,-27,2},{142,-27,2},{143,-27,2},{144,-27,2},{145,-27,2},{146,-27,2} +,{147,-27,2},{148,-27,2},{149,-27,2},{150,-27,2},{151,-27,2},{152,-27,2},{153,-27,2},{-106,-27,2} +,{113,-28,2},{114,-28,2},{115,-28,2},{116,-28,2},{117,-28,2},{118,-28,2},{119,-28,2},{120,-28,2} +,{121,-28,2},{122,-28,2},{123,-28,2},{124,-28,2},{125,-28,2},{126,-28,2},{127,-28,2},{128,-28,2} +,{129,-28,2},{130,-28,2},{131,-28,2},{132,-28,2},{133,-28,2},{134,-28,2},{135,-28,2},{136,-28,2} +,{137,-28,2},{138,-28,2},{139,-28,2},{140,-28,2},{141,-28,2},{142,-28,2},{143,-28,2},{144,-28,2} +,{145,-28,2},{146,-28,2},{147,-28,2},{148,-28,2},{149,-28,2},{150,-28,2},{151,-28,2},{152,-28,2} +,{153,-28,2},{-110,-28,2},{-144,-28,2},{-145,-28,2},{113,-29,2},{114,-29,2},{115,-29,2},{116,-29,2} +,{117,-29,2},{118,-29,2},{119,-29,2},{120,-29,2},{121,-29,2},{122,-29,2},{123,-29,2},{124,-29,2} +,{125,-29,2},{126,-29,2},{127,-29,2},{128,-29,2},{129,-29,2},{130,-29,2},{131,-29,2},{132,-29,2} +,{133,-29,2},{134,-29,2},{135,-29,2},{136,-29,2},{137,-29,2},{138,-29,2},{139,-29,2},{140,-29,2} +,{141,-29,2},{142,-29,2},{143,-29,2},{144,-29,2},{145,-29,2},{146,-29,2},{147,-29,2},{148,-29,2} +,{149,-29,2},{150,-29,2},{151,-29,2},{152,-29,2},{153,-29,2},{114,-30,2},{115,-30,2},{116,-30,2} +,{117,-30,2},{118,-30,2},{119,-30,2},{120,-30,2},{121,-30,2},{122,-30,2},{123,-30,2},{124,-30,2} +,{125,-30,2},{126,-30,2},{127,-30,2},{128,-30,2},{129,-30,2},{130,-30,2},{131,-30,2},{132,-30,2} +,{133,-30,2},{134,-30,2},{135,-30,2},{136,-30,2},{137,-30,2},{138,-30,2},{139,-30,2},{140,-30,2} +,{141,-30,2},{142,-30,2},{143,-30,2},{144,-30,2},{145,-30,2},{146,-30,2},{147,-30,2},{148,-30,2} +,{149,-30,2},{150,-30,2},{151,-30,2},{152,-30,2},{153,-30,2},{114,-31,2},{115,-31,2},{116,-31,2} +,{117,-31,2},{118,-31,2},{119,-31,2},{120,-31,2},{121,-31,2},{122,-31,2},{123,-31,2},{124,-31,2} +,{125,-31,2},{126,-31,2},{127,-31,2},{128,-31,2},{129,-31,2},{130,-31,2},{131,-31,2},{132,-31,2} +,{133,-31,2},{134,-31,2},{135,-31,2},{136,-31,2},{137,-31,2},{138,-31,2},{139,-31,2},{140,-31,2} +,{141,-31,2},{142,-31,2},{143,-31,2},{144,-31,2},{145,-31,2},{146,-31,2},{147,-31,2},{148,-31,2} +,{149,-31,2},{150,-31,2},{151,-31,2},{152,-31,2},{153,-31,2},{115,-32,2},{116,-32,2},{117,-32,2} +,{118,-32,2},{119,-32,2},{120,-32,2},{121,-32,2},{122,-32,2},{123,-32,2},{124,-32,2},{125,-32,2} +,{126,-32,2},{127,-32,2},{128,-32,2},{129,-32,2},{130,-32,2},{131,-32,2},{132,-32,2},{133,-32,2} +,{134,-32,2},{135,-32,2},{136,-32,2},{137,-32,2},{138,-32,2},{139,-32,2},{140,-32,2},{141,-32,2} +,{142,-32,2},{143,-32,2},{144,-32,2},{145,-32,2},{146,-32,2},{147,-32,2},{148,-32,2},{149,-32,2} +,{150,-32,2},{151,-32,2},{152,-32,2},{153,-32,2},{159,-32,2},{115,-33,2},{116,-33,2},{117,-33,2} +,{118,-33,2},{119,-33,2},{120,-33,2},{121,-33,2},{122,-33,2},{123,-33,2},{124,-33,2},{125,-33,2} +,{126,-33,2},{127,-33,2},{128,-33,2},{132,-33,2},{133,-33,2},{134,-33,2},{135,-33,2},{136,-33,2} +,{137,-33,2},{138,-33,2},{139,-33,2},{140,-33,2},{141,-33,2},{142,-33,2},{143,-33,2},{144,-33,2} +,{145,-33,2},{146,-33,2},{147,-33,2},{148,-33,2},{149,-33,2},{150,-33,2},{151,-33,2},{152,-33,2} +,{114,-34,2},{115,-34,2},{116,-34,2},{117,-34,2},{118,-34,2},{119,-34,2},{120,-34,2},{121,-34,2} +,{122,-34,2},{123,-34,2},{124,-34,2},{134,-34,2},{135,-34,2},{136,-34,2},{137,-34,2},{138,-34,2} +,{139,-34,2},{140,-34,2},{141,-34,2},{142,-34,2},{143,-34,2},{144,-34,2},{145,-34,2},{146,-34,2} +,{147,-34,2},{148,-34,2},{149,-34,2},{150,-34,2},{151,-34,2},{114,-35,2},{115,-35,2},{116,-35,2} +,{117,-35,2},{118,-35,2},{119,-35,2},{120,-35,2},{121,-35,2},{122,-35,2},{123,-35,2},{134,-35,2} +,{135,-35,2},{136,-35,2},{137,-35,2},{138,-35,2},{139,-35,2},{140,-35,2},{141,-35,2},{142,-35,2} +,{143,-35,2},{144,-35,2},{145,-35,2},{146,-35,2},{147,-35,2},{148,-35,2},{149,-35,2},{150,-35,2} +,{151,-35,2},{116,-36,2},{117,-36,2},{118,-36,2},{135,-36,2},{136,-36,2},{137,-36,2},{138,-36,2} +,{139,-36,2},{140,-36,2},{141,-36,2},{142,-36,2},{143,-36,2},{144,-36,2},{145,-36,2},{146,-36,2} +,{147,-36,2},{148,-36,2},{149,-36,2},{150,-36,2},{136,-37,2},{137,-37,2},{139,-37,2},{140,-37,2} +,{141,-37,2},{142,-37,2},{143,-37,2},{144,-37,2},{145,-37,2},{146,-37,2},{147,-37,2},{148,-37,2} +,{149,-37,2},{150,-37,2},{139,-38,2},{140,-38,2},{141,-38,2},{142,-38,2},{143,-38,2},{144,-38,2} +,{145,-38,2},{146,-38,2},{147,-38,2},{148,-38,2},{149,-38,2},{150,-38,2},{140,-39,2},{141,-39,2} +,{142,-39,2},{143,-39,2},{144,-39,2},{145,-39,2},{146,-39,2},{147,-39,2},{143,-40,2},{144,-40,2} +,{146,-40,2},{147,-40,2},{148,-40,2},{143,-41,2},{144,-41,2},{145,-41,2},{146,-41,2},{147,-41,2} +,{148,-41,2},{144,-42,2},{145,-42,2},{146,-42,2},{147,-42,2},{148,-42,2},{145,-43,2},{146,-43,2} +,{147,-43,2},{148,-43,2},{145,-44,2},{146,-44,2},{147,-44,2},{148,-44,2},{72,0,3},{73,0,3} +,{97,0,3},{98,0,3},{99,0,3},{100,0,3},{101,0,3},{102,0,3},{103,0,3},{104,0,3} +,{106,0,3},{107,0,3},{108,0,3},{109,0,3},{110,0,3},{111,0,3},{112,0,3},{113,0,3} +,{114,0,3},{115,0,3},{116,0,3},{117,0,3},{118,0,3},{119,0,3},{120,0,3},{121,0,3} +,{122,0,3},{123,0,3},{124,0,3},{126,0,3},{127,0,3},{128,0,3},{129,0,3},{130,0,3} +,{131,0,3},{134,0,3},{172,0,3},{173,0,3},{-177,0,3},{73,1,3},{97,1,3},{98,1,3} +,{99,1,3},{100,1,3},{101,1,3},{102,1,3},{103,1,3},{104,1,3},{106,1,3},{107,1,3} +,{108,1,3},{109,1,3},{110,1,3},{111,1,3},{112,1,3},{113,1,3},{114,1,3},{115,1,3} +,{116,1,3},{117,1,3},{118,1,3},{119,1,3},{120,1,3},{121,1,3},{122,1,3},{124,1,3} +,{125,1,3},{126,1,3},{127,1,3},{128,1,3},{131,1,3},{154,1,3},{172,1,3},{173,1,3} +,{-158,1,3},{72,2,3},{73,2,3},{95,2,3},{96,2,3},{97,2,3},{98,2,3},{99,2,3} +,{100,2,3},{101,2,3},{102,2,3},{103,2,3},{104,2,3},{105,2,3},{106,2,3},{107,2,3} +,{108,2,3},{109,2,3},{111,2,3},{112,2,3},{113,2,3},{114,2,3},{115,2,3},{116,2,3} +,{117,2,3},{118,2,3},{125,2,3},{127,2,3},{128,2,3},{131,2,3},{173,2,3},{-158,2,3} +,{72,3,3},{73,3,3},{95,3,3},{96,3,3},{97,3,3},{98,3,3},{99,3,3},{100,3,3} +,{101,3,3},{102,3,3},{103,3,3},{105,3,3},{106,3,3},{107,3,3},{108,3,3},{112,3,3} +,{113,3,3},{114,3,3},{115,3,3},{116,3,3},{117,3,3},{125,3,3},{126,3,3},{131,3,3} +,{154,3,3},{172,3,3},{173,3,3},{-160,3,3},{72,4,3},{73,4,3},{95,4,3},{96,4,3} +,{97,4,3},{98,4,3},{100,4,3},{101,4,3},{102,4,3},{103,4,3},{107,4,3},{108,4,3} +,{113,4,3},{114,4,3},{115,4,3},{116,4,3},{117,4,3},{118,4,3},{119,4,3},{125,4,3} +,{126,4,3},{127,4,3},{131,4,3},{132,4,3},{168,4,3},{-161,4,3},{72,5,3},{73,5,3} +,{80,5,3},{94,5,3},{95,5,3},{96,5,3},{97,5,3},{100,5,3},{101,5,3},{102,5,3} +,{103,5,3},{114,5,3},{115,5,3},{116,5,3},{117,5,3},{118,5,3},{119,5,3},{120,5,3} +,{121,5,3},{124,5,3},{125,5,3},{126,5,3},{132,5,3},{153,5,3},{157,5,3},{162,5,3} +,{163,5,3},{168,5,3},{169,5,3},{172,5,3},{-163,5,3},{72,6,3},{73,6,3},{79,6,3} +,{80,6,3},{81,6,3},{93,6,3},{95,6,3},{99,6,3},{100,6,3},{101,6,3},{102,6,3} +,{115,6,3},{116,6,3},{117,6,3},{118,6,3},{120,6,3},{121,6,3},{122,6,3},{123,6,3} +,{124,6,3},{125,6,3},{126,6,3},{134,6,3},{143,6,3},{149,6,3},{151,6,3},{152,6,3} +,{157,6,3},{158,6,3},{159,6,3},{160,6,3},{169,6,3},{171,6,3},{172,6,3},{-163,6,3} +,{72,7,3},{73,7,3},{79,7,3},{80,7,3},{81,7,3},{93,7,3},{98,7,3},{99,7,3} +,{100,7,3},{113,7,3},{116,7,3},{117,7,3},{118,7,3},{121,7,3},{122,7,3},{123,7,3} +,{124,7,3},{125,7,3},{126,7,3},{134,7,3},{143,7,3},{144,7,3},{145,7,3},{146,7,3} +,{147,7,3},{149,7,3},{151,7,3},{152,7,3},{155,7,3},{157,7,3},{158,7,3},{168,7,3} +,{171,7,3},{73,8,3},{76,8,3},{77,8,3},{78,8,3},{79,8,3},{80,8,3},{81,8,3} +,{92,8,3},{93,8,3},{97,8,3},{98,8,3},{99,8,3},{100,8,3},{104,8,3},{105,8,3} +,{106,8,3},{111,8,3},{116,8,3},{117,8,3},{118,8,3},{122,8,3},{123,8,3},{124,8,3} +,{125,8,3},{126,8,3},{134,8,3},{137,8,3},{140,8,3},{144,8,3},{146,8,3},{147,8,3} +,{149,8,3},{150,8,3},{151,8,3},{152,8,3},{154,8,3},{165,8,3},{166,8,3},{167,8,3} +,{168,8,3},{170,8,3},{171,8,3},{76,9,3},{77,9,3},{78,9,3},{79,9,3},{80,9,3} +,{92,9,3},{97,9,3},{98,9,3},{99,9,3},{100,9,3},{102,9,3},{103,9,3},{104,9,3} +,{105,9,3},{106,9,3},{109,9,3},{117,9,3},{118,9,3},{119,9,3},{120,9,3},{121,9,3} +,{122,9,3},{123,9,3},{124,9,3},{125,9,3},{126,9,3},{138,9,3},{139,9,3},{140,9,3} +,{145,9,3},{160,9,3},{165,9,3},{166,9,3},{167,9,3},{169,9,3},{170,9,3},{72,10,3} +,{73,10,3},{75,10,3},{76,10,3},{77,10,3},{78,10,3},{79,10,3},{92,10,3},{97,10,3} +,{98,10,3},{99,10,3},{102,10,3},{103,10,3},{104,10,3},{105,10,3},{106,10,3},{107,10,3} +,{108,10,3},{114,10,3},{115,10,3},{118,10,3},{119,10,3},{120,10,3},{121,10,3},{122,10,3} +,{123,10,3},{124,10,3},{125,10,3},{126,10,3},{139,10,3},{165,10,3},{166,10,3},{168,10,3} +,{169,10,3},{170,10,3},{72,11,3},{73,11,3},{75,11,3},{76,11,3},{77,11,3},{78,11,3} +,{79,11,3},{92,11,3},{93,11,3},{97,11,3},{98,11,3},{99,11,3},{102,11,3},{103,11,3} +,{104,11,3},{105,11,3},{106,11,3},{107,11,3},{108,11,3},{109,11,3},{114,11,3},{115,11,3} +,{119,11,3},{120,11,3},{121,11,3},{122,11,3},{123,11,3},{124,11,3},{125,11,3},{162,11,3} +,{165,11,3},{166,11,3},{167,11,3},{169,11,3},{74,12,3},{75,12,3},{76,12,3},{77,12,3} +,{78,12,3},{79,12,3},{80,12,3},{92,12,3},{93,12,3},{97,12,3},{98,12,3},{99,12,3} +,{100,12,3},{101,12,3},{102,12,3},{103,12,3},{104,12,3},{105,12,3},{106,12,3},{107,12,3} +,{108,12,3},{109,12,3},{119,12,3},{120,12,3},{121,12,3},{122,12,3},{123,12,3},{124,12,3} +,{125,12,3},{170,12,3},{74,13,3},{75,13,3},{76,13,3},{77,13,3},{78,13,3},{79,13,3} +,{80,13,3},{92,13,3},{93,13,3},{94,13,3},{97,13,3},{98,13,3},{99,13,3},{100,13,3} +,{101,13,3},{102,13,3},{103,13,3},{104,13,3},{105,13,3},{106,13,3},{107,13,3},{108,13,3} +,{109,13,3},{120,13,3},{121,13,3},{122,13,3},{123,13,3},{124,13,3},{144,13,3},{74,14,3} +,{75,14,3},{76,14,3},{77,14,3},{78,14,3},{79,14,3},{80,14,3},{93,14,3},{97,14,3} +,{98,14,3},{99,14,3},{100,14,3},{101,14,3},{102,14,3},{103,14,3},{104,14,3},{105,14,3} +,{106,14,3},{107,14,3},{108,14,3},{109,14,3},{120,14,3},{121,14,3},{122,14,3},{123,14,3} +,{124,14,3},{145,14,3},{168,14,3},{169,14,3},{73,15,3},{74,15,3},{75,15,3},{76,15,3} +,{77,15,3},{78,15,3},{79,15,3},{80,15,3},{81,15,3},{94,15,3},{95,15,3},{97,15,3} +,{98,15,3},{99,15,3},{100,15,3},{101,15,3},{102,15,3},{103,15,3},{104,15,3},{105,15,3} +,{106,15,3},{107,15,3},{108,15,3},{109,15,3},{111,15,3},{119,15,3},{120,15,3},{121,15,3} +,{122,15,3},{145,15,3},{73,16,3},{74,16,3},{75,16,3},{76,16,3},{77,16,3},{78,16,3} +,{79,16,3},{80,16,3},{81,16,3},{82,16,3},{94,16,3},{95,16,3},{96,16,3},{97,16,3} +,{98,16,3},{99,16,3},{100,16,3},{101,16,3},{102,16,3},{103,16,3},{104,16,3},{105,16,3} +,{106,16,3},{107,16,3},{108,16,3},{111,16,3},{112,16,3},{119,16,3},{120,16,3},{121,16,3} +,{122,16,3},{145,16,3},{146,16,3},{73,17,3},{74,17,3},{75,17,3},{76,17,3},{77,17,3} +,{78,17,3},{79,17,3},{80,17,3},{81,17,3},{82,17,3},{83,17,3},{94,17,3},{95,17,3} +,{96,17,3},{97,17,3},{98,17,3},{99,17,3},{100,17,3},{101,17,3},{102,17,3},{103,17,3} +,{104,17,3},{105,17,3},{106,17,3},{107,17,3},{120,17,3},{121,17,3},{122,17,3},{145,17,3} +,{72,18,3},{73,18,3},{74,18,3},{75,18,3},{76,18,3},{77,18,3},{78,18,3},{79,18,3} +,{80,18,3},{81,18,3},{82,18,3},{83,18,3},{84,18,3},{93,18,3},{94,18,3},{95,18,3} +,{96,18,3},{97,18,3},{98,18,3},{99,18,3},{100,18,3},{101,18,3},{102,18,3},{103,18,3} +,{104,18,3},{105,18,3},{106,18,3},{108,18,3},{109,18,3},{110,18,3},{120,18,3},{121,18,3} +,{122,18,3},{145,18,3},{72,19,3},{73,19,3},{74,19,3},{75,19,3},{76,19,3},{77,19,3} +,{78,19,3},{79,19,3},{80,19,3},{81,19,3},{82,19,3},{83,19,3},{84,19,3},{85,19,3} +,{86,19,3},{92,19,3},{93,19,3},{94,19,3},{95,19,3},{96,19,3},{97,19,3},{98,19,3} +,{99,19,3},{100,19,3},{101,19,3},{102,19,3},{103,19,3},{104,19,3},{105,19,3},{106,19,3} +,{108,19,3},{109,19,3},{110,19,3},{111,19,3},{121,19,3},{122,19,3},{145,19,3},{166,19,3} +,{70,20,3},{71,20,3},{72,20,3},{73,20,3},{74,20,3},{75,20,3},{76,20,3},{77,20,3} +,{78,20,3},{79,20,3},{80,20,3},{81,20,3},{82,20,3},{83,20,3},{84,20,3},{85,20,3} +,{86,20,3},{87,20,3},{92,20,3},{93,20,3},{94,20,3},{95,20,3},{96,20,3},{97,20,3} +,{98,20,3},{99,20,3},{100,20,3},{101,20,3},{102,20,3},{103,20,3},{104,20,3},{105,20,3} +,{106,20,3},{107,20,3},{109,20,3},{110,20,3},{116,20,3},{121,20,3},{122,20,3},{136,20,3} +,{144,20,3},{145,20,3},{69,21,3},{70,21,3},{71,21,3},{72,21,3},{73,21,3},{74,21,3} +,{75,21,3},{76,21,3},{77,21,3},{78,21,3},{79,21,3},{80,21,3},{81,21,3},{82,21,3} +,{83,21,3},{84,21,3},{85,21,3},{86,21,3},{87,21,3},{88,21,3},{89,21,3},{90,21,3} +,{91,21,3},{92,21,3},{93,21,3},{94,21,3},{95,21,3},{96,21,3},{97,21,3},{98,21,3} +,{99,21,3},{100,21,3},{101,21,3},{102,21,3},{103,21,3},{104,21,3},{105,21,3},{106,21,3} +,{107,21,3},{108,21,3},{109,21,3},{110,21,3},{111,21,3},{112,21,3},{113,21,3},{114,21,3} +,{120,21,3},{121,21,3},{68,22,3},{69,22,3},{70,22,3},{71,22,3},{72,22,3},{73,22,3} +,{74,22,3},{75,22,3},{76,22,3},{77,22,3},{78,22,3},{79,22,3},{80,22,3},{81,22,3} +,{82,22,3},{83,22,3},{84,22,3},{85,22,3},{86,22,3},{87,22,3},{88,22,3},{89,22,3} +,{90,22,3},{91,22,3},{92,22,3},{93,22,3},{94,22,3},{95,22,3},{96,22,3},{97,22,3} +,{98,22,3},{99,22,3},{100,22,3},{101,22,3},{102,22,3},{103,22,3},{104,22,3},{105,22,3} +,{106,22,3},{107,22,3},{108,22,3},{109,22,3},{110,22,3},{111,22,3},{112,22,3},{113,22,3} +,{114,22,3},{115,22,3},{116,22,3},{120,22,3},{121,22,3},{67,23,3},{68,23,3},{69,23,3} +,{70,23,3},{71,23,3},{72,23,3},{73,23,3},{74,23,3},{75,23,3},{76,23,3},{77,23,3} +,{78,23,3},{79,23,3},{80,23,3},{81,23,3},{82,23,3},{83,23,3},{84,23,3},{85,23,3} +,{86,23,3},{87,23,3},{88,23,3},{89,23,3},{90,23,3},{91,23,3},{92,23,3},{93,23,3} +,{94,23,3},{95,23,3},{96,23,3},{97,23,3},{98,23,3},{99,23,3},{100,23,3},{101,23,3} +,{102,23,3},{103,23,3},{104,23,3},{105,23,3},{106,23,3},{107,23,3},{108,23,3},{109,23,3} +,{110,23,3},{111,23,3},{112,23,3},{113,23,3},{114,23,3},{115,23,3},{116,23,3},{117,23,3} +,{119,23,3},{120,23,3},{121,23,3},{66,24,3},{67,24,3},{68,24,3},{69,24,3},{70,24,3} +,{71,24,3},{72,24,3},{73,24,3},{74,24,3},{75,24,3},{76,24,3},{77,24,3},{78,24,3} +,{79,24,3},{80,24,3},{81,24,3},{82,24,3},{83,24,3},{84,24,3},{85,24,3},{86,24,3} +,{87,24,3},{88,24,3},{89,24,3},{90,24,3},{91,24,3},{92,24,3},{93,24,3},{94,24,3} +,{95,24,3},{96,24,3},{97,24,3},{98,24,3},{99,24,3},{100,24,3},{101,24,3},{102,24,3} +,{103,24,3},{104,24,3},{105,24,3},{106,24,3},{107,24,3},{108,24,3},{109,24,3},{110,24,3} +,{111,24,3},{112,24,3},{113,24,3},{114,24,3},{115,24,3},{116,24,3},{117,24,3},{118,24,3} +,{119,24,3},{120,24,3},{121,24,3},{122,24,3},{123,24,3},{124,24,3},{125,24,3},{131,24,3} +,{141,24,3},{153,24,3},{60,25,3},{61,25,3},{62,25,3},{63,25,3},{64,25,3},{65,25,3} +,{66,25,3},{67,25,3},{68,25,3},{69,25,3},{70,25,3},{71,25,3},{72,25,3},{73,25,3} +,{74,25,3},{75,25,3},{76,25,3},{77,25,3},{78,25,3},{79,25,3},{80,25,3},{81,25,3} +,{82,25,3},{83,25,3},{84,25,3},{85,25,3},{86,25,3},{87,25,3},{88,25,3},{89,25,3} +,{90,25,3},{91,25,3},{92,25,3},{93,25,3},{94,25,3},{95,25,3},{96,25,3},{97,25,3} +,{98,25,3},{99,25,3},{100,25,3},{101,25,3},{102,25,3},{103,25,3},{104,25,3},{105,25,3} +,{106,25,3},{107,25,3},{108,25,3},{109,25,3},{110,25,3},{111,25,3},{112,25,3},{113,25,3} +,{114,25,3},{115,25,3},{116,25,3},{117,25,3},{118,25,3},{119,25,3},{121,25,3},{122,25,3} +,{123,25,3},{124,25,3},{131,25,3},{141,25,3},{60,26,3},{61,26,3},{62,26,3},{63,26,3} +,{64,26,3},{65,26,3},{66,26,3},{67,26,3},{68,26,3},{69,26,3},{70,26,3},{71,26,3} +,{72,26,3},{73,26,3},{74,26,3},{75,26,3},{76,26,3},{77,26,3},{78,26,3},{79,26,3} +,{80,26,3},{81,26,3},{82,26,3},{83,26,3},{84,26,3},{85,26,3},{86,26,3},{87,26,3} +,{88,26,3},{89,26,3},{90,26,3},{91,26,3},{92,26,3},{93,26,3},{94,26,3},{95,26,3} +,{96,26,3},{97,26,3},{98,26,3},{99,26,3},{100,26,3},{101,26,3},{102,26,3},{103,26,3} +,{104,26,3},{105,26,3},{106,26,3},{107,26,3},{108,26,3},{109,26,3},{110,26,3},{111,26,3} +,{112,26,3},{113,26,3},{114,26,3},{115,26,3},{116,26,3},{117,26,3},{118,26,3},{119,26,3} +,{120,26,3},{126,26,3},{127,26,3},{128,26,3},{142,26,3},{60,27,3},{61,27,3},{62,27,3} +,{63,27,3},{64,27,3},{65,27,3},{66,27,3},{67,27,3},{68,27,3},{69,27,3},{70,27,3} +,{71,27,3},{72,27,3},{73,27,3},{74,27,3},{75,27,3},{76,27,3},{77,27,3},{78,27,3} +,{79,27,3},{80,27,3},{81,27,3},{82,27,3},{83,27,3},{84,27,3},{85,27,3},{86,27,3} +,{87,27,3},{88,27,3},{89,27,3},{90,27,3},{91,27,3},{92,27,3},{93,27,3},{94,27,3} +,{95,27,3},{96,27,3},{97,27,3},{98,27,3},{99,27,3},{100,27,3},{101,27,3},{102,27,3} +,{103,27,3},{104,27,3},{105,27,3},{106,27,3},{107,27,3},{108,27,3},{109,27,3},{110,27,3} +,{111,27,3},{112,27,3},{113,27,3},{114,27,3},{115,27,3},{116,27,3},{117,27,3},{118,27,3} +,{119,27,3},{120,27,3},{121,27,3},{127,27,3},{128,27,3},{129,27,3},{140,27,3},{142,27,3} +,{60,28,3},{61,28,3},{62,28,3},{63,28,3},{64,28,3},{65,28,3},{66,28,3},{67,28,3} +,{68,28,3},{69,28,3},{70,28,3},{71,28,3},{72,28,3},{73,28,3},{74,28,3},{75,28,3} +,{76,28,3},{77,28,3},{78,28,3},{79,28,3},{80,28,3},{81,28,3},{82,28,3},{83,28,3} +,{84,28,3},{85,28,3},{86,28,3},{87,28,3},{88,28,3},{89,28,3},{90,28,3},{91,28,3} +,{92,28,3},{93,28,3},{94,28,3},{95,28,3},{96,28,3},{97,28,3},{98,28,3},{99,28,3} +,{100,28,3},{101,28,3},{102,28,3},{103,28,3},{104,28,3},{105,28,3},{106,28,3},{107,28,3} +,{108,28,3},{109,28,3},{110,28,3},{111,28,3},{112,28,3},{113,28,3},{114,28,3},{115,28,3} +,{116,28,3},{117,28,3},{118,28,3},{119,28,3},{120,28,3},{121,28,3},{122,28,3},{128,28,3} +,{129,28,3},{130,28,3},{60,29,3},{61,29,3},{62,29,3},{63,29,3},{64,29,3},{65,29,3} +,{66,29,3},{67,29,3},{68,29,3},{69,29,3},{70,29,3},{71,29,3},{72,29,3},{73,29,3} +,{74,29,3},{75,29,3},{76,29,3},{77,29,3},{78,29,3},{79,29,3},{80,29,3},{81,29,3} +,{82,29,3},{83,29,3},{84,29,3},{85,29,3},{86,29,3},{87,29,3},{88,29,3},{89,29,3} +,{90,29,3},{91,29,3},{92,29,3},{93,29,3},{94,29,3},{95,29,3},{96,29,3},{97,29,3} +,{98,29,3},{99,29,3},{100,29,3},{101,29,3},{102,29,3},{103,29,3},{104,29,3},{105,29,3} +,{106,29,3},{107,29,3},{108,29,3},{109,29,3},{110,29,3},{111,29,3},{112,29,3},{113,29,3} +,{114,29,3},{115,29,3},{116,29,3},{117,29,3},{118,29,3},{119,29,3},{120,29,3},{121,29,3} +,{122,29,3},{129,29,3},{140,29,3},{60,30,3},{61,30,3},{62,30,3},{63,30,3},{64,30,3} +,{65,30,3},{66,30,3},{67,30,3},{68,30,3},{69,30,3},{70,30,3},{71,30,3},{72,30,3} +,{73,30,3},{74,30,3},{75,30,3},{76,30,3},{77,30,3},{78,30,3},{79,30,3},{80,30,3} +,{81,30,3},{82,30,3},{83,30,3},{84,30,3},{85,30,3},{86,30,3},{87,30,3},{88,30,3} +,{89,30,3},{90,30,3},{91,30,3},{92,30,3},{93,30,3},{94,30,3},{95,30,3},{96,30,3} +,{97,30,3},{98,30,3},{99,30,3},{100,30,3},{101,30,3},{102,30,3},{103,30,3},{104,30,3} +,{105,30,3},{106,30,3},{107,30,3},{108,30,3},{109,30,3},{110,30,3},{111,30,3},{112,30,3} +,{113,30,3},{114,30,3},{115,30,3},{116,30,3},{117,30,3},{118,30,3},{119,30,3},{120,30,3} +,{121,30,3},{122,30,3},{129,30,3},{130,30,3},{131,30,3},{140,30,3},{60,31,3},{61,31,3} +,{62,31,3},{63,31,3},{64,31,3},{65,31,3},{66,31,3},{67,31,3},{68,31,3},{69,31,3} +,{70,31,3},{71,31,3},{72,31,3},{73,31,3},{74,31,3},{75,31,3},{76,31,3},{77,31,3} +,{78,31,3},{79,31,3},{80,31,3},{81,31,3},{82,31,3},{83,31,3},{84,31,3},{85,31,3} +,{86,31,3},{87,31,3},{88,31,3},{89,31,3},{90,31,3},{91,31,3},{92,31,3},{93,31,3} +,{94,31,3},{95,31,3},{96,31,3},{97,31,3},{98,31,3},{99,31,3},{100,31,3},{101,31,3} +,{102,31,3},{103,31,3},{104,31,3},{105,31,3},{106,31,3},{107,31,3},{108,31,3},{109,31,3} +,{110,31,3},{111,31,3},{112,31,3},{113,31,3},{114,31,3},{115,31,3},{116,31,3},{117,31,3} +,{118,31,3},{119,31,3},{120,31,3},{121,31,3},{122,31,3},{128,31,3},{129,31,3},{130,31,3} +,{131,31,3},{139,31,3},{140,31,3},{60,32,3},{61,32,3},{62,32,3},{63,32,3},{64,32,3} +,{65,32,3},{66,32,3},{67,32,3},{68,32,3},{69,32,3},{70,32,3},{71,32,3},{72,32,3} +,{73,32,3},{74,32,3},{75,32,3},{76,32,3},{77,32,3},{78,32,3},{79,32,3},{80,32,3} +,{81,32,3},{82,32,3},{83,32,3},{84,32,3},{85,32,3},{86,32,3},{87,32,3},{88,32,3} +,{89,32,3},{90,32,3},{91,32,3},{92,32,3},{93,32,3},{94,32,3},{95,32,3},{96,32,3} +,{97,32,3},{98,32,3},{99,32,3},{100,32,3},{101,32,3},{102,32,3},{103,32,3},{104,32,3} +,{105,32,3},{106,32,3},{107,32,3},{108,32,3},{109,32,3},{110,32,3},{111,32,3},{112,32,3} +,{113,32,3},{114,32,3},{115,32,3},{116,32,3},{117,32,3},{118,32,3},{119,32,3},{120,32,3} +,{121,32,3},{128,32,3},{129,32,3},{130,32,3},{131,32,3},{132,32,3},{133,32,3},{139,32,3} +,{60,33,3},{61,33,3},{62,33,3},{63,33,3},{64,33,3},{65,33,3},{66,33,3},{67,33,3} +,{68,33,3},{69,33,3},{70,33,3},{71,33,3},{72,33,3},{73,33,3},{74,33,3},{75,33,3} +,{76,33,3},{77,33,3},{78,33,3},{79,33,3},{80,33,3},{81,33,3},{82,33,3},{83,33,3} +,{84,33,3},{85,33,3},{86,33,3},{87,33,3},{88,33,3},{89,33,3},{90,33,3},{91,33,3} +,{92,33,3},{93,33,3},{94,33,3},{95,33,3},{96,33,3},{97,33,3},{98,33,3},{99,33,3} +,{100,33,3},{101,33,3},{102,33,3},{103,33,3},{104,33,3},{105,33,3},{106,33,3},{107,33,3} +,{108,33,3},{109,33,3},{110,33,3},{111,33,3},{112,33,3},{113,33,3},{114,33,3},{115,33,3} +,{116,33,3},{117,33,3},{118,33,3},{119,33,3},{120,33,3},{126,33,3},{128,33,3},{129,33,3} +,{130,33,3},{131,33,3},{132,33,3},{133,33,3},{134,33,3},{135,33,3},{136,33,3},{138,33,3} +,{139,33,3},{60,34,3},{61,34,3},{62,34,3},{63,34,3},{64,34,3},{65,34,3},{66,34,3} +,{67,34,3},{68,34,3},{69,34,3},{70,34,3},{71,34,3},{72,34,3},{73,34,3},{74,34,3} +,{75,34,3},{76,34,3},{77,34,3},{78,34,3},{79,34,3},{80,34,3},{81,34,3},{82,34,3} +,{83,34,3},{84,34,3},{85,34,3},{86,34,3},{87,34,3},{88,34,3},{89,34,3},{90,34,3} +,{91,34,3},{92,34,3},{93,34,3},{94,34,3},{95,34,3},{96,34,3},{97,34,3},{98,34,3} +,{99,34,3},{100,34,3},{101,34,3},{102,34,3},{103,34,3},{104,34,3},{105,34,3},{106,34,3} +,{107,34,3},{108,34,3},{109,34,3},{110,34,3},{111,34,3},{112,34,3},{113,34,3},{114,34,3} +,{115,34,3},{116,34,3},{117,34,3},{118,34,3},{119,34,3},{120,34,3},{125,34,3},{126,34,3} +,{127,34,3},{128,34,3},{129,34,3},{130,34,3},{131,34,3},{132,34,3},{133,34,3},{134,34,3} +,{135,34,3},{136,34,3},{137,34,3},{138,34,3},{139,34,3},{0,35,3},{1,35,3},{2,35,3} +,{3,35,3},{4,35,3},{5,35,3},{6,35,3},{7,35,3},{8,35,3},{9,35,3},{10,35,3} +,{11,35,3},{12,35,3},{14,35,3},{23,35,3},{24,35,3},{25,35,3},{26,35,3},{27,35,3} +,{32,35,3},{33,35,3},{34,35,3},{35,35,3},{36,35,3},{37,35,3},{38,35,3},{39,35,3} +,{40,35,3},{41,35,3},{42,35,3},{43,35,3},{44,35,3},{45,35,3},{46,35,3},{47,35,3} +,{48,35,3},{49,35,3},{50,35,3},{51,35,3},{52,35,3},{53,35,3},{54,35,3},{55,35,3} +,{56,35,3},{57,35,3},{58,35,3},{59,35,3},{60,35,3},{61,35,3},{62,35,3},{63,35,3} +,{64,35,3},{65,35,3},{66,35,3},{67,35,3},{68,35,3},{69,35,3},{70,35,3},{71,35,3} +,{72,35,3},{73,35,3},{74,35,3},{75,35,3},{76,35,3},{77,35,3},{78,35,3},{79,35,3} +,{80,35,3},{81,35,3},{82,35,3},{83,35,3},{84,35,3},{85,35,3},{86,35,3},{87,35,3} +,{88,35,3},{89,35,3},{90,35,3},{91,35,3},{92,35,3},{93,35,3},{94,35,3},{95,35,3} +,{96,35,3},{97,35,3},{98,35,3},{99,35,3},{100,35,3},{101,35,3},{102,35,3},{103,35,3} +,{104,35,3},{105,35,3},{106,35,3},{107,35,3},{108,35,3},{109,35,3},{110,35,3},{111,35,3} +,{112,35,3},{113,35,3},{114,35,3},{115,35,3},{116,35,3},{117,35,3},{118,35,3},{119,35,3} +,{120,35,3},{125,35,3},{126,35,3},{127,35,3},{128,35,3},{129,35,3},{132,35,3},{133,35,3} +,{134,35,3},{135,35,3},{136,35,3},{137,35,3},{138,35,3},{139,35,3},{140,35,3},{-1,35,3} +,{-2,35,3},{-3,35,3},{-4,35,3},{-5,35,3},{-6,35,3},{-7,35,3},{0,36,3},{1,36,3} +,{2,36,3},{3,36,3},{4,36,3},{5,36,3},{6,36,3},{7,36,3},{8,36,3},{9,36,3} +,{10,36,3},{11,36,3},{12,36,3},{14,36,3},{15,36,3},{21,36,3},{22,36,3},{23,36,3} +,{24,36,3},{25,36,3},{26,36,3},{27,36,3},{28,36,3},{29,36,3},{30,36,3},{31,36,3} +,{32,36,3},{33,36,3},{34,36,3},{35,36,3},{36,36,3},{37,36,3},{38,36,3},{39,36,3} +,{40,36,3},{41,36,3},{42,36,3},{43,36,3},{44,36,3},{45,36,3},{46,36,3},{47,36,3} +,{48,36,3},{49,36,3},{50,36,3},{51,36,3},{52,36,3},{53,36,3},{54,36,3},{55,36,3} +,{56,36,3},{57,36,3},{58,36,3},{59,36,3},{60,36,3},{61,36,3},{62,36,3},{63,36,3} +,{64,36,3},{65,36,3},{66,36,3},{67,36,3},{68,36,3},{69,36,3},{70,36,3},{71,36,3} +,{72,36,3},{73,36,3},{74,36,3},{75,36,3},{76,36,3},{77,36,3},{78,36,3},{79,36,3} +,{80,36,3},{81,36,3},{82,36,3},{83,36,3},{84,36,3},{85,36,3},{86,36,3},{87,36,3} +,{88,36,3},{89,36,3},{90,36,3},{91,36,3},{92,36,3},{93,36,3},{94,36,3},{95,36,3} +,{96,36,3},{97,36,3},{98,36,3},{99,36,3},{100,36,3},{101,36,3},{102,36,3},{103,36,3} +,{104,36,3},{105,36,3},{106,36,3},{107,36,3},{108,36,3},{109,36,3},{110,36,3},{111,36,3} +,{112,36,3},{113,36,3},{114,36,3},{115,36,3},{116,36,3},{117,36,3},{118,36,3},{119,36,3} +,{120,36,3},{121,36,3},{122,36,3},{125,36,3},{126,36,3},{127,36,3},{128,36,3},{129,36,3} +,{132,36,3},{133,36,3},{135,36,3},{136,36,3},{137,36,3},{138,36,3},{139,36,3},{140,36,3} +,{-2,36,3},{-3,36,3},{-4,36,3},{-5,36,3},{-6,36,3},{-7,36,3},{-8,36,3},{-9,36,3} +,{6,37,3},{7,37,3},{8,37,3},{9,37,3},{10,37,3},{11,37,3},{12,37,3},{13,37,3} +,{14,37,3},{15,37,3},{16,37,3},{20,37,3},{21,37,3},{22,37,3},{23,37,3},{24,37,3} +,{25,37,3},{26,37,3},{27,37,3},{28,37,3},{29,37,3},{30,37,3},{31,37,3},{32,37,3} +,{33,37,3},{34,37,3},{35,37,3},{36,37,3},{37,37,3},{38,37,3},{39,37,3},{40,37,3} +,{41,37,3},{42,37,3},{43,37,3},{44,37,3},{45,37,3},{46,37,3},{47,37,3},{48,37,3} +,{49,37,3},{50,37,3},{53,37,3},{54,37,3},{55,37,3},{56,37,3},{57,37,3},{58,37,3} +,{59,37,3},{60,37,3},{61,37,3},{62,37,3},{63,37,3},{64,37,3},{65,37,3},{66,37,3} +,{67,37,3},{68,37,3},{69,37,3},{70,37,3},{71,37,3},{72,37,3},{73,37,3},{74,37,3} +,{75,37,3},{76,37,3},{77,37,3},{78,37,3},{79,37,3},{80,37,3},{81,37,3},{82,37,3} +,{83,37,3},{84,37,3},{85,37,3},{86,37,3},{87,37,3},{88,37,3},{89,37,3},{90,37,3} +,{91,37,3},{92,37,3},{93,37,3},{94,37,3},{95,37,3},{96,37,3},{97,37,3},{98,37,3} +,{99,37,3},{100,37,3},{101,37,3},{102,37,3},{103,37,3},{104,37,3},{105,37,3},{106,37,3} +,{107,37,3},{108,37,3},{109,37,3},{110,37,3},{111,37,3},{112,37,3},{113,37,3},{114,37,3} +,{115,37,3},{116,37,3},{117,37,3},{118,37,3},{119,37,3},{120,37,3},{121,37,3},{122,37,3} +,{124,37,3},{125,37,3},{126,37,3},{127,37,3},{128,37,3},{129,37,3},{130,37,3},{131,37,3} +,{136,37,3},{137,37,3},{138,37,3},{139,37,3},{140,37,3},{141,37,3},{-1,37,3},{-2,37,3} +,{-3,37,3},{-4,37,3},{-5,37,3},{-6,37,3},{-7,37,3},{-8,37,3},{-9,37,3},{0,38,3} +,{1,38,3},{8,38,3},{9,38,3},{12,38,3},{13,38,3},{14,38,3},{15,38,3},{16,38,3} +,{17,38,3},{20,38,3},{21,38,3},{22,38,3},{23,38,3},{24,38,3},{25,38,3},{26,38,3} +,{27,38,3},{28,38,3},{29,38,3},{30,38,3},{31,38,3},{32,38,3},{33,38,3},{34,38,3} +,{35,38,3},{36,38,3},{37,38,3},{38,38,3},{39,38,3},{40,38,3},{41,38,3},{42,38,3} +,{43,38,3},{44,38,3},{45,38,3},{46,38,3},{47,38,3},{48,38,3},{49,38,3},{53,38,3} +,{54,38,3},{55,38,3},{56,38,3},{57,38,3},{58,38,3},{59,38,3},{60,38,3},{61,38,3} +,{62,38,3},{63,38,3},{64,38,3},{65,38,3},{66,38,3},{67,38,3},{68,38,3},{69,38,3} +,{70,38,3},{71,38,3},{72,38,3},{73,38,3},{74,38,3},{75,38,3},{76,38,3},{77,38,3} +,{78,38,3},{79,38,3},{80,38,3},{81,38,3},{82,38,3},{83,38,3},{84,38,3},{85,38,3} +,{86,38,3},{87,38,3},{88,38,3},{89,38,3},{90,38,3},{91,38,3},{92,38,3},{93,38,3} +,{94,38,3},{95,38,3},{96,38,3},{97,38,3},{98,38,3},{99,38,3},{100,38,3},{101,38,3} +,{102,38,3},{103,38,3},{104,38,3},{105,38,3},{106,38,3},{107,38,3},{108,38,3},{109,38,3} +,{110,38,3},{111,38,3},{112,38,3},{113,38,3},{114,38,3},{115,38,3},{116,38,3},{117,38,3} +,{118,38,3},{120,38,3},{121,38,3},{124,38,3},{125,38,3},{126,38,3},{127,38,3},{128,38,3} +,{138,38,3},{139,38,3},{140,38,3},{141,38,3},{-1,38,3},{-2,38,3},{-3,38,3},{-4,38,3} +,{-5,38,3},{-6,38,3},{-7,38,3},{-8,38,3},{-9,38,3},{-10,38,3},{0,39,3},{1,39,3} +,{2,39,3},{3,39,3},{4,39,3},{8,39,3},{9,39,3},{15,39,3},{16,39,3},{17,39,3} +,{18,39,3},{19,39,3},{20,39,3},{21,39,3},{22,39,3},{23,39,3},{24,39,3},{25,39,3} +,{26,39,3},{27,39,3},{28,39,3},{29,39,3},{30,39,3},{31,39,3},{32,39,3},{33,39,3} +,{34,39,3},{35,39,3},{36,39,3},{37,39,3},{38,39,3},{39,39,3},{40,39,3},{41,39,3} +,{42,39,3},{43,39,3},{44,39,3},{45,39,3},{46,39,3},{47,39,3},{48,39,3},{49,39,3} +,{52,39,3},{53,39,3},{54,39,3},{55,39,3},{56,39,3},{57,39,3},{58,39,3},{59,39,3} +,{60,39,3},{61,39,3},{62,39,3},{63,39,3},{64,39,3},{65,39,3},{66,39,3},{67,39,3} +,{68,39,3},{69,39,3},{70,39,3},{71,39,3},{72,39,3},{73,39,3},{74,39,3},{75,39,3} +,{76,39,3},{77,39,3},{78,39,3},{79,39,3},{80,39,3},{81,39,3},{82,39,3},{83,39,3} +,{84,39,3},{85,39,3},{86,39,3},{87,39,3},{88,39,3},{89,39,3},{90,39,3},{91,39,3} +,{92,39,3},{93,39,3},{94,39,3},{95,39,3},{96,39,3},{97,39,3},{98,39,3},{99,39,3} +,{100,39,3},{101,39,3},{102,39,3},{103,39,3},{104,39,3},{105,39,3},{106,39,3},{107,39,3} +,{108,39,3},{109,39,3},{110,39,3},{111,39,3},{112,39,3},{113,39,3},{114,39,3},{115,39,3} +,{116,39,3},{117,39,3},{118,39,3},{119,39,3},{121,39,3},{122,39,3},{123,39,3},{124,39,3} +,{125,39,3},{126,39,3},{127,39,3},{128,39,3},{139,39,3},{140,39,3},{141,39,3},{142,39,3} +,{-1,39,3},{-2,39,3},{-3,39,3},{-4,39,3},{-5,39,3},{-6,39,3},{-7,39,3},{-8,39,3} +,{-9,39,3},{-10,39,3},{0,40,3},{3,40,3},{4,40,3},{8,40,3},{9,40,3},{12,40,3} +,{13,40,3},{14,40,3},{15,40,3},{16,40,3},{17,40,3},{18,40,3},{19,40,3},{20,40,3} +,{21,40,3},{22,40,3},{23,40,3},{24,40,3},{25,40,3},{26,40,3},{27,40,3},{28,40,3} +,{29,40,3},{30,40,3},{31,40,3},{32,40,3},{33,40,3},{34,40,3},{35,40,3},{36,40,3} +,{37,40,3},{38,40,3},{39,40,3},{40,40,3},{41,40,3},{42,40,3},{43,40,3},{44,40,3} +,{45,40,3},{46,40,3},{47,40,3},{48,40,3},{49,40,3},{50,40,3},{52,40,3},{53,40,3} +,{54,40,3},{55,40,3},{56,40,3},{57,40,3},{58,40,3},{59,40,3},{60,40,3},{61,40,3} +,{62,40,3},{63,40,3},{64,40,3},{65,40,3},{66,40,3},{67,40,3},{68,40,3},{69,40,3} +,{70,40,3},{71,40,3},{72,40,3},{73,40,3},{74,40,3},{75,40,3},{76,40,3},{77,40,3} +,{78,40,3},{79,40,3},{80,40,3},{81,40,3},{82,40,3},{83,40,3},{84,40,3},{85,40,3} +,{86,40,3},{87,40,3},{88,40,3},{89,40,3},{90,40,3},{91,40,3},{92,40,3},{93,40,3} +,{94,40,3},{95,40,3},{96,40,3},{97,40,3},{98,40,3},{99,40,3},{100,40,3},{101,40,3} +,{102,40,3},{103,40,3},{104,40,3},{105,40,3},{106,40,3},{107,40,3},{108,40,3},{109,40,3} +,{110,40,3},{111,40,3},{112,40,3},{113,40,3},{114,40,3},{115,40,3},{116,40,3},{117,40,3} +,{118,40,3},{119,40,3},{120,40,3},{121,40,3},{122,40,3},{123,40,3},{124,40,3},{125,40,3} +,{126,40,3},{127,40,3},{128,40,3},{129,40,3},{139,40,3},{140,40,3},{141,40,3},{-1,40,3} +,{-2,40,3},{-3,40,3},{-4,40,3},{-5,40,3},{-6,40,3},{-7,40,3},{-8,40,3},{-9,40,3} +,{0,41,3},{1,41,3},{2,41,3},{3,41,3},{8,41,3},{9,41,3},{11,41,3},{12,41,3} +,{13,41,3},{14,41,3},{15,41,3},{16,41,3},{17,41,3},{19,41,3},{20,41,3},{21,41,3} +,{22,41,3},{23,41,3},{24,41,3},{25,41,3},{26,41,3},{27,41,3},{28,41,3},{29,41,3} +,{30,41,3},{31,41,3},{32,41,3},{33,41,3},{34,41,3},{35,41,3},{36,41,3},{37,41,3} +,{38,41,3},{39,41,3},{40,41,3},{41,41,3},{42,41,3},{43,41,3},{44,41,3},{45,41,3} +,{46,41,3},{47,41,3},{48,41,3},{49,41,3},{52,41,3},{53,41,3},{54,41,3},{55,41,3} +,{56,41,3},{57,41,3},{58,41,3},{59,41,3},{60,41,3},{61,41,3},{62,41,3},{63,41,3} +,{64,41,3},{65,41,3},{66,41,3},{67,41,3},{68,41,3},{69,41,3},{70,41,3},{71,41,3} +,{72,41,3},{73,41,3},{74,41,3},{75,41,3},{76,41,3},{77,41,3},{78,41,3},{79,41,3} +,{80,41,3},{81,41,3},{82,41,3},{83,41,3},{84,41,3},{85,41,3},{86,41,3},{87,41,3} +,{88,41,3},{89,41,3},{90,41,3},{91,41,3},{92,41,3},{93,41,3},{94,41,3},{95,41,3} +,{96,41,3},{97,41,3},{98,41,3},{99,41,3},{100,41,3},{101,41,3},{102,41,3},{103,41,3} +,{104,41,3},{105,41,3},{106,41,3},{107,41,3},{108,41,3},{109,41,3},{110,41,3},{111,41,3} +,{112,41,3},{113,41,3},{114,41,3},{115,41,3},{116,41,3},{117,41,3},{118,41,3},{119,41,3} +,{120,41,3},{121,41,3},{122,41,3},{123,41,3},{124,41,3},{125,41,3},{126,41,3},{127,41,3} +,{128,41,3},{129,41,3},{130,41,3},{139,41,3},{140,41,3},{141,41,3},{143,41,3},{-1,41,3} +,{-2,41,3},{-3,41,3},{-4,41,3},{-5,41,3},{-6,41,3},{-7,41,3},{-8,41,3},{-9,41,3} +,{0,42,3},{1,42,3},{2,42,3},{3,42,3},{6,42,3},{8,42,3},{9,42,3},{10,42,3} +,{11,42,3},{12,42,3},{13,42,3},{14,42,3},{15,42,3},{16,42,3},{17,42,3},{18,42,3} +,{19,42,3},{20,42,3},{21,42,3},{22,42,3},{23,42,3},{24,42,3},{25,42,3},{26,42,3} +,{27,42,3},{28,42,3},{33,42,3},{34,42,3},{35,42,3},{40,42,3},{41,42,3},{42,42,3} +,{43,42,3},{44,42,3},{45,42,3},{46,42,3},{47,42,3},{48,42,3},{51,42,3},{52,42,3} +,{53,42,3},{54,42,3},{55,42,3},{56,42,3},{57,42,3},{58,42,3},{59,42,3},{60,42,3} +,{61,42,3},{62,42,3},{63,42,3},{64,42,3},{65,42,3},{66,42,3},{67,42,3},{68,42,3} +,{69,42,3},{70,42,3},{71,42,3},{72,42,3},{73,42,3},{74,42,3},{75,42,3},{76,42,3} +,{77,42,3},{78,42,3},{79,42,3},{80,42,3},{81,42,3},{82,42,3},{83,42,3},{84,42,3} +,{85,42,3},{86,42,3},{87,42,3},{88,42,3},{89,42,3},{90,42,3},{91,42,3},{92,42,3} +,{93,42,3},{94,42,3},{95,42,3},{96,42,3},{97,42,3},{98,42,3},{99,42,3},{100,42,3} +,{101,42,3},{102,42,3},{103,42,3},{104,42,3},{105,42,3},{106,42,3},{107,42,3},{108,42,3} +,{109,42,3},{110,42,3},{111,42,3},{112,42,3},{113,42,3},{114,42,3},{115,42,3},{116,42,3} +,{117,42,3},{118,42,3},{119,42,3},{120,42,3},{121,42,3},{122,42,3},{123,42,3},{124,42,3} +,{125,42,3},{126,42,3},{127,42,3},{128,42,3},{129,42,3},{130,42,3},{131,42,3},{132,42,3} +,{133,42,3},{134,42,3},{139,42,3},{140,42,3},{141,42,3},{142,42,3},{143,42,3},{144,42,3} +,{145,42,3},{-1,42,3},{-2,42,3},{-3,42,3},{-4,42,3},{-5,42,3},{-6,42,3},{-7,42,3} +,{-8,42,3},{-9,42,3},{-10,42,3},{0,43,3},{1,43,3},{2,43,3},{3,43,3},{4,43,3} +,{5,43,3},{6,43,3},{7,43,3},{8,43,3},{9,43,3},{10,43,3},{11,43,3},{12,43,3} +,{13,43,3},{15,43,3},{16,43,3},{17,43,3},{18,43,3},{19,43,3},{20,43,3},{21,43,3} +,{22,43,3},{23,43,3},{24,43,3},{25,43,3},{26,43,3},{27,43,3},{28,43,3},{39,43,3} +,{40,43,3},{41,43,3},{42,43,3},{43,43,3},{44,43,3},{45,43,3},{46,43,3},{47,43,3} +,{50,43,3},{51,43,3},{52,43,3},{53,43,3},{54,43,3},{55,43,3},{56,43,3},{57,43,3} +,{58,43,3},{59,43,3},{60,43,3},{61,43,3},{62,43,3},{63,43,3},{64,43,3},{65,43,3} +,{66,43,3},{67,43,3},{68,43,3},{69,43,3},{70,43,3},{71,43,3},{72,43,3},{73,43,3} +,{74,43,3},{75,43,3},{76,43,3},{77,43,3},{78,43,3},{79,43,3},{80,43,3},{81,43,3} +,{82,43,3},{83,43,3},{84,43,3},{85,43,3},{86,43,3},{87,43,3},{88,43,3},{89,43,3} +,{90,43,3},{91,43,3},{92,43,3},{93,43,3},{94,43,3},{95,43,3},{96,43,3},{97,43,3} +,{98,43,3},{99,43,3},{100,43,3},{101,43,3},{102,43,3},{103,43,3},{104,43,3},{105,43,3} +,{106,43,3},{107,43,3},{108,43,3},{109,43,3},{110,43,3},{111,43,3},{112,43,3},{113,43,3} +,{114,43,3},{115,43,3},{116,43,3},{117,43,3},{118,43,3},{119,43,3},{120,43,3},{121,43,3} +,{122,43,3},{123,43,3},{124,43,3},{125,43,3},{126,43,3},{127,43,3},{128,43,3},{129,43,3} +,{130,43,3},{131,43,3},{132,43,3},{133,43,3},{134,43,3},{135,43,3},{140,43,3},{141,43,3} +,{142,43,3},{143,43,3},{144,43,3},{145,43,3},{146,43,3},{-1,43,3},{-2,43,3},{-3,43,3} +,{-4,43,3},{-5,43,3},{-6,43,3},{-7,43,3},{-8,43,3},{-9,43,3},{-10,43,3},{0,44,3} +,{1,44,3},{2,44,3},{3,44,3},{4,44,3},{5,44,3},{6,44,3},{7,44,3},{8,44,3} +,{9,44,3},{10,44,3},{11,44,3},{12,44,3},{13,44,3},{14,44,3},{15,44,3},{16,44,3} +,{17,44,3},{18,44,3},{19,44,3},{20,44,3},{21,44,3},{22,44,3},{23,44,3},{24,44,3} +,{25,44,3},{26,44,3},{27,44,3},{28,44,3},{29,44,3},{33,44,3},{34,44,3},{35,44,3} +,{37,44,3},{38,44,3},{39,44,3},{40,44,3},{41,44,3},{42,44,3},{43,44,3},{44,44,3} +,{45,44,3},{46,44,3},{47,44,3},{50,44,3},{51,44,3},{52,44,3},{53,44,3},{54,44,3} +,{55,44,3},{56,44,3},{57,44,3},{58,44,3},{59,44,3},{60,44,3},{61,44,3},{62,44,3} +,{63,44,3},{64,44,3},{65,44,3},{66,44,3},{67,44,3},{68,44,3},{69,44,3},{70,44,3} +,{71,44,3},{72,44,3},{73,44,3},{74,44,3},{75,44,3},{76,44,3},{77,44,3},{78,44,3} +,{79,44,3},{80,44,3},{81,44,3},{82,44,3},{83,44,3},{84,44,3},{85,44,3},{86,44,3} +,{87,44,3},{88,44,3},{89,44,3},{90,44,3},{91,44,3},{92,44,3},{93,44,3},{94,44,3} +,{95,44,3},{96,44,3},{97,44,3},{98,44,3},{99,44,3},{100,44,3},{101,44,3},{102,44,3} +,{103,44,3},{104,44,3},{105,44,3},{106,44,3},{107,44,3},{108,44,3},{109,44,3},{110,44,3} +,{111,44,3},{112,44,3},{113,44,3},{114,44,3},{115,44,3},{116,44,3},{117,44,3},{118,44,3} +,{119,44,3},{120,44,3},{121,44,3},{122,44,3},{123,44,3},{124,44,3},{125,44,3},{126,44,3} +,{127,44,3},{128,44,3},{129,44,3},{130,44,3},{131,44,3},{132,44,3},{133,44,3},{134,44,3} +,{135,44,3},{136,44,3},{141,44,3},{142,44,3},{143,44,3},{144,44,3},{145,44,3},{146,44,3} +,{147,44,3},{-1,44,3},{-2,44,3},{0,45,3},{1,45,3},{2,45,3},{3,45,3},{4,45,3} +,{5,45,3},{6,45,3},{7,45,3},{8,45,3},{9,45,3},{10,45,3},{11,45,3},{12,45,3} +,{13,45,3},{14,45,3},{15,45,3},{16,45,3},{17,45,3},{18,45,3},{19,45,3},{20,45,3} +,{21,45,3},{22,45,3},{23,45,3},{24,45,3},{25,45,3},{26,45,3},{27,45,3},{28,45,3} +,{29,45,3},{30,45,3},{32,45,3},{33,45,3},{34,45,3},{35,45,3},{36,45,3},{37,45,3} +,{38,45,3},{39,45,3},{40,45,3},{41,45,3},{42,45,3},{43,45,3},{44,45,3},{45,45,3} +,{46,45,3},{47,45,3},{48,45,3},{49,45,3},{50,45,3},{51,45,3},{52,45,3},{53,45,3} +,{54,45,3},{55,45,3},{56,45,3},{57,45,3},{58,45,3},{59,45,3},{60,45,3},{61,45,3} +,{62,45,3},{63,45,3},{64,45,3},{65,45,3},{66,45,3},{67,45,3},{68,45,3},{69,45,3} +,{70,45,3},{71,45,3},{72,45,3},{73,45,3},{74,45,3},{75,45,3},{76,45,3},{77,45,3} +,{78,45,3},{79,45,3},{80,45,3},{81,45,3},{82,45,3},{83,45,3},{84,45,3},{85,45,3} +,{86,45,3},{87,45,3},{88,45,3},{89,45,3},{90,45,3},{91,45,3},{92,45,3},{93,45,3} +,{94,45,3},{95,45,3},{96,45,3},{97,45,3},{98,45,3},{99,45,3},{100,45,3},{101,45,3} +,{102,45,3},{103,45,3},{104,45,3},{105,45,3},{106,45,3},{107,45,3},{108,45,3},{109,45,3} +,{110,45,3},{111,45,3},{112,45,3},{113,45,3},{114,45,3},{115,45,3},{116,45,3},{117,45,3} +,{118,45,3},{119,45,3},{120,45,3},{121,45,3},{122,45,3},{123,45,3},{124,45,3},{125,45,3} +,{126,45,3},{127,45,3},{128,45,3},{129,45,3},{130,45,3},{131,45,3},{132,45,3},{133,45,3} +,{134,45,3},{135,45,3},{136,45,3},{137,45,3},{140,45,3},{141,45,3},{142,45,3},{147,45,3} +,{148,45,3},{149,45,3},{150,45,3},{-1,45,3},{-2,45,3},{0,46,3},{1,46,3},{2,46,3} +,{3,46,3},{4,46,3},{5,46,3},{6,46,3},{7,46,3},{8,46,3},{9,46,3},{10,46,3} +,{11,46,3},{12,46,3},{13,46,3},{14,46,3},{15,46,3},{16,46,3},{17,46,3},{18,46,3} +,{19,46,3},{20,46,3},{21,46,3},{22,46,3},{23,46,3},{24,46,3},{25,46,3},{26,46,3} +,{27,46,3},{28,46,3},{29,46,3},{30,46,3},{31,46,3},{32,46,3},{33,46,3},{34,46,3} +,{35,46,3},{36,46,3},{37,46,3},{38,46,3},{39,46,3},{40,46,3},{41,46,3},{42,46,3} +,{43,46,3},{44,46,3},{45,46,3},{46,46,3},{47,46,3},{48,46,3},{49,46,3},{50,46,3} +,{51,46,3},{52,46,3},{53,46,3},{54,46,3},{55,46,3},{56,46,3},{57,46,3},{58,46,3} +,{59,46,3},{60,46,3},{61,46,3},{62,46,3},{63,46,3},{64,46,3},{65,46,3},{66,46,3} +,{67,46,3},{68,46,3},{69,46,3},{70,46,3},{71,46,3},{72,46,3},{73,46,3},{74,46,3} +,{75,46,3},{76,46,3},{77,46,3},{78,46,3},{79,46,3},{80,46,3},{81,46,3},{82,46,3} +,{83,46,3},{84,46,3},{85,46,3},{86,46,3},{87,46,3},{88,46,3},{89,46,3},{90,46,3} +,{91,46,3},{92,46,3},{93,46,3},{94,46,3},{95,46,3},{96,46,3},{97,46,3},{98,46,3} +,{99,46,3},{100,46,3},{101,46,3},{102,46,3},{103,46,3},{104,46,3},{105,46,3},{106,46,3} +,{107,46,3},{108,46,3},{109,46,3},{110,46,3},{111,46,3},{112,46,3},{113,46,3},{114,46,3} +,{115,46,3},{116,46,3},{117,46,3},{118,46,3},{119,46,3},{120,46,3},{121,46,3},{122,46,3} +,{123,46,3},{124,46,3},{125,46,3},{126,46,3},{127,46,3},{128,46,3},{129,46,3},{130,46,3} +,{131,46,3},{132,46,3},{133,46,3},{134,46,3},{135,46,3},{136,46,3},{137,46,3},{138,46,3} +,{141,46,3},{142,46,3},{143,46,3},{149,46,3},{150,46,3},{151,46,3},{152,46,3},{-1,46,3} +,{-2,46,3},{-3,46,3},{0,47,3},{1,47,3},{2,47,3},{3,47,3},{4,47,3},{5,47,3} +,{6,47,3},{7,47,3},{8,47,3},{9,47,3},{10,47,3},{11,47,3},{12,47,3},{13,47,3} +,{14,47,3},{15,47,3},{16,47,3},{17,47,3},{18,47,3},{19,47,3},{20,47,3},{21,47,3} +,{22,47,3},{23,47,3},{24,47,3},{25,47,3},{26,47,3},{27,47,3},{28,47,3},{29,47,3} +,{30,47,3},{31,47,3},{32,47,3},{33,47,3},{34,47,3},{35,47,3},{36,47,3},{37,47,3} +,{38,47,3},{39,47,3},{40,47,3},{41,47,3},{42,47,3},{43,47,3},{44,47,3},{45,47,3} +,{46,47,3},{47,47,3},{48,47,3},{49,47,3},{50,47,3},{51,47,3},{52,47,3},{53,47,3} +,{54,47,3},{55,47,3},{56,47,3},{57,47,3},{58,47,3},{59,47,3},{60,47,3},{61,47,3} +,{62,47,3},{63,47,3},{64,47,3},{65,47,3},{66,47,3},{67,47,3},{68,47,3},{69,47,3} +,{70,47,3},{71,47,3},{72,47,3},{73,47,3},{74,47,3},{75,47,3},{76,47,3},{77,47,3} +,{78,47,3},{79,47,3},{80,47,3},{81,47,3},{82,47,3},{83,47,3},{84,47,3},{85,47,3} +,{86,47,3},{87,47,3},{88,47,3},{89,47,3},{90,47,3},{91,47,3},{92,47,3},{93,47,3} +,{94,47,3},{95,47,3},{96,47,3},{97,47,3},{98,47,3},{99,47,3},{100,47,3},{101,47,3} +,{102,47,3},{103,47,3},{104,47,3},{105,47,3},{106,47,3},{107,47,3},{108,47,3},{109,47,3} +,{110,47,3},{111,47,3},{112,47,3},{113,47,3},{114,47,3},{115,47,3},{116,47,3},{117,47,3} +,{118,47,3},{119,47,3},{120,47,3},{121,47,3},{122,47,3},{123,47,3},{124,47,3},{125,47,3} +,{126,47,3},{127,47,3},{128,47,3},{129,47,3},{130,47,3},{131,47,3},{132,47,3},{133,47,3} +,{134,47,3},{135,47,3},{136,47,3},{137,47,3},{138,47,3},{139,47,3},{141,47,3},{142,47,3} +,{143,47,3},{152,47,3},{153,47,3},{-1,47,3},{-2,47,3},{-3,47,3},{-4,47,3},{-5,47,3} +,{0,48,3},{1,48,3},{2,48,3},{3,48,3},{4,48,3},{5,48,3},{6,48,3},{7,48,3} +,{8,48,3},{9,48,3},{10,48,3},{11,48,3},{12,48,3},{13,48,3},{14,48,3},{15,48,3} +,{16,48,3},{17,48,3},{18,48,3},{19,48,3},{20,48,3},{21,48,3},{22,48,3},{23,48,3} +,{24,48,3},{25,48,3},{26,48,3},{27,48,3},{28,48,3},{29,48,3},{30,48,3},{31,48,3} +,{32,48,3},{33,48,3},{34,48,3},{35,48,3},{36,48,3},{37,48,3},{38,48,3},{39,48,3} +,{40,48,3},{41,48,3},{42,48,3},{43,48,3},{44,48,3},{45,48,3},{46,48,3},{47,48,3} +,{48,48,3},{49,48,3},{50,48,3},{51,48,3},{52,48,3},{53,48,3},{54,48,3},{55,48,3} +,{56,48,3},{57,48,3},{58,48,3},{59,48,3},{60,48,3},{61,48,3},{62,48,3},{63,48,3} +,{64,48,3},{65,48,3},{66,48,3},{67,48,3},{68,48,3},{69,48,3},{70,48,3},{71,48,3} +,{72,48,3},{73,48,3},{74,48,3},{75,48,3},{76,48,3},{77,48,3},{78,48,3},{79,48,3} +,{80,48,3},{81,48,3},{82,48,3},{83,48,3},{84,48,3},{85,48,3},{86,48,3},{87,48,3} +,{88,48,3},{89,48,3},{90,48,3},{91,48,3},{92,48,3},{93,48,3},{94,48,3},{95,48,3} +,{96,48,3},{97,48,3},{98,48,3},{99,48,3},{100,48,3},{101,48,3},{102,48,3},{103,48,3} +,{104,48,3},{105,48,3},{106,48,3},{107,48,3},{108,48,3},{109,48,3},{110,48,3},{111,48,3} +,{112,48,3},{113,48,3},{114,48,3},{115,48,3},{116,48,3},{117,48,3},{118,48,3},{119,48,3} +,{120,48,3},{121,48,3},{122,48,3},{123,48,3},{124,48,3},{125,48,3},{126,48,3},{127,48,3} +,{128,48,3},{129,48,3},{130,48,3},{131,48,3},{132,48,3},{133,48,3},{134,48,3},{135,48,3} +,{136,48,3},{137,48,3},{138,48,3},{139,48,3},{140,48,3},{141,48,3},{142,48,3},{144,48,3} +,{153,48,3},{154,48,3},{-1,48,3},{-2,48,3},{-3,48,3},{-4,48,3},{-5,48,3},{-6,48,3} +,{0,49,3},{1,49,3},{2,49,3},{3,49,3},{4,49,3},{5,49,3},{6,49,3},{7,49,3} +,{8,49,3},{9,49,3},{10,49,3},{11,49,3},{12,49,3},{13,49,3},{14,49,3},{15,49,3} +,{16,49,3},{17,49,3},{18,49,3},{19,49,3},{20,49,3},{21,49,3},{22,49,3},{23,49,3} +,{24,49,3},{25,49,3},{26,49,3},{27,49,3},{28,49,3},{29,49,3},{30,49,3},{31,49,3} +,{32,49,3},{33,49,3},{34,49,3},{35,49,3},{36,49,3},{37,49,3},{38,49,3},{39,49,3} +,{40,49,3},{41,49,3},{42,49,3},{43,49,3},{44,49,3},{45,49,3},{46,49,3},{47,49,3} +,{48,49,3},{49,49,3},{50,49,3},{51,49,3},{52,49,3},{53,49,3},{54,49,3},{55,49,3} +,{56,49,3},{57,49,3},{58,49,3},{59,49,3},{60,49,3},{61,49,3},{62,49,3},{63,49,3} +,{64,49,3},{65,49,3},{66,49,3},{67,49,3},{68,49,3},{69,49,3},{70,49,3},{71,49,3} +,{72,49,3},{73,49,3},{74,49,3},{75,49,3},{76,49,3},{77,49,3},{78,49,3},{79,49,3} +,{80,49,3},{81,49,3},{82,49,3},{83,49,3},{84,49,3},{85,49,3},{86,49,3},{87,49,3} +,{88,49,3},{89,49,3},{90,49,3},{91,49,3},{92,49,3},{93,49,3},{94,49,3},{95,49,3} +,{96,49,3},{97,49,3},{98,49,3},{99,49,3},{100,49,3},{101,49,3},{102,49,3},{103,49,3} +,{104,49,3},{105,49,3},{106,49,3},{107,49,3},{108,49,3},{109,49,3},{110,49,3},{111,49,3} +,{112,49,3},{113,49,3},{114,49,3},{115,49,3},{116,49,3},{117,49,3},{118,49,3},{119,49,3} +,{120,49,3},{121,49,3},{122,49,3},{123,49,3},{124,49,3},{125,49,3},{126,49,3},{127,49,3} +,{128,49,3},{129,49,3},{130,49,3},{131,49,3},{132,49,3},{133,49,3},{134,49,3},{135,49,3} +,{136,49,3},{137,49,3},{138,49,3},{139,49,3},{140,49,3},{142,49,3},{143,49,3},{144,49,3} +,{154,49,3},{155,49,3},{-1,49,3},{-2,49,3},{-3,49,3},{-6,49,3},{-7,49,3},{0,50,3} +,{1,50,3},{2,50,3},{3,50,3},{4,50,3},{5,50,3},{6,50,3},{7,50,3},{8,50,3} +,{9,50,3},{10,50,3},{11,50,3},{12,50,3},{13,50,3},{14,50,3},{15,50,3},{16,50,3} +,{17,50,3},{18,50,3},{19,50,3},{20,50,3},{21,50,3},{22,50,3},{23,50,3},{24,50,3} +,{25,50,3},{26,50,3},{27,50,3},{28,50,3},{29,50,3},{30,50,3},{31,50,3},{32,50,3} +,{33,50,3},{34,50,3},{35,50,3},{36,50,3},{37,50,3},{38,50,3},{39,50,3},{40,50,3} +,{41,50,3},{42,50,3},{43,50,3},{44,50,3},{45,50,3},{46,50,3},{47,50,3},{48,50,3} +,{49,50,3},{50,50,3},{51,50,3},{52,50,3},{53,50,3},{54,50,3},{55,50,3},{56,50,3} +,{57,50,3},{58,50,3},{59,50,3},{60,50,3},{61,50,3},{62,50,3},{63,50,3},{64,50,3} +,{65,50,3},{66,50,3},{67,50,3},{68,50,3},{69,50,3},{70,50,3},{71,50,3},{72,50,3} +,{73,50,3},{74,50,3},{75,50,3},{76,50,3},{77,50,3},{78,50,3},{79,50,3},{80,50,3} +,{81,50,3},{82,50,3},{83,50,3},{84,50,3},{85,50,3},{86,50,3},{87,50,3},{88,50,3} +,{89,50,3},{90,50,3},{91,50,3},{92,50,3},{93,50,3},{94,50,3},{95,50,3},{96,50,3} +,{97,50,3},{98,50,3},{99,50,3},{100,50,3},{101,50,3},{102,50,3},{103,50,3},{104,50,3} +,{105,50,3},{106,50,3},{107,50,3},{108,50,3},{109,50,3},{110,50,3},{111,50,3},{112,50,3} +,{113,50,3},{114,50,3},{115,50,3},{116,50,3},{117,50,3},{118,50,3},{119,50,3},{120,50,3} +,{121,50,3},{122,50,3},{123,50,3},{124,50,3},{125,50,3},{126,50,3},{127,50,3},{128,50,3} +,{129,50,3},{130,50,3},{131,50,3},{132,50,3},{133,50,3},{134,50,3},{135,50,3},{136,50,3} +,{137,50,3},{138,50,3},{139,50,3},{140,50,3},{142,50,3},{143,50,3},{154,50,3},{155,50,3} +,{156,50,3},{-1,50,3},{-2,50,3},{-3,50,3},{-4,50,3},{-5,50,3},{-6,50,3},{0,51,3} +,{1,51,3},{2,51,3},{3,51,3},{4,51,3},{5,51,3},{6,51,3},{7,51,3},{8,51,3} +,{9,51,3},{10,51,3},{11,51,3},{12,51,3},{13,51,3},{14,51,3},{15,51,3},{16,51,3} +,{17,51,3},{18,51,3},{19,51,3},{20,51,3},{21,51,3},{22,51,3},{23,51,3},{24,51,3} +,{25,51,3},{26,51,3},{27,51,3},{28,51,3},{29,51,3},{30,51,3},{31,51,3},{32,51,3} +,{33,51,3},{34,51,3},{35,51,3},{36,51,3},{37,51,3},{38,51,3},{39,51,3},{40,51,3} +,{41,51,3},{42,51,3},{43,51,3},{44,51,3},{45,51,3},{46,51,3},{47,51,3},{48,51,3} +,{49,51,3},{50,51,3},{51,51,3},{52,51,3},{53,51,3},{54,51,3},{55,51,3},{56,51,3} +,{57,51,3},{58,51,3},{59,51,3},{60,51,3},{61,51,3},{62,51,3},{63,51,3},{64,51,3} +,{65,51,3},{66,51,3},{67,51,3},{68,51,3},{69,51,3},{70,51,3},{71,51,3},{72,51,3} +,{73,51,3},{74,51,3},{75,51,3},{76,51,3},{77,51,3},{78,51,3},{79,51,3},{80,51,3} +,{81,51,3},{82,51,3},{83,51,3},{84,51,3},{85,51,3},{86,51,3},{87,51,3},{88,51,3} +,{89,51,3},{90,51,3},{91,51,3},{92,51,3},{93,51,3},{94,51,3},{95,51,3},{96,51,3} +,{97,51,3},{98,51,3},{99,51,3},{100,51,3},{101,51,3},{102,51,3},{103,51,3},{104,51,3} +,{105,51,3},{106,51,3},{107,51,3},{108,51,3},{109,51,3},{110,51,3},{111,51,3},{112,51,3} +,{113,51,3},{114,51,3},{115,51,3},{116,51,3},{117,51,3},{118,51,3},{119,51,3},{120,51,3} +,{121,51,3},{122,51,3},{123,51,3},{124,51,3},{125,51,3},{126,51,3},{127,51,3},{128,51,3} +,{129,51,3},{130,51,3},{131,51,3},{132,51,3},{133,51,3},{134,51,3},{135,51,3},{136,51,3} +,{137,51,3},{138,51,3},{139,51,3},{140,51,3},{141,51,3},{142,51,3},{143,51,3},{156,51,3} +,{157,51,3},{158,51,3},{-1,51,3},{-2,51,3},{-3,51,3},{-4,51,3},{-5,51,3},{-6,51,3} +,{-8,51,3},{-9,51,3},{-10,51,3},{-11,51,3},{0,52,3},{1,52,3},{4,52,3},{5,52,3} +,{6,52,3},{7,52,3},{8,52,3},{9,52,3},{10,52,3},{11,52,3},{12,52,3},{13,52,3} +,{14,52,3},{15,52,3},{16,52,3},{17,52,3},{18,52,3},{19,52,3},{20,52,3},{21,52,3} +,{22,52,3},{23,52,3},{24,52,3},{25,52,3},{26,52,3},{27,52,3},{28,52,3},{29,52,3} +,{30,52,3},{31,52,3},{32,52,3},{33,52,3},{34,52,3},{35,52,3},{36,52,3},{37,52,3} +,{38,52,3},{39,52,3},{40,52,3},{41,52,3},{42,52,3},{43,52,3},{44,52,3},{45,52,3} +,{46,52,3},{47,52,3},{48,52,3},{49,52,3},{50,52,3},{51,52,3},{52,52,3},{53,52,3} +,{54,52,3},{55,52,3},{56,52,3},{57,52,3},{58,52,3},{59,52,3},{60,52,3},{61,52,3} +,{62,52,3},{63,52,3},{64,52,3},{65,52,3},{66,52,3},{67,52,3},{68,52,3},{69,52,3} +,{70,52,3},{71,52,3},{72,52,3},{73,52,3},{74,52,3},{75,52,3},{76,52,3},{77,52,3} +,{78,52,3},{79,52,3},{80,52,3},{81,52,3},{82,52,3},{83,52,3},{84,52,3},{85,52,3} +,{86,52,3},{87,52,3},{88,52,3},{89,52,3},{90,52,3},{91,52,3},{92,52,3},{93,52,3} +,{94,52,3},{95,52,3},{96,52,3},{97,52,3},{98,52,3},{99,52,3},{100,52,3},{101,52,3} +,{102,52,3},{103,52,3},{104,52,3},{105,52,3},{106,52,3},{107,52,3},{108,52,3},{109,52,3} +,{110,52,3},{111,52,3},{112,52,3},{113,52,3},{114,52,3},{115,52,3},{116,52,3},{117,52,3} +,{118,52,3},{119,52,3},{120,52,3},{121,52,3},{122,52,3},{123,52,3},{124,52,3},{125,52,3} +,{126,52,3},{127,52,3},{128,52,3},{129,52,3},{130,52,3},{131,52,3},{132,52,3},{133,52,3} +,{134,52,3},{135,52,3},{136,52,3},{137,52,3},{138,52,3},{139,52,3},{140,52,3},{141,52,3} +,{142,52,3},{143,52,3},{156,52,3},{157,52,3},{158,52,3},{-1,52,3},{-2,52,3},{-3,52,3} +,{-4,52,3},{-5,52,3},{-6,52,3},{-7,52,3},{-8,52,3},{-9,52,3},{-10,52,3},{-11,52,3} +,{0,53,3},{4,53,3},{5,53,3},{6,53,3},{7,53,3},{8,53,3},{9,53,3},{10,53,3} +,{11,53,3},{12,53,3},{13,53,3},{14,53,3},{15,53,3},{16,53,3},{17,53,3},{18,53,3} +,{19,53,3},{20,53,3},{21,53,3},{22,53,3},{23,53,3},{24,53,3},{25,53,3},{26,53,3} +,{27,53,3},{28,53,3},{29,53,3},{30,53,3},{31,53,3},{32,53,3},{33,53,3},{34,53,3} +,{35,53,3},{36,53,3},{37,53,3},{38,53,3},{39,53,3},{40,53,3},{41,53,3},{42,53,3} +,{43,53,3},{44,53,3},{45,53,3},{46,53,3},{47,53,3},{48,53,3},{49,53,3},{50,53,3} +,{51,53,3},{52,53,3},{53,53,3},{54,53,3},{55,53,3},{56,53,3},{57,53,3},{58,53,3} +,{59,53,3},{60,53,3},{61,53,3},{62,53,3},{63,53,3},{64,53,3},{65,53,3},{66,53,3} +,{67,53,3},{68,53,3},{69,53,3},{70,53,3},{71,53,3},{72,53,3},{73,53,3},{74,53,3} +,{75,53,3},{76,53,3},{77,53,3},{78,53,3},{79,53,3},{80,53,3},{81,53,3},{82,53,3} +,{83,53,3},{84,53,3},{85,53,3},{86,53,3},{87,53,3},{88,53,3},{89,53,3},{90,53,3} +,{91,53,3},{92,53,3},{93,53,3},{94,53,3},{95,53,3},{96,53,3},{97,53,3},{98,53,3} +,{99,53,3},{100,53,3},{101,53,3},{102,53,3},{103,53,3},{104,53,3},{105,53,3},{106,53,3} +,{107,53,3},{108,53,3},{109,53,3},{110,53,3},{111,53,3},{112,53,3},{113,53,3},{114,53,3} +,{115,53,3},{116,53,3},{117,53,3},{118,53,3},{119,53,3},{120,53,3},{121,53,3},{122,53,3} +,{123,53,3},{124,53,3},{125,53,3},{126,53,3},{127,53,3},{128,53,3},{129,53,3},{130,53,3} +,{131,53,3},{132,53,3},{133,53,3},{134,53,3},{135,53,3},{136,53,3},{137,53,3},{138,53,3} +,{139,53,3},{140,53,3},{141,53,3},{142,53,3},{143,53,3},{155,53,3},{156,53,3},{157,53,3} +,{158,53,3},{159,53,3},{160,53,3},{-1,53,3},{-2,53,3},{-3,53,3},{-4,53,3},{-5,53,3} +,{-6,53,3},{-7,53,3},{-8,53,3},{-9,53,3},{-10,53,3},{-11,53,3},{7,54,3},{8,54,3} +,{9,54,3},{10,54,3},{11,54,3},{12,54,3},{13,54,3},{14,54,3},{15,54,3},{16,54,3} +,{17,54,3},{18,54,3},{19,54,3},{20,54,3},{21,54,3},{22,54,3},{23,54,3},{24,54,3} +,{25,54,3},{26,54,3},{27,54,3},{28,54,3},{29,54,3},{30,54,3},{31,54,3},{32,54,3} +,{33,54,3},{34,54,3},{35,54,3},{36,54,3},{37,54,3},{38,54,3},{39,54,3},{40,54,3} +,{41,54,3},{42,54,3},{43,54,3},{44,54,3},{45,54,3},{46,54,3},{47,54,3},{48,54,3} +,{49,54,3},{50,54,3},{51,54,3},{52,54,3},{53,54,3},{54,54,3},{55,54,3},{56,54,3} +,{57,54,3},{58,54,3},{59,54,3},{60,54,3},{61,54,3},{62,54,3},{63,54,3},{64,54,3} +,{65,54,3},{66,54,3},{67,54,3},{68,54,3},{69,54,3},{70,54,3},{71,54,3},{72,54,3} +,{73,54,3},{74,54,3},{75,54,3},{76,54,3},{77,54,3},{78,54,3},{79,54,3},{80,54,3} +,{81,54,3},{82,54,3},{83,54,3},{84,54,3},{85,54,3},{86,54,3},{87,54,3},{88,54,3} +,{89,54,3},{90,54,3},{91,54,3},{92,54,3},{93,54,3},{94,54,3},{95,54,3},{96,54,3} +,{97,54,3},{98,54,3},{99,54,3},{100,54,3},{101,54,3},{102,54,3},{103,54,3},{104,54,3} +,{105,54,3},{106,54,3},{107,54,3},{108,54,3},{109,54,3},{110,54,3},{111,54,3},{112,54,3} +,{113,54,3},{114,54,3},{115,54,3},{116,54,3},{117,54,3},{118,54,3},{119,54,3},{120,54,3} +,{121,54,3},{122,54,3},{123,54,3},{124,54,3},{125,54,3},{126,54,3},{127,54,3},{128,54,3} +,{129,54,3},{130,54,3},{131,54,3},{132,54,3},{133,54,3},{134,54,3},{135,54,3},{136,54,3} +,{137,54,3},{138,54,3},{139,54,3},{140,54,3},{142,54,3},{155,54,3},{156,54,3},{157,54,3} +,{158,54,3},{159,54,3},{160,54,3},{161,54,3},{162,54,3},{166,54,3},{167,54,3},{168,54,3} +,{-1,54,3},{-2,54,3},{-3,54,3},{-4,54,3},{-5,54,3},{-6,54,3},{-7,54,3},{-8,54,3} +,{-9,54,3},{-10,54,3},{-11,54,3},{8,55,3},{9,55,3},{10,55,3},{11,55,3},{12,55,3} +,{13,55,3},{14,55,3},{15,55,3},{20,55,3},{21,55,3},{22,55,3},{23,55,3},{24,55,3} +,{25,55,3},{26,55,3},{27,55,3},{28,55,3},{29,55,3},{30,55,3},{31,55,3},{32,55,3} +,{33,55,3},{34,55,3},{35,55,3},{36,55,3},{37,55,3},{38,55,3},{39,55,3},{40,55,3} +,{41,55,3},{42,55,3},{43,55,3},{44,55,3},{45,55,3},{46,55,3},{47,55,3},{48,55,3} +,{49,55,3},{50,55,3},{51,55,3},{52,55,3},{53,55,3},{54,55,3},{55,55,3},{56,55,3} +,{57,55,3},{58,55,3},{59,55,3},{60,55,3},{61,55,3},{62,55,3},{63,55,3},{64,55,3} +,{65,55,3},{66,55,3},{67,55,3},{68,55,3},{69,55,3},{70,55,3},{71,55,3},{72,55,3} +,{73,55,3},{74,55,3},{75,55,3},{76,55,3},{77,55,3},{78,55,3},{79,55,3},{80,55,3} +,{81,55,3},{82,55,3},{83,55,3},{84,55,3},{85,55,3},{86,55,3},{87,55,3},{88,55,3} +,{89,55,3},{90,55,3},{91,55,3},{92,55,3},{93,55,3},{94,55,3},{95,55,3},{96,55,3} +,{97,55,3},{98,55,3},{99,55,3},{100,55,3},{101,55,3},{102,55,3},{103,55,3},{104,55,3} +,{105,55,3},{106,55,3},{107,55,3},{108,55,3},{109,55,3},{110,55,3},{111,55,3},{112,55,3} +,{113,55,3},{114,55,3},{115,55,3},{116,55,3},{117,55,3},{118,55,3},{119,55,3},{120,55,3} +,{121,55,3},{122,55,3},{123,55,3},{124,55,3},{125,55,3},{126,55,3},{127,55,3},{128,55,3} +,{129,55,3},{130,55,3},{131,55,3},{132,55,3},{133,55,3},{134,55,3},{135,55,3},{136,55,3} +,{137,55,3},{138,55,3},{155,55,3},{156,55,3},{157,55,3},{158,55,3},{159,55,3},{160,55,3} +,{161,55,3},{162,55,3},{165,55,3},{166,55,3},{-2,55,3},{-3,55,3},{-4,55,3},{-5,55,3} +,{-6,55,3},{-7,55,3},{-8,55,3},{-9,55,3},{8,56,3},{9,56,3},{10,56,3},{11,56,3} +,{12,56,3},{13,56,3},{14,56,3},{15,56,3},{16,56,3},{18,56,3},{20,56,3},{21,56,3} +,{22,56,3},{23,56,3},{24,56,3},{25,56,3},{26,56,3},{27,56,3},{28,56,3},{29,56,3} +,{30,56,3},{31,56,3},{32,56,3},{33,56,3},{34,56,3},{35,56,3},{36,56,3},{37,56,3} +,{38,56,3},{39,56,3},{40,56,3},{41,56,3},{42,56,3},{43,56,3},{44,56,3},{45,56,3} +,{46,56,3},{47,56,3},{48,56,3},{49,56,3},{50,56,3},{51,56,3},{52,56,3},{53,56,3} +,{54,56,3},{55,56,3},{56,56,3},{57,56,3},{58,56,3},{59,56,3},{60,56,3},{61,56,3} +,{62,56,3},{63,56,3},{64,56,3},{65,56,3},{66,56,3},{67,56,3},{68,56,3},{69,56,3} +,{70,56,3},{71,56,3},{72,56,3},{73,56,3},{74,56,3},{75,56,3},{76,56,3},{77,56,3} +,{78,56,3},{79,56,3},{80,56,3},{81,56,3},{82,56,3},{83,56,3},{84,56,3},{85,56,3} +,{86,56,3},{87,56,3},{88,56,3},{89,56,3},{90,56,3},{91,56,3},{92,56,3},{93,56,3} +,{94,56,3},{95,56,3},{96,56,3},{97,56,3},{98,56,3},{99,56,3},{100,56,3},{101,56,3} +,{102,56,3},{103,56,3},{104,56,3},{105,56,3},{106,56,3},{107,56,3},{108,56,3},{109,56,3} +,{110,56,3},{111,56,3},{112,56,3},{113,56,3},{114,56,3},{115,56,3},{116,56,3},{117,56,3} +,{118,56,3},{119,56,3},{120,56,3},{121,56,3},{122,56,3},{123,56,3},{124,56,3},{125,56,3} +,{126,56,3},{127,56,3},{128,56,3},{129,56,3},{130,56,3},{131,56,3},{132,56,3},{133,56,3} +,{134,56,3},{135,56,3},{136,56,3},{137,56,3},{138,56,3},{143,56,3},{155,56,3},{156,56,3} +,{157,56,3},{158,56,3},{159,56,3},{160,56,3},{161,56,3},{162,56,3},{163,56,3},{-3,56,3} +,{-4,56,3},{-5,56,3},{-6,56,3},{-7,56,3},{-8,56,3},{6,57,3},{7,57,3},{8,57,3} +,{9,57,3},{10,57,3},{11,57,3},{12,57,3},{13,57,3},{14,57,3},{15,57,3},{16,57,3} +,{17,57,3},{18,57,3},{19,57,3},{21,57,3},{22,57,3},{23,57,3},{24,57,3},{25,57,3} +,{26,57,3},{27,57,3},{28,57,3},{29,57,3},{30,57,3},{31,57,3},{32,57,3},{33,57,3} +,{34,57,3},{35,57,3},{36,57,3},{37,57,3},{38,57,3},{39,57,3},{40,57,3},{41,57,3} +,{42,57,3},{43,57,3},{44,57,3},{45,57,3},{46,57,3},{47,57,3},{48,57,3},{49,57,3} +,{50,57,3},{51,57,3},{52,57,3},{53,57,3},{54,57,3},{55,57,3},{56,57,3},{57,57,3} +,{58,57,3},{59,57,3},{60,57,3},{61,57,3},{62,57,3},{63,57,3},{64,57,3},{65,57,3} +,{66,57,3},{67,57,3},{68,57,3},{69,57,3},{70,57,3},{71,57,3},{72,57,3},{73,57,3} +,{74,57,3},{75,57,3},{76,57,3},{77,57,3},{78,57,3},{79,57,3},{80,57,3},{81,57,3} +,{82,57,3},{83,57,3},{84,57,3},{85,57,3},{86,57,3},{87,57,3},{88,57,3},{89,57,3} +,{90,57,3},{91,57,3},{92,57,3},{93,57,3},{94,57,3},{95,57,3},{96,57,3},{97,57,3} +,{98,57,3},{99,57,3},{100,57,3},{101,57,3},{102,57,3},{103,57,3},{104,57,3},{105,57,3} +,{106,57,3},{107,57,3},{108,57,3},{109,57,3},{110,57,3},{111,57,3},{112,57,3},{113,57,3} +,{114,57,3},{115,57,3},{116,57,3},{117,57,3},{118,57,3},{119,57,3},{120,57,3},{121,57,3} +,{122,57,3},{123,57,3},{124,57,3},{125,57,3},{126,57,3},{127,57,3},{128,57,3},{129,57,3} +,{130,57,3},{131,57,3},{132,57,3},{133,57,3},{134,57,3},{135,57,3},{136,57,3},{137,57,3} +,{138,57,3},{139,57,3},{140,57,3},{156,57,3},{157,57,3},{158,57,3},{159,57,3},{160,57,3} +,{161,57,3},{162,57,3},{163,57,3},{-2,57,3},{-3,57,3},{-4,57,3},{-5,57,3},{-6,57,3} +,{-7,57,3},{-8,57,3},{-9,57,3},{-14,57,3},{5,58,3},{6,58,3},{7,58,3},{8,58,3} +,{9,58,3},{10,58,3},{11,58,3},{12,58,3},{13,58,3},{14,58,3},{15,58,3},{16,58,3} +,{17,58,3},{18,58,3},{19,58,3},{21,58,3},{22,58,3},{23,58,3},{24,58,3},{25,58,3} +,{26,58,3},{27,58,3},{28,58,3},{29,58,3},{30,58,3},{31,58,3},{32,58,3},{33,58,3} +,{34,58,3},{35,58,3},{36,58,3},{37,58,3},{38,58,3},{39,58,3},{40,58,3},{41,58,3} +,{42,58,3},{43,58,3},{44,58,3},{45,58,3},{46,58,3},{47,58,3},{48,58,3},{49,58,3} +,{50,58,3},{51,58,3},{52,58,3},{53,58,3},{54,58,3},{55,58,3},{56,58,3},{57,58,3} +,{58,58,3},{59,58,3},{60,58,3},{61,58,3},{62,58,3},{63,58,3},{64,58,3},{65,58,3} +,{66,58,3},{67,58,3},{68,58,3},{69,58,3},{70,58,3},{71,58,3},{72,58,3},{73,58,3} +,{74,58,3},{75,58,3},{76,58,3},{77,58,3},{78,58,3},{79,58,3},{80,58,3},{81,58,3} +,{82,58,3},{83,58,3},{84,58,3},{85,58,3},{86,58,3},{87,58,3},{88,58,3},{89,58,3} +,{90,58,3},{91,58,3},{92,58,3},{93,58,3},{94,58,3},{95,58,3},{96,58,3},{97,58,3} +,{98,58,3},{99,58,3},{100,58,3},{101,58,3},{102,58,3},{103,58,3},{104,58,3},{105,58,3} +,{106,58,3},{107,58,3},{108,58,3},{109,58,3},{110,58,3},{111,58,3},{112,58,3},{113,58,3} +,{114,58,3},{115,58,3},{116,58,3},{117,58,3},{118,58,3},{119,58,3},{120,58,3},{121,58,3} +,{122,58,3},{123,58,3},{124,58,3},{125,58,3},{126,58,3},{127,58,3},{128,58,3},{129,58,3} +,{130,58,3},{131,58,3},{132,58,3},{133,58,3},{134,58,3},{135,58,3},{136,58,3},{137,58,3} +,{138,58,3},{139,58,3},{140,58,3},{141,58,3},{142,58,3},{150,58,3},{151,58,3},{152,58,3} +,{157,58,3},{158,58,3},{159,58,3},{160,58,3},{161,58,3},{162,58,3},{163,58,3},{164,58,3} +,{-3,58,3},{-4,58,3},{-5,58,3},{-6,58,3},{-7,58,3},{-8,58,3},{4,59,3},{5,59,3} +,{6,59,3},{7,59,3},{8,59,3},{9,59,3},{10,59,3},{11,59,3},{12,59,3},{13,59,3} +,{14,59,3},{15,59,3},{16,59,3},{17,59,3},{18,59,3},{19,59,3},{20,59,3},{21,59,3} +,{22,59,3},{23,59,3},{24,59,3},{25,59,3},{26,59,3},{27,59,3},{28,59,3},{29,59,3} +,{30,59,3},{31,59,3},{32,59,3},{33,59,3},{34,59,3},{35,59,3},{36,59,3},{37,59,3} +,{38,59,3},{39,59,3},{40,59,3},{41,59,3},{42,59,3},{43,59,3},{44,59,3},{45,59,3} +,{46,59,3},{47,59,3},{48,59,3},{49,59,3},{50,59,3},{51,59,3},{52,59,3},{53,59,3} +,{54,59,3},{55,59,3},{56,59,3},{57,59,3},{58,59,3},{59,59,3},{60,59,3},{61,59,3} +,{62,59,3},{63,59,3},{64,59,3},{65,59,3},{66,59,3},{67,59,3},{68,59,3},{69,59,3} +,{70,59,3},{71,59,3},{72,59,3},{73,59,3},{74,59,3},{75,59,3},{76,59,3},{77,59,3} +,{78,59,3},{79,59,3},{80,59,3},{81,59,3},{82,59,3},{83,59,3},{84,59,3},{85,59,3} +,{86,59,3},{87,59,3},{88,59,3},{89,59,3},{90,59,3},{91,59,3},{92,59,3},{93,59,3} +,{94,59,3},{95,59,3},{96,59,3},{97,59,3},{98,59,3},{99,59,3},{100,59,3},{101,59,3} +,{102,59,3},{103,59,3},{104,59,3},{105,59,3},{106,59,3},{107,59,3},{108,59,3},{109,59,3} +,{110,59,3},{111,59,3},{112,59,3},{113,59,3},{114,59,3},{115,59,3},{116,59,3},{117,59,3} +,{118,59,3},{119,59,3},{120,59,3},{121,59,3},{122,59,3},{123,59,3},{124,59,3},{125,59,3} +,{126,59,3},{127,59,3},{128,59,3},{129,59,3},{130,59,3},{131,59,3},{132,59,3},{133,59,3} +,{134,59,3},{135,59,3},{136,59,3},{137,59,3},{138,59,3},{139,59,3},{140,59,3},{141,59,3} +,{142,59,3},{143,59,3},{144,59,3},{145,59,3},{146,59,3},{147,59,3},{148,59,3},{149,59,3} +,{150,59,3},{151,59,3},{152,59,3},{153,59,3},{154,59,3},{155,59,3},{159,59,3},{160,59,3} +,{161,59,3},{162,59,3},{163,59,3},{164,59,3},{165,59,3},{166,59,3},{-2,59,3},{-3,59,3} +,{-4,59,3},{-5,59,3},{-6,59,3},{-7,59,3},{4,60,3},{5,60,3},{6,60,3},{7,60,3} +,{8,60,3},{9,60,3},{10,60,3},{11,60,3},{12,60,3},{13,60,3},{14,60,3},{15,60,3} +,{16,60,3},{17,60,3},{18,60,3},{19,60,3},{20,60,3},{21,60,3},{22,60,3},{23,60,3} +,{24,60,3},{25,60,3},{26,60,3},{27,60,3},{28,60,3},{29,60,3},{30,60,3},{31,60,3} +,{32,60,3},{33,60,3},{34,60,3},{35,60,3},{36,60,3},{37,60,3},{38,60,3},{39,60,3} +,{40,60,3},{41,60,3},{42,60,3},{43,60,3},{44,60,3},{45,60,3},{46,60,3},{47,60,3} +,{48,60,3},{49,60,3},{50,60,3},{51,60,3},{52,60,3},{53,60,3},{54,60,3},{55,60,3} +,{56,60,3},{57,60,3},{58,60,3},{59,60,3},{60,60,3},{61,60,3},{62,60,3},{63,60,3} +,{64,60,3},{65,60,3},{66,60,3},{67,60,3},{68,60,3},{69,60,3},{70,60,3},{71,60,3} +,{72,60,3},{73,60,3},{74,60,3},{75,60,3},{76,60,3},{77,60,3},{78,60,3},{79,60,3} +,{80,60,3},{81,60,3},{82,60,3},{83,60,3},{84,60,3},{85,60,3},{86,60,3},{87,60,3} +,{88,60,3},{89,60,3},{90,60,3},{91,60,3},{92,60,3},{93,60,3},{94,60,3},{95,60,3} +,{96,60,3},{97,60,3},{98,60,3},{99,60,3},{100,60,3},{101,60,3},{102,60,3},{103,60,3} +,{104,60,3},{105,60,3},{106,60,3},{107,60,3},{108,60,3},{109,60,3},{110,60,3},{111,60,3} +,{112,60,3},{113,60,3},{114,60,3},{115,60,3},{116,60,3},{117,60,3},{118,60,3},{119,60,3} +,{120,60,3},{121,60,3},{122,60,3},{123,60,3},{124,60,3},{125,60,3},{126,60,3},{127,60,3} +,{128,60,3},{129,60,3},{130,60,3},{131,60,3},{132,60,3},{133,60,3},{134,60,3},{135,60,3} +,{136,60,3},{137,60,3},{138,60,3},{139,60,3},{140,60,3},{141,60,3},{142,60,3},{143,60,3} +,{144,60,3},{145,60,3},{146,60,3},{147,60,3},{148,60,3},{149,60,3},{150,60,3},{151,60,3} +,{152,60,3},{153,60,3},{154,60,3},{155,60,3},{156,60,3},{159,60,3},{160,60,3},{161,60,3} +,{162,60,3},{163,60,3},{164,60,3},{165,60,3},{166,60,3},{167,60,3},{168,60,3},{169,60,3} +,{170,60,3},{171,60,3},{172,60,3},{-1,60,3},{-2,60,3},{-3,60,3},{73,-1,3},{98,-1,3} +,{99,-1,3},{100,-1,3},{101,-1,3},{102,-1,3},{103,-1,3},{104,-1,3},{105,-1,3},{109,-1,3} +,{110,-1,3},{111,-1,3},{112,-1,3},{113,-1,3},{114,-1,3},{115,-1,3},{116,-1,3},{117,-1,3} +,{119,-1,3},{120,-1,3},{121,-1,3},{122,-1,3},{123,-1,3},{127,-1,3},{128,-1,3},{129,-1,3} +,{130,-1,3},{131,-1,3},{132,-1,3},{133,-1,3},{134,-1,3},{135,-1,3},{136,-1,3},{145,-1,3} +,{166,-1,3},{169,-1,3},{174,-1,3},{-161,-1,3},{98,-2,3},{99,-2,3},{100,-2,3},{101,-2,3} +,{102,-2,3},{103,-2,3},{104,-2,3},{105,-2,3},{106,-2,3},{108,-2,3},{109,-2,3},{110,-2,3} +,{111,-2,3},{112,-2,3},{113,-2,3},{114,-2,3},{115,-2,3},{116,-2,3},{117,-2,3},{119,-2,3} +,{120,-2,3},{121,-2,3},{122,-2,3},{123,-2,3},{124,-2,3},{125,-2,3},{126,-2,3},{127,-2,3} +,{128,-2,3},{129,-2,3},{130,-2,3},{131,-2,3},{132,-2,3},{133,-2,3},{134,-2,3},{135,-2,3} +,{136,-2,3},{137,-2,3},{138,-2,3},{139,-2,3},{142,-2,3},{143,-2,3},{144,-2,3},{145,-2,3} +,{146,-2,3},{147,-2,3},{148,-2,3},{149,-2,3},{150,-2,3},{174,-2,3},{175,-2,3},{176,-2,3} +,{99,-3,3},{100,-3,3},{101,-3,3},{102,-3,3},{103,-3,3},{104,-3,3},{105,-3,3},{106,-3,3} +,{107,-3,3},{108,-3,3},{110,-3,3},{111,-3,3},{112,-3,3},{113,-3,3},{114,-3,3},{115,-3,3} +,{116,-3,3},{117,-3,3},{118,-3,3},{119,-3,3},{120,-3,3},{121,-3,3},{122,-3,3},{123,-3,3} +,{124,-3,3},{125,-3,3},{126,-3,3},{127,-3,3},{128,-3,3},{129,-3,3},{130,-3,3},{131,-3,3} +,{132,-3,3},{133,-3,3},{134,-3,3},{135,-3,3},{136,-3,3},{137,-3,3},{138,-3,3},{139,-3,3} +,{140,-3,3},{141,-3,3},{142,-3,3},{145,-3,3},{146,-3,3},{147,-3,3},{148,-3,3},{149,-3,3} +,{150,-3,3},{151,-3,3},{152,-3,3},{175,-3,3},{176,-3,3},{-172,-3,3},{100,-4,3},{101,-4,3} +,{102,-4,3},{103,-4,3},{104,-4,3},{105,-4,3},{106,-4,3},{107,-4,3},{108,-4,3},{110,-4,3} +,{111,-4,3},{112,-4,3},{113,-4,3},{114,-4,3},{115,-4,3},{116,-4,3},{117,-4,3},{118,-4,3} +,{119,-4,3},{120,-4,3},{121,-4,3},{122,-4,3},{123,-4,3},{125,-4,3},{126,-4,3},{127,-4,3} +,{128,-4,3},{129,-4,3},{130,-4,3},{131,-4,3},{132,-4,3},{133,-4,3},{134,-4,3},{135,-4,3} +,{136,-4,3},{137,-4,3},{138,-4,3},{139,-4,3},{140,-4,3},{141,-4,3},{142,-4,3},{143,-4,3} +,{144,-4,3},{150,-4,3},{151,-4,3},{152,-4,3},{153,-4,3},{154,-4,3},{-155,-4,3},{-171,-4,3} +,{-172,-4,3},{-175,-4,3},{101,-5,3},{102,-5,3},{103,-5,3},{104,-5,3},{105,-5,3},{114,-5,3} +,{115,-5,3},{116,-5,3},{119,-5,3},{120,-5,3},{121,-5,3},{122,-5,3},{123,-5,3},{129,-5,3} +,{130,-5,3},{131,-5,3},{132,-5,3},{133,-5,3},{134,-5,3},{135,-5,3},{136,-5,3},{137,-5,3} +,{138,-5,3},{139,-5,3},{140,-5,3},{141,-5,3},{142,-5,3},{143,-5,3},{144,-5,3},{145,-5,3} +,{146,-5,3},{149,-5,3},{150,-5,3},{151,-5,3},{152,-5,3},{153,-5,3},{154,-5,3},{155,-5,3} +,{156,-5,3},{157,-5,3},{159,-5,3},{-155,-5,3},{-172,-5,3},{-173,-5,3},{-175,-5,3},{71,-6,3} +,{72,-6,3},{102,-6,3},{103,-6,3},{104,-6,3},{105,-6,3},{106,-6,3},{107,-6,3},{108,-6,3} +,{110,-6,3},{112,-6,3},{114,-6,3},{117,-6,3},{118,-6,3},{119,-6,3},{120,-6,3},{121,-6,3} +,{122,-6,3},{123,-6,3},{124,-6,3},{127,-6,3},{130,-6,3},{131,-6,3},{132,-6,3},{133,-6,3} +,{134,-6,3},{137,-6,3},{138,-6,3},{139,-6,3},{140,-6,3},{141,-6,3},{142,-6,3},{143,-6,3} +,{144,-6,3},{145,-6,3},{146,-6,3},{147,-6,3},{148,-6,3},{149,-6,3},{150,-6,3},{151,-6,3} +,{152,-6,3},{154,-6,3},{155,-6,3},{159,-6,3},{176,-6,3},{-156,-6,3},{71,-7,3},{105,-7,3} +,{106,-7,3},{107,-7,3},{108,-7,3},{109,-7,3},{110,-7,3},{111,-7,3},{112,-7,3},{113,-7,3} +,{114,-7,3},{115,-7,3},{116,-7,3},{118,-7,3},{119,-7,3},{120,-7,3},{121,-7,3},{122,-7,3} +,{124,-7,3},{126,-7,3},{129,-7,3},{130,-7,3},{131,-7,3},{132,-7,3},{134,-7,3},{138,-7,3} +,{139,-7,3},{140,-7,3},{141,-7,3},{142,-7,3},{143,-7,3},{144,-7,3},{145,-7,3},{146,-7,3} +,{147,-7,3},{148,-7,3},{149,-7,3},{150,-7,3},{151,-7,3},{154,-7,3},{155,-7,3},{156,-7,3} +,{157,-7,3},{176,-7,3},{177,-7,3},{72,-8,3},{105,-8,3},{106,-8,3},{107,-8,3},{108,-8,3} +,{109,-8,3},{110,-8,3},{111,-8,3},{112,-8,3},{113,-8,3},{114,-8,3},{115,-8,3},{117,-8,3} +,{118,-8,3},{120,-8,3},{121,-8,3},{122,-8,3},{123,-8,3},{125,-8,3},{126,-8,3},{127,-8,3} +,{128,-8,3},{129,-8,3},{130,-8,3},{131,-8,3},{134,-8,3},{137,-8,3},{138,-8,3},{139,-8,3} +,{140,-8,3},{141,-8,3},{142,-8,3},{143,-8,3},{144,-8,3},{145,-8,3},{146,-8,3},{147,-8,3} +,{155,-8,3},{156,-8,3},{157,-8,3},{158,-8,3},{159,-8,3},{160,-8,3},{177,-8,3},{178,-8,3} +,{-141,-8,3},{110,-9,3},{111,-9,3},{112,-9,3},{113,-9,3},{114,-9,3},{115,-9,3},{116,-9,3} +,{117,-9,3},{118,-9,3},{119,-9,3},{120,-9,3},{121,-9,3},{122,-9,3},{123,-9,3},{124,-9,3} +,{125,-9,3},{126,-9,3},{127,-9,3},{128,-9,3},{129,-9,3},{130,-9,3},{131,-9,3},{137,-9,3} +,{138,-9,3},{139,-9,3},{140,-9,3},{141,-9,3},{142,-9,3},{143,-9,3},{145,-9,3},{146,-9,3} +,{147,-9,3},{148,-9,3},{149,-9,3},{150,-9,3},{151,-9,3},{152,-9,3},{156,-9,3},{157,-9,3} +,{158,-9,3},{159,-9,3},{160,-9,3},{161,-9,3},{178,-9,3},{179,-9,3},{-140,-9,3},{-141,-9,3} +,{-158,-9,3},{-159,-9,3},{-173,-9,3},{116,-10,3},{117,-10,3},{118,-10,3},{119,-10,3},{120,-10,3} +,{123,-10,3},{124,-10,3},{125,-10,3},{126,-10,3},{140,-10,3},{141,-10,3},{142,-10,3},{143,-10,3} +,{144,-10,3},{146,-10,3},{147,-10,3},{148,-10,3},{149,-10,3},{150,-10,3},{151,-10,3},{152,-10,3} +,{153,-10,3},{158,-10,3},{159,-10,3},{160,-10,3},{161,-10,3},{167,-10,3},{179,-10,3},{-139,-10,3} +,{-140,-10,3},{-141,-10,3},{-151,-10,3},{-158,-10,3},{-159,-10,3},{-162,-10,3},{-172,-10,3},{105,-11,3} +,{96,-12,3},{96,-13,3},{-170,16,4},{-156,18,4},{-155,19,4},{-156,19,4},{-157,19,4},{-156,20,4} +,{-157,20,4},{-158,20,4},{-157,21,4},{-158,21,4},{-159,21,4},{-160,21,4},{-161,21,4},{-160,22,4} +,{-161,22,4},{-162,23,4},{-165,23,4},{-167,23,4},{-168,24,4},{-168,25,4},{-172,25,4},{-174,26,4} +,{-176,27,4},{-178,28,4},{-179,28,4},{-15,-8,4},{-6,-16,4},{-6,-17,4},{-29,-21,4},{-30,-21,4} +,{167,-29,4},{167,-30,4},{-178,-30,4},{-179,-31,4},{-179,-32,4},{172,-35,4},{173,-35,4},{173,-36,4} +,{174,-36,4},{175,-36,4},{173,-37,4},{174,-37,4},{175,-37,4},{176,-37,4},{77,-38,4},{174,-38,4} +,{175,-38,4},{176,-38,4},{177,-38,4},{178,-38,4},{-13,-38,4},{77,-39,4},{174,-39,4},{175,-39,4} +,{176,-39,4},{177,-39,4},{178,-39,4},{173,-40,4},{174,-40,4},{175,-40,4},{176,-40,4},{177,-40,4} +,{178,-40,4},{172,-41,4},{173,-41,4},{174,-41,4},{175,-41,4},{176,-41,4},{-10,-41,4},{-11,-41,4} +,{171,-42,4},{172,-42,4},{173,-42,4},{174,-42,4},{175,-42,4},{176,-42,4},{170,-43,4},{171,-43,4} +,{172,-43,4},{173,-43,4},{174,-43,4},{168,-44,4},{169,-44,4},{170,-44,4},{171,-44,4},{172,-44,4} +,{173,-44,4},{-176,-44,4},{-177,-44,4},{167,-45,4},{168,-45,4},{169,-45,4},{170,-45,4},{171,-45,4} +,{-176,-45,4},{-177,-45,4},{50,-46,4},{166,-46,4},{167,-46,4},{168,-46,4},{169,-46,4},{170,-46,4} +,{171,-46,4},{37,-47,4},{38,-47,4},{50,-47,4},{51,-47,4},{52,-47,4},{166,-47,4},{167,-47,4} +,{168,-47,4},{169,-47,4},{170,-47,4},{167,-48,4},{168,-48,4},{179,-48,4},{68,-49,4},{69,-49,4} +,{166,-49,4},{68,-50,4},{69,-50,4},{70,-50,4},{178,-50,4},{68,-51,4},{165,-51,4},{166,-51,4} +,{73,-53,4},{168,-53,4},{169,-53,4},{72,-54,4},{73,-54,4},{-38,-54,4},{-39,-54,4},{3,-55,4} +,{158,-55,4},{-36,-55,4},{-37,-55,4},{-38,-55,4},{-39,-55,4},{158,-56,4},{-35,-56,4},{-110,10,5} +,{-62,15,5},{-64,15,5},{-79,15,5},{-80,15,5},{-83,15,5},{-84,15,5},{-85,15,5},{-86,15,5} +,{-87,15,5},{-88,15,5},{-89,15,5},{-90,15,5},{-91,15,5},{-92,15,5},{-93,15,5},{-94,15,5} +,{-96,15,5},{-97,15,5},{-98,15,5},{-62,16,5},{-63,16,5},{-86,16,5},{-87,16,5},{-88,16,5} +,{-89,16,5},{-90,16,5},{-91,16,5},{-92,16,5},{-93,16,5},{-94,16,5},{-95,16,5},{-96,16,5} +,{-97,16,5},{-98,16,5},{-99,16,5},{-100,16,5},{-101,16,5},{-62,17,5},{-63,17,5},{-64,17,5} +,{-65,17,5},{-66,17,5},{-67,17,5},{-68,17,5},{-72,17,5},{-76,17,5},{-77,17,5},{-78,17,5} +,{-84,17,5},{-88,17,5},{-89,17,5},{-90,17,5},{-91,17,5},{-92,17,5},{-93,17,5},{-94,17,5} +,{-95,17,5},{-96,17,5},{-97,17,5},{-98,17,5},{-99,17,5},{-100,17,5},{-101,17,5},{-102,17,5} +,{-103,17,5},{-63,18,5},{-64,18,5},{-65,18,5},{-66,18,5},{-67,18,5},{-68,18,5},{-69,18,5} +,{-70,18,5},{-71,18,5},{-72,18,5},{-73,18,5},{-74,18,5},{-75,18,5},{-76,18,5},{-77,18,5} +,{-78,18,5},{-79,18,5},{-88,18,5},{-89,18,5},{-90,18,5},{-91,18,5},{-92,18,5},{-93,18,5} +,{-94,18,5},{-95,18,5},{-96,18,5},{-97,18,5},{-98,18,5},{-99,18,5},{-100,18,5},{-101,18,5} +,{-102,18,5},{-103,18,5},{-104,18,5},{-105,18,5},{-111,18,5},{-112,18,5},{-115,18,5},{-69,19,5} +,{-70,19,5},{-71,19,5},{-72,19,5},{-73,19,5},{-74,19,5},{-75,19,5},{-76,19,5},{-77,19,5} +,{-78,19,5},{-80,19,5},{-81,19,5},{-82,19,5},{-88,19,5},{-89,19,5},{-90,19,5},{-91,19,5} +,{-92,19,5},{-96,19,5},{-97,19,5},{-98,19,5},{-99,19,5},{-100,19,5},{-101,19,5},{-102,19,5} +,{-103,19,5},{-104,19,5},{-105,19,5},{-106,19,5},{-111,19,5},{-73,20,5},{-74,20,5},{-75,20,5} +,{-76,20,5},{-77,20,5},{-78,20,5},{-79,20,5},{-80,20,5},{-87,20,5},{-88,20,5},{-89,20,5} +,{-90,20,5},{-91,20,5},{-92,20,5},{-93,20,5},{-97,20,5},{-98,20,5},{-99,20,5},{-100,20,5} +,{-101,20,5},{-102,20,5},{-103,20,5},{-104,20,5},{-105,20,5},{-106,20,5},{-72,21,5},{-73,21,5} +,{-74,21,5},{-76,21,5},{-77,21,5},{-78,21,5},{-79,21,5},{-80,21,5},{-81,21,5},{-82,21,5} +,{-83,21,5},{-84,21,5},{-85,21,5},{-87,21,5},{-88,21,5},{-89,21,5},{-90,21,5},{-91,21,5} +,{-98,21,5},{-99,21,5},{-100,21,5},{-101,21,5},{-102,21,5},{-103,21,5},{-104,21,5},{-105,21,5} +,{-106,21,5},{-107,21,5},{-73,22,5},{-74,22,5},{-75,22,5},{-76,22,5},{-78,22,5},{-79,22,5} +,{-80,22,5},{-81,22,5},{-82,22,5},{-83,22,5},{-84,22,5},{-85,22,5},{-90,22,5},{-92,22,5} +,{-98,22,5},{-99,22,5},{-100,22,5},{-101,22,5},{-102,22,5},{-103,22,5},{-104,22,5},{-105,22,5} +,{-106,22,5},{-107,22,5},{-110,22,5},{-111,22,5},{-74,23,5},{-75,23,5},{-76,23,5},{-77,23,5} +,{-78,23,5},{-80,23,5},{-81,23,5},{-82,23,5},{-83,23,5},{-84,23,5},{-98,23,5},{-99,23,5} +,{-100,23,5},{-101,23,5},{-102,23,5},{-103,23,5},{-104,23,5},{-105,23,5},{-106,23,5},{-107,23,5} +,{-108,23,5},{-110,23,5},{-111,23,5},{-75,24,5},{-76,24,5},{-77,24,5},{-78,24,5},{-79,24,5} +,{-80,24,5},{-81,24,5},{-82,24,5},{-83,24,5},{-98,24,5},{-99,24,5},{-100,24,5},{-101,24,5} +,{-102,24,5},{-103,24,5},{-104,24,5},{-105,24,5},{-106,24,5},{-107,24,5},{-108,24,5},{-109,24,5} +,{-110,24,5},{-111,24,5},{-112,24,5},{-113,24,5},{-116,24,5},{-77,25,5},{-78,25,5},{-79,25,5} +,{-80,25,5},{-81,25,5},{-82,25,5},{-98,25,5},{-99,25,5},{-100,25,5},{-101,25,5},{-102,25,5} +,{-103,25,5},{-104,25,5},{-105,25,5},{-106,25,5},{-107,25,5},{-108,25,5},{-109,25,5},{-110,25,5} +,{-111,25,5},{-112,25,5},{-113,25,5},{-77,26,5},{-78,26,5},{-79,26,5},{-80,26,5},{-81,26,5} +,{-82,26,5},{-83,26,5},{-98,26,5},{-99,26,5},{-100,26,5},{-101,26,5},{-102,26,5},{-103,26,5} +,{-104,26,5},{-105,26,5},{-106,26,5},{-107,26,5},{-108,26,5},{-109,26,5},{-110,26,5},{-112,26,5} +,{-113,26,5},{-114,26,5},{-115,26,5},{-78,27,5},{-79,27,5},{-81,27,5},{-82,27,5},{-83,27,5} +,{-97,27,5},{-98,27,5},{-99,27,5},{-100,27,5},{-101,27,5},{-102,27,5},{-103,27,5},{-104,27,5} +,{-105,27,5},{-106,27,5},{-107,27,5},{-108,27,5},{-109,27,5},{-110,27,5},{-111,27,5},{-112,27,5} +,{-113,27,5},{-114,27,5},{-115,27,5},{-116,27,5},{-81,28,5},{-82,28,5},{-83,28,5},{-90,28,5} +,{-96,28,5},{-97,28,5},{-98,28,5},{-99,28,5},{-100,28,5},{-101,28,5},{-102,28,5},{-103,28,5} +,{-104,28,5},{-105,28,5},{-106,28,5},{-107,28,5},{-108,28,5},{-109,28,5},{-110,28,5},{-111,28,5} +,{-112,28,5},{-113,28,5},{-114,28,5},{-115,28,5},{-116,28,5},{-119,28,5},{-81,29,5},{-82,29,5} +,{-83,29,5},{-84,29,5},{-85,29,5},{-86,29,5},{-89,29,5},{-90,29,5},{-91,29,5},{-92,29,5} +,{-93,29,5},{-94,29,5},{-95,29,5},{-96,29,5},{-97,29,5},{-98,29,5},{-99,29,5},{-100,29,5} +,{-101,29,5},{-102,29,5},{-103,29,5},{-104,29,5},{-105,29,5},{-106,29,5},{-107,29,5},{-108,29,5} +,{-109,29,5},{-110,29,5},{-111,29,5},{-112,29,5},{-113,29,5},{-114,29,5},{-115,29,5},{-116,29,5} +,{-119,29,5},{-82,30,5},{-83,30,5},{-84,30,5},{-85,30,5},{-86,30,5},{-87,30,5},{-88,30,5} +,{-89,30,5},{-90,30,5},{-91,30,5},{-92,30,5},{-93,30,5},{-94,30,5},{-95,30,5},{-96,30,5} +,{-97,30,5},{-98,30,5},{-99,30,5},{-100,30,5},{-101,30,5},{-102,30,5},{-103,30,5},{-104,30,5} +,{-105,30,5},{-106,30,5},{-107,30,5},{-108,30,5},{-109,30,5},{-110,30,5},{-111,30,5},{-112,30,5} +,{-113,30,5},{-114,30,5},{-115,30,5},{-116,30,5},{-117,30,5},{-81,31,5},{-82,31,5},{-83,31,5} +,{-84,31,5},{-85,31,5},{-86,31,5},{-87,31,5},{-88,31,5},{-89,31,5},{-90,31,5},{-91,31,5} +,{-92,31,5},{-93,31,5},{-94,31,5},{-95,31,5},{-96,31,5},{-97,31,5},{-98,31,5},{-99,31,5} +,{-100,31,5},{-101,31,5},{-102,31,5},{-103,31,5},{-104,31,5},{-105,31,5},{-106,31,5},{-107,31,5} +,{-108,31,5},{-109,31,5},{-110,31,5},{-111,31,5},{-112,31,5},{-113,31,5},{-114,31,5},{-115,31,5} +,{-116,31,5},{-117,31,5},{-65,32,5},{-80,32,5},{-81,32,5},{-82,32,5},{-83,32,5},{-84,32,5} +,{-85,32,5},{-86,32,5},{-87,32,5},{-88,32,5},{-89,32,5},{-90,32,5},{-91,32,5},{-92,32,5} +,{-93,32,5},{-94,32,5},{-95,32,5},{-96,32,5},{-97,32,5},{-98,32,5},{-99,32,5},{-100,32,5} +,{-101,32,5},{-102,32,5},{-103,32,5},{-104,32,5},{-105,32,5},{-106,32,5},{-107,32,5},{-108,32,5} +,{-109,32,5},{-110,32,5},{-111,32,5},{-112,32,5},{-113,32,5},{-114,32,5},{-115,32,5},{-116,32,5} +,{-117,32,5},{-118,32,5},{-119,32,5},{-78,33,5},{-79,33,5},{-80,33,5},{-81,33,5},{-82,33,5} +,{-83,33,5},{-84,33,5},{-85,33,5},{-86,33,5},{-87,33,5},{-88,33,5},{-89,33,5},{-90,33,5} +,{-91,33,5},{-92,33,5},{-93,33,5},{-94,33,5},{-95,33,5},{-96,33,5},{-97,33,5},{-98,33,5} +,{-99,33,5},{-100,33,5},{-101,33,5},{-102,33,5},{-103,33,5},{-104,33,5},{-105,33,5},{-106,33,5} +,{-107,33,5},{-108,33,5},{-109,33,5},{-110,33,5},{-111,33,5},{-112,33,5},{-113,33,5},{-114,33,5} +,{-115,33,5},{-116,33,5},{-117,33,5},{-118,33,5},{-119,33,5},{-120,33,5},{-121,33,5},{-77,34,5} +,{-78,34,5},{-79,34,5},{-80,34,5},{-81,34,5},{-82,34,5},{-83,34,5},{-84,34,5},{-85,34,5} +,{-86,34,5},{-87,34,5},{-88,34,5},{-89,34,5},{-90,34,5},{-91,34,5},{-92,34,5},{-93,34,5} +,{-94,34,5},{-95,34,5},{-96,34,5},{-97,34,5},{-98,34,5},{-99,34,5},{-100,34,5},{-101,34,5} +,{-102,34,5},{-103,34,5},{-104,34,5},{-105,34,5},{-106,34,5},{-107,34,5},{-108,34,5},{-109,34,5} +,{-110,34,5},{-111,34,5},{-112,34,5},{-113,34,5},{-114,34,5},{-115,34,5},{-116,34,5},{-117,34,5} +,{-118,34,5},{-119,34,5},{-120,34,5},{-121,34,5},{-76,35,5},{-77,35,5},{-78,35,5},{-79,35,5} +,{-80,35,5},{-81,35,5},{-82,35,5},{-83,35,5},{-84,35,5},{-85,35,5},{-86,35,5},{-87,35,5} +,{-88,35,5},{-89,35,5},{-90,35,5},{-91,35,5},{-92,35,5},{-93,35,5},{-94,35,5},{-95,35,5} +,{-96,35,5},{-97,35,5},{-98,35,5},{-99,35,5},{-100,35,5},{-101,35,5},{-102,35,5},{-103,35,5} +,{-104,35,5},{-105,35,5},{-106,35,5},{-107,35,5},{-108,35,5},{-109,35,5},{-110,35,5},{-111,35,5} +,{-112,35,5},{-113,35,5},{-114,35,5},{-115,35,5},{-116,35,5},{-117,35,5},{-118,35,5},{-119,35,5} +,{-120,35,5},{-121,35,5},{-122,35,5},{-76,36,5},{-77,36,5},{-78,36,5},{-79,36,5},{-80,36,5} +,{-81,36,5},{-82,36,5},{-83,36,5},{-84,36,5},{-85,36,5},{-86,36,5},{-87,36,5},{-88,36,5} +,{-89,36,5},{-90,36,5},{-91,36,5},{-92,36,5},{-93,36,5},{-94,36,5},{-95,36,5},{-96,36,5} +,{-97,36,5},{-98,36,5},{-99,36,5},{-100,36,5},{-101,36,5},{-102,36,5},{-103,36,5},{-104,36,5} +,{-105,36,5},{-106,36,5},{-107,36,5},{-108,36,5},{-109,36,5},{-110,36,5},{-111,36,5},{-112,36,5} +,{-113,36,5},{-114,36,5},{-115,36,5},{-116,36,5},{-117,36,5},{-118,36,5},{-119,36,5},{-120,36,5} +,{-121,36,5},{-122,36,5},{-123,36,5},{-76,37,5},{-77,37,5},{-78,37,5},{-79,37,5},{-80,37,5} +,{-81,37,5},{-82,37,5},{-83,37,5},{-84,37,5},{-85,37,5},{-86,37,5},{-87,37,5},{-88,37,5} +,{-89,37,5},{-90,37,5},{-91,37,5},{-92,37,5},{-93,37,5},{-94,37,5},{-95,37,5},{-96,37,5} +,{-97,37,5},{-98,37,5},{-99,37,5},{-100,37,5},{-101,37,5},{-102,37,5},{-103,37,5},{-104,37,5} +,{-105,37,5},{-106,37,5},{-107,37,5},{-108,37,5},{-109,37,5},{-110,37,5},{-111,37,5},{-112,37,5} +,{-113,37,5},{-114,37,5},{-115,37,5},{-116,37,5},{-117,37,5},{-118,37,5},{-119,37,5},{-120,37,5} +,{-121,37,5},{-122,37,5},{-123,37,5},{-124,37,5},{-75,38,5},{-76,38,5},{-77,38,5},{-78,38,5} +,{-79,38,5},{-80,38,5},{-81,38,5},{-82,38,5},{-83,38,5},{-84,38,5},{-85,38,5},{-86,38,5} +,{-87,38,5},{-88,38,5},{-89,38,5},{-90,38,5},{-91,38,5},{-92,38,5},{-93,38,5},{-94,38,5} +,{-95,38,5},{-96,38,5},{-97,38,5},{-98,38,5},{-99,38,5},{-100,38,5},{-101,38,5},{-102,38,5} +,{-103,38,5},{-104,38,5},{-105,38,5},{-106,38,5},{-107,38,5},{-108,38,5},{-109,38,5},{-110,38,5} +,{-111,38,5},{-112,38,5},{-113,38,5},{-114,38,5},{-115,38,5},{-116,38,5},{-117,38,5},{-118,38,5} +,{-119,38,5},{-120,38,5},{-121,38,5},{-122,38,5},{-123,38,5},{-124,38,5},{-75,39,5},{-76,39,5} +,{-77,39,5},{-78,39,5},{-79,39,5},{-80,39,5},{-81,39,5},{-82,39,5},{-83,39,5},{-84,39,5} +,{-85,39,5},{-86,39,5},{-87,39,5},{-88,39,5},{-89,39,5},{-90,39,5},{-91,39,5},{-92,39,5} +,{-93,39,5},{-94,39,5},{-95,39,5},{-96,39,5},{-97,39,5},{-98,39,5},{-99,39,5},{-100,39,5} +,{-101,39,5},{-102,39,5},{-103,39,5},{-104,39,5},{-105,39,5},{-106,39,5},{-107,39,5},{-108,39,5} +,{-109,39,5},{-110,39,5},{-111,39,5},{-112,39,5},{-113,39,5},{-114,39,5},{-115,39,5},{-116,39,5} +,{-117,39,5},{-118,39,5},{-119,39,5},{-120,39,5},{-121,39,5},{-122,39,5},{-123,39,5},{-124,39,5} +,{-125,39,5},{-73,40,5},{-74,40,5},{-75,40,5},{-76,40,5},{-77,40,5},{-78,40,5},{-79,40,5} +,{-80,40,5},{-81,40,5},{-82,40,5},{-83,40,5},{-84,40,5},{-85,40,5},{-86,40,5},{-87,40,5} +,{-88,40,5},{-89,40,5},{-90,40,5},{-91,40,5},{-92,40,5},{-93,40,5},{-94,40,5},{-95,40,5} +,{-96,40,5},{-97,40,5},{-98,40,5},{-99,40,5},{-100,40,5},{-101,40,5},{-102,40,5},{-103,40,5} +,{-104,40,5},{-105,40,5},{-106,40,5},{-107,40,5},{-108,40,5},{-109,40,5},{-110,40,5},{-111,40,5} +,{-112,40,5},{-113,40,5},{-114,40,5},{-115,40,5},{-116,40,5},{-117,40,5},{-118,40,5},{-119,40,5} +,{-120,40,5},{-121,40,5},{-122,40,5},{-123,40,5},{-124,40,5},{-125,40,5},{-70,41,5},{-71,41,5} +,{-72,41,5},{-73,41,5},{-74,41,5},{-75,41,5},{-76,41,5},{-77,41,5},{-78,41,5},{-79,41,5} +,{-80,41,5},{-81,41,5},{-82,41,5},{-83,41,5},{-84,41,5},{-85,41,5},{-86,41,5},{-87,41,5} +,{-88,41,5},{-89,41,5},{-90,41,5},{-91,41,5},{-92,41,5},{-93,41,5},{-94,41,5},{-95,41,5} +,{-96,41,5},{-97,41,5},{-98,41,5},{-99,41,5},{-100,41,5},{-101,41,5},{-102,41,5},{-103,41,5} +,{-104,41,5},{-105,41,5},{-106,41,5},{-107,41,5},{-108,41,5},{-109,41,5},{-110,41,5},{-111,41,5} +,{-112,41,5},{-113,41,5},{-114,41,5},{-115,41,5},{-116,41,5},{-117,41,5},{-118,41,5},{-119,41,5} +,{-120,41,5},{-121,41,5},{-122,41,5},{-123,41,5},{-124,41,5},{-125,41,5},{-71,42,5},{-72,42,5} +,{-73,42,5},{-74,42,5},{-75,42,5},{-76,42,5},{-77,42,5},{-78,42,5},{-79,42,5},{-80,42,5} +,{-81,42,5},{-82,42,5},{-83,42,5},{-84,42,5},{-85,42,5},{-86,42,5},{-87,42,5},{-88,42,5} +,{-89,42,5},{-90,42,5},{-91,42,5},{-92,42,5},{-93,42,5},{-94,42,5},{-95,42,5},{-96,42,5} +,{-97,42,5},{-98,42,5},{-99,42,5},{-100,42,5},{-101,42,5},{-102,42,5},{-103,42,5},{-104,42,5} +,{-105,42,5},{-106,42,5},{-107,42,5},{-108,42,5},{-109,42,5},{-110,42,5},{-111,42,5},{-112,42,5} +,{-113,42,5},{-114,42,5},{-115,42,5},{-116,42,5},{-117,42,5},{-118,42,5},{-119,42,5},{-120,42,5} +,{-121,42,5},{-122,42,5},{-123,42,5},{-124,42,5},{-125,42,5},{-60,43,5},{-61,43,5},{-65,43,5} +,{-66,43,5},{-67,43,5},{-69,43,5},{-70,43,5},{-71,43,5},{-72,43,5},{-73,43,5},{-74,43,5} +,{-75,43,5},{-76,43,5},{-77,43,5},{-78,43,5},{-79,43,5},{-80,43,5},{-81,43,5},{-82,43,5} +,{-83,43,5},{-84,43,5},{-85,43,5},{-86,43,5},{-87,43,5},{-88,43,5},{-89,43,5},{-90,43,5} +,{-91,43,5},{-92,43,5},{-93,43,5},{-94,43,5},{-95,43,5},{-96,43,5},{-97,43,5},{-98,43,5} +,{-99,43,5},{-100,43,5},{-101,43,5},{-102,43,5},{-103,43,5},{-104,43,5},{-105,43,5},{-106,43,5} +,{-107,43,5},{-108,43,5},{-109,43,5},{-110,43,5},{-111,43,5},{-112,43,5},{-113,43,5},{-114,43,5} +,{-115,43,5},{-116,43,5},{-117,43,5},{-118,43,5},{-119,43,5},{-120,43,5},{-121,43,5},{-122,43,5} +,{-123,43,5},{-124,43,5},{-125,43,5},{-60,44,5},{-62,44,5},{-63,44,5},{-64,44,5},{-65,44,5} +,{-66,44,5},{-67,44,5},{-68,44,5},{-69,44,5},{-70,44,5},{-71,44,5},{-72,44,5},{-73,44,5} +,{-74,44,5},{-75,44,5},{-76,44,5},{-77,44,5},{-78,44,5},{-79,44,5},{-80,44,5},{-81,44,5} +,{-82,44,5},{-83,44,5},{-84,44,5},{-85,44,5},{-86,44,5},{-87,44,5},{-88,44,5},{-89,44,5} +,{-90,44,5},{-91,44,5},{-92,44,5},{-93,44,5},{-94,44,5},{-95,44,5},{-96,44,5},{-97,44,5} +,{-98,44,5},{-99,44,5},{-100,44,5},{-101,44,5},{-102,44,5},{-103,44,5},{-104,44,5},{-105,44,5} +,{-106,44,5},{-107,44,5},{-108,44,5},{-109,44,5},{-110,44,5},{-111,44,5},{-112,44,5},{-113,44,5} +,{-114,44,5},{-115,44,5},{-116,44,5},{-117,44,5},{-118,44,5},{-119,44,5},{-120,44,5},{-121,44,5} +,{-122,44,5},{-123,44,5},{-124,44,5},{-125,44,5},{-60,45,5},{-61,45,5},{-62,45,5},{-63,45,5} +,{-64,45,5},{-65,45,5},{-66,45,5},{-67,45,5},{-68,45,5},{-69,45,5},{-70,45,5},{-71,45,5} +,{-72,45,5},{-73,45,5},{-74,45,5},{-75,45,5},{-76,45,5},{-77,45,5},{-78,45,5},{-79,45,5} +,{-80,45,5},{-81,45,5},{-82,45,5},{-83,45,5},{-84,45,5},{-85,45,5},{-86,45,5},{-87,45,5} +,{-88,45,5},{-89,45,5},{-90,45,5},{-91,45,5},{-92,45,5},{-93,45,5},{-94,45,5},{-95,45,5} +,{-96,45,5},{-97,45,5},{-98,45,5},{-99,45,5},{-100,45,5},{-101,45,5},{-102,45,5},{-103,45,5} +,{-104,45,5},{-105,45,5},{-106,45,5},{-107,45,5},{-108,45,5},{-109,45,5},{-110,45,5},{-111,45,5} +,{-112,45,5},{-113,45,5},{-114,45,5},{-115,45,5},{-116,45,5},{-117,45,5},{-118,45,5},{-119,45,5} +,{-120,45,5},{-121,45,5},{-122,45,5},{-123,45,5},{-124,45,5},{-125,45,5},{-53,46,5},{-54,46,5} +,{-55,46,5},{-56,46,5},{-57,46,5},{-60,46,5},{-61,46,5},{-62,46,5},{-63,46,5},{-64,46,5} +,{-65,46,5},{-66,46,5},{-67,46,5},{-68,46,5},{-69,46,5},{-70,46,5},{-71,46,5},{-72,46,5} +,{-73,46,5},{-74,46,5},{-75,46,5},{-76,46,5},{-77,46,5},{-78,46,5},{-79,46,5},{-80,46,5} +,{-81,46,5},{-82,46,5},{-83,46,5},{-84,46,5},{-85,46,5},{-86,46,5},{-87,46,5},{-88,46,5} +,{-89,46,5},{-90,46,5},{-91,46,5},{-92,46,5},{-93,46,5},{-94,46,5},{-95,46,5},{-96,46,5} +,{-97,46,5},{-98,46,5},{-99,46,5},{-100,46,5},{-101,46,5},{-102,46,5},{-103,46,5},{-104,46,5} +,{-105,46,5},{-106,46,5},{-107,46,5},{-108,46,5},{-109,46,5},{-110,46,5},{-111,46,5},{-112,46,5} +,{-113,46,5},{-114,46,5},{-115,46,5},{-116,46,5},{-117,46,5},{-118,46,5},{-119,46,5},{-120,46,5} +,{-121,46,5},{-122,46,5},{-123,46,5},{-124,46,5},{-125,46,5},{-53,47,5},{-54,47,5},{-55,47,5} +,{-56,47,5},{-57,47,5},{-58,47,5},{-59,47,5},{-60,47,5},{-61,47,5},{-62,47,5},{-63,47,5} +,{-64,47,5},{-65,47,5},{-66,47,5},{-67,47,5},{-68,47,5},{-69,47,5},{-70,47,5},{-71,47,5} +,{-72,47,5},{-73,47,5},{-74,47,5},{-75,47,5},{-76,47,5},{-77,47,5},{-78,47,5},{-79,47,5} +,{-80,47,5},{-81,47,5},{-82,47,5},{-83,47,5},{-84,47,5},{-85,47,5},{-86,47,5},{-88,47,5} +,{-89,47,5},{-90,47,5},{-91,47,5},{-92,47,5},{-93,47,5},{-94,47,5},{-95,47,5},{-96,47,5} +,{-97,47,5},{-98,47,5},{-99,47,5},{-100,47,5},{-101,47,5},{-102,47,5},{-103,47,5},{-104,47,5} +,{-105,47,5},{-106,47,5},{-107,47,5},{-108,47,5},{-109,47,5},{-110,47,5},{-111,47,5},{-112,47,5} +,{-113,47,5},{-114,47,5},{-115,47,5},{-116,47,5},{-117,47,5},{-118,47,5},{-119,47,5},{-120,47,5} +,{-121,47,5},{-122,47,5},{-123,47,5},{-124,47,5},{-125,47,5},{-53,48,5},{-54,48,5},{-55,48,5} +,{-56,48,5},{-57,48,5},{-58,48,5},{-59,48,5},{-60,48,5},{-65,48,5},{-66,48,5},{-67,48,5} +,{-68,48,5},{-69,48,5},{-70,48,5},{-71,48,5},{-72,48,5},{-73,48,5},{-74,48,5},{-75,48,5} +,{-76,48,5},{-77,48,5},{-78,48,5},{-79,48,5},{-80,48,5},{-81,48,5},{-82,48,5},{-83,48,5} +,{-84,48,5},{-85,48,5},{-86,48,5},{-87,48,5},{-88,48,5},{-89,48,5},{-90,48,5},{-91,48,5} +,{-92,48,5},{-93,48,5},{-94,48,5},{-95,48,5},{-96,48,5},{-97,48,5},{-98,48,5},{-99,48,5} +,{-100,48,5},{-101,48,5},{-102,48,5},{-103,48,5},{-104,48,5},{-105,48,5},{-106,48,5},{-107,48,5} +,{-108,48,5},{-109,48,5},{-110,48,5},{-111,48,5},{-112,48,5},{-113,48,5},{-114,48,5},{-115,48,5} +,{-116,48,5},{-117,48,5},{-118,48,5},{-119,48,5},{-120,48,5},{-121,48,5},{-122,48,5},{-123,48,5} +,{-124,48,5},{-125,48,5},{-126,48,5},{-54,49,5},{-55,49,5},{-56,49,5},{-57,49,5},{-58,49,5} +,{-59,49,5},{-62,49,5},{-63,49,5},{-64,49,5},{-65,49,5},{-66,49,5},{-67,49,5},{-68,49,5} +,{-69,49,5},{-70,49,5},{-71,49,5},{-72,49,5},{-73,49,5},{-74,49,5},{-75,49,5},{-76,49,5} +,{-77,49,5},{-78,49,5},{-79,49,5},{-80,49,5},{-81,49,5},{-82,49,5},{-83,49,5},{-84,49,5} +,{-85,49,5},{-86,49,5},{-87,49,5},{-88,49,5},{-89,49,5},{-90,49,5},{-91,49,5},{-92,49,5} +,{-93,49,5},{-94,49,5},{-95,49,5},{-96,49,5},{-97,49,5},{-98,49,5},{-99,49,5},{-100,49,5} +,{-101,49,5},{-102,49,5},{-103,49,5},{-104,49,5},{-105,49,5},{-106,49,5},{-107,49,5},{-108,49,5} +,{-109,49,5},{-110,49,5},{-111,49,5},{-112,49,5},{-113,49,5},{-114,49,5},{-115,49,5},{-116,49,5} +,{-117,49,5},{-118,49,5},{-119,49,5},{-120,49,5},{-121,49,5},{-122,49,5},{-123,49,5},{-124,49,5} +,{-125,49,5},{-126,49,5},{-127,49,5},{-128,49,5},{-56,50,5},{-57,50,5},{-58,50,5},{-59,50,5} +,{-60,50,5},{-61,50,5},{-62,50,5},{-63,50,5},{-64,50,5},{-65,50,5},{-66,50,5},{-67,50,5} +,{-68,50,5},{-69,50,5},{-70,50,5},{-71,50,5},{-72,50,5},{-73,50,5},{-74,50,5},{-75,50,5} +,{-76,50,5},{-77,50,5},{-78,50,5},{-79,50,5},{-80,50,5},{-81,50,5},{-82,50,5},{-83,50,5} +,{-84,50,5},{-85,50,5},{-86,50,5},{-87,50,5},{-88,50,5},{-89,50,5},{-90,50,5},{-91,50,5} +,{-92,50,5},{-93,50,5},{-94,50,5},{-95,50,5},{-96,50,5},{-97,50,5},{-98,50,5},{-99,50,5} +,{-100,50,5},{-101,50,5},{-102,50,5},{-103,50,5},{-104,50,5},{-105,50,5},{-106,50,5},{-107,50,5} +,{-108,50,5},{-109,50,5},{-110,50,5},{-111,50,5},{-112,50,5},{-113,50,5},{-114,50,5},{-115,50,5} +,{-116,50,5},{-117,50,5},{-118,50,5},{-119,50,5},{-120,50,5},{-121,50,5},{-122,50,5},{-123,50,5} +,{-124,50,5},{-125,50,5},{-126,50,5},{-127,50,5},{-128,50,5},{-129,50,5},{-130,50,5},{177,51,5} +,{178,51,5},{179,51,5},{-56,51,5},{-57,51,5},{-58,51,5},{-59,51,5},{-60,51,5},{-61,51,5} +,{-62,51,5},{-63,51,5},{-64,51,5},{-65,51,5},{-66,51,5},{-67,51,5},{-68,51,5},{-69,51,5} +,{-70,51,5},{-71,51,5},{-72,51,5},{-73,51,5},{-74,51,5},{-75,51,5},{-76,51,5},{-77,51,5} +,{-78,51,5},{-79,51,5},{-80,51,5},{-81,51,5},{-82,51,5},{-83,51,5},{-84,51,5},{-85,51,5} +,{-86,51,5},{-87,51,5},{-88,51,5},{-89,51,5},{-90,51,5},{-91,51,5},{-92,51,5},{-93,51,5} +,{-94,51,5},{-95,51,5},{-96,51,5},{-97,51,5},{-98,51,5},{-99,51,5},{-100,51,5},{-101,51,5} +,{-102,51,5},{-103,51,5},{-104,51,5},{-105,51,5},{-106,51,5},{-107,51,5},{-108,51,5},{-109,51,5} +,{-110,51,5},{-111,51,5},{-112,51,5},{-113,51,5},{-114,51,5},{-115,51,5},{-116,51,5},{-117,51,5} +,{-118,51,5},{-119,51,5},{-120,51,5},{-121,51,5},{-122,51,5},{-123,51,5},{-124,51,5},{-125,51,5} +,{-126,51,5},{-127,51,5},{-128,51,5},{-129,51,5},{-131,51,5},{-132,51,5},{-176,51,5},{-177,51,5} +,{-178,51,5},{-179,51,5},{-180,51,5},{172,52,5},{173,52,5},{174,52,5},{175,52,5},{177,52,5} +,{178,52,5},{179,52,5},{-56,52,5},{-57,52,5},{-58,52,5},{-59,52,5},{-60,52,5},{-61,52,5} +,{-62,52,5},{-63,52,5},{-64,52,5},{-65,52,5},{-66,52,5},{-67,52,5},{-68,52,5},{-69,52,5} +,{-70,52,5},{-71,52,5},{-72,52,5},{-73,52,5},{-74,52,5},{-75,52,5},{-76,52,5},{-77,52,5} +,{-78,52,5},{-79,52,5},{-80,52,5},{-81,52,5},{-82,52,5},{-83,52,5},{-84,52,5},{-85,52,5} +,{-86,52,5},{-87,52,5},{-88,52,5},{-89,52,5},{-90,52,5},{-91,52,5},{-92,52,5},{-93,52,5} +,{-94,52,5},{-95,52,5},{-96,52,5},{-97,52,5},{-98,52,5},{-99,52,5},{-100,52,5},{-101,52,5} +,{-102,52,5},{-103,52,5},{-104,52,5},{-105,52,5},{-106,52,5},{-107,52,5},{-108,52,5},{-109,52,5} +,{-110,52,5},{-111,52,5},{-112,52,5},{-113,52,5},{-114,52,5},{-115,52,5},{-116,52,5},{-117,52,5} +,{-118,52,5},{-119,52,5},{-120,52,5},{-121,52,5},{-122,52,5},{-123,52,5},{-124,52,5},{-125,52,5} +,{-126,52,5},{-127,52,5},{-128,52,5},{-129,52,5},{-130,52,5},{-131,52,5},{-132,52,5},{-133,52,5} +,{-169,52,5},{-170,52,5},{-171,52,5},{-172,52,5},{-173,52,5},{-174,52,5},{-175,52,5},{-176,52,5} +,{-177,52,5},{172,53,5},{-56,53,5},{-57,53,5},{-58,53,5},{-59,53,5},{-60,53,5},{-61,53,5} +,{-62,53,5},{-63,53,5},{-64,53,5},{-65,53,5},{-66,53,5},{-67,53,5},{-68,53,5},{-69,53,5} +,{-70,53,5},{-71,53,5},{-72,53,5},{-73,53,5},{-74,53,5},{-75,53,5},{-76,53,5},{-77,53,5} +,{-78,53,5},{-79,53,5},{-80,53,5},{-81,53,5},{-82,53,5},{-83,53,5},{-84,53,5},{-85,53,5} +,{-86,53,5},{-87,53,5},{-88,53,5},{-89,53,5},{-90,53,5},{-91,53,5},{-92,53,5},{-93,53,5} +,{-94,53,5},{-95,53,5},{-96,53,5},{-97,53,5},{-98,53,5},{-99,53,5},{-100,53,5},{-101,53,5} +,{-102,53,5},{-103,53,5},{-104,53,5},{-105,53,5},{-106,53,5},{-107,53,5},{-108,53,5},{-109,53,5} +,{-110,53,5},{-111,53,5},{-112,53,5},{-113,53,5},{-114,53,5},{-115,53,5},{-116,53,5},{-117,53,5} +,{-118,53,5},{-119,53,5},{-120,53,5},{-121,53,5},{-122,53,5},{-123,53,5},{-124,53,5},{-125,53,5} +,{-126,53,5},{-127,53,5},{-128,53,5},{-129,53,5},{-130,53,5},{-131,53,5},{-132,53,5},{-133,53,5} +,{-134,53,5},{-167,53,5},{-168,53,5},{-169,53,5},{-170,53,5},{-57,54,5},{-58,54,5},{-59,54,5} +,{-60,54,5},{-61,54,5},{-62,54,5},{-63,54,5},{-64,54,5},{-65,54,5},{-66,54,5},{-67,54,5} +,{-68,54,5},{-69,54,5},{-70,54,5},{-71,54,5},{-72,54,5},{-73,54,5},{-74,54,5},{-75,54,5} +,{-76,54,5},{-77,54,5},{-78,54,5},{-79,54,5},{-80,54,5},{-81,54,5},{-82,54,5},{-83,54,5} +,{-84,54,5},{-85,54,5},{-86,54,5},{-87,54,5},{-88,54,5},{-89,54,5},{-90,54,5},{-91,54,5} +,{-92,54,5},{-93,54,5},{-94,54,5},{-95,54,5},{-96,54,5},{-97,54,5},{-98,54,5},{-99,54,5} +,{-100,54,5},{-101,54,5},{-102,54,5},{-103,54,5},{-104,54,5},{-105,54,5},{-106,54,5},{-107,54,5} +,{-108,54,5},{-109,54,5},{-110,54,5},{-111,54,5},{-112,54,5},{-113,54,5},{-114,54,5},{-115,54,5} +,{-116,54,5},{-117,54,5},{-118,54,5},{-119,54,5},{-120,54,5},{-121,54,5},{-122,54,5},{-123,54,5} +,{-124,54,5},{-125,54,5},{-126,54,5},{-127,54,5},{-128,54,5},{-129,54,5},{-130,54,5},{-131,54,5} +,{-132,54,5},{-133,54,5},{-134,54,5},{-160,54,5},{-161,54,5},{-162,54,5},{-163,54,5},{-164,54,5} +,{-165,54,5},{-166,54,5},{-167,54,5},{-50,0,6},{-51,0,6},{-52,0,6},{-53,0,6},{-54,0,6} +,{-55,0,6},{-56,0,6},{-57,0,6},{-58,0,6},{-59,0,6},{-60,0,6},{-61,0,6},{-62,0,6} +,{-63,0,6},{-64,0,6},{-65,0,6},{-66,0,6},{-67,0,6},{-68,0,6},{-69,0,6},{-70,0,6} +,{-71,0,6},{-72,0,6},{-73,0,6},{-74,0,6},{-75,0,6},{-76,0,6},{-77,0,6},{-78,0,6} +,{-79,0,6},{-80,0,6},{-81,0,6},{-90,0,6},{-91,0,6},{-92,0,6},{-50,1,6},{-51,1,6} +,{-52,1,6},{-53,1,6},{-54,1,6},{-55,1,6},{-56,1,6},{-57,1,6},{-58,1,6},{-59,1,6} +,{-60,1,6},{-61,1,6},{-62,1,6},{-63,1,6},{-64,1,6},{-65,1,6},{-66,1,6},{-67,1,6} +,{-68,1,6},{-69,1,6},{-70,1,6},{-71,1,6},{-72,1,6},{-73,1,6},{-74,1,6},{-75,1,6} +,{-76,1,6},{-77,1,6},{-78,1,6},{-79,1,6},{-80,1,6},{-92,1,6},{-51,2,6},{-52,2,6} +,{-53,2,6},{-54,2,6},{-55,2,6},{-56,2,6},{-57,2,6},{-58,2,6},{-59,2,6},{-60,2,6} +,{-61,2,6},{-62,2,6},{-63,2,6},{-64,2,6},{-65,2,6},{-66,2,6},{-67,2,6},{-68,2,6} +,{-69,2,6},{-70,2,6},{-71,2,6},{-72,2,6},{-73,2,6},{-74,2,6},{-75,2,6},{-76,2,6} +,{-77,2,6},{-78,2,6},{-79,2,6},{-51,3,6},{-52,3,6},{-53,3,6},{-54,3,6},{-55,3,6} +,{-56,3,6},{-57,3,6},{-58,3,6},{-59,3,6},{-60,3,6},{-61,3,6},{-62,3,6},{-63,3,6} +,{-64,3,6},{-65,3,6},{-66,3,6},{-67,3,6},{-68,3,6},{-69,3,6},{-70,3,6},{-71,3,6} +,{-72,3,6},{-73,3,6},{-74,3,6},{-75,3,6},{-76,3,6},{-77,3,6},{-78,3,6},{-79,3,6} +,{-82,3,6},{-52,4,6},{-53,4,6},{-54,4,6},{-55,4,6},{-56,4,6},{-57,4,6},{-58,4,6} +,{-59,4,6},{-60,4,6},{-61,4,6},{-62,4,6},{-63,4,6},{-64,4,6},{-65,4,6},{-66,4,6} +,{-67,4,6},{-68,4,6},{-69,4,6},{-70,4,6},{-71,4,6},{-72,4,6},{-73,4,6},{-74,4,6} +,{-75,4,6},{-76,4,6},{-77,4,6},{-78,4,6},{-82,4,6},{-53,5,6},{-54,5,6},{-55,5,6} +,{-56,5,6},{-57,5,6},{-58,5,6},{-59,5,6},{-60,5,6},{-61,5,6},{-62,5,6},{-63,5,6} +,{-64,5,6},{-65,5,6},{-66,5,6},{-67,5,6},{-68,5,6},{-69,5,6},{-70,5,6},{-71,5,6} +,{-72,5,6},{-73,5,6},{-74,5,6},{-75,5,6},{-76,5,6},{-77,5,6},{-78,5,6},{-88,5,6} +,{-56,6,6},{-57,6,6},{-58,6,6},{-59,6,6},{-60,6,6},{-61,6,6},{-62,6,6},{-63,6,6} +,{-64,6,6},{-65,6,6},{-66,6,6},{-67,6,6},{-68,6,6},{-69,6,6},{-70,6,6},{-71,6,6} +,{-72,6,6},{-73,6,6},{-74,6,6},{-75,6,6},{-76,6,6},{-77,6,6},{-78,6,6},{-59,7,6} +,{-60,7,6},{-61,7,6},{-62,7,6},{-63,7,6},{-64,7,6},{-65,7,6},{-66,7,6},{-67,7,6} +,{-68,7,6},{-69,7,6},{-70,7,6},{-71,7,6},{-72,7,6},{-73,7,6},{-74,7,6},{-75,7,6} +,{-76,7,6},{-77,7,6},{-78,7,6},{-79,7,6},{-80,7,6},{-81,7,6},{-82,7,6},{-83,7,6} +,{-60,8,6},{-61,8,6},{-62,8,6},{-63,8,6},{-64,8,6},{-65,8,6},{-66,8,6},{-67,8,6} +,{-68,8,6},{-69,8,6},{-70,8,6},{-71,8,6},{-72,8,6},{-73,8,6},{-74,8,6},{-75,8,6} +,{-76,8,6},{-77,8,6},{-78,8,6},{-79,8,6},{-80,8,6},{-81,8,6},{-82,8,6},{-83,8,6} +,{-84,8,6},{-61,9,6},{-62,9,6},{-63,9,6},{-64,9,6},{-65,9,6},{-66,9,6},{-67,9,6} +,{-68,9,6},{-69,9,6},{-70,9,6},{-71,9,6},{-72,9,6},{-73,9,6},{-74,9,6},{-75,9,6} +,{-76,9,6},{-77,9,6},{-78,9,6},{-79,9,6},{-80,9,6},{-81,9,6},{-82,9,6},{-83,9,6} +,{-84,9,6},{-85,9,6},{-86,9,6},{-61,10,6},{-62,10,6},{-63,10,6},{-64,10,6},{-65,10,6} +,{-66,10,6},{-67,10,6},{-68,10,6},{-69,10,6},{-70,10,6},{-71,10,6},{-72,10,6},{-73,10,6} +,{-74,10,6},{-75,10,6},{-76,10,6},{-84,10,6},{-85,10,6},{-86,10,6},{-61,11,6},{-62,11,6} +,{-64,11,6},{-65,11,6},{-67,11,6},{-68,11,6},{-69,11,6},{-70,11,6},{-71,11,6},{-72,11,6} +,{-73,11,6},{-74,11,6},{-75,11,6},{-84,11,6},{-85,11,6},{-86,11,6},{-87,11,6},{-62,12,6} +,{-69,12,6},{-70,12,6},{-71,12,6},{-72,12,6},{-73,12,6},{-82,12,6},{-83,12,6},{-84,12,6} +,{-85,12,6},{-86,12,6},{-87,12,6},{-88,12,6},{-60,13,6},{-61,13,6},{-62,13,6},{-81,13,6} +,{-82,13,6},{-84,13,6},{-85,13,6},{-86,13,6},{-87,13,6},{-88,13,6},{-89,13,6},{-90,13,6} +,{-91,13,6},{-92,13,6},{-61,14,6},{-62,14,6},{-81,14,6},{-83,14,6},{-84,14,6},{-85,14,6} +,{-86,14,6},{-87,14,6},{-88,14,6},{-89,14,6},{-90,14,6},{-91,14,6},{-92,14,6},{-93,14,6} +,{-47,-1,6},{-48,-1,6},{-49,-1,6},{-50,-1,6},{-51,-1,6},{-52,-1,6},{-53,-1,6},{-54,-1,6} +,{-55,-1,6},{-56,-1,6},{-57,-1,6},{-58,-1,6},{-59,-1,6},{-60,-1,6},{-61,-1,6},{-62,-1,6} +,{-63,-1,6},{-64,-1,6},{-65,-1,6},{-66,-1,6},{-67,-1,6},{-68,-1,6},{-69,-1,6},{-70,-1,6} +,{-71,-1,6},{-72,-1,6},{-73,-1,6},{-74,-1,6},{-75,-1,6},{-76,-1,6},{-77,-1,6},{-78,-1,6} +,{-79,-1,6},{-80,-1,6},{-81,-1,6},{-90,-1,6},{-91,-1,6},{-92,-1,6},{-45,-2,6},{-46,-2,6} +,{-47,-2,6},{-48,-2,6},{-49,-2,6},{-50,-2,6},{-51,-2,6},{-52,-2,6},{-53,-2,6},{-54,-2,6} +,{-55,-2,6},{-56,-2,6},{-57,-2,6},{-58,-2,6},{-59,-2,6},{-60,-2,6},{-61,-2,6},{-62,-2,6} +,{-63,-2,6},{-64,-2,6},{-65,-2,6},{-66,-2,6},{-67,-2,6},{-68,-2,6},{-69,-2,6},{-70,-2,6} +,{-71,-2,6},{-72,-2,6},{-73,-2,6},{-74,-2,6},{-75,-2,6},{-76,-2,6},{-77,-2,6},{-78,-2,6} +,{-79,-2,6},{-80,-2,6},{-81,-2,6},{-82,-2,6},{-90,-2,6},{-91,-2,6},{-92,-2,6},{-40,-3,6} +,{-41,-3,6},{-42,-3,6},{-43,-3,6},{-44,-3,6},{-45,-3,6},{-46,-3,6},{-47,-3,6},{-48,-3,6} +,{-49,-3,6},{-50,-3,6},{-51,-3,6},{-52,-3,6},{-53,-3,6},{-54,-3,6},{-55,-3,6},{-56,-3,6} +,{-57,-3,6},{-58,-3,6},{-59,-3,6},{-60,-3,6},{-61,-3,6},{-62,-3,6},{-63,-3,6},{-64,-3,6} +,{-65,-3,6},{-66,-3,6},{-67,-3,6},{-68,-3,6},{-69,-3,6},{-70,-3,6},{-71,-3,6},{-72,-3,6} +,{-73,-3,6},{-74,-3,6},{-75,-3,6},{-76,-3,6},{-77,-3,6},{-78,-3,6},{-79,-3,6},{-80,-3,6} +,{-81,-3,6},{-82,-3,6},{-33,-4,6},{-34,-4,6},{-39,-4,6},{-40,-4,6},{-41,-4,6},{-42,-4,6} +,{-43,-4,6},{-44,-4,6},{-45,-4,6},{-46,-4,6},{-47,-4,6},{-48,-4,6},{-49,-4,6},{-50,-4,6} +,{-51,-4,6},{-52,-4,6},{-53,-4,6},{-54,-4,6},{-55,-4,6},{-56,-4,6},{-57,-4,6},{-58,-4,6} +,{-59,-4,6},{-60,-4,6},{-61,-4,6},{-62,-4,6},{-63,-4,6},{-64,-4,6},{-65,-4,6},{-66,-4,6} +,{-67,-4,6},{-68,-4,6},{-69,-4,6},{-70,-4,6},{-71,-4,6},{-72,-4,6},{-73,-4,6},{-74,-4,6} +,{-75,-4,6},{-76,-4,6},{-77,-4,6},{-78,-4,6},{-79,-4,6},{-80,-4,6},{-81,-4,6},{-37,-5,6} +,{-38,-5,6},{-39,-5,6},{-40,-5,6},{-41,-5,6},{-42,-5,6},{-43,-5,6},{-44,-5,6},{-45,-5,6} +,{-46,-5,6},{-47,-5,6},{-48,-5,6},{-49,-5,6},{-50,-5,6},{-51,-5,6},{-52,-5,6},{-53,-5,6} +,{-54,-5,6},{-55,-5,6},{-56,-5,6},{-57,-5,6},{-58,-5,6},{-59,-5,6},{-60,-5,6},{-61,-5,6} +,{-62,-5,6},{-63,-5,6},{-64,-5,6},{-65,-5,6},{-66,-5,6},{-67,-5,6},{-68,-5,6},{-69,-5,6} +,{-70,-5,6},{-71,-5,6},{-72,-5,6},{-73,-5,6},{-74,-5,6},{-75,-5,6},{-76,-5,6},{-77,-5,6} +,{-78,-5,6},{-79,-5,6},{-80,-5,6},{-81,-5,6},{-82,-5,6},{-36,-6,6},{-37,-6,6},{-38,-6,6} +,{-39,-6,6},{-40,-6,6},{-41,-6,6},{-42,-6,6},{-43,-6,6},{-44,-6,6},{-45,-6,6},{-46,-6,6} +,{-47,-6,6},{-48,-6,6},{-49,-6,6},{-50,-6,6},{-51,-6,6},{-52,-6,6},{-53,-6,6},{-54,-6,6} +,{-55,-6,6},{-56,-6,6},{-57,-6,6},{-58,-6,6},{-59,-6,6},{-60,-6,6},{-61,-6,6},{-62,-6,6} +,{-63,-6,6},{-64,-6,6},{-65,-6,6},{-66,-6,6},{-67,-6,6},{-68,-6,6},{-69,-6,6},{-70,-6,6} +,{-71,-6,6},{-72,-6,6},{-73,-6,6},{-74,-6,6},{-75,-6,6},{-76,-6,6},{-77,-6,6},{-78,-6,6} +,{-79,-6,6},{-80,-6,6},{-81,-6,6},{-82,-6,6},{-35,-7,6},{-36,-7,6},{-37,-7,6},{-38,-7,6} +,{-39,-7,6},{-40,-7,6},{-41,-7,6},{-42,-7,6},{-43,-7,6},{-44,-7,6},{-45,-7,6},{-46,-7,6} +,{-47,-7,6},{-48,-7,6},{-49,-7,6},{-50,-7,6},{-51,-7,6},{-52,-7,6},{-53,-7,6},{-54,-7,6} +,{-55,-7,6},{-56,-7,6},{-57,-7,6},{-58,-7,6},{-59,-7,6},{-60,-7,6},{-61,-7,6},{-62,-7,6} +,{-63,-7,6},{-64,-7,6},{-65,-7,6},{-66,-7,6},{-67,-7,6},{-68,-7,6},{-69,-7,6},{-70,-7,6} +,{-71,-7,6},{-72,-7,6},{-73,-7,6},{-74,-7,6},{-75,-7,6},{-76,-7,6},{-77,-7,6},{-78,-7,6} +,{-79,-7,6},{-80,-7,6},{-81,-7,6},{-82,-7,6},{-35,-8,6},{-36,-8,6},{-37,-8,6},{-38,-8,6} +,{-39,-8,6},{-40,-8,6},{-41,-8,6},{-42,-8,6},{-43,-8,6},{-44,-8,6},{-45,-8,6},{-46,-8,6} +,{-47,-8,6},{-48,-8,6},{-49,-8,6},{-50,-8,6},{-51,-8,6},{-52,-8,6},{-53,-8,6},{-54,-8,6} +,{-55,-8,6},{-56,-8,6},{-57,-8,6},{-58,-8,6},{-59,-8,6},{-60,-8,6},{-61,-8,6},{-62,-8,6} +,{-63,-8,6},{-64,-8,6},{-65,-8,6},{-66,-8,6},{-67,-8,6},{-68,-8,6},{-69,-8,6},{-70,-8,6} +,{-71,-8,6},{-72,-8,6},{-73,-8,6},{-74,-8,6},{-75,-8,6},{-76,-8,6},{-77,-8,6},{-78,-8,6} +,{-79,-8,6},{-80,-8,6},{-35,-9,6},{-36,-9,6},{-37,-9,6},{-38,-9,6},{-39,-9,6},{-40,-9,6} +,{-41,-9,6},{-42,-9,6},{-43,-9,6},{-44,-9,6},{-45,-9,6},{-46,-9,6},{-47,-9,6},{-48,-9,6} +,{-49,-9,6},{-50,-9,6},{-51,-9,6},{-52,-9,6},{-53,-9,6},{-54,-9,6},{-55,-9,6},{-56,-9,6} +,{-57,-9,6},{-58,-9,6},{-59,-9,6},{-60,-9,6},{-61,-9,6},{-62,-9,6},{-63,-9,6},{-64,-9,6} +,{-65,-9,6},{-66,-9,6},{-67,-9,6},{-68,-9,6},{-69,-9,6},{-70,-9,6},{-71,-9,6},{-72,-9,6} +,{-73,-9,6},{-74,-9,6},{-75,-9,6},{-76,-9,6},{-77,-9,6},{-78,-9,6},{-79,-9,6},{-80,-9,6} +,{-36,-10,6},{-37,-10,6},{-38,-10,6},{-39,-10,6},{-40,-10,6},{-41,-10,6},{-42,-10,6},{-43,-10,6} +,{-44,-10,6},{-45,-10,6},{-46,-10,6},{-47,-10,6},{-48,-10,6},{-49,-10,6},{-50,-10,6},{-51,-10,6} +,{-52,-10,6},{-53,-10,6},{-54,-10,6},{-55,-10,6},{-56,-10,6},{-57,-10,6},{-58,-10,6},{-59,-10,6} +,{-60,-10,6},{-61,-10,6},{-62,-10,6},{-63,-10,6},{-64,-10,6},{-65,-10,6},{-66,-10,6},{-67,-10,6} +,{-68,-10,6},{-69,-10,6},{-70,-10,6},{-71,-10,6},{-72,-10,6},{-73,-10,6},{-74,-10,6},{-75,-10,6} +,{-76,-10,6},{-77,-10,6},{-78,-10,6},{-79,-10,6},{-37,-11,6},{-38,-11,6},{-39,-11,6},{-40,-11,6} +,{-41,-11,6},{-42,-11,6},{-43,-11,6},{-44,-11,6},{-45,-11,6},{-46,-11,6},{-47,-11,6},{-48,-11,6} +,{-49,-11,6},{-50,-11,6},{-51,-11,6},{-52,-11,6},{-53,-11,6},{-54,-11,6},{-55,-11,6},{-56,-11,6} +,{-57,-11,6},{-58,-11,6},{-59,-11,6},{-60,-11,6},{-61,-11,6},{-62,-11,6},{-63,-11,6},{-64,-11,6} +,{-65,-11,6},{-66,-11,6},{-67,-11,6},{-68,-11,6},{-69,-11,6},{-70,-11,6},{-71,-11,6},{-72,-11,6} +,{-73,-11,6},{-74,-11,6},{-75,-11,6},{-76,-11,6},{-77,-11,6},{-78,-11,6},{-79,-11,6},{-38,-12,6} +,{-39,-12,6},{-40,-12,6},{-41,-12,6},{-42,-12,6},{-43,-12,6},{-44,-12,6},{-45,-12,6},{-46,-12,6} +,{-47,-12,6},{-48,-12,6},{-49,-12,6},{-50,-12,6},{-51,-12,6},{-52,-12,6},{-53,-12,6},{-54,-12,6} +,{-55,-12,6},{-56,-12,6},{-57,-12,6},{-58,-12,6},{-59,-12,6},{-60,-12,6},{-61,-12,6},{-62,-12,6} +,{-63,-12,6},{-64,-12,6},{-65,-12,6},{-66,-12,6},{-67,-12,6},{-68,-12,6},{-69,-12,6},{-70,-12,6} +,{-71,-12,6},{-72,-12,6},{-73,-12,6},{-74,-12,6},{-75,-12,6},{-76,-12,6},{-77,-12,6},{-78,-12,6} +,{-38,-13,6},{-39,-13,6},{-40,-13,6},{-41,-13,6},{-42,-13,6},{-43,-13,6},{-44,-13,6},{-45,-13,6} +,{-46,-13,6},{-47,-13,6},{-48,-13,6},{-49,-13,6},{-50,-13,6},{-51,-13,6},{-52,-13,6},{-53,-13,6} +,{-54,-13,6},{-55,-13,6},{-56,-13,6},{-57,-13,6},{-58,-13,6},{-59,-13,6},{-60,-13,6},{-61,-13,6} +,{-62,-13,6},{-63,-13,6},{-64,-13,6},{-65,-13,6},{-66,-13,6},{-67,-13,6},{-68,-13,6},{-69,-13,6} +,{-70,-13,6},{-71,-13,6},{-72,-13,6},{-73,-13,6},{-74,-13,6},{-75,-13,6},{-76,-13,6},{-77,-13,6} +,{-78,-13,6},{-39,-14,6},{-40,-14,6},{-41,-14,6},{-42,-14,6},{-43,-14,6},{-44,-14,6},{-45,-14,6} +,{-46,-14,6},{-47,-14,6},{-48,-14,6},{-49,-14,6},{-50,-14,6},{-51,-14,6},{-52,-14,6},{-53,-14,6} +,{-54,-14,6},{-55,-14,6},{-56,-14,6},{-57,-14,6},{-58,-14,6},{-59,-14,6},{-60,-14,6},{-61,-14,6} +,{-62,-14,6},{-63,-14,6},{-64,-14,6},{-65,-14,6},{-66,-14,6},{-67,-14,6},{-68,-14,6},{-69,-14,6} +,{-70,-14,6},{-71,-14,6},{-72,-14,6},{-73,-14,6},{-74,-14,6},{-75,-14,6},{-76,-14,6},{-77,-14,6} +,{-39,-15,6},{-40,-15,6},{-41,-15,6},{-42,-15,6},{-43,-15,6},{-44,-15,6},{-45,-15,6},{-46,-15,6} +,{-47,-15,6},{-48,-15,6},{-49,-15,6},{-50,-15,6},{-51,-15,6},{-52,-15,6},{-53,-15,6},{-54,-15,6} +,{-55,-15,6},{-56,-15,6},{-57,-15,6},{-58,-15,6},{-59,-15,6},{-60,-15,6},{-61,-15,6},{-62,-15,6} +,{-63,-15,6},{-64,-15,6},{-65,-15,6},{-66,-15,6},{-67,-15,6},{-68,-15,6},{-69,-15,6},{-70,-15,6} +,{-71,-15,6},{-72,-15,6},{-73,-15,6},{-74,-15,6},{-75,-15,6},{-76,-15,6},{-77,-15,6},{-39,-16,6} +,{-40,-16,6},{-41,-16,6},{-42,-16,6},{-43,-16,6},{-44,-16,6},{-45,-16,6},{-46,-16,6},{-47,-16,6} +,{-48,-16,6},{-49,-16,6},{-50,-16,6},{-51,-16,6},{-52,-16,6},{-53,-16,6},{-54,-16,6},{-55,-16,6} +,{-56,-16,6},{-57,-16,6},{-58,-16,6},{-59,-16,6},{-60,-16,6},{-61,-16,6},{-62,-16,6},{-63,-16,6} +,{-64,-16,6},{-65,-16,6},{-66,-16,6},{-67,-16,6},{-68,-16,6},{-69,-16,6},{-70,-16,6},{-71,-16,6} +,{-72,-16,6},{-73,-16,6},{-74,-16,6},{-75,-16,6},{-76,-16,6},{-39,-17,6},{-40,-17,6},{-41,-17,6} +,{-42,-17,6},{-43,-17,6},{-44,-17,6},{-45,-17,6},{-46,-17,6},{-47,-17,6},{-48,-17,6},{-49,-17,6} +,{-50,-17,6},{-51,-17,6},{-52,-17,6},{-53,-17,6},{-54,-17,6},{-55,-17,6},{-56,-17,6},{-57,-17,6} +,{-58,-17,6},{-59,-17,6},{-60,-17,6},{-61,-17,6},{-62,-17,6},{-63,-17,6},{-64,-17,6},{-65,-17,6} +,{-66,-17,6},{-67,-17,6},{-68,-17,6},{-69,-17,6},{-70,-17,6},{-71,-17,6},{-72,-17,6},{-73,-17,6} +,{-74,-17,6},{-75,-17,6},{-39,-18,6},{-40,-18,6},{-41,-18,6},{-42,-18,6},{-43,-18,6},{-44,-18,6} +,{-45,-18,6},{-46,-18,6},{-47,-18,6},{-48,-18,6},{-49,-18,6},{-50,-18,6},{-51,-18,6},{-52,-18,6} +,{-53,-18,6},{-54,-18,6},{-55,-18,6},{-56,-18,6},{-57,-18,6},{-58,-18,6},{-59,-18,6},{-60,-18,6} +,{-61,-18,6},{-62,-18,6},{-63,-18,6},{-64,-18,6},{-65,-18,6},{-66,-18,6},{-67,-18,6},{-68,-18,6} +,{-69,-18,6},{-70,-18,6},{-71,-18,6},{-72,-18,6},{-73,-18,6},{-40,-19,6},{-41,-19,6},{-42,-19,6} +,{-43,-19,6},{-44,-19,6},{-45,-19,6},{-46,-19,6},{-47,-19,6},{-48,-19,6},{-49,-19,6},{-50,-19,6} +,{-51,-19,6},{-52,-19,6},{-53,-19,6},{-54,-19,6},{-55,-19,6},{-56,-19,6},{-57,-19,6},{-58,-19,6} +,{-59,-19,6},{-60,-19,6},{-61,-19,6},{-62,-19,6},{-63,-19,6},{-64,-19,6},{-65,-19,6},{-66,-19,6} +,{-67,-19,6},{-68,-19,6},{-69,-19,6},{-70,-19,6},{-71,-19,6},{-40,-20,6},{-41,-20,6},{-42,-20,6} +,{-43,-20,6},{-44,-20,6},{-45,-20,6},{-46,-20,6},{-47,-20,6},{-48,-20,6},{-49,-20,6},{-50,-20,6} +,{-51,-20,6},{-52,-20,6},{-53,-20,6},{-54,-20,6},{-55,-20,6},{-56,-20,6},{-57,-20,6},{-58,-20,6} +,{-59,-20,6},{-60,-20,6},{-61,-20,6},{-62,-20,6},{-63,-20,6},{-64,-20,6},{-65,-20,6},{-66,-20,6} +,{-67,-20,6},{-68,-20,6},{-69,-20,6},{-70,-20,6},{-71,-20,6},{-41,-21,6},{-42,-21,6},{-43,-21,6} +,{-44,-21,6},{-45,-21,6},{-46,-21,6},{-47,-21,6},{-48,-21,6},{-49,-21,6},{-50,-21,6},{-51,-21,6} +,{-52,-21,6},{-53,-21,6},{-54,-21,6},{-55,-21,6},{-56,-21,6},{-57,-21,6},{-58,-21,6},{-59,-21,6} +,{-60,-21,6},{-61,-21,6},{-62,-21,6},{-63,-21,6},{-64,-21,6},{-65,-21,6},{-66,-21,6},{-67,-21,6} +,{-68,-21,6},{-69,-21,6},{-70,-21,6},{-71,-21,6},{-41,-22,6},{-42,-22,6},{-43,-22,6},{-44,-22,6} +,{-45,-22,6},{-46,-22,6},{-47,-22,6},{-48,-22,6},{-49,-22,6},{-50,-22,6},{-51,-22,6},{-52,-22,6} +,{-53,-22,6},{-54,-22,6},{-55,-22,6},{-56,-22,6},{-57,-22,6},{-58,-22,6},{-59,-22,6},{-60,-22,6} +,{-61,-22,6},{-62,-22,6},{-63,-22,6},{-64,-22,6},{-65,-22,6},{-66,-22,6},{-67,-22,6},{-68,-22,6} +,{-69,-22,6},{-70,-22,6},{-71,-22,6},{-41,-23,6},{-42,-23,6},{-43,-23,6},{-44,-23,6},{-45,-23,6} +,{-46,-23,6},{-47,-23,6},{-48,-23,6},{-49,-23,6},{-50,-23,6},{-51,-23,6},{-52,-23,6},{-53,-23,6} +,{-54,-23,6},{-55,-23,6},{-56,-23,6},{-57,-23,6},{-58,-23,6},{-59,-23,6},{-60,-23,6},{-61,-23,6} +,{-62,-23,6},{-63,-23,6},{-64,-23,6},{-65,-23,6},{-66,-23,6},{-67,-23,6},{-68,-23,6},{-69,-23,6} +,{-70,-23,6},{-71,-23,6},{-42,-24,6},{-43,-24,6},{-44,-24,6},{-45,-24,6},{-46,-24,6},{-47,-24,6} +,{-48,-24,6},{-49,-24,6},{-50,-24,6},{-51,-24,6},{-52,-24,6},{-53,-24,6},{-54,-24,6},{-55,-24,6} +,{-56,-24,6},{-57,-24,6},{-58,-24,6},{-59,-24,6},{-60,-24,6},{-61,-24,6},{-62,-24,6},{-63,-24,6} +,{-64,-24,6},{-65,-24,6},{-66,-24,6},{-67,-24,6},{-68,-24,6},{-69,-24,6},{-70,-24,6},{-71,-24,6} +,{-46,-25,6},{-47,-25,6},{-48,-25,6},{-49,-25,6},{-50,-25,6},{-51,-25,6},{-52,-25,6},{-53,-25,6} +,{-54,-25,6},{-55,-25,6},{-56,-25,6},{-57,-25,6},{-58,-25,6},{-59,-25,6},{-60,-25,6},{-61,-25,6} +,{-62,-25,6},{-63,-25,6},{-64,-25,6},{-65,-25,6},{-66,-25,6},{-67,-25,6},{-68,-25,6},{-69,-25,6} +,{-70,-25,6},{-71,-25,6},{-48,-26,6},{-49,-26,6},{-50,-26,6},{-51,-26,6},{-52,-26,6},{-53,-26,6} +,{-54,-26,6},{-55,-26,6},{-56,-26,6},{-57,-26,6},{-58,-26,6},{-59,-26,6},{-60,-26,6},{-61,-26,6} +,{-62,-26,6},{-63,-26,6},{-64,-26,6},{-65,-26,6},{-66,-26,6},{-67,-26,6},{-68,-26,6},{-69,-26,6} +,{-70,-26,6},{-71,-26,6},{-49,-27,6},{-50,-27,6},{-51,-27,6},{-52,-27,6},{-53,-27,6},{-54,-27,6} +,{-55,-27,6},{-56,-27,6},{-57,-27,6},{-58,-27,6},{-59,-27,6},{-60,-27,6},{-61,-27,6},{-62,-27,6} +,{-63,-27,6},{-64,-27,6},{-65,-27,6},{-66,-27,6},{-67,-27,6},{-68,-27,6},{-69,-27,6},{-70,-27,6} +,{-71,-27,6},{-80,-27,6},{-81,-27,6},{-49,-28,6},{-50,-28,6},{-51,-28,6},{-52,-28,6},{-53,-28,6} +,{-54,-28,6},{-55,-28,6},{-56,-28,6},{-57,-28,6},{-58,-28,6},{-59,-28,6},{-60,-28,6},{-61,-28,6} +,{-62,-28,6},{-63,-28,6},{-64,-28,6},{-65,-28,6},{-66,-28,6},{-67,-28,6},{-68,-28,6},{-69,-28,6} +,{-70,-28,6},{-71,-28,6},{-72,-28,6},{-49,-29,6},{-50,-29,6},{-51,-29,6},{-52,-29,6},{-53,-29,6} +,{-54,-29,6},{-55,-29,6},{-56,-29,6},{-57,-29,6},{-58,-29,6},{-59,-29,6},{-60,-29,6},{-61,-29,6} +,{-62,-29,6},{-63,-29,6},{-64,-29,6},{-65,-29,6},{-66,-29,6},{-67,-29,6},{-68,-29,6},{-69,-29,6} +,{-70,-29,6},{-71,-29,6},{-72,-29,6},{-50,-30,6},{-51,-30,6},{-52,-30,6},{-53,-30,6},{-54,-30,6} +,{-55,-30,6},{-56,-30,6},{-57,-30,6},{-58,-30,6},{-59,-30,6},{-60,-30,6},{-61,-30,6},{-62,-30,6} +,{-63,-30,6},{-64,-30,6},{-65,-30,6},{-66,-30,6},{-67,-30,6},{-68,-30,6},{-69,-30,6},{-70,-30,6} +,{-71,-30,6},{-72,-30,6},{-51,-31,6},{-52,-31,6},{-53,-31,6},{-54,-31,6},{-55,-31,6},{-56,-31,6} +,{-57,-31,6},{-58,-31,6},{-59,-31,6},{-60,-31,6},{-61,-31,6},{-62,-31,6},{-63,-31,6},{-64,-31,6} +,{-65,-31,6},{-66,-31,6},{-67,-31,6},{-68,-31,6},{-69,-31,6},{-70,-31,6},{-71,-31,6},{-72,-31,6} +,{-51,-32,6},{-52,-32,6},{-53,-32,6},{-54,-32,6},{-55,-32,6},{-56,-32,6},{-57,-32,6},{-58,-32,6} +,{-59,-32,6},{-60,-32,6},{-61,-32,6},{-62,-32,6},{-63,-32,6},{-64,-32,6},{-65,-32,6},{-66,-32,6} +,{-67,-32,6},{-68,-32,6},{-69,-32,6},{-70,-32,6},{-71,-32,6},{-72,-32,6},{-52,-33,6},{-53,-33,6} +,{-54,-33,6},{-55,-33,6},{-56,-33,6},{-57,-33,6},{-58,-33,6},{-59,-33,6},{-60,-33,6},{-61,-33,6} +,{-62,-33,6},{-63,-33,6},{-64,-33,6},{-65,-33,6},{-66,-33,6},{-67,-33,6},{-68,-33,6},{-69,-33,6} +,{-70,-33,6},{-71,-33,6},{-72,-33,6},{-53,-34,6},{-54,-34,6},{-55,-34,6},{-56,-34,6},{-57,-34,6} +,{-58,-34,6},{-59,-34,6},{-60,-34,6},{-61,-34,6},{-62,-34,6},{-63,-34,6},{-64,-34,6},{-65,-34,6} +,{-66,-34,6},{-67,-34,6},{-68,-34,6},{-69,-34,6},{-70,-34,6},{-71,-34,6},{-72,-34,6},{-79,-34,6} +,{-81,-34,6},{-54,-35,6},{-55,-35,6},{-56,-35,6},{-57,-35,6},{-58,-35,6},{-59,-35,6},{-60,-35,6} +,{-61,-35,6},{-62,-35,6},{-63,-35,6},{-64,-35,6},{-65,-35,6},{-66,-35,6},{-67,-35,6},{-68,-35,6} +,{-69,-35,6},{-70,-35,6},{-71,-35,6},{-72,-35,6},{-73,-35,6},{-58,-36,6},{-59,-36,6},{-60,-36,6} +,{-61,-36,6},{-62,-36,6},{-63,-36,6},{-64,-36,6},{-65,-36,6},{-66,-36,6},{-67,-36,6},{-68,-36,6} +,{-69,-36,6},{-70,-36,6},{-71,-36,6},{-72,-36,6},{-73,-36,6},{-57,-37,6},{-58,-37,6},{-59,-37,6} +,{-60,-37,6},{-61,-37,6},{-62,-37,6},{-63,-37,6},{-64,-37,6},{-65,-37,6},{-66,-37,6},{-67,-37,6} +,{-68,-37,6},{-69,-37,6},{-70,-37,6},{-71,-37,6},{-72,-37,6},{-73,-37,6},{-74,-37,6},{-57,-38,6} +,{-58,-38,6},{-59,-38,6},{-60,-38,6},{-61,-38,6},{-62,-38,6},{-63,-38,6},{-64,-38,6},{-65,-38,6} +,{-66,-38,6},{-67,-38,6},{-68,-38,6},{-69,-38,6},{-70,-38,6},{-71,-38,6},{-72,-38,6},{-73,-38,6} +,{-74,-38,6},{-58,-39,6},{-59,-39,6},{-60,-39,6},{-61,-39,6},{-62,-39,6},{-63,-39,6},{-64,-39,6} +,{-65,-39,6},{-66,-39,6},{-67,-39,6},{-68,-39,6},{-69,-39,6},{-70,-39,6},{-71,-39,6},{-72,-39,6} +,{-73,-39,6},{-74,-39,6},{-62,-40,6},{-63,-40,6},{-64,-40,6},{-65,-40,6},{-66,-40,6},{-67,-40,6} +,{-68,-40,6},{-69,-40,6},{-70,-40,6},{-71,-40,6},{-72,-40,6},{-73,-40,6},{-74,-40,6},{-63,-41,6} +,{-64,-41,6},{-65,-41,6},{-66,-41,6},{-67,-41,6},{-68,-41,6},{-69,-41,6},{-70,-41,6},{-71,-41,6} +,{-72,-41,6},{-73,-41,6},{-74,-41,6},{-63,-42,6},{-64,-42,6},{-65,-42,6},{-66,-42,6},{-67,-42,6} +,{-68,-42,6},{-69,-42,6},{-70,-42,6},{-71,-42,6},{-72,-42,6},{-73,-42,6},{-74,-42,6},{-75,-42,6} +,{-64,-43,6},{-65,-43,6},{-66,-43,6},{-67,-43,6},{-68,-43,6},{-69,-43,6},{-70,-43,6},{-71,-43,6} +,{-72,-43,6},{-73,-43,6},{-74,-43,6},{-75,-43,6},{-65,-44,6},{-66,-44,6},{-67,-44,6},{-68,-44,6} +,{-69,-44,6},{-70,-44,6},{-71,-44,6},{-72,-44,6},{-73,-44,6},{-74,-44,6},{-75,-44,6},{-66,-45,6} +,{-67,-45,6},{-68,-45,6},{-69,-45,6},{-70,-45,6},{-71,-45,6},{-72,-45,6},{-73,-45,6},{-74,-45,6} +,{-75,-45,6},{-76,-45,6},{-66,-46,6},{-67,-46,6},{-68,-46,6},{-69,-46,6},{-70,-46,6},{-71,-46,6} +,{-72,-46,6},{-73,-46,6},{-74,-46,6},{-75,-46,6},{-76,-46,6},{-67,-47,6},{-68,-47,6},{-69,-47,6} +,{-70,-47,6},{-71,-47,6},{-72,-47,6},{-73,-47,6},{-74,-47,6},{-75,-47,6},{-76,-47,6},{-66,-48,6} +,{-67,-48,6},{-68,-48,6},{-69,-48,6},{-70,-48,6},{-71,-48,6},{-72,-48,6},{-73,-48,6},{-74,-48,6} +,{-75,-48,6},{-76,-48,6},{-66,-49,6},{-67,-49,6},{-68,-49,6},{-69,-49,6},{-70,-49,6},{-71,-49,6} +,{-72,-49,6},{-73,-49,6},{-74,-49,6},{-75,-49,6},{-76,-49,6},{-68,-50,6},{-69,-50,6},{-70,-50,6} +,{-71,-50,6},{-72,-50,6},{-73,-50,6},{-74,-50,6},{-75,-50,6},{-76,-50,6},{-62,-51,6},{-68,-51,6} +,{-69,-51,6},{-70,-51,6},{-71,-51,6},{-72,-51,6},{-73,-51,6},{-74,-51,6},{-75,-51,6},{-76,-51,6} +,{-58,-52,6},{-59,-52,6},{-60,-52,6},{-61,-52,6},{-62,-52,6},{-69,-52,6},{-70,-52,6},{-71,-52,6} +,{-72,-52,6},{-73,-52,6},{-74,-52,6},{-75,-52,6},{-76,-52,6},{-59,-53,6},{-60,-53,6},{-61,-53,6} +,{-62,-53,6},{-69,-53,6},{-70,-53,6},{-71,-53,6},{-72,-53,6},{-73,-53,6},{-74,-53,6},{-75,-53,6} +,{-76,-53,6},{-68,-54,6},{-69,-54,6},{-70,-54,6},{-71,-54,6},{-72,-54,6},{-73,-54,6},{-74,-54,6} +,{-75,-54,6},{-64,-55,6},{-65,-55,6},{-66,-55,6},{-67,-55,6},{-68,-55,6},{-69,-55,6},{-70,-55,6} +,{-71,-55,6},{-72,-55,6},{-73,-55,6},{-74,-55,6},{-67,-56,6},{-68,-56,6},{-69,-56,6},{-70,-56,6} }; -} -} +otb::Wrapper::DownloadSRTMTiles +::DownloadSRTMTiles() + : m_SRTMTileList(std::begin(staticTileList),std::end(staticTileList)) +{} OTB_APPLICATION_EXPORT(otb::Wrapper::DownloadSRTMTiles) diff --git a/Modules/Applications/AppImageUtils/app/otbPixelValue.cxx b/Modules/Applications/AppImageUtils/app/otbPixelValue.cxx index 3296b1742877c97e04af6b0035f796461fbea9f4..1bca9241ea384ab9210913f1ca7949e68178142c 100644 --- a/Modules/Applications/AppImageUtils/app/otbPixelValue.cxx +++ b/Modules/Applications/AppImageUtils/app/otbPixelValue.cxx @@ -22,6 +22,7 @@ #include "otbWrapperApplicationFactory.h" #include "otbMultiChannelExtractROI.h" +#include "otbGenericRSTransform.h" namespace otb { @@ -32,14 +33,15 @@ class PixelValue : public Application { public: /** Standard class typedefs. */ - typedef PixelValue Self; + typedef PixelValue Self; typedef Application Superclass; typedef itk::SmartPointer<Self> Pointer; typedef itk::SmartPointer<const Self> ConstPointer; typedef otb::MultiChannelExtractROI<FloatVectorImageType::InternalPixelType, - FloatVectorImageType::InternalPixelType> ExtractROIFilterType; + FloatVectorImageType::InternalPixelType> ExtractROIFilterType; + typedef otb::GenericRSTransform<> RSTransformType; /** Standard macro */ itkNewMacro(Self); @@ -53,26 +55,53 @@ private: // Documentation SetDocName("Pixel Value"); - SetDocLongDescription("Get the value of a pixel.\nPay attention, index starts at 0."); + SetDocLongDescription("This application gives the value of a selected " + "pixel. There are three ways to designate a pixel, with its index, " + "its physical coordinate (in the physical space attached to the image), " + "and with geographical coordinate system. Coordinates will be " + "interpreted differently depending on which mode is chosen."); SetDocLimitations("None"); SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); - AddDocTag("Miscellaneous"); + AddDocTag("Miscellaneous"); AddDocTag("Utilities"); AddDocTag("Coordinates"); AddDocTag("Raster"); - AddParameter(ParameterType_InputImage, "in", "Input Image"); - SetParameterDescription("in", "Input image"); - - AddParameter(ParameterType_Int,"coordx","Col index"); - SetParameterDescription("coordx","Column index of the wanted pixel (starts at 0)."); - SetMinimumParameterIntValue("coordx", 0); - - AddParameter(ParameterType_Int,"coordy","Line index"); - SetParameterDescription("coordy","Line index of the wanted pixel (starts at 0)."); - SetMinimumParameterIntValue("coordy", 0); + AddParameter(ParameterType_InputImage , "in", "Input Image"); + SetParameterDescription("in" , "Input image"); + + AddParameter(ParameterType_Float , "coordx" , "X coordinate" ); + SetParameterDescription("coordx" , + "This will be the X coordinate interpreted depending on the " + "chosen mode"); + AddParameter(ParameterType_Float , "coordy" , "Y coordinate" ); + SetParameterDescription("coordy" , + "This will be the Y coordinate interpreted depending on the " + "chosen mode"); + + AddParameter(ParameterType_Choice , "mode" , + "Coordinate system used to designate the pixel"); + SetParameterDescription( "mode" , + "Different modes can be selected, default mode is Index."); + AddChoice( "mode.index" , "Index"); + SetParameterDescription( "mode.index" , + "This mode uses the given coordinates as index to locate the pixel."); + AddChoice( "mode.physical" , "Image physical space"); + SetParameterDescription( "mode.physical" , + "This mode interprets the given coordinates in the image " + "physical space."); + AddChoice( "mode.epsg" , "EPSG coordinates"); + SetParameterDescription( "mode.epsg" , + "This mode interprets the given coordinates in the specified " + "geographical coordinate system by the EPSG code."); + + AddParameter(ParameterType_Int , "mode.epsg.code" , "EPSG code"); + SetParameterDescription("mode.epsg.code" , + "This code is used to define a geographical coordinate system. " + "If no system is specified, WGS84 (EPSG : 4326) is used by default."); + MandatoryOff("mode.epsg.code"); AddParameter(ParameterType_ListView,"cl","Channels"); SetParameterDescription("cl","Displayed channels"); @@ -95,7 +124,7 @@ private: { if ( HasValue("in") ) { - ExtractROIFilterType::InputImageType* inImage = GetParameterImage("in"); + ExtractROIFilterType::InputImageType * inImage = GetParameterImage("in"); // Update the values of the channels to be selected unsigned int nbComponents = inImage->GetNumberOfComponentsPerPixel(); @@ -107,53 +136,163 @@ private: item<<"Channel"<<idx+1; AddChoice(key.str(), item.str()); } - - ExtractROIFilterType::InputImageType::RegionType largestRegion = inImage->GetLargestPossibleRegion(); - SetMaximumParameterIntValue("coordx", largestRegion.GetSize(0)-1); - SetMaximumParameterIntValue("coordy", largestRegion.GetSize(1)-1); } } - void DoExecute() ITK_OVERRIDE + std::string CreateBoundaryBox( const std::string & mode ) { - std::ostringstream ossOutput; FloatVectorImageType::Pointer inImage = GetParameterImage("in"); + FloatVectorImageType::IndexType min , max; + min.Fill(0); + max[0] = inImage->GetLargestPossibleRegion().GetSize()[0] - 1; + max[1] = inImage->GetLargestPossibleRegion().GetSize()[1] - 1; + std::string boundaries[4]; + if (mode == "index") + { + boundaries[0] = std::to_string(max[0]); + boundaries[1] = std::to_string(max[1]); + boundaries[2] = std::to_string(min[0]); + boundaries[3] = std::to_string(min[1]); + } + else if (mode == "physical") + { + itk::Point< float, 2 > minP(0) , maxP(0); + inImage->TransformIndexToPhysicalPoint(min,minP); + inImage->TransformIndexToPhysicalPoint(max,maxP); + boundaries[0] = std::to_string(std::max(minP[0],maxP[0])); + boundaries[1] = std::to_string(std::max(minP[1],maxP[1])); + boundaries[2] = std::to_string(std::min(minP[0],maxP[0])); + boundaries[3] = std::to_string(std::min(minP[1],maxP[1])); + } + else if (mode == "epsg") + { + RSTransformType::Pointer inverse = RSTransformType::New(); + if ( HasUserValue("mode.epsg.code") ) + { + std::string wktFromEpsg = + otb::GeoInformationConversion::ToWKT(GetParameterInt( "mode.epsg.code" )); + inverse->SetOutputProjectionRef(wktFromEpsg); + } + inverse->SetInputKeywordList( inImage->GetImageKeywordlist() ); + inverse->SetInputProjectionRef( inImage->GetProjectionRef() ); + inverse->InstantiateTransform(); + itk::Point< float, 2 > minPOut(0) , maxPOut(0) , minP(0) , maxP(0); + inImage->TransformIndexToPhysicalPoint(min,minP); + inImage->TransformIndexToPhysicalPoint(max,maxP); + minPOut = inverse->TransformPoint( minP ); + maxPOut = inverse->TransformPoint( maxP ); + boundaries[0] = std::to_string(std::max(minPOut[0],maxPOut[0])); + boundaries[1] = std::to_string(std::max(minPOut[1],maxPOut[1])); + boundaries[2] = std::to_string(std::min(minPOut[0],maxPOut[0])); + boundaries[3] = std::to_string(std::min(minPOut[1],maxPOut[1])); + } - ExtractROIFilterType::Pointer extractor = ExtractROIFilterType::New(); - extractor->SetInput(inImage); + for (int i = 0 ; i<4 ; i++) + { + std::size_t coma = boundaries[i].find("."); + if ( coma != std::string::npos ) + { + std::size_t zero = boundaries[i].find_last_not_of("0"); + if ( zero != std::string::npos ) + boundaries[i].erase(zero + 1); + else + boundaries[i] = "0"; + } + } + + std::string box = ""; + box += "["+boundaries[2]+" , "+boundaries[0]+"] x "; + box += "["+boundaries[3]+" , "+boundaries[1]+"]"; + return box; + } - // Create the region - FloatVectorImageType::IndexType id; - id[0] = GetParameterInt("coordx"); - id[1] = GetParameterInt("coordy"); + void DoExecute() ITK_OVERRIDE + { + std::string mode = GetParameterString( "mode" ); + FloatVectorImageType::Pointer inImage = GetParameterImage("in"); + FloatVectorImageType::IndexType id ; + id.Fill(0); + bool isPixelIn( false ); + if ( mode == "index" ) + { + id[0] = static_cast< int >( GetParameterFloat( "coordx" ) ); + id[1] = static_cast< int >( GetParameterFloat( "coordy" ) ); + if (static_cast< unsigned int >( id[0] ) >= + inImage->GetLargestPossibleRegion().GetSize()[0] + || static_cast< unsigned int >( id[1] ) >= + inImage->GetLargestPossibleRegion().GetSize()[1] + || id[0] < 0 || id[1] < 0 ) + { + id.Fill(0); + isPixelIn = false; + } + else + { + isPixelIn = true; + } + } - FloatVectorImageType::SizeType size; - size.Fill(0); + else if ( mode == "physical" ) + { + itk::Point<float, 2> pixel(0); + pixel[ 0 ] = GetParameterFloat( "coordx" ); + pixel[ 1 ] = GetParameterFloat( "coordy" ); + isPixelIn = inImage->TransformPhysicalPointToIndex(pixel,id); + } + + else if ( mode == "epsg" ) + { + RSTransformType::Pointer rsTransform = RSTransformType::New(); + if ( HasUserValue("mode.epsg.code") ) + { + std::string wktFromEpsg = + otb::GeoInformationConversion::ToWKT( GetParameterInt( "mode.epsg.code" ) ); + rsTransform->SetInputProjectionRef(wktFromEpsg); + } + rsTransform->SetOutputKeywordList( inImage->GetImageKeywordlist() ); + rsTransform->SetOutputProjectionRef( inImage->GetProjectionRef() ); + rsTransform->InstantiateTransform(); + itk::Point<float, 2> pixelIn(0) , pixelOut(0); + pixelIn[ 0 ] = GetParameterFloat( "coordx" ); + pixelIn[ 1 ] = GetParameterFloat( "coordy" ); + rsTransform->InstantiateTransform(); + pixelOut = rsTransform->TransformPoint(pixelIn); + isPixelIn = inImage->TransformPhysicalPointToIndex(pixelOut,id); + } - FloatVectorImageType::RegionType region; - region.SetSize(size); - region.SetIndex(id); + if ( !isPixelIn ) + { + std::string why = "Accessible pixels are in "; + why += CreateBoundaryBox( GetParameterString( "mode" ) ); + why += " for the selected mode."; + otbAppLogFATAL(<<"Specified position out of bound.\n" + why); + } - extractor->SetExtractionRegion(region); + ExtractROIFilterType::Pointer extractor = ExtractROIFilterType::New(); + extractor->SetInput(inImage); // Extract the channels if needed if ( GetParameterByKey("cl")->GetActive() ) { - for (unsigned int idx = 0; idx < GetSelectedItems("cl").size(); ++idx) + for (unsigned int idx = 0; idx < GetSelectedItems("cl").size(); ++idx) { extractor->SetChannel(GetSelectedItems("cl")[idx] + 1 ); } } + FloatVectorImageType::SizeType size; + size.Fill(1); + FloatVectorImageType::RegionType region; + region.SetSize(size); + region.SetIndex(id); - extractor->Update(); + extractor->SetExtractionRegion(region); + extractor->Update(); // Display the pixel value id.Fill(0); std::ostringstream oss; - oss << extractor->GetOutput()->GetPixel(id)<<std::endl; - + oss << extractor->GetOutput()->GetPixel(id); SetParameterString("value", oss.str(), false); - //Display image information in the dedicated logger otbAppLogINFO( << oss.str() ); } diff --git a/Modules/Applications/AppImageUtils/test/CMakeLists.txt b/Modules/Applications/AppImageUtils/test/CMakeLists.txt index 1117d032186bd937d516522ce449924bdc63e8f2..7c33a6b68e7078ab32d85c1890ac21e16df9859a 100644 --- a/Modules/Applications/AppImageUtils/test/CMakeLists.txt +++ b/Modules/Applications/AppImageUtils/test/CMakeLists.txt @@ -24,7 +24,7 @@ otb_test_application(NAME apTuUtDownloadSRTMTiles APP DownloadSRTMTiles OPTIONS -il LARGEINPUT{QUICKBIRD/TOULOUSE/000000128955_01_P001_MUL/02APR01105228-M1BS-000000128955_01_P001.TIF} -mode list - -mode.list.indir ${INPUTDATA}/DEM/srtm_directory + -tiledir ${INPUTDATA}/DEM/srtm_directory ) @@ -34,7 +34,7 @@ otb_test_application(NAME apTuUtDownloadSRTMTiles otb_test_application(NAME apTvUtConvertBasic APP Convert OPTIONS -in ${INPUTDATA}/QB_Toulouse_Ortho_XS.tif - -out ${TEMP}/apTvUtConvertBasicOutput.tif + -out ${TEMP}/apTvUtConvertBasicOutput.tif float VALID --compare-image ${NOTOL} ${INPUTDATA}/apTvUtConvertBasicOutput.tif ${TEMP}/apTvUtConvertBasicOutput.tif @@ -49,7 +49,7 @@ otb_test_application(NAME apTuUtConvertExtendedFilename_writer otb_test_application(NAME apTvUtConvertWithScaling APP Convert OPTIONS -in ${INPUTDATA}/QB_Toulouse_Ortho_XS.tif - -out ${TEMP}/apTvUtConvertWithScalingOutput.tif uint8 + -out ${TEMP}/apTvUtConvertWithScalingOutput.tif -type linear VALID --compare-image ${NOTOL} ${INPUTDATA}/apTvUtConvertWithScalingOutput.tif @@ -64,6 +64,28 @@ otb_test_application(NAME apTvUtConvertExtendedFilename_readerGEOM ${INPUTDATA}/ToulouseExtract_ModifiedGeom.geom ${TEMP}/apTvUtGeomExtendedFilename.geom) +otb_test_application(NAME apTvUtConvertSelectChannels + APP Convert + OPTIONS -in ${INPUTDATA}/QB_Toulouse_Ortho_XS.tif + -out ${TEMP}/apTvUtConvertSelectChannelsRgbOutput.tif + -channels rgb + -channels.rgb.red 2 + -channels.rgb.green 3 + -channels.rgb.blue 1 + -type linear + VALID --compare-image ${NOTOL} + ${INPUTDATA}/apTvUtConvertSelectChannelsRgbOutput.tif + ${TEMP}/apTvUtConvertSelectChannelsRgbOutput.tif) + +otb_test_application(NAME apTvUtConvertMonoChannel + APP Convert + OPTIONS -in ${INPUTDATA}/QB_Toulouse_Ortho_PAN.tif + -out ${TEMP}/apTvUtConvertMonoChannelOutput.tif + -channels grayscale + -type linear + VALID --compare-image ${NOTOL} + ${INPUTDATA}/apTvUtConvertMonoChannelOutput.tif + ${TEMP}/apTvUtConvertMonoChannelOutput.tif) #----------- PixelInfo TESTS ---------------- @@ -236,16 +258,43 @@ otb_test_application(NAME apTvUtConcatenateImages_1Image #----------- MultiResolutionPyramid TESTS ---------------- #----------- PixelValue TESTS ---------------- -OTB_TEST_APPLICATION(NAME apTvUtPixelValue +OTB_TEST_APPLICATION(NAME apTvUtPixelValueIndex APP PixelValue OPTIONS -in ${INPUTDATA}/QB_Toulouse_Ortho_XS.tif -coordx 30 -coordy 30 + -mode index + -cl Channel1 Channel3 Channel4 + TESTENVOPTIONS ${TEMP}/apTvUtPixelValueIndex.txt + VALID --compare-ascii ${EPSILON_7} + ${BASELINE_FILES}/apTvUtPixelValue.txt + ${TEMP}/apTvUtPixelValueIndex.txt + ) +OTB_TEST_APPLICATION(NAME apTvUtPixelValuePhys + APP PixelValue + OPTIONS -in ${INPUTDATA}/QB_Toulouse_Ortho_XS.tif + -coordx 374168 + -coordy 4829165.5 + -mode physical + -cl Channel1 Channel3 Channel4 + TESTENVOPTIONS ${TEMP}/apTvUtPixelValuePhys.txt + VALID --compare-ascii ${EPSILON_7} + ${BASELINE_FILES}/apTvUtPixelValue.txt + ${TEMP}/apTvUtPixelValuePhys.txt + ) + +OTB_TEST_APPLICATION(NAME apTvUtPixelValueEpsg + APP PixelValue + OPTIONS -in ${INPUTDATA}/QB_Toulouse_Ortho_XS.tif + -coordx 1.4408400058746337890625 + -coordy 43.604839324951171875 + -mode epsg + -mode.epsg.code 4326 -cl Channel1 Channel3 Channel4 - TESTENVOPTIONS ${TEMP}/apTvUtPixelValue.txt + TESTENVOPTIONS ${TEMP}/apTvUtPixelValueEpsg.txt VALID --compare-ascii ${EPSILON_7} ${BASELINE_FILES}/apTvUtPixelValue.txt - ${TEMP}/apTvUtPixelValue.txt + ${TEMP}/apTvUtPixelValueEpsg.txt ) #----------- ColorMapping TESTS ---------------- diff --git a/Modules/Applications/AppMathParserX/app/otbBandMathX.cxx b/Modules/Applications/AppMathParserX/app/otbBandMathX.cxx index 06da000b882e6c8215e602e79ca01baad1bd9877..7c56aa82da09b946c57ecc5225144e89768fb59a 100644 --- a/Modules/Applications/AppMathParserX/app/otbBandMathX.cxx +++ b/Modules/Applications/AppMathParserX/app/otbBandMathX.cxx @@ -74,7 +74,7 @@ private: "The list of features and the syntax of muParserX is available at [1].\n\n" "As opposed to muParser (and thus the BandMath OTB-application [2]), " - "muParserX supports vector expressions which allows to output multi-band " + "muParserX supports vector expressions which allows outputting multi-band " "images.\n\n" "Hereafter is a brief reference of the muParserX syntax\n\n" @@ -106,10 +106,10 @@ private: "im1b2Mean\n" " mean of the 2nd component of the 1st input (global statistics)\n\n" - "im1b2Min\n" + "im1b2Mini\n" " minimum of the 2nd component of the 1st input (global statistics)\n\n" - "im1b2Max\n" + "im1b2Maxi\n" " minimum of the 2nd component of the 1st input (global statistics)\n\n" "im1b2Sum\n" diff --git a/Modules/Applications/AppOpticalCalibration/app/otbOpticalCalibration.cxx b/Modules/Applications/AppOpticalCalibration/app/otbOpticalCalibration.cxx index b4253f066542b5eb1cb0186d2f1dd1d94fb6c124..87e7dc310fa0cc14efda2c900c0b29942d3feb11 100644 --- a/Modules/Applications/AppOpticalCalibration/app/otbOpticalCalibration.cxx +++ b/Modules/Applications/AppOpticalCalibration/app/otbOpticalCalibration.cxx @@ -23,10 +23,10 @@ #include "otbWrapperApplication.h" #include "otbWrapperApplicationFactory.h" -#include "otbImageToLuminanceImageFilter.h" -#include "otbLuminanceToReflectanceImageFilter.h" -#include "otbLuminanceToImageImageFilter.h" -#include "otbReflectanceToLuminanceImageFilter.h" +#include "otbImageToRadianceImageFilter.h" +#include "otbRadianceToReflectanceImageFilter.h" +#include "otbRadianceToImageImageFilter.h" +#include "otbReflectanceToRadianceImageFilter.h" #include "otbReflectanceToSurfaceReflectanceImageFilter.h" #include "itkMultiplyImageFilter.h" #include "otbClampVectorImageFilter.h" @@ -78,17 +78,17 @@ public: itkTypeMacro(OpticalCalibration, Application); - typedef ImageToLuminanceImageFilter<FloatVectorImageType, - DoubleVectorImageType> ImageToLuminanceImageFilterType; + typedef ImageToRadianceImageFilter<FloatVectorImageType, + DoubleVectorImageType> ImageToRadianceImageFilterType; - typedef LuminanceToReflectanceImageFilter<DoubleVectorImageType, - DoubleVectorImageType> LuminanceToReflectanceImageFilterType; + typedef RadianceToReflectanceImageFilter<DoubleVectorImageType, + DoubleVectorImageType> RadianceToReflectanceImageFilterType; - typedef LuminanceToImageImageFilter<DoubleVectorImageType, - DoubleVectorImageType> LuminanceToImageImageFilterType; + typedef RadianceToImageImageFilter<DoubleVectorImageType, + DoubleVectorImageType> RadianceToImageImageFilterType; - typedef ReflectanceToLuminanceImageFilter<FloatVectorImageType, - DoubleVectorImageType> ReflectanceToLuminanceImageFilterType; + typedef ReflectanceToRadianceImageFilter<FloatVectorImageType, + DoubleVectorImageType> ReflectanceToRadianceImageFilterType; typedef itk::MultiplyImageFilter<DoubleVectorImageType,DoubleImageType,DoubleVectorImageType> ScaleFilterOutDoubleType; @@ -186,7 +186,7 @@ private: AddDocTag(Tags::Calibration); AddParameter(ParameterType_InputImage, "in", "Input"); - SetParameterDescription("in", "Input image filename (values in DN)"); + SetParameterDescription("in", "Input image filename"); AddParameter(ParameterType_OutputImage, "out", "Output"); SetParameterDescription("out","Output calibrated image filename"); @@ -205,8 +205,8 @@ private: DisableParameter("milli"); MandatoryOff("milli"); - AddParameter(ParameterType_Empty, "clamp", "Clamp of reflectivity values between [0, 100]"); - SetParameterDescription("clamp", "Clamping in the range [0, 100]. It can be useful to preserve area with specular reflectance."); + AddParameter(ParameterType_Empty, "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"); @@ -381,7 +381,7 @@ private: { ossOutput << std::endl << "File: " << m_inImageName << std::endl; - //Check if valid metadata information are available to compute ImageToLuminance and LuminanceToReflectance + //Check if valid metadata information are available to compute ImageToRadiance and RadianceToReflectance FloatVectorImageType::Pointer inImage = GetParameterFloatVectorImage("in"); itk::MetaDataDictionary dict = inImage->GetMetaDataDictionary(); OpticalImageMetadataInterface::Pointer lImageMetadataInterface = OpticalImageMetadataInterfaceFactory::CreateIMI(dict); @@ -566,11 +566,11 @@ private: void DoExecute() ITK_OVERRIDE { //Main filters instantiations - m_ImageToLuminanceFilter = ImageToLuminanceImageFilterType::New(); - m_LuminanceToReflectanceFilter = LuminanceToReflectanceImageFilterType::New(); + m_ImageToRadianceFilter = ImageToRadianceImageFilterType::New(); + m_RadianceToReflectanceFilter = RadianceToReflectanceImageFilterType::New(); m_ReflectanceToSurfaceReflectanceFilter = ReflectanceToSurfaceReflectanceImageFilterType::New(); - m_ReflectanceToLuminanceFilter = ReflectanceToLuminanceImageFilterType::New(); - m_LuminanceToImageFilter = LuminanceToImageImageFilterType::New(); + m_ReflectanceToRadianceFilter = ReflectanceToRadianceImageFilterType::New(); + m_RadianceToImageFilter = RadianceToImageImageFilterType::New(); //Other instantiations m_ScaleFilter = ScaleFilterOutDoubleType::New(); @@ -590,22 +590,22 @@ private: // Set (Date and Day) OR FluxNormalizationCoef to corresponding filters if ( !IsParameterEnabled("acqui.fluxnormcoeff") ) { - m_LuminanceToReflectanceFilter->SetDay(GetParameterInt("acqui.day")); - m_LuminanceToReflectanceFilter->SetMonth(GetParameterInt("acqui.month")); + m_RadianceToReflectanceFilter->SetDay(GetParameterInt("acqui.day")); + m_RadianceToReflectanceFilter->SetMonth(GetParameterInt("acqui.month")); - m_ReflectanceToLuminanceFilter->SetDay(GetParameterInt("acqui.day")); - m_ReflectanceToLuminanceFilter->SetMonth(GetParameterInt("acqui.month")); + m_ReflectanceToRadianceFilter->SetDay(GetParameterInt("acqui.day")); + m_ReflectanceToRadianceFilter->SetMonth(GetParameterInt("acqui.month")); } else { - m_LuminanceToReflectanceFilter->SetFluxNormalizationCoefficient(GetParameterFloat("acqui.fluxnormcoeff")); + m_RadianceToReflectanceFilter->SetFluxNormalizationCoefficient(GetParameterFloat("acqui.fluxnormcoeff")); - m_ReflectanceToLuminanceFilter->SetFluxNormalizationCoefficient(GetParameterFloat("acqui.fluxnormcoeff")); + m_ReflectanceToRadianceFilter->SetFluxNormalizationCoefficient(GetParameterFloat("acqui.fluxnormcoeff")); } // Set Sun Elevation Angle to corresponding filters - m_LuminanceToReflectanceFilter->SetElevationSolarAngle(GetParameterFloat("acqui.sun.elev")); - m_ReflectanceToLuminanceFilter->SetElevationSolarAngle(GetParameterFloat("acqui.sun.elev")); + m_RadianceToReflectanceFilter->SetElevationSolarAngle(GetParameterFloat("acqui.sun.elev")); + m_ReflectanceToRadianceFilter->SetElevationSolarAngle(GetParameterFloat("acqui.sun.elev")); // Set Gain and Bias to corresponding filters if (IsParameterEnabled("acqui.gainbias") && HasValue("acqui.gainbias")) @@ -644,14 +644,14 @@ private: switch (numLine) { case 1 : - m_ImageToLuminanceFilter->SetAlpha(vlvector); - m_LuminanceToImageFilter->SetAlpha(vlvector); + m_ImageToRadianceFilter->SetAlpha(vlvector); + m_RadianceToImageFilter->SetAlpha(vlvector); GetLogger()->Info("Trying to get gains/biases information... OK (1/2)\n"); break; case 2 : - m_ImageToLuminanceFilter->SetBeta(vlvector); - m_LuminanceToImageFilter->SetBeta(vlvector); + m_ImageToRadianceFilter->SetBeta(vlvector); + m_RadianceToImageFilter->SetBeta(vlvector); GetLogger()->Info("Trying to get gains/biases information... OK (2/2)\n"); break; @@ -669,11 +669,11 @@ private: //Try to retrieve information from image metadata if (IMIName != IMIOptDfltName) { - m_ImageToLuminanceFilter->SetAlpha(lImageMetadataInterface->GetPhysicalGain()); - m_LuminanceToImageFilter->SetAlpha(lImageMetadataInterface->GetPhysicalGain()); + m_ImageToRadianceFilter->SetAlpha(lImageMetadataInterface->GetPhysicalGain()); + m_RadianceToImageFilter->SetAlpha(lImageMetadataInterface->GetPhysicalGain()); - m_ImageToLuminanceFilter->SetBeta(lImageMetadataInterface->GetPhysicalBias()); - m_LuminanceToImageFilter->SetBeta(lImageMetadataInterface->GetPhysicalBias()); + m_ImageToRadianceFilter->SetBeta(lImageMetadataInterface->GetPhysicalBias()); + m_RadianceToImageFilter->SetBeta(lImageMetadataInterface->GetPhysicalBias()); } else itkExceptionMacro(<< "Please, provide a type of sensor supported by OTB for automatic metadata extraction! "); @@ -711,8 +711,8 @@ private: itk::VariableLengthVector<double> vlvector; vlvector.SetData(values.data(),values.size(),false); - m_LuminanceToReflectanceFilter->SetSolarIllumination(vlvector); - m_ReflectanceToLuminanceFilter->SetSolarIllumination(vlvector); + m_RadianceToReflectanceFilter->SetSolarIllumination(vlvector); + m_ReflectanceToRadianceFilter->SetSolarIllumination(vlvector); } } file.close(); @@ -725,8 +725,8 @@ private: //Try to retrieve information from image metadata if (IMIName != IMIOptDfltName) { - m_LuminanceToReflectanceFilter->SetSolarIllumination(lImageMetadataInterface->GetSolarIrradiance()); - m_ReflectanceToLuminanceFilter->SetSolarIllumination(lImageMetadataInterface->GetSolarIrradiance()); + m_RadianceToReflectanceFilter->SetSolarIllumination(lImageMetadataInterface->GetSolarIrradiance()); + m_ReflectanceToRadianceFilter->SetSolarIllumination(lImageMetadataInterface->GetSolarIrradiance()); } else itkExceptionMacro(<< "Please, provide a type of sensor supported by OTB for automatic metadata extraction! "); @@ -748,17 +748,17 @@ private: GetLogger()->Info("Compute Top of Atmosphere reflectance\n"); //Pipeline - m_ImageToLuminanceFilter->SetInput(inImage); - m_LuminanceToReflectanceFilter->SetInput(m_ImageToLuminanceFilter->GetOutput()); + m_ImageToRadianceFilter->SetInput(inImage); + m_RadianceToReflectanceFilter->SetInput(m_ImageToRadianceFilter->GetOutput()); if (IsParameterEnabled("clamp")) { GetLogger()->Info("Clamp values between [0, 100]\n"); } - m_LuminanceToReflectanceFilter->SetUseClamp(IsParameterEnabled("clamp")); - m_LuminanceToReflectanceFilter->UpdateOutputInformation(); - m_ScaleFilter->SetInput(m_LuminanceToReflectanceFilter->GetOutput()); + m_RadianceToReflectanceFilter->SetUseClamp(IsParameterEnabled("clamp")); + m_RadianceToReflectanceFilter->UpdateOutputInformation(); + m_ScaleFilter->SetInput(m_RadianceToReflectanceFilter->GetOutput()); } break; case Level_TOA_IM: @@ -766,10 +766,10 @@ private: GetLogger()->Info("Convert Top of Atmosphere reflectance to image DN\n"); //Pipeline - m_ReflectanceToLuminanceFilter->SetInput(inImage); - m_LuminanceToImageFilter->SetInput(m_ReflectanceToLuminanceFilter->GetOutput()); - m_LuminanceToImageFilter->UpdateOutputInformation(); - m_ScaleFilter->SetInput(m_LuminanceToImageFilter->GetOutput()); + m_ReflectanceToRadianceFilter->SetInput(inImage); + m_RadianceToImageFilter->SetInput(m_ReflectanceToRadianceFilter->GetOutput()); + m_RadianceToImageFilter->UpdateOutputInformation(); + m_ScaleFilter->SetInput(m_RadianceToImageFilter->GetOutput()); } break; case Level_TOC: @@ -777,9 +777,9 @@ private: GetLogger()->Info("Compute Top of Canopy reflectance\n"); //Pipeline - m_ImageToLuminanceFilter->SetInput(inImage); - m_LuminanceToReflectanceFilter->SetInput(m_ImageToLuminanceFilter->GetOutput()); - m_ReflectanceToSurfaceReflectanceFilter->SetInput(m_LuminanceToReflectanceFilter->GetOutput()); + m_ImageToRadianceFilter->SetInput(inImage); + m_RadianceToReflectanceFilter->SetInput(m_ImageToRadianceFilter->GetOutput()); + m_ReflectanceToSurfaceReflectanceFilter->SetInput(m_RadianceToReflectanceFilter->GetOutput()); m_ReflectanceToSurfaceReflectanceFilter->SetAcquiCorrectionParameters(m_paramAcqui); m_ReflectanceToSurfaceReflectanceFilter->SetAtmoCorrectionParameters(m_paramAtmo); @@ -934,10 +934,10 @@ private: } //Keep object references as a members of the class, else the pipeline will be broken after exiting DoExecute(). - ImageToLuminanceImageFilterType ::Pointer m_ImageToLuminanceFilter; - LuminanceToReflectanceImageFilterType::Pointer m_LuminanceToReflectanceFilter; - ReflectanceToLuminanceImageFilterType::Pointer m_ReflectanceToLuminanceFilter; - LuminanceToImageImageFilterType::Pointer m_LuminanceToImageFilter; + ImageToRadianceImageFilterType ::Pointer m_ImageToRadianceFilter; + RadianceToReflectanceImageFilterType::Pointer m_RadianceToReflectanceFilter; + ReflectanceToRadianceImageFilterType::Pointer m_ReflectanceToRadianceFilter; + RadianceToImageImageFilterType::Pointer m_RadianceToImageFilter; ReflectanceToSurfaceReflectanceImageFilterType::Pointer m_ReflectanceToSurfaceReflectanceFilter; ScaleFilterOutDoubleType::Pointer m_ScaleFilter; AtmoCorrectionParametersPointerType m_paramAtmo; diff --git a/Modules/Applications/AppOpticalCalibration/test/CMakeLists.txt b/Modules/Applications/AppOpticalCalibration/test/CMakeLists.txt index b5df61f0596399e35679cb52af0698130a3ad7e7..a3068e1a64d109373ccb799f839f62a9c74c03b1 100644 --- a/Modules/Applications/AppOpticalCalibration/test/CMakeLists.txt +++ b/Modules/Applications/AppOpticalCalibration/test/CMakeLists.txt @@ -27,7 +27,7 @@ otb_test_application(NAME apTvRaOpticalCalibration_QuickbirdXS -clamp false -out ${TEMP}/apTvRaOpticalCalibration_QuickbirdXS.tif VALID --compare-image ${EPSILON_7} - ${BASELINE}/raTvLuminanceToReflectanceImageFilterAutoQuickbirdXS.tif + ${BASELINE}/raTvRadianceToReflectanceImageFilterAutoQuickbirdXS.tif ${TEMP}/apTvRaOpticalCalibration_QuickbirdXS.tif ) otb_test_application(NAME apTvRaOpticalCalibration_WV2PAN @@ -36,7 +36,7 @@ otb_test_application(NAME apTvRaOpticalCalibration_WV2PAN -level toa -out ${TEMP}/apTvRaOpticalCalibration_WV2PAN.tif VALID --compare-image ${EPSILON_7} - ${BASELINE}/raTvLuminanceToReflectanceImageFilterAutoWV2PAN.tif + ${BASELINE}/raTvRadianceToReflectanceImageFilterAutoWV2PAN.tif ${TEMP}/apTvRaOpticalCalibration_WV2PAN.tif ) otb_test_application(NAME apTvRaOpticalCalibration_WV2Multi @@ -45,7 +45,7 @@ otb_test_application(NAME apTvRaOpticalCalibration_WV2Multi -level toa -out ${TEMP}/apTvRaOpticalCalibration_WV2Multi.tif VALID --compare-image ${EPSILON_7} - ${BASELINE}/raTvLuminanceToReflectanceImageFilterAutoWV2Multi.tif + ${BASELINE}/raTvRadianceToReflectanceImageFilterAutoWV2Multi.tif ${TEMP}/apTvRaOpticalCalibration_WV2Multi.tif ) otb_test_application(NAME apTvRaOpticalCalibration_Formosat @@ -54,7 +54,7 @@ otb_test_application(NAME apTvRaOpticalCalibration_Formosat -level toa -out ${TEMP}/apTvRaOpticalCalibration_Formosat.img VALID --compare-image ${EPSILON_7} - ${BASELINE}/raTvLuminanceToReflectanceImageFilterAutoFormosat.tif + ${BASELINE}/raTvRadianceToReflectanceImageFilterAutoFormosat.tif ${TEMP}/apTvRaOpticalCalibration_Formosat.img ) otb_test_application(NAME apTvRaOpticalCalibration_QuickbirdPAN @@ -63,7 +63,7 @@ otb_test_application(NAME apTvRaOpticalCalibration_QuickbirdPAN -level toa -out ${TEMP}/apTvRaOpticalCalibration_QuickbirdPAN.tif VALID --compare-image ${EPSILON_7} - ${BASELINE}/raTvLuminanceToReflectanceImageFilterAutoQuickbirdPAN.tif + ${BASELINE}/raTvRadianceToReflectanceImageFilterAutoQuickbirdPAN.tif ${TEMP}/apTvRaOpticalCalibration_QuickbirdPAN.tif ) otb_test_application(NAME apTvRaOpticalCalibration_Spot5 @@ -72,7 +72,7 @@ otb_test_application(NAME apTvRaOpticalCalibration_Spot5 -level toa -out ${TEMP}/apTvRaOpticalCalibration_Spot5.img VALID --compare-image ${EPSILON_7} - ${BASELINE}/raTvLuminanceToReflectanceImageFilterAutoSpot5.tif + ${BASELINE}/raTvRadianceToReflectanceImageFilterAutoSpot5.tif ${TEMP}/apTvRaOpticalCalibration_Spot5.img ) otb_test_application(NAME apTvRaOpticalCalibration_UnknownSensor @@ -106,7 +106,7 @@ otb_test_application(NAME apTvRaOpticalCalibration_UnknownSensor otb_test_application(NAME apTvRaOpticalCalibration_Reverse_UnknownSensor APP OpticalCalibration OPTIONS - -in ${BASELINE}/raTvLuminanceToReflectanceImageFilterAutoQuickbirdXS.tif + -in ${BASELINE}/raTvRadianceToReflectanceImageFilterAutoQuickbirdXS.tif -out ${TEMP}/apTvRaOpticalCalibration_Rev_QB-XS_UnknownSensor_test.tif -level toatoim -acqui.gainbias ${INPUTDATA}/apTvRaOpticalCalibrationUnknownSensorGainsBiases.txt @@ -126,6 +126,6 @@ otb_test_application(NAME apTvRaOpticalCalibration_Ikonos -level toa -out ${TEMP}/apTvRaOpticalCalibration_Ikonos.tif VALID --compare-image ${EPSILON_7} - ${BASELINE}/raTvLuminanceToReflectanceImageFilterAutoIkonos.tif + ${BASELINE}/raTvRadianceToReflectanceImageFilterAutoIkonos.tif ${TEMP}/apTvRaOpticalCalibration_Ikonos.tif ) diff --git a/Modules/Applications/AppProjection/app/otbOrthoRectification.cxx b/Modules/Applications/AppProjection/app/otbOrthoRectification.cxx index 1313e70650cb4748f66d19f59de968dd31bba812..2dc6a6119f70ce75cd81e2483d32392e10933fc6 100644 --- a/Modules/Applications/AppProjection/app/otbOrthoRectification.cxx +++ b/Modules/Applications/AppProjection/app/otbOrthoRectification.cxx @@ -91,7 +91,7 @@ private: { SetName("OrthoRectification"); std::ostringstream oss; - oss << "This application allows ortho-rectification of optical images from supported sensors." << std::endl; + oss << "This application allows ortho-rectification of optical and radar images from supported sensors." << std::endl; SetDescription(oss.str()); // Documentation SetDocName("Ortho-rectification"); @@ -101,7 +101,7 @@ private: oss<<"A Digital Elevation Model can be specified to account for terrain deformations. "<<std::endl; oss<<"In case of SPOT5 images, the sensor model can be approximated by an RPC model in order to speed-up computation."; SetDocLongDescription(oss.str()); - SetDocLimitations("Supported sensors are Pleiades, SPOT5 (TIF format), SPOT6/7, Ikonos, Quickbird, Worldview2, Worldview3, GeoEye, Sentinel1."); + SetDocLimitations("Supported sensors (both optical and radar) are: GeoEye, Ikonos, Pleiades, Quickbird, RadarSat, Sentinel-1, SPOT5 (TIF format), SPOT6/7, TerraSAR-X, Worldview 1/2/3."); SetDocAuthors("OTB-Team"); SetDocSeeAlso("Ortho-rectification chapter from the OTB Software Guide"); diff --git a/Modules/Applications/AppSegmentation/app/otbLargeScaleMeanShift.cxx b/Modules/Applications/AppSegmentation/app/otbLargeScaleMeanShift.cxx index d0dfadb1a535ce0c3acafecb650258c3c4d855e1..27f8da837771c4eada660c43b6628e6fa32ec462 100644 --- a/Modules/Applications/AppSegmentation/app/otbLargeScaleMeanShift.cxx +++ b/Modules/Applications/AppSegmentation/app/otbLargeScaleMeanShift.cxx @@ -64,7 +64,7 @@ private: "This application can be a preliminary step for an object-based analysis.\n\n" "It generates a vector data file containing the regions extracted with " "the MeanShift algorithm. The spatial and range radius parameters allow " - "to adapt the sensitivity of the algorithm depending on the image dynamic " + "adapting the sensitivity of the algorithm depending on the image dynamic " "and resolution. There is a step to remove small regions whose size " "(in pixels) is less than the given 'minsize' parameter. These regions " "are merged to a similar neighbor region. In the output vectors, there " diff --git a/Modules/Applications/AppSegmentation/app/otbMeanShiftSmoothing.cxx b/Modules/Applications/AppSegmentation/app/otbMeanShiftSmoothing.cxx index 1219f24c1a9876a30ba77a55277442247a43e26b..8f63bf13ef99f1062726c988b7c6b18a8aa236d5 100644 --- a/Modules/Applications/AppSegmentation/app/otbMeanShiftSmoothing.cxx +++ b/Modules/Applications/AppSegmentation/app/otbMeanShiftSmoothing.cxx @@ -76,16 +76,16 @@ private: " will speed-up convergence, at the expense of stability of the result.\n\n" "The application outputs the image of the final averaged spectral" - " signatures (fout), and can also optionnaly output the 2D" + " signatures (fout), and can also optionally output the 2D" " displacement field between input pixel position and final pixel" " position after convergence (foutpos).\n\n" "Note that computing an euclidean distance between spectral signatures" - " may be innacurate and that techniques such as color space transform or image" + " may be inaccurate and that techniques such as color space transform or image" " normalisation could be applied before using this application. Also" " note that most satellite images noise model is not gaussian, since" - " noise variance linearly depends on luminance (the higher the" - " luminance, the higher the noise variance). To account for such noise" + " noise variance linearly depends on radiance (the higher the" + " radiance, the higher the noise variance). To account for such noise" " model, the application provides the range radius ramp option" " (rangeramp), which will vary the range radius linearly with the" " central pixel intensity. Default value is 1. (no ramp).\n\n" diff --git a/Modules/Applications/AppStereo/app/otbBlockMatching.cxx b/Modules/Applications/AppStereo/app/otbBlockMatching.cxx index eaf57ea79a2c47f194d73db7c8e2cdad7db717c2..2ec8f7e63a0c00d90c3156c390ea71ce3af63573 100644 --- a/Modules/Applications/AppStereo/app/otbBlockMatching.cxx +++ b/Modules/Applications/AppStereo/app/otbBlockMatching.cxx @@ -139,9 +139,9 @@ private: " and resampled each input image into epipolar geometry (with " "GridBasedImageResampling).\n\n" "The application searches locally for the displacement between a reference" - " image and a secondary image. The correspondance is evaluated for each " + " image and a secondary image. The correspondence is evaluated for each " "pixel, based on a pair of local neighborhood windows. The displacement " - "evaluated can be 1D (along lines) or 2D. Parameters allows to set the " + "evaluated can be 1D (along lines) or 2D. Parameters allow setting the " "minimum and maximum disparities to search (both for horizontal and " "vertical directions). A winner-take-all approach is used to select the " "best match. There are different metrics implemented to evaluate the " diff --git a/Modules/Applications/AppStereo/app/otbDisparityMapToElevationMap.cxx b/Modules/Applications/AppStereo/app/otbDisparityMapToElevationMap.cxx index 6302a912f14fdaf910a80970825a70a384ef8807..25e4b96189fc1549b2875f9e55c255a75611cd38 100644 --- a/Modules/Applications/AppStereo/app/otbDisparityMapToElevationMap.cxx +++ b/Modules/Applications/AppStereo/app/otbDisparityMapToElevationMap.cxx @@ -124,7 +124,7 @@ private: AddParameter(ParameterType_InputImage,"io.rgrid","Right Grid"); SetParameterDescription("io.rgrid","Right epipolar grid (deformation grid " - "between rigth sensor et disparity spaces)"); + "between right sensor et disparity spaces)"); AddParameter(ParameterType_OutputImage,"io.out","Output elevation map"); SetParameterDescription("io.out", "Output elevation map in ground " diff --git a/Modules/Core/Common/include/otbImageRegionAdaptativeSplitter.txx b/Modules/Core/Common/include/otbImageRegionAdaptativeSplitter.txx index 13856ec403e303b1c78d95722269879dda56ed1c..b9bb88e318d687d85b48976f43a8b11bbd3d8b23 100644 --- a/Modules/Core/Common/include/otbImageRegionAdaptativeSplitter.txx +++ b/Modules/Core/Common/include/otbImageRegionAdaptativeSplitter.txx @@ -25,7 +25,7 @@ #include "otbMath.h" #include "otbMacro.h" -// Defaut when no tile hint available +// Default when no tile hint available #include "otbImageRegionSquareTileSplitter.h" namespace otb diff --git a/Modules/Core/Common/include/otbModelComponentBase.h b/Modules/Core/Common/include/otbModelComponentBase.h index c23c5a0062c267ec4c4fb87824a1f70246f6f7a2..1bb6180576b50fc517e10733d56c261981a0c944 100644 --- a/Modules/Core/Common/include/otbModelComponentBase.h +++ b/Modules/Core/Common/include/otbModelComponentBase.h @@ -126,7 +126,7 @@ public: /** Show the parameters in a minimal form in comparison to PrintSelf */ virtual void ShowParameters(std::ostream& os, itk::Indent indent) const; - // TODO: Distance between distribtions with some kind of member function... + // TODO: Distance between distributions with some kind of member function... protected: ModelComponentBase(); diff --git a/Modules/Core/LabelMap/include/otbShapeAttributesLabelMapFilter.h b/Modules/Core/LabelMap/include/otbShapeAttributesLabelMapFilter.h index c7142a057d434cc1ae0ab30ffc8ee99e10a6241e..eb2dfbc8fb48ed0c381d145721f137db4a62b3f6 100644 --- a/Modules/Core/LabelMap/include/otbShapeAttributesLabelMapFilter.h +++ b/Modules/Core/LabelMap/include/otbShapeAttributesLabelMapFilter.h @@ -242,14 +242,14 @@ public: /** * Set/Get whether the maximum Feret diameter should be computed or not. The - * defaut value is false, because of the high computation time required. + * default value is false, because of the high computation time required. */ void SetComputeFeretDiameter(bool flag); bool GetComputeFeretDiameter() const; itkBooleanMacro(ComputeFeretDiameter); /** - * Set/Get whether the perimeter should be computed or not. The defaut value + * Set/Get whether the perimeter should be computed or not. The default value * is false, because of the high computation time required. */ void SetComputePerimeter(bool flag); diff --git a/Modules/Core/Transform/include/otbGeoInformationConversion.h b/Modules/Core/Transform/include/otbGeoInformationConversion.h index 3fd9b45d621a002fd68d08dc2f1093192144d18a..d20f786f7ccd2be7b4081e341fdadbbbb018d72e 100644 --- a/Modules/Core/Transform/include/otbGeoInformationConversion.h +++ b/Modules/Core/Transform/include/otbGeoInformationConversion.h @@ -33,7 +33,9 @@ namespace otb * \brief Helper functions to do the geo information conversions used frequently. * * This namespace provides helpers functions to build a WKT from a valid EPSG number using - * the method ToWKT(int srid). + * the method ToWKT(int srid), and also to retrieve an EPSG number from a WKT + * using the method ToEPSG(const std::string &) + * */ namespace GeoInformationConversion { @@ -43,6 +45,13 @@ namespace GeoInformationConversion /** this method try to morph a wkt to ESRI WKT format and returns the error code**/ OTBTransform_EXPORT bool IsESRIValidWKT(const std::string &Wkt); + + /** Function used to get an epsg number from a wkt string. + * Returns -1 if the wkt is neither a PROJCS nor a GEOGCS. + * Returns 0 if no authority code is found but wkt has a PROJCS or a GEOGCS. + * Otherwise the EPSG authority code is returned + */ + OTBTransform_EXPORT int ToEPSG(const std::string &wkt); } } // End namespace otb diff --git a/Modules/Core/Transform/src/otbGeoInformationConversion.cxx b/Modules/Core/Transform/src/otbGeoInformationConversion.cxx index 635b8cf8f89397fb4479a83c20d348fb8f3b672d..4beb0cd9ec0dfcfcd7278957d8b5b9899b9a9e31 100644 --- a/Modules/Core/Transform/src/otbGeoInformationConversion.cxx +++ b/Modules/Core/Transform/src/otbGeoInformationConversion.cxx @@ -73,4 +73,35 @@ bool GeoInformationConversion::IsESRIValidWKT(const std::string &wkt) return SRS.Validate()==OGRERR_NONE; } +int GeoInformationConversion::ToEPSG(const std::string &wkt) +{ + int code = -1; + OGRSpatialReference srs(wkt.c_str()); + srs.Fixup(); + srs.AutoIdentifyEPSG(); + const char * epsg = nullptr; + if (srs.IsGeographic()) + { + code = 0; + epsg = srs.GetAuthorityCode("GEOGCS"); + } + else if (srs.IsProjected()) + { + code = 0; + epsg = srs.GetAuthorityCode("PROJCS"); + } + if (epsg!=nullptr && strcmp( epsg, "" )!=0 ) + { + try + { + code = boost::lexical_cast<int>(epsg); + } + catch(boost::bad_lexical_cast &) + { + code = 0; + } + } + return code; +} + } // End namespace otb diff --git a/Modules/Filtering/Projection/test/otbGenericRSTransformGenericTest.cxx b/Modules/Filtering/Projection/test/otbGenericRSTransformGenericTest.cxx index 4237cce946a45ebc1a0e7a493d24443d02910c21..3898a1d9b39a9cd3875db865188107ffa07b358b 100644 --- a/Modules/Filtering/Projection/test/otbGenericRSTransformGenericTest.cxx +++ b/Modules/Filtering/Projection/test/otbGenericRSTransformGenericTest.cxx @@ -249,7 +249,7 @@ int otbGenericRSTransformGenericTest(int argc, char * argv[]) if(inRes>inThreshold) { failed = true; - std::cerr<<"Input residual ("<<outRes<<") outpasses the threshold ("<<inThreshold<<")"<<std::endl; + std::cerr<<"Input residual ("<<inRes<<") outpasses the threshold ("<<inThreshold<<")"<<std::endl; std::cerr<<std::endl; } diff --git a/Modules/Filtering/Statistics/include/otbPatternSampler.h b/Modules/Filtering/Statistics/include/otbPatternSampler.h index 5a9b640a622d47224f733ef5a48492ba15e08735..cc9dd9465dfe5be082025a960d0707f64f56c31a 100644 --- a/Modules/Filtering/Statistics/include/otbPatternSampler.h +++ b/Modules/Filtering/Statistics/include/otbPatternSampler.h @@ -49,7 +49,7 @@ public: typedef struct Parameter { /** Maximum size of the internal patterns */ - unsigned long MaxPatternSize; + unsigned long MaxPatternSize = 0; /** First sampling pattern */ std::vector<bool> Pattern1; @@ -59,7 +59,7 @@ public: std::vector<bool> Pattern2; /** Seed used to randomly generate patterns (used only if greater than 0) */ - unsigned int Seed; + unsigned int Seed = 0; bool operator!=(const struct Parameter & param) const; } ParameterType; diff --git a/Modules/IO/ImageIO/include/otbImageFileReader.txx b/Modules/IO/ImageIO/include/otbImageFileReader.txx index f701d882571bd7c17dbd6dd90e162b19f450e21b..966fe434b9ebf1ab7fd58711e55f9e171d7575f3 100644 --- a/Modules/IO/ImageIO/include/otbImageFileReader.txx +++ b/Modules/IO/ImageIO/include/otbImageFileReader.txx @@ -734,7 +734,7 @@ ImageFileReader<TOutputImage, ConvertPixelTraits> // TODO: // Pass down the PixelType (RGB, VECTOR, etc.) so that any vector to // scalar conversion be type specific. i.e. RGB to scalar would use - // a formula to convert to luminance, VECTOR to scalar would use + // a formula to convert to radiance, VECTOR to scalar would use // vector magnitude. diff --git a/Modules/IO/TestKernel/src/otbTestDriver.cxx b/Modules/IO/TestKernel/src/otbTestDriver.cxx index 27d45ef1e7618fbb846936483bed12fd70b7f792..349a224db4c88a4816d550d1db463c0a90420c5c 100644 --- a/Modules/IO/TestKernel/src/otbTestDriver.cxx +++ b/Modules/IO/TestKernel/src/otbTestDriver.cxx @@ -114,7 +114,7 @@ int parseCommandLine(int ac, char * av[], std::vector<char *>& remainingArgs) if (oldenv2) { libpath64 += KWSYS_SHARED_FORWARD_PATH_SEP; - libpath64 += oldenv; + libpath64 += oldenv2; } itksys::SystemTools::PutEnv(libpath64.c_str()); } diff --git a/Modules/Learning/LearningBase/include/otbMachineLearningModelTraits.h b/Modules/Learning/LearningBase/include/otbMachineLearningModelTraits.h index e9bc4cec29b9b3b45891e0265d63009bff34b76e..e5f53f39c8810b4aeb4fe4fc94b7cfddc5bb7ee0 100644 --- a/Modules/Learning/LearningBase/include/otbMachineLearningModelTraits.h +++ b/Modules/Learning/LearningBase/include/otbMachineLearningModelTraits.h @@ -37,7 +37,7 @@ namespace otb * and ValueType. * * \tparam TInput : input sample type (can be either a scalar type or - * a VariableLenghtVector + * a VariableLengthVector * \tparam isNumber either TrueType or FalseType for partial * specialization @@ -71,7 +71,7 @@ template <typename TInput> using MLMSampleTraits = MLMSampleTraitsImpl< TInput, * and ValueType. * * \tparam TInput : input sample type (can be either a scalar type or - * a VariableLenghtVector or a FixedArray + * a VariableLengthVector or a FixedArray * \tparam isNumber either TrueType or FalseType for partial * specialization diff --git a/Modules/Learning/Sampling/include/otbPersistentSamplingFilterBase.txx b/Modules/Learning/Sampling/include/otbPersistentSamplingFilterBase.txx index 1a442a249a7ace0ad8768ec2ecac7be1b077cce8..7fa8822ec670b416ed36e9b7eab478afca57fccb 100644 --- a/Modules/Learning/Sampling/include/otbPersistentSamplingFilterBase.txx +++ b/Modules/Learning/Sampling/include/otbPersistentSamplingFilterBase.txx @@ -725,19 +725,22 @@ PersistentSamplingFilterBase<TInputImage,TMaskImage> { tmpLayers.push_back(this->GetInMemoryInput(i)); } - + + const unsigned int nbFeatThread = std::ceil(inLayer.GetFeatureCount(true) / (float) numberOfThreads); + assert(nbFeatThread > 0); + OGRFeatureDefn &layerDefn = inLayer.GetLayerDefn(); ogr::Layer::const_iterator featIt = inLayer.begin(); unsigned int counter=0; + unsigned int cptFeat = 0; for(; featIt!=inLayer.end(); ++featIt) { ogr::Feature dstFeature(layerDefn); dstFeature.SetFrom( *featIt, TRUE ); dstFeature.SetFID(featIt->GetFID()); tmpLayers[counter].CreateFeature( dstFeature ); - counter++; - if (counter >= tmpLayers.size()) - counter = 0; + cptFeat++; + if (cptFeat > nbFeatThread) counter++; cptFeat=0; } inLayer.SetSpatialFilter(ITK_NULLPTR); diff --git a/Modules/OBIA/RCC8/test/otbImageToImageRCC8Calculator.cxx b/Modules/OBIA/RCC8/test/otbImageToImageRCC8Calculator.cxx index 90769aaffbad96377b2c5bce41cc5b2b15b23f6a..f9137e47ca3a2162c76936799387c1f7e2a3821c 100644 --- a/Modules/OBIA/RCC8/test/otbImageToImageRCC8Calculator.cxx +++ b/Modules/OBIA/RCC8/test/otbImageToImageRCC8Calculator.cxx @@ -94,7 +94,7 @@ int otbImageToImageRCC8Calculator(int itkNotUsed(argc), char* argv[]) { std::cout << "Test failed: Result with level3AprioriKnowledge "; std::cout << "different from result without a priori knowledge" << std::endl; - std::cout << calc->GetValue() << "!=" << calc1->GetValue() << std::endl; + std::cout << calc->GetValue() << "!=" << calc2->GetValue() << std::endl; return EXIT_FAILURE; } } diff --git a/Modules/Radiometry/OpticalCalibration/include/otbImageToLuminanceImageFilter.h b/Modules/Radiometry/OpticalCalibration/include/otbImageToLuminanceImageFilter.h index d451f59441923a2b09a36bf81cacc16be99b7c38..0b6cda132f6f1846cc8503a9b8553d05f57966b7 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbImageToLuminanceImageFilter.h +++ b/Modules/Radiometry/OpticalCalibration/include/otbImageToLuminanceImageFilter.h @@ -22,204 +22,27 @@ #ifndef otbImageToLuminanceImageFilter_h #define otbImageToLuminanceImageFilter_h -#include "otbUnaryImageFunctorWithVectorImageFilter.h" -#include "itkNumericTraits.h" -#include "otbMacro.h" -#include "otbOpticalImageMetadataInterfaceFactory.h" - -#include <fstream> +#include <otbImageToRadianceImageFilter.h> +#include <vcl_deprecated_header.h> namespace otb { -namespace Functor -{ -/** - * \class ImageToLuminanceImageFunctor - * \brief Add beta to the quotient Input over alpha. - * - * \sa ImageToLuminanceImageFilter - * \ingroup Functor - * \ingroup Radiometry - * - * \ingroup OTBOpticalCalibration - */ - -template <class TInput, class TOutput> -class ImageToLuminanceImageFunctor -{ -public: - ImageToLuminanceImageFunctor() : - m_Alpha(1.), - m_Beta(0.) - {} - - virtual ~ImageToLuminanceImageFunctor() {} - - void SetAlpha(double alpha) - { - m_Alpha = alpha; - } - void SetBeta(double beta) - { - m_Beta = beta; - } - double GetAlpha() - { - return m_Alpha; - } - double GetBeta() - { - return m_Beta; - } - inline TOutput operator ()(const TInput& inPixel) const - { - TOutput outPixel; - double temp; - temp = static_cast<double>(inPixel) / m_Alpha + m_Beta; - outPixel = static_cast<TOutput>(temp); - return outPixel; - } - -private: - double m_Alpha; - double m_Beta; -}; -} /** \class ImageToLuminanceImageFilter - * \brief Convert a raw value into a luminance value - * - * Transform a classical image into the luminance image. For this it - * uses the functor ImageToLuminanceImageFunctor calling for each component of each pixel. - * - * - * For Spot image in the dimap format, the correction parameters are - * retrieved automatically from the metadata + * \brief Convert a raw value into a Luminance value * - * \ingroup ImageToLuminanceImageFunctor - * \ingroup Radiometry - * - * \example Radiometry/AtmosphericCorrectionSequencement.cxx + * \deprecated in OTB 6.2, please use ImageToRadianceImageFilter instead * * \ingroup OTBOpticalCalibration */ template <class TInputImage, class TOutputImage> class ITK_EXPORT ImageToLuminanceImageFilter : - public UnaryImageFunctorWithVectorImageFilter<TInputImage, - TOutputImage, - typename Functor::ImageToLuminanceImageFunctor<typename - TInputImage:: - InternalPixelType, - typename - TOutputImage:: - InternalPixelType> > + public ImageToRadianceImageFilter<TInputImage, TOutputImage> { -public: - /** Extract input and output images dimensions.*/ - itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension); - itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension); - - /** "typedef" to simplify the variables definition and the declaration. */ - typedef TInputImage InputImageType; - typedef TOutputImage OutputImageType; - typedef typename Functor::ImageToLuminanceImageFunctor<typename InputImageType::InternalPixelType, - typename OutputImageType::InternalPixelType> FunctorType; - - /** "typedef" for standard classes. */ - typedef ImageToLuminanceImageFilter Self; - typedef UnaryImageFunctorWithVectorImageFilter<InputImageType, OutputImageType, FunctorType> Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - /** object factory method. */ - itkNewMacro(Self); - - /** return class name. */ - itkTypeMacro(ImageToLuminanceImageFilter, UnaryImageFunctorWithVectorImageFiltermageFilter); - - /** Supported images definition. */ - typedef typename InputImageType::PixelType InputPixelType; - typedef typename InputImageType::InternalPixelType InputInternalPixelType; - typedef typename InputImageType::RegionType InputImageRegionType; - typedef typename OutputImageType::PixelType OutputPixelType; - typedef typename OutputImageType::InternalPixelType OutputInternalPixelType; - typedef typename OutputImageType::RegionType OutputImageRegionType; - - typedef typename itk::VariableLengthVector<double> VectorType; - - /** Image size "typedef" definition. */ - typedef typename InputImageType::SizeType SizeType; - - /** Set the absolute calibration gains. */ - itkSetMacro(Alpha, VectorType); - - /** Give the absolute calibration gains. */ - itkGetConstReferenceMacro(Alpha, VectorType); - - /** Set the absolute calibration bias. */ - itkSetMacro(Beta, VectorType); - /** Give the absolute calibration bias. */ - itkGetConstReferenceMacro(Beta, VectorType); - -protected: - /** Constructor */ - ImageToLuminanceImageFilter() - { - m_Alpha.SetSize(0); - m_Beta.SetSize(0); - }; - - /** Destructor */ - ~ImageToLuminanceImageFilter() ITK_OVERRIDE {} - - /** Update the functor list and input parameters */ - void BeforeThreadedGenerateData(void) ITK_OVERRIDE - { - OpticalImageMetadataInterface::Pointer imageMetadataInterface = OpticalImageMetadataInterfaceFactory::CreateIMI( - this->GetInput()->GetMetaDataDictionary()); - if (m_Alpha.GetSize() == 0) - { - m_Alpha = imageMetadataInterface->GetPhysicalGain(); - } - - if (m_Beta.GetSize() == 0) - { - m_Beta = imageMetadataInterface->GetPhysicalBias(); - } - - otbMsgDevMacro(<< "Dimension: "); - otbMsgDevMacro(<< "m_Alpha.GetSize(): " << m_Alpha.GetSize()); - otbMsgDevMacro(<< "m_Beta.GetSize() : " << m_Beta.GetSize()); - otbMsgDevMacro( - << "this->GetInput()->GetNumberOfComponentsPerPixel() : " << this->GetInput()->GetNumberOfComponentsPerPixel()); - - if ((m_Alpha.GetSize() != this->GetInput()->GetNumberOfComponentsPerPixel()) - || (m_Beta.GetSize() != this->GetInput()->GetNumberOfComponentsPerPixel())) - { - itkExceptionMacro(<< "Alpha and Beta parameters should have the same size as the number of bands"); - } - - otbMsgDevMacro(<< "Using correction parameters: "); - otbMsgDevMacro(<< "Alpha (gain): " << m_Alpha); - otbMsgDevMacro(<< "Beta (bias): " << m_Beta); - - this->GetFunctorVector().clear(); - for (unsigned int i = 0; i < this->GetInput()->GetNumberOfComponentsPerPixel(); ++i) - { - FunctorType functor; - functor.SetAlpha(m_Alpha[i]); - functor.SetBeta(m_Beta[i]); - this->GetFunctorVector().push_back(functor); - } - } - -private: - /** Ponderation declaration*/ - VectorType m_Alpha; - VectorType m_Beta; }; -} // end namespace otb + +} // namespace otb #endif diff --git a/Modules/Radiometry/OpticalCalibration/include/otbImageToRadianceImageFilter.h b/Modules/Radiometry/OpticalCalibration/include/otbImageToRadianceImageFilter.h new file mode 100644 index 0000000000000000000000000000000000000000..fc8b7c3bbde428c1907ead63b869c77bd6707a78 --- /dev/null +++ b/Modules/Radiometry/OpticalCalibration/include/otbImageToRadianceImageFilter.h @@ -0,0 +1,225 @@ +/* + * Copyright (C) 1999-2011 Insight Software Consortium + * 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 otbImageToRadianceImageFilter_h +#define otbImageToRadianceImageFilter_h + +#include "otbUnaryImageFunctorWithVectorImageFilter.h" +#include "itkNumericTraits.h" +#include "otbMacro.h" +#include "otbOpticalImageMetadataInterfaceFactory.h" + +#include <fstream> + +namespace otb +{ +namespace Functor +{ +/** + * \class ImageToRadianceImageFunctor + * \brief Add beta to the quotient Input over alpha. + * + * \sa ImageToRadianceImageFilter + * \ingroup Functor + * \ingroup Radiometry + * + * \ingroup OTBOpticalCalibration + */ + +template <class TInput, class TOutput> +class ImageToRadianceImageFunctor +{ +public: + ImageToRadianceImageFunctor() : + m_Alpha(1.), + m_Beta(0.) + {} + + virtual ~ImageToRadianceImageFunctor() {} + + void SetAlpha(double alpha) + { + m_Alpha = alpha; + } + void SetBeta(double beta) + { + m_Beta = beta; + } + double GetAlpha() + { + return m_Alpha; + } + double GetBeta() + { + return m_Beta; + } + + inline TOutput operator ()(const TInput& inPixel) const + { + TOutput outPixel; + double temp; + temp = static_cast<double>(inPixel) / m_Alpha + m_Beta; + outPixel = static_cast<TOutput>(temp); + return outPixel; + } + +private: + double m_Alpha; + double m_Beta; +}; +} + +/** \class ImageToRadianceImageFilter + * \brief Convert a raw value into a radiance value + * + * Transform a classical image into the radiance image. For this it + * uses the functor ImageToRadianceImageFunctor calling for each component of each pixel. + * + * + * For Spot image in the dimap format, the correction parameters are + * retrieved automatically from the metadata + * + * \ingroup ImageToRadianceImageFunctor + * \ingroup Radiometry + * + * \example Radiometry/AtmosphericCorrectionSequencement.cxx + * + * \ingroup OTBOpticalCalibration + */ +template <class TInputImage, class TOutputImage> +class ITK_EXPORT ImageToRadianceImageFilter : + public UnaryImageFunctorWithVectorImageFilter<TInputImage, + TOutputImage, + typename Functor::ImageToRadianceImageFunctor<typename + TInputImage:: + InternalPixelType, + typename + TOutputImage:: + InternalPixelType> > +{ +public: + /** Extract input and output images dimensions.*/ + itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension); + itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension); + + /** "typedef" to simplify the variables definition and the declaration. */ + typedef TInputImage InputImageType; + typedef TOutputImage OutputImageType; + typedef typename Functor::ImageToRadianceImageFunctor<typename InputImageType::InternalPixelType, + typename OutputImageType::InternalPixelType> FunctorType; + + /** "typedef" for standard classes. */ + typedef ImageToRadianceImageFilter Self; + typedef UnaryImageFunctorWithVectorImageFilter<InputImageType, OutputImageType, FunctorType> Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + /** object factory method. */ + itkNewMacro(Self); + + /** return class name. */ + itkTypeMacro(ImageToRadianceImageFilter, UnaryImageFunctorWithVectorImageFiltermageFilter); + + /** Supported images definition. */ + typedef typename InputImageType::PixelType InputPixelType; + typedef typename InputImageType::InternalPixelType InputInternalPixelType; + typedef typename InputImageType::RegionType InputImageRegionType; + typedef typename OutputImageType::PixelType OutputPixelType; + typedef typename OutputImageType::InternalPixelType OutputInternalPixelType; + typedef typename OutputImageType::RegionType OutputImageRegionType; + + typedef typename itk::VariableLengthVector<double> VectorType; + + /** Image size "typedef" definition. */ + typedef typename InputImageType::SizeType SizeType; + + /** Set the absolute calibration gains. */ + itkSetMacro(Alpha, VectorType); + + /** Give the absolute calibration gains. */ + itkGetConstReferenceMacro(Alpha, VectorType); + + /** Set the absolute calibration bias. */ + itkSetMacro(Beta, VectorType); + /** Give the absolute calibration bias. */ + itkGetConstReferenceMacro(Beta, VectorType); + +protected: + /** Constructor */ + ImageToRadianceImageFilter() + { + m_Alpha.SetSize(0); + m_Beta.SetSize(0); + }; + + /** Destructor */ + ~ImageToRadianceImageFilter() ITK_OVERRIDE {} + + /** Update the functor list and input parameters */ + void BeforeThreadedGenerateData(void) ITK_OVERRIDE + { + OpticalImageMetadataInterface::Pointer imageMetadataInterface = OpticalImageMetadataInterfaceFactory::CreateIMI( + this->GetInput()->GetMetaDataDictionary()); + if (m_Alpha.GetSize() == 0) + { + m_Alpha = imageMetadataInterface->GetPhysicalGain(); + } + + if (m_Beta.GetSize() == 0) + { + m_Beta = imageMetadataInterface->GetPhysicalBias(); + } + + otbMsgDevMacro(<< "Dimension: "); + otbMsgDevMacro(<< "m_Alpha.GetSize(): " << m_Alpha.GetSize()); + otbMsgDevMacro(<< "m_Beta.GetSize() : " << m_Beta.GetSize()); + otbMsgDevMacro( + << "this->GetInput()->GetNumberOfComponentsPerPixel() : " << this->GetInput()->GetNumberOfComponentsPerPixel()); + + if ((m_Alpha.GetSize() != this->GetInput()->GetNumberOfComponentsPerPixel()) + || (m_Beta.GetSize() != this->GetInput()->GetNumberOfComponentsPerPixel())) + { + itkExceptionMacro(<< "Alpha and Beta parameters should have the same size as the number of bands"); + } + + otbMsgDevMacro(<< "Using correction parameters: "); + otbMsgDevMacro(<< "Alpha (gain): " << m_Alpha); + otbMsgDevMacro(<< "Beta (bias): " << m_Beta); + + this->GetFunctorVector().clear(); + for (unsigned int i = 0; i < this->GetInput()->GetNumberOfComponentsPerPixel(); ++i) + { + FunctorType functor; + functor.SetAlpha(m_Alpha[i]); + functor.SetBeta(m_Beta[i]); + this->GetFunctorVector().push_back(functor); + } + } + +private: + /** Ponderation declaration*/ + VectorType m_Alpha; + VectorType m_Beta; +}; + +} // end namespace otb + +#endif diff --git a/Modules/Radiometry/OpticalCalibration/include/otbImageToReflectanceImageFilter.h b/Modules/Radiometry/OpticalCalibration/include/otbImageToReflectanceImageFilter.h index 024a72343815e62413aebee0a2a6b6c5725e40d9..6dbc688a7f1e0861f4624e0a14d2fab256a49293 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbImageToReflectanceImageFilter.h +++ b/Modules/Radiometry/OpticalCalibration/include/otbImageToReflectanceImageFilter.h @@ -22,22 +22,22 @@ #ifndef otbImageToReflectanceImageFilter_h #define otbImageToReflectanceImageFilter_h -#include "otbImageToLuminanceImageFilter.h" -#include "otbLuminanceToReflectanceImageFilter.h" +#include "otbImageToRadianceImageFilter.h" +#include "otbRadianceToReflectanceImageFilter.h" namespace otb { namespace Functor { /** \class ImageToReflectanceImageFunctor - * \brief Call the ImageToLuminanceFunctor over the input and the LuminanceToReflectanceFunctor to this result. + * \brief Call the ImageToRadianceFunctor over the input and the RadianceToReflectanceFunctor to this result. * * * \sa ImageToReflectanceImageFilter * * \ingroup Functor - * \ingroup ImageToLuminanceFunctor - * \ingroup LuminanceToReflectanceFunctor + * \ingroup ImageToRadianceFunctor + * \ingroup RadianceToReflectanceFunctor * \ingroup Radiometry * * \ingroup OTBOpticalCalibration @@ -49,8 +49,8 @@ public: ImageToReflectanceImageFunctor() {} virtual ~ImageToReflectanceImageFunctor() {} - typedef Functor::ImageToLuminanceImageFunctor<TInput, TOutput> ImToLumFunctorType; - typedef Functor::LuminanceToReflectanceImageFunctor<TInput, TOutput> LumToReflecFunctorType; + typedef Functor::ImageToRadianceImageFunctor<TInput, TOutput> ImToLumFunctorType; + typedef Functor::RadianceToReflectanceImageFunctor<TInput, TOutput> LumToReflecFunctorType; void SetAlpha(double alpha) { @@ -124,8 +124,8 @@ private: * retrieved automatically from the metadata * * \ingroup ImageToReflectanceImageFunctor - * \ingroup ImageToLuminanceImageFilter - * \ingroup ReflectanceToLuminanceImageFilter + * \ingroup ImageToRadianceImageFilter + * \ingroup ReflectanceToRadianceImageFilter * \ingroup Radiometry * * \ingroup OTBOpticalCalibration diff --git a/Modules/Radiometry/OpticalCalibration/include/otbLuminanceToImageImageFilter.h b/Modules/Radiometry/OpticalCalibration/include/otbLuminanceToImageImageFilter.h index c28fd72970594c3a28c844eeb596b9005ce7756d..3ddbe95da8505254593c1b32690c5fc3c5f197db 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbLuminanceToImageImageFilter.h +++ b/Modules/Radiometry/OpticalCalibration/include/otbLuminanceToImageImageFilter.h @@ -22,205 +22,24 @@ #ifndef otbLuminanceToImageImageFilter_h #define otbLuminanceToImageImageFilter_h -#include "otb_6S.h" -#include "otbUnaryImageFunctorWithVectorImageFilter.h" -#include "itkNumericTraits.h" -#include "otbMacro.h" -#include "otbOpticalImageMetadataInterfaceFactory.h" - -#include <fstream> +#include <otbRadianceToImageImageFilter.h> +#include <vcl_deprecated_header.h> namespace otb { -namespace Functor -{ -/** - * \class LuminanceToImageImageFunctor - * \brief Subtract beta to the Input and multiply by alpha. - * - * \sa LuminanceToImageImageFilter - * \ingroup Functor - * \ingroup Radiometry - * - * \ingroup OTBOpticalCalibration - */ - -template <class TInput, class TOutput> -class LuminanceToImageImageFunctor -{ -public: - LuminanceToImageImageFunctor() : - m_Alpha(1.), - m_Beta(0.) - {} - - virtual ~LuminanceToImageImageFunctor() {} - - void SetAlpha(double alpha) - { - m_Alpha = alpha; - } - void SetBeta(double beta) - { - m_Beta = beta; - } - double GetAlpha() - { - return m_Alpha; - } - double GetBeta() - { - return m_Beta; - } - - inline TOutput operator ()(const TInput& inPixel) const - { - TOutput outPixel; - double temp; - temp = (static_cast<double>(inPixel) - m_Beta) * m_Alpha; - outPixel = static_cast<TOutput>(temp); - return outPixel; - } - -private: - double m_Alpha; - double m_Beta; -}; -} /** \class LuminanceToImageImageFilter - * \brief Convert a raw value into a luminance value - * - * Transform a luminance image into a classical image. For this it - * uses the functor LuminanceToImageImageFunctor calling for each component of each pixel. - * + * \brief Convert a radiance value into raw image value * - * For Spot image in the dimap format, the correction parameters are - * retrieved automatically from the metadata - * - * \ingroup LuminanceToImageImageFunctor - * \ingroup Radiometry - * - * \example Radiometry/AtmosphericCorrectionSequencement.cxx + * \deprecated in OTB 6.2, please use RadianceToImageImageFilter instead * * \ingroup OTBOpticalCalibration */ template <class TInputImage, class TOutputImage> class ITK_EXPORT LuminanceToImageImageFilter : - public UnaryImageFunctorWithVectorImageFilter<TInputImage, - TOutputImage, - typename Functor::LuminanceToImageImageFunctor<typename - TInputImage:: - InternalPixelType, - typename - TOutputImage:: - InternalPixelType> > + public RadianceToImageImageFilter<TInputImage, TOutputImage> { -public: - /** Extract input and output images dimensions.*/ - itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension); - itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension); - - /** "typedef" to simplify the variables definition and the declaration. */ - typedef TInputImage InputImageType; - typedef TOutputImage OutputImageType; - typedef typename Functor::LuminanceToImageImageFunctor<typename InputImageType::InternalPixelType, - typename OutputImageType::InternalPixelType> FunctorType; - - /** "typedef" for standard classes. */ - typedef LuminanceToImageImageFilter Self; - typedef UnaryImageFunctorWithVectorImageFilter<InputImageType, OutputImageType, FunctorType> Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - /** object factory method. */ - itkNewMacro(Self); - - /** return class name. */ - itkTypeMacro(LuminanceToImageImageFilter, UnaryImageFunctorWithVectorImageFiltermageFilter); - - /** Supported images definition. */ - typedef typename InputImageType::PixelType InputPixelType; - typedef typename InputImageType::InternalPixelType InputInternalPixelType; - typedef typename InputImageType::RegionType InputImageRegionType; - typedef typename OutputImageType::PixelType OutputPixelType; - typedef typename OutputImageType::InternalPixelType OutputInternalPixelType; - typedef typename OutputImageType::RegionType OutputImageRegionType; - - typedef typename itk::VariableLengthVector<double> VectorType; - - /** Image size "typedef" definition. */ - typedef typename InputImageType::SizeType SizeType; - - /** Set the absolute calibration gains. */ - itkSetMacro(Alpha, VectorType); - - /** Give the absolute calibration gains. */ - itkGetConstReferenceMacro(Alpha, VectorType); - - /** Set the absolute calibration bias. */ - itkSetMacro(Beta, VectorType); - /** Give the absolute calibration bias. */ - itkGetConstReferenceMacro(Beta, VectorType); - -protected: - /** Constructor */ - LuminanceToImageImageFilter() - { - m_Alpha.SetSize(0); - m_Beta.SetSize(0); - }; - - /** Destructor */ - ~LuminanceToImageImageFilter() ITK_OVERRIDE {} - - /** Update the functor list and input parameters */ - void BeforeThreadedGenerateData(void) ITK_OVERRIDE - { - OpticalImageMetadataInterface::Pointer imageMetadataInterface = OpticalImageMetadataInterfaceFactory::CreateIMI( - this->GetInput()->GetMetaDataDictionary()); - if (m_Alpha.GetSize() == 0) - { - m_Alpha = imageMetadataInterface->GetPhysicalGain(); - } - - if (m_Beta.GetSize() == 0) - { - m_Beta = imageMetadataInterface->GetPhysicalBias(); - } - - otbMsgDevMacro(<< "Dimension: "); - otbMsgDevMacro(<< "m_Alpha.GetSize(): " << m_Alpha.GetSize()); - otbMsgDevMacro(<< "m_Beta.GetSize() : " << m_Beta.GetSize()); - otbMsgDevMacro( - << "this->GetInput()->GetNumberOfComponentsPerPixel() : " << this->GetInput()->GetNumberOfComponentsPerPixel()); - - if ((m_Alpha.GetSize() != this->GetInput()->GetNumberOfComponentsPerPixel()) - || (m_Beta.GetSize() != this->GetInput()->GetNumberOfComponentsPerPixel())) - { - itkExceptionMacro(<< "Alpha and Beta parameters should have the same size as the number of bands"); - } - - otbMsgDevMacro(<< "Using correction parameters: "); - otbMsgDevMacro(<< "Alpha (gain): " << m_Alpha); - otbMsgDevMacro(<< "Beta (bias): " << m_Beta); - - this->GetFunctorVector().clear(); - for (unsigned int i = 0; i < this->GetInput()->GetNumberOfComponentsPerPixel(); ++i) - { - FunctorType functor; - functor.SetAlpha(m_Alpha[i]); - functor.SetBeta(m_Beta[i]); - this->GetFunctorVector().push_back(functor); - } - } - -private: - /** Ponderation declaration*/ - VectorType m_Alpha; - VectorType m_Beta; }; -} // end namespace otb - +} #endif diff --git a/Modules/Radiometry/OpticalCalibration/include/otbLuminanceToReflectanceImageFilter.h b/Modules/Radiometry/OpticalCalibration/include/otbLuminanceToReflectanceImageFilter.h index 1d126c854ca068152e206f732065a1ce642e5960..79a14d62dc7d060a26d662a7353a5dfc97555950 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbLuminanceToReflectanceImageFilter.h +++ b/Modules/Radiometry/OpticalCalibration/include/otbLuminanceToReflectanceImageFilter.h @@ -22,321 +22,24 @@ #ifndef otbLuminanceToReflectanceImageFilter_h #define otbLuminanceToReflectanceImageFilter_h -#include "otbVarSol.h" -#include "otbUnaryImageFunctorWithVectorImageFilter.h" -#include "otbMacro.h" -#include "otbOpticalImageMetadataInterfaceFactory.h" -#include <iomanip> +#include <otbRadianceToReflectanceImageFilter.h> +#include <vcl_deprecated_header.h> namespace otb { -namespace Functor -{ -/** - * \class LuminanceToReflectanceImageFunctor - * \brief Compupute reflectance from the luminance value - * - * Multiply by Pi and by an illumination correction coefficient the - * quotient between the input and the given solar illumination. - * - * - * \sa LuminanceToReflectanceImageFilter - * - * \ingroup Functor - * \ingroup Radiometry - * - * - * \ingroup OTBOpticalCalibration - */ -template <class TInput, class TOutput> -class LuminanceToReflectanceImageFunctor -{ -public: - LuminanceToReflectanceImageFunctor() : - m_SolarIllumination(1.0), - m_IlluminationCorrectionCoefficient(1.0), - m_UseClamp(true) - {} - - virtual ~LuminanceToReflectanceImageFunctor() {} - - void SetSolarIllumination(double solarIllumination) - { - m_SolarIllumination = solarIllumination; - } - void SetIlluminationCorrectionCoefficient(double coef) - { - m_IlluminationCorrectionCoefficient = coef; - } - void SetUseClamp(bool useClamp) - { - m_UseClamp = useClamp; - } - - double GetSolarIllumination() - { - return m_SolarIllumination; - } - double GetIlluminationCorrectionCoefficient() - { - return m_IlluminationCorrectionCoefficient; - } - bool GetUseClamp() - { - return m_UseClamp; - } - - inline TOutput operator ()(const TInput& inPixel) const - { - TOutput outPixel; - double temp; - temp = static_cast<double>(inPixel) - * static_cast<double>(CONST_PI) - * m_IlluminationCorrectionCoefficient - / m_SolarIllumination; - - if (m_UseClamp) - { - temp = std::max(temp,0.); - temp = std::min(temp,1.); - } - outPixel = static_cast<TOutput>(temp); - - return outPixel; - } - -private: - double m_SolarIllumination; - double m_IlluminationCorrectionCoefficient; - double m_UseClamp; -}; -} /** \class LuminanceToReflectanceImageFilter - * \brief Convert luminance value into reflectance value - * - * Transform a luminance image into the reflectance. For this it uses the - * functor LuminanceToReflectanceImageFunctor calling for each component of each pixel. - * + * \brief Convert radiance value into reflectance value * - * For Spot image in the dimap format, the correction parameters are - * retrieved automatically from the metadata - * - * \ingroup ImageToLuminanceImageFunctor - * \ingroup Radiometry - * - * \example Radiometry/AtmosphericCorrectionSequencement.cxx + * \deprecated in OTB 6.2, please use RadianceToReflectanceImageFilter instead * * \ingroup OTBOpticalCalibration */ template <class TInputImage, class TOutputImage> class ITK_EXPORT LuminanceToReflectanceImageFilter : - public UnaryImageFunctorWithVectorImageFilter<TInputImage, - TOutputImage, - typename Functor::LuminanceToReflectanceImageFunctor<typename - TInputImage:: - InternalPixelType, - typename - TOutputImage:: - InternalPixelType> > + public RadianceToReflectanceImageFilter<TInputImage,TOutputImage> { -public: - /** Extract input and output images dimensions.*/ - itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension); - itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension); - - /** "typedef" to simplify the variables definition and the declaration. */ - typedef TInputImage InputImageType; - typedef TOutputImage OutputImageType; - typedef typename Functor::LuminanceToReflectanceImageFunctor<typename InputImageType::InternalPixelType, - typename OutputImageType::InternalPixelType> - FunctorType; - - /** "typedef" for standard classes. */ - typedef LuminanceToReflectanceImageFilter Self; - typedef UnaryImageFunctorWithVectorImageFilter<InputImageType, OutputImageType, FunctorType> Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - /** object factory method. */ - itkNewMacro(Self); - - /** return class name. */ - itkTypeMacro(LuminanceToReflectanceImageFilter, UnaryImageFunctorWithVectorImageFiltermageFilter); - - /** Supported images definition. */ - typedef typename InputImageType::PixelType InputPixelType; - typedef typename InputImageType::InternalPixelType InputInternalPixelType; - typedef typename InputImageType::RegionType InputImageRegionType; - typedef typename OutputImageType::PixelType OutputPixelType; - typedef typename OutputImageType::InternalPixelType OutputInternalPixelType; - typedef typename OutputImageType::RegionType OutputImageRegionType; - - typedef typename itk::VariableLengthVector<double> VectorType; - - /** Image size "typedef" definition. */ - typedef typename InputImageType::SizeType SizeType; - - /** Set the solar illumination value. */ - itkSetMacro(SolarIllumination, VectorType); - /** Give the solar illumination value. */ - itkGetConstReferenceMacro(SolarIllumination, VectorType); - - /** Set the zenithal solar angle. */ - itkSetMacro(ZenithalSolarAngle, double); - /** Give the zenithal solar angle. */ - itkGetConstReferenceMacro(ZenithalSolarAngle, double); - - /** Set/Get the sun elevation angle (internally handled by the zenithal angle)*/ - virtual void SetElevationSolarAngle(double elevationAngle) - { - double zenithalAngle = 90.0 - elevationAngle; - if (this->m_ZenithalSolarAngle != zenithalAngle) - { - this->m_ZenithalSolarAngle = zenithalAngle; - this->Modified(); - } - } - - virtual double GetElevationSolarAngle() const - { - return 90.0 - this->m_ZenithalSolarAngle; - } - - /** Set the day. */ - itkSetClampMacro(Day, int, 1, 31); - /** Give the day. */ - itkGetConstReferenceMacro(Day, int); - - /** Set the month. */ - itkSetClampMacro(Month, int, 1, 12); - /** Give the month. */ - itkGetConstReferenceMacro(Month, int); - - /** Set the flux normalization coefficient. */ - void SetFluxNormalizationCoefficient(double coef) - { - m_FluxNormalizationCoefficient = coef; - m_IsSetFluxNormalizationCoefficient = true; - this->Modified(); - } - /** Give the flux normalization coefficient. */ - itkGetConstReferenceMacro(FluxNormalizationCoefficient, double); - - /** Set the IsSetFluxNormalizationCoefficient boolean. */ - itkSetMacro(IsSetFluxNormalizationCoefficient, bool); - /** Give the IsSetFluxNormalizationCoefficient boolean. */ - itkGetConstReferenceMacro(IsSetFluxNormalizationCoefficient, bool); - - /** Set the UseClamp boolean. */ - itkSetMacro(UseClamp, bool); - /** Give the UseClamp boolean. */ - itkGetConstReferenceMacro(UseClamp, bool); - -protected: - /** Constructor */ - LuminanceToReflectanceImageFilter() : - m_ZenithalSolarAngle(120.0), //invalid value which will lead to negative radiometry - m_FluxNormalizationCoefficient(1.), - m_Day(0), - m_Month(0), - m_IsSetFluxNormalizationCoefficient(false), - m_UseClamp(true) - { - m_SolarIllumination.SetSize(0); - }; - - /** Destructor */ - ~LuminanceToReflectanceImageFilter() ITK_OVERRIDE {} - - /** Update the functor list and input parameters */ - void BeforeThreadedGenerateData(void) ITK_OVERRIDE - { - OpticalImageMetadataInterface::Pointer imageMetadataInterface = OpticalImageMetadataInterfaceFactory::CreateIMI( - this->GetInput()->GetMetaDataDictionary()); - if ((m_Day == 0) && (!m_IsSetFluxNormalizationCoefficient)) - { - m_Day = imageMetadataInterface->GetDay(); - } - - if ((m_Month == 0) && (!m_IsSetFluxNormalizationCoefficient)) - { - m_Month = imageMetadataInterface->GetMonth(); - } - - if (m_SolarIllumination.GetSize() == 0) - { - m_SolarIllumination = imageMetadataInterface->GetSolarIrradiance(); - } - - if (m_ZenithalSolarAngle == 120.0) - { - //the zenithal angle is the complementary of the elevation angle - m_ZenithalSolarAngle = 90.0 - imageMetadataInterface->GetSunElevation(); - } - - otbMsgDevMacro(<< "Using correction parameters: "); - otbMsgDevMacro(<< "Day: " << m_Day); - otbMsgDevMacro(<< "Month: " << m_Month); - otbMsgDevMacro(<< "Solar irradiance: " << m_SolarIllumination); - otbMsgDevMacro(<< "Zenithal angle: " << m_ZenithalSolarAngle); - - if ((m_SolarIllumination.GetSize() != this->GetInput()->GetNumberOfComponentsPerPixel())) - { - itkExceptionMacro(<< "SolarIllumination parameter should have the same size as the number of bands"); - } - - this->GetFunctorVector().clear(); - - for (unsigned int i = 0; i < this->GetInput()->GetNumberOfComponentsPerPixel(); ++i) - { - FunctorType functor; - double coefTemp = 0.; - if (!m_IsSetFluxNormalizationCoefficient) - { - if (m_Day * m_Month != 0 && m_Day < 32 && m_Month < 13) - { - double dsol = VarSol::GetVarSol(m_Day, m_Month); - coefTemp = vcl_cos(m_ZenithalSolarAngle * CONST_PI_180) * dsol; - } - else - { - itkExceptionMacro(<< "Day has to be included between 1 and 31, Month between 1 and 12."); - } - } - else - { - coefTemp = - vcl_cos(m_ZenithalSolarAngle * - CONST_PI_180) * m_FluxNormalizationCoefficient * m_FluxNormalizationCoefficient; - } - functor.SetIlluminationCorrectionCoefficient(1. / coefTemp); - functor.SetSolarIllumination(static_cast<double>(m_SolarIllumination[i])); - functor.SetUseClamp(m_UseClamp); - - this->GetFunctorVector().push_back(functor); - } - } - -private: - - /** Set the zenithal soalr angle. */ - double m_ZenithalSolarAngle; - /** Flux normalization coefficient. */ - double m_FluxNormalizationCoefficient; - /** Acquisition day. */ - int m_Day; - /** Acquisition month. */ - int m_Month; - /** Solar illumination value. */ - VectorType m_SolarIllumination; - /** Used to know if the user has set a value for the FluxNormalizationCoefficient parameter - * or if the class has to compute it */ - bool m_IsSetFluxNormalizationCoefficient; - /** Clamp values to [0,1] */ - bool m_UseClamp; - }; -} // end namespace otb +} #endif diff --git a/Modules/Radiometry/OpticalCalibration/include/otbRadianceToImageImageFilter.h b/Modules/Radiometry/OpticalCalibration/include/otbRadianceToImageImageFilter.h new file mode 100644 index 0000000000000000000000000000000000000000..b52793fb4817d27d510d91d31580225eb093808f --- /dev/null +++ b/Modules/Radiometry/OpticalCalibration/include/otbRadianceToImageImageFilter.h @@ -0,0 +1,226 @@ +/* + * Copyright (C) 1999-2011 Insight Software Consortium + * 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 otbRadianceToImageImageFilter_h +#define otbRadianceToImageImageFilter_h + +#include "otb_6S.h" +#include "otbUnaryImageFunctorWithVectorImageFilter.h" +#include "itkNumericTraits.h" +#include "otbMacro.h" +#include "otbOpticalImageMetadataInterfaceFactory.h" + +#include <fstream> + +namespace otb +{ +namespace Functor +{ +/** + * \class RadianceToImageImageFunctor + * \brief Subtract beta to the Input and multiply by alpha. + * + * \sa RadianceToImageImageFilter + * \ingroup Functor + * \ingroup Radiometry + * + * \ingroup OTBOpticalCalibration + */ + +template <class TInput, class TOutput> +class RadianceToImageImageFunctor +{ +public: + RadianceToImageImageFunctor() : + m_Alpha(1.), + m_Beta(0.) + {} + + virtual ~RadianceToImageImageFunctor() {} + + void SetAlpha(double alpha) + { + m_Alpha = alpha; + } + void SetBeta(double beta) + { + m_Beta = beta; + } + double GetAlpha() + { + return m_Alpha; + } + double GetBeta() + { + return m_Beta; + } + + inline TOutput operator ()(const TInput& inPixel) const + { + TOutput outPixel; + double temp; + temp = (static_cast<double>(inPixel) - m_Beta) * m_Alpha; + outPixel = static_cast<TOutput>(temp); + return outPixel; + } + +private: + double m_Alpha; + double m_Beta; +}; +} + +/** \class RadianceToImageImageFilter + * \brief Convert a radiance value into raw image value + * + * Transform a radiance image into a classical image. For this it + * uses the functor RadianceToImageImageFunctor calling for each component of each pixel. + * + * + * For Spot image in the dimap format, the correction parameters are + * retrieved automatically from the metadata + * + * \ingroup RadianceToImageImageFunctor + * \ingroup Radiometry + * + * \example Radiometry/AtmosphericCorrectionSequencement.cxx + * + * \ingroup OTBOpticalCalibration + */ +template <class TInputImage, class TOutputImage> +class ITK_EXPORT RadianceToImageImageFilter : + public UnaryImageFunctorWithVectorImageFilter<TInputImage, + TOutputImage, + typename Functor::RadianceToImageImageFunctor<typename + TInputImage:: + InternalPixelType, + typename + TOutputImage:: + InternalPixelType> > +{ +public: + /** Extract input and output images dimensions.*/ + itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension); + itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension); + + /** "typedef" to simplify the variables definition and the declaration. */ + typedef TInputImage InputImageType; + typedef TOutputImage OutputImageType; + typedef typename Functor::RadianceToImageImageFunctor<typename InputImageType::InternalPixelType, + typename OutputImageType::InternalPixelType> FunctorType; + + /** "typedef" for standard classes. */ + typedef RadianceToImageImageFilter Self; + typedef UnaryImageFunctorWithVectorImageFilter<InputImageType, OutputImageType, FunctorType> Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + /** object factory method. */ + itkNewMacro(Self); + + /** return class name. */ + itkTypeMacro(RadianceToImageImageFilter, UnaryImageFunctorWithVectorImageFiltermageFilter); + + /** Supported images definition. */ + typedef typename InputImageType::PixelType InputPixelType; + typedef typename InputImageType::InternalPixelType InputInternalPixelType; + typedef typename InputImageType::RegionType InputImageRegionType; + typedef typename OutputImageType::PixelType OutputPixelType; + typedef typename OutputImageType::InternalPixelType OutputInternalPixelType; + typedef typename OutputImageType::RegionType OutputImageRegionType; + + typedef typename itk::VariableLengthVector<double> VectorType; + + /** Image size "typedef" definition. */ + typedef typename InputImageType::SizeType SizeType; + + /** Set the absolute calibration gains. */ + itkSetMacro(Alpha, VectorType); + + /** Give the absolute calibration gains. */ + itkGetConstReferenceMacro(Alpha, VectorType); + + /** Set the absolute calibration bias. */ + itkSetMacro(Beta, VectorType); + /** Give the absolute calibration bias. */ + itkGetConstReferenceMacro(Beta, VectorType); + +protected: + /** Constructor */ + RadianceToImageImageFilter() + { + m_Alpha.SetSize(0); + m_Beta.SetSize(0); + }; + + /** Destructor */ + ~RadianceToImageImageFilter() ITK_OVERRIDE {} + + /** Update the functor list and input parameters */ + void BeforeThreadedGenerateData(void) ITK_OVERRIDE + { + OpticalImageMetadataInterface::Pointer imageMetadataInterface = OpticalImageMetadataInterfaceFactory::CreateIMI( + this->GetInput()->GetMetaDataDictionary()); + if (m_Alpha.GetSize() == 0) + { + m_Alpha = imageMetadataInterface->GetPhysicalGain(); + } + + if (m_Beta.GetSize() == 0) + { + m_Beta = imageMetadataInterface->GetPhysicalBias(); + } + + otbMsgDevMacro(<< "Dimension: "); + otbMsgDevMacro(<< "m_Alpha.GetSize(): " << m_Alpha.GetSize()); + otbMsgDevMacro(<< "m_Beta.GetSize() : " << m_Beta.GetSize()); + otbMsgDevMacro( + << "this->GetInput()->GetNumberOfComponentsPerPixel() : " << this->GetInput()->GetNumberOfComponentsPerPixel()); + + if ((m_Alpha.GetSize() != this->GetInput()->GetNumberOfComponentsPerPixel()) + || (m_Beta.GetSize() != this->GetInput()->GetNumberOfComponentsPerPixel())) + { + itkExceptionMacro(<< "Alpha and Beta parameters should have the same size as the number of bands"); + } + + otbMsgDevMacro(<< "Using correction parameters: "); + otbMsgDevMacro(<< "Alpha (gain): " << m_Alpha); + otbMsgDevMacro(<< "Beta (bias): " << m_Beta); + + this->GetFunctorVector().clear(); + for (unsigned int i = 0; i < this->GetInput()->GetNumberOfComponentsPerPixel(); ++i) + { + FunctorType functor; + functor.SetAlpha(m_Alpha[i]); + functor.SetBeta(m_Beta[i]); + this->GetFunctorVector().push_back(functor); + } + } + +private: + /** Ponderation declaration*/ + VectorType m_Alpha; + VectorType m_Beta; +}; + +} // end namespace otb + +#endif diff --git a/Modules/Radiometry/OpticalCalibration/include/otbRadianceToReflectanceImageFilter.h b/Modules/Radiometry/OpticalCalibration/include/otbRadianceToReflectanceImageFilter.h new file mode 100644 index 0000000000000000000000000000000000000000..9e4d667b5edaa63752e2ff746b7fad97e2e4c3bf --- /dev/null +++ b/Modules/Radiometry/OpticalCalibration/include/otbRadianceToReflectanceImageFilter.h @@ -0,0 +1,342 @@ +/* + * Copyright (C) 1999-2011 Insight Software Consortium + * 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 otbRadianceToReflectanceImageFilter_h +#define otbRadianceToReflectanceImageFilter_h + +#include "otbVarSol.h" +#include "otbUnaryImageFunctorWithVectorImageFilter.h" +#include "otbMacro.h" +#include "otbOpticalImageMetadataInterfaceFactory.h" +#include <iomanip> + +namespace otb +{ +namespace Functor +{ +/** + * \class RadianceToReflectanceImageFunctor + * \brief Compute reflectance from the radiance value + * + * Multiply by Pi and by an illumination correction coefficient the + * quotient between the input and the given solar illumination. + * + * + * \sa RadianceToReflectanceImageFilter + * + * \ingroup Functor + * \ingroup Radiometry + * + * + * \ingroup OTBOpticalCalibration + */ +template <class TInput, class TOutput> +class RadianceToReflectanceImageFunctor +{ +public: + RadianceToReflectanceImageFunctor() : + m_SolarIllumination(1.0), + m_IlluminationCorrectionCoefficient(1.0), + m_UseClamp(true) + {} + + virtual ~RadianceToReflectanceImageFunctor() {} + + void SetSolarIllumination(double solarIllumination) + { + m_SolarIllumination = solarIllumination; + } + void SetIlluminationCorrectionCoefficient(double coef) + { + m_IlluminationCorrectionCoefficient = coef; + } + void SetUseClamp(bool useClamp) + { + m_UseClamp = useClamp; + } + + double GetSolarIllumination() + { + return m_SolarIllumination; + } + double GetIlluminationCorrectionCoefficient() + { + return m_IlluminationCorrectionCoefficient; + } + bool GetUseClamp() + { + return m_UseClamp; + } + + inline TOutput operator ()(const TInput& inPixel) const + { + TOutput outPixel; + double temp; + temp = static_cast<double>(inPixel) + * static_cast<double>(CONST_PI) + * m_IlluminationCorrectionCoefficient + / m_SolarIllumination; + + if (m_UseClamp) + { + temp = std::max(temp,0.); + temp = std::min(temp,1.); + } + outPixel = static_cast<TOutput>(temp); + + return outPixel; + } + +private: + double m_SolarIllumination; + double m_IlluminationCorrectionCoefficient; + double m_UseClamp; +}; +} + +/** \class RadianceToReflectanceImageFilter + * \brief Convert radiance value into reflectance value + * + * Transform a radiance image into the reflectance. For this it uses the + * functor RadianceToReflectanceImageFunctor calling for each component of each pixel. + * + * + * For Spot image in the dimap format, the correction parameters are + * retrieved automatically from the metadata + * + * \ingroup ImageToRadianceImageFunctor + * \ingroup Radiometry + * + * \example Radiometry/AtmosphericCorrectionSequencement.cxx + * + * \ingroup OTBOpticalCalibration + */ +template <class TInputImage, class TOutputImage> +class ITK_EXPORT RadianceToReflectanceImageFilter : + public UnaryImageFunctorWithVectorImageFilter<TInputImage, + TOutputImage, + typename Functor::RadianceToReflectanceImageFunctor<typename + TInputImage:: + InternalPixelType, + typename + TOutputImage:: + InternalPixelType> > +{ +public: + /** Extract input and output images dimensions.*/ + itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension); + itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension); + + /** "typedef" to simplify the variables definition and the declaration. */ + typedef TInputImage InputImageType; + typedef TOutputImage OutputImageType; + typedef typename Functor::RadianceToReflectanceImageFunctor<typename InputImageType::InternalPixelType, + typename OutputImageType::InternalPixelType> + FunctorType; + + /** "typedef" for standard classes. */ + typedef RadianceToReflectanceImageFilter Self; + typedef UnaryImageFunctorWithVectorImageFilter<InputImageType, OutputImageType, FunctorType> Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + /** object factory method. */ + itkNewMacro(Self); + + /** return class name. */ + itkTypeMacro(RadianceToReflectanceImageFilter, UnaryImageFunctorWithVectorImageFiltermageFilter); + + /** Supported images definition. */ + typedef typename InputImageType::PixelType InputPixelType; + typedef typename InputImageType::InternalPixelType InputInternalPixelType; + typedef typename InputImageType::RegionType InputImageRegionType; + typedef typename OutputImageType::PixelType OutputPixelType; + typedef typename OutputImageType::InternalPixelType OutputInternalPixelType; + typedef typename OutputImageType::RegionType OutputImageRegionType; + + typedef typename itk::VariableLengthVector<double> VectorType; + + /** Image size "typedef" definition. */ + typedef typename InputImageType::SizeType SizeType; + + /** Set the solar illumination value. */ + itkSetMacro(SolarIllumination, VectorType); + /** Give the solar illumination value. */ + itkGetConstReferenceMacro(SolarIllumination, VectorType); + + /** Set the zenithal solar angle. */ + itkSetMacro(ZenithalSolarAngle, double); + /** Give the zenithal solar angle. */ + itkGetConstReferenceMacro(ZenithalSolarAngle, double); + + /** Set/Get the sun elevation angle (internally handled by the zenithal angle)*/ + virtual void SetElevationSolarAngle(double elevationAngle) + { + double zenithalAngle = 90.0 - elevationAngle; + if (this->m_ZenithalSolarAngle != zenithalAngle) + { + this->m_ZenithalSolarAngle = zenithalAngle; + this->Modified(); + } + } + + virtual double GetElevationSolarAngle() const + { + return 90.0 - this->m_ZenithalSolarAngle; + } + + /** Set the day. */ + itkSetClampMacro(Day, int, 1, 31); + /** Give the day. */ + itkGetConstReferenceMacro(Day, int); + + /** Set the month. */ + itkSetClampMacro(Month, int, 1, 12); + /** Give the month. */ + itkGetConstReferenceMacro(Month, int); + + /** Set the flux normalization coefficient. */ + void SetFluxNormalizationCoefficient(double coef) + { + m_FluxNormalizationCoefficient = coef; + m_IsSetFluxNormalizationCoefficient = true; + this->Modified(); + } + /** Give the flux normalization coefficient. */ + itkGetConstReferenceMacro(FluxNormalizationCoefficient, double); + + /** Set the IsSetFluxNormalizationCoefficient boolean. */ + itkSetMacro(IsSetFluxNormalizationCoefficient, bool); + /** Give the IsSetFluxNormalizationCoefficient boolean. */ + itkGetConstReferenceMacro(IsSetFluxNormalizationCoefficient, bool); + + /** Set the UseClamp boolean. */ + itkSetMacro(UseClamp, bool); + /** Give the UseClamp boolean. */ + itkGetConstReferenceMacro(UseClamp, bool); + +protected: + /** Constructor */ + RadianceToReflectanceImageFilter() : + m_ZenithalSolarAngle(120.0), //invalid value which will lead to negative radiometry + m_FluxNormalizationCoefficient(1.), + m_Day(0), + m_Month(0), + m_IsSetFluxNormalizationCoefficient(false), + m_UseClamp(true) + { + m_SolarIllumination.SetSize(0); + }; + + /** Destructor */ + ~RadianceToReflectanceImageFilter() ITK_OVERRIDE {} + + /** Update the functor list and input parameters */ + void BeforeThreadedGenerateData(void) ITK_OVERRIDE + { + OpticalImageMetadataInterface::Pointer imageMetadataInterface = OpticalImageMetadataInterfaceFactory::CreateIMI( + this->GetInput()->GetMetaDataDictionary()); + if ((m_Day == 0) && (!m_IsSetFluxNormalizationCoefficient)) + { + m_Day = imageMetadataInterface->GetDay(); + } + + if ((m_Month == 0) && (!m_IsSetFluxNormalizationCoefficient)) + { + m_Month = imageMetadataInterface->GetMonth(); + } + + if (m_SolarIllumination.GetSize() == 0) + { + m_SolarIllumination = imageMetadataInterface->GetSolarIrradiance(); + } + + if (m_ZenithalSolarAngle == 120.0) + { + //the zenithal angle is the complementary of the elevation angle + m_ZenithalSolarAngle = 90.0 - imageMetadataInterface->GetSunElevation(); + } + + otbMsgDevMacro(<< "Using correction parameters: "); + otbMsgDevMacro(<< "Day: " << m_Day); + otbMsgDevMacro(<< "Month: " << m_Month); + otbMsgDevMacro(<< "Solar irradiance: " << m_SolarIllumination); + otbMsgDevMacro(<< "Zenithal angle: " << m_ZenithalSolarAngle); + + if ((m_SolarIllumination.GetSize() != this->GetInput()->GetNumberOfComponentsPerPixel())) + { + itkExceptionMacro(<< "SolarIllumination parameter should have the same size as the number of bands"); + } + + this->GetFunctorVector().clear(); + + for (unsigned int i = 0; i < this->GetInput()->GetNumberOfComponentsPerPixel(); ++i) + { + FunctorType functor; + double coefTemp = 0.; + if (!m_IsSetFluxNormalizationCoefficient) + { + if (m_Day * m_Month != 0 && m_Day < 32 && m_Month < 13) + { + double dsol = VarSol::GetVarSol(m_Day, m_Month); + coefTemp = vcl_cos(m_ZenithalSolarAngle * CONST_PI_180) * dsol; + } + else + { + itkExceptionMacro(<< "Day has to be included between 1 and 31, Month between 1 and 12."); + } + } + else + { + coefTemp = + vcl_cos(m_ZenithalSolarAngle * + CONST_PI_180) * m_FluxNormalizationCoefficient * m_FluxNormalizationCoefficient; + } + functor.SetIlluminationCorrectionCoefficient(1. / coefTemp); + functor.SetSolarIllumination(static_cast<double>(m_SolarIllumination[i])); + functor.SetUseClamp(m_UseClamp); + + this->GetFunctorVector().push_back(functor); + } + } + +private: + + /** Set the zenithal soalr angle. */ + double m_ZenithalSolarAngle; + /** Flux normalization coefficient. */ + double m_FluxNormalizationCoefficient; + /** Acquisition day. */ + int m_Day; + /** Acquisition month. */ + int m_Month; + /** Solar illumination value. */ + VectorType m_SolarIllumination; + /** Used to know if the user has set a value for the FluxNormalizationCoefficient parameter + * or if the class has to compute it */ + bool m_IsSetFluxNormalizationCoefficient; + /** Clamp values to [0,1] */ + bool m_UseClamp; + +}; + +} // end namespace otb +#endif diff --git a/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToImageImageFilter.h b/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToImageImageFilter.h index 23fa33c2d069fb92686495f054858a716feadd15..6050d66777077a99b24d82a1baf04496947a2f1b 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToImageImageFilter.h +++ b/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToImageImageFilter.h @@ -22,22 +22,22 @@ #ifndef otbReflectanceToImageImageFilter_h #define otbReflectanceToImageImageFilter_h -#include "otbLuminanceToImageImageFilter.h" -#include "otbReflectanceToLuminanceImageFilter.h" +#include "otbRadianceToImageImageFilter.h" +#include "otbReflectanceToRadianceImageFilter.h" namespace otb { namespace Functor { /** \class ReflectanceToImageImageFunctor - * \brief Call the ReflectanceToLuminanceFunctor over the input and the LuminanceToImageFunctor to this result. + * \brief Call the ReflectanceToRadianceFunctor over the input and the RadianceToImageFunctor to this result. * * * \sa ReflectanceToImageImageFilter * * \ingroup Functor - * \ingroup LuminanceToImageFunctor - * \ingroup ReflectanceToLuminanceFunctor + * \ingroup RadianceToImageFunctor + * \ingroup ReflectanceToRadianceFunctor * \ingroup Radiometry * * \ingroup OTBOpticalCalibration @@ -49,8 +49,8 @@ public: ReflectanceToImageImageFunctor() {} virtual ~ReflectanceToImageImageFunctor() {} - typedef Functor::LuminanceToImageImageFunctor<TInput, TOutput> LumToImFunctorType; - typedef Functor::ReflectanceToLuminanceImageFunctor<TInput, TOutput> ReflecToLumFunctorType; + typedef Functor::RadianceToImageImageFunctor<TInput, TOutput> LumToImFunctorType; + typedef Functor::ReflectanceToRadianceImageFunctor<TInput, TOutput> ReflecToLumFunctorType; void SetAlpha(double alpha) { @@ -116,8 +116,8 @@ private: * retrieved automatically from the metadata * * \ingroup ReflectanceToImageImageFunctor - * \ingroup LuminanceToImageImageFilter - * \ingroup ReflectanceToLuminanceImageFilter + * \ingroup RadianceToImageImageFilter + * \ingroup ReflectanceToRadianceImageFilter * \ingroup Radiometry * * \ingroup OTBOpticalCalibration diff --git a/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToLuminanceImageFilter.h b/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToLuminanceImageFilter.h index be524148c3155e0dab067dc0b8fc35e60fc87be7..786e023a795cb961f20e489d748ccb52096f5e2b 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToLuminanceImageFilter.h +++ b/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToLuminanceImageFilter.h @@ -22,303 +22,23 @@ #ifndef otbReflectanceToLuminanceImageFilter_h #define otbReflectanceToLuminanceImageFilter_h -#include "otbVarSol.h" -#include "otbUnaryImageFunctorWithVectorImageFilter.h" -#include "otbMath.h" -#include "otbMacro.h" -#include "otbOpticalImageMetadataInterfaceFactory.h" -#include <iomanip> +#include <otbReflectanceToRadianceImageFilter.h> +#include <vcl_deprecated_header.h> namespace otb { -namespace Functor -{ -/** - * \class ReflectanceToLuminanceImageFunctor - * \brief Compupute luminance from the reflectance value - * - * Divide by Pi and multiply by an illumination correction coefficient - * and the given solar illumination. - * - * - * \sa ReflectanceToLuminanceImageFilter - * - * \ingroup Functor - * \ingroup Radiometry - * - * - * \ingroup OTBOpticalCalibration - */ -template <class TInput, class TOutput> -class ReflectanceToLuminanceImageFunctor -{ -public: - ReflectanceToLuminanceImageFunctor() : - m_SolarIllumination(1.0), - m_IlluminationCorrectionCoefficient(1.0) - {} - - virtual ~ReflectanceToLuminanceImageFunctor() {} - - void SetSolarIllumination(double solarIllumination) - { - m_SolarIllumination = solarIllumination; - } - void SetIlluminationCorrectionCoefficient(double coef) - { - m_IlluminationCorrectionCoefficient = coef; - } - - double GetSolarIllumination() - { - return m_SolarIllumination; - } - double GetIlluminationCorrectionCoefficient() - { - return m_IlluminationCorrectionCoefficient; - } - - inline TOutput operator ()(const TInput& inPixel) const - { - TOutput outPixel; - double temp; - temp = static_cast<double>(inPixel) - / static_cast<double>(CONST_PI) - * m_IlluminationCorrectionCoefficient - * m_SolarIllumination; - - outPixel = static_cast<TOutput>(temp); - return outPixel; - } - -private: - double m_SolarIllumination; - double m_IlluminationCorrectionCoefficient; -}; -} - /** \class ReflectanceToLuminanceImageFilter - * \brief Convert reflectance value into luminance value - * - * Transform a reflectance image into the luminance. For this it uses the - * functor ReflectanceToLuminanceImageFunctor calling for each component of each pixel. - * + * \brief Convert reflectance value into radiance value * - * For Spot image in the dimap format, the correction parameters are - * retrieved automatically from the metadata - * - * \ingroup ImageToLuminanceImageFunctor - * \ingroup Radiometry - * - * \example Radiometry/AtmosphericCorrectionSequencement.cxx + * \deprecated in OTB 6.2, please use ReflectanceToRadianceImageFilter instead * * \ingroup OTBOpticalCalibration */ template <class TInputImage, class TOutputImage> class ITK_EXPORT ReflectanceToLuminanceImageFilter : - public UnaryImageFunctorWithVectorImageFilter<TInputImage, - TOutputImage, - typename Functor::ReflectanceToLuminanceImageFunctor<typename - TInputImage:: - InternalPixelType, - typename - TOutputImage:: - InternalPixelType> > + public ReflectanceToRadianceImageFilter<TInputImage,TOutputImage> { -public: - /** Extract input and output images dimensions.*/ - itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension); - itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension); - - /** "typedef" to simplify the variables definition and the declaration. */ - typedef TInputImage InputImageType; - typedef TOutputImage OutputImageType; - typedef typename Functor::ReflectanceToLuminanceImageFunctor<typename InputImageType::InternalPixelType, - typename OutputImageType::InternalPixelType> - FunctorType; - - /** "typedef" for standard classes. */ - typedef ReflectanceToLuminanceImageFilter Self; - typedef UnaryImageFunctorWithVectorImageFilter<InputImageType, OutputImageType, FunctorType> Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - /** object factory method. */ - itkNewMacro(Self); - - /** return class name. */ - itkTypeMacro(ReflectanceToLuminanceImageFilter, UnaryImageFunctorWithVectorImageFiltermageFilter); - - /** Supported images definition. */ - typedef typename InputImageType::PixelType InputPixelType; - typedef typename InputImageType::InternalPixelType InputInternalPixelType; - typedef typename InputImageType::RegionType InputImageRegionType; - typedef typename OutputImageType::PixelType OutputPixelType; - typedef typename OutputImageType::InternalPixelType OutputInternalPixelType; - typedef typename OutputImageType::RegionType OutputImageRegionType; - - typedef typename itk::VariableLengthVector<double> VectorType; - - /** Image size "typedef" definition. */ - typedef typename InputImageType::SizeType SizeType; - - /** Set the solar illumination value. */ - itkSetMacro(SolarIllumination, VectorType); - /** Give the solar illumination value. */ - itkGetConstReferenceMacro(SolarIllumination, VectorType); - - /** Set the zenithal solar angle. */ - itkSetMacro(ZenithalSolarAngle, double); - /** Give the zenithal solar angle. */ - itkGetConstReferenceMacro(ZenithalSolarAngle, double); - - /** Set/Get the sun elevation angle (internally handled by the zenithal angle)*/ - virtual void SetElevationSolarAngle(double elevationAngle) - { - double zenithalAngle = 90.0 - elevationAngle; - if (this->m_ZenithalSolarAngle != zenithalAngle) - { - this->m_ZenithalSolarAngle = zenithalAngle; - this->Modified(); - } - } - - virtual double GetElevationSolarAngle() const - { - return 90.0 - this->m_ZenithalSolarAngle; - } - - /** Set the day. */ - itkSetClampMacro(Day, int, 1, 31); - /** Give the day. */ - itkGetConstReferenceMacro(Day, int); - - /** Set the month. */ - itkSetClampMacro(Month, int, 1, 12); - /** Give the month. */ - itkGetConstReferenceMacro(Month, int); - - /** Set the flux normalization coefficient. */ - void SetFluxNormalizationCoefficient(double coef) - { - m_FluxNormalizationCoefficient = coef; - m_IsSetFluxNormalizationCoefficient = true; - this->Modified(); - } - /** Give the flux normalization coefficient. */ - itkGetConstReferenceMacro(FluxNormalizationCoefficient, double); - - /** Set the IsSetFluxNormalizationCoefficient boolean. */ - itkSetMacro(IsSetFluxNormalizationCoefficient, bool); - /** Give the IsSetFluxNormalizationCoefficient boolean. */ - itkGetConstReferenceMacro(IsSetFluxNormalizationCoefficient, bool); - - /** Set the UseClamp boolean. */ - itkSetMacro(UseClamp, bool); - /** Give the UseClamp boolean. */ - itkGetConstReferenceMacro(UseClamp, bool); - -protected: - /** Constructor */ - ReflectanceToLuminanceImageFilter() : - m_ZenithalSolarAngle(120.0), //invalid value which will lead to negative radiometry - m_FluxNormalizationCoefficient(1.), - m_Day(0), - m_Month(0), - m_IsSetFluxNormalizationCoefficient(false) - { - m_SolarIllumination.SetSize(0); - }; - - /** Destructor */ - ~ReflectanceToLuminanceImageFilter() ITK_OVERRIDE {} - - /** Update the functor list and input parameters */ - void BeforeThreadedGenerateData(void) ITK_OVERRIDE - { - OpticalImageMetadataInterface::Pointer imageMetadataInterface = OpticalImageMetadataInterfaceFactory::CreateIMI( - this->GetInput()->GetMetaDataDictionary()); - if ((m_Day == 0) && (!m_IsSetFluxNormalizationCoefficient)) - { - m_Day = imageMetadataInterface->GetDay(); - } - - if ((m_Month == 0) && (!m_IsSetFluxNormalizationCoefficient)) - { - m_Month = imageMetadataInterface->GetMonth(); - } - - if (m_SolarIllumination.GetSize() == 0) - { - m_SolarIllumination = imageMetadataInterface->GetSolarIrradiance(); - } - - if (m_ZenithalSolarAngle == 120.0) - { - //the zenithal angle is the complementary of the elevation angle - m_ZenithalSolarAngle = 90.0 - imageMetadataInterface->GetSunElevation(); - } - - std::cout << "Using correction parameters: " << std::endl; - std::cout<< "Day: " << m_Day << std::endl; - std::cout<< "Month: " << m_Month << std::endl; - std::cout<< "Solar irradiance: " << m_SolarIllumination << std::endl; - std::cout<< "Zenithal angle: " << m_ZenithalSolarAngle << std::endl; - - if ((m_SolarIllumination.GetSize() != this->GetInput()->GetNumberOfComponentsPerPixel())) - { - itkExceptionMacro(<< "SolarIllumination parameter should have the same size as the number of bands"); - } - - this->GetFunctorVector().clear(); - - for (unsigned int i = 0; i < this->GetInput()->GetNumberOfComponentsPerPixel(); ++i) - { - FunctorType functor; - double coefTemp = 0.; - if (!m_IsSetFluxNormalizationCoefficient) - { - if (m_Day * m_Month != 0 && m_Day < 32 && m_Month < 13) - { - coefTemp = vcl_cos(m_ZenithalSolarAngle * CONST_PI_180) * VarSol::GetVarSol(m_Day,m_Month); - } - else - { - itkExceptionMacro(<< "Day has to be included between 1 and 31, Month between 1 and 12."); - } - } - else - { - coefTemp = - vcl_cos(m_ZenithalSolarAngle * - CONST_PI_180) * m_FluxNormalizationCoefficient * m_FluxNormalizationCoefficient; - } - functor.SetIlluminationCorrectionCoefficient(coefTemp); - functor.SetSolarIllumination(static_cast<double>(m_SolarIllumination[i])); - - this->GetFunctorVector().push_back(functor); - } - } - -private: - - /** Set the zenithal soalr angle. */ - double m_ZenithalSolarAngle; - /** Flux normalization coefficient. */ - double m_FluxNormalizationCoefficient; - /** Acquisition day. */ - int m_Day; - /** Acquisition month. */ - int m_Month; - /** Solar illumination value. */ - VectorType m_SolarIllumination; - /** Used to know if the user has set a value for the FluxNormalizationCoefficient parameter - * or if the class has to compute it */ - bool m_IsSetFluxNormalizationCoefficient; - /** Clamp values to [0,1] */ - bool m_UseClamp; - }; -} // end namespace otb +} #endif diff --git a/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToRadianceImageFilter.h b/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToRadianceImageFilter.h new file mode 100644 index 0000000000000000000000000000000000000000..69352382feae6b50c9679f93586b71cedb6366d0 --- /dev/null +++ b/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToRadianceImageFilter.h @@ -0,0 +1,324 @@ +/* + * Copyright (C) 1999-2011 Insight Software Consortium + * 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 otbReflectanceToRadianceImageFilter_h +#define otbReflectanceToRadianceImageFilter_h + +#include "otbVarSol.h" +#include "otbUnaryImageFunctorWithVectorImageFilter.h" +#include "otbMath.h" +#include "otbMacro.h" +#include "otbOpticalImageMetadataInterfaceFactory.h" +#include <iomanip> + +namespace otb +{ +namespace Functor +{ +/** + * \class ReflectanceToRadianceImageFunctor + * \brief Compute radiance from the reflectance value + * + * Divide by Pi and multiply by an illumination correction coefficient + * and the given solar illumination. + * + * + * \sa ReflectanceToRadianceImageFilter + * + * \ingroup Functor + * \ingroup Radiometry + * + * + * \ingroup OTBOpticalCalibration + */ +template <class TInput, class TOutput> +class ReflectanceToRadianceImageFunctor +{ +public: + ReflectanceToRadianceImageFunctor() : + m_SolarIllumination(1.0), + m_IlluminationCorrectionCoefficient(1.0) + {} + + virtual ~ReflectanceToRadianceImageFunctor() {} + + void SetSolarIllumination(double solarIllumination) + { + m_SolarIllumination = solarIllumination; + } + void SetIlluminationCorrectionCoefficient(double coef) + { + m_IlluminationCorrectionCoefficient = coef; + } + + double GetSolarIllumination() + { + return m_SolarIllumination; + } + double GetIlluminationCorrectionCoefficient() + { + return m_IlluminationCorrectionCoefficient; + } + + inline TOutput operator ()(const TInput& inPixel) const + { + TOutput outPixel; + double temp; + temp = static_cast<double>(inPixel) + / static_cast<double>(CONST_PI) + * m_IlluminationCorrectionCoefficient + * m_SolarIllumination; + + outPixel = static_cast<TOutput>(temp); + return outPixel; + } + +private: + double m_SolarIllumination; + double m_IlluminationCorrectionCoefficient; +}; +} + +/** \class ReflectanceToRadianceImageFilter + * \brief Convert reflectance value into radiance value + * + * Transform a reflectance image into the radiance. For this it uses the + * functor ReflectanceToRadianceImageFunctor calling for each component of each pixel. + * + * + * For Spot image in the dimap format, the correction parameters are + * retrieved automatically from the metadata + * + * \ingroup ImageToRadianceImageFunctor + * \ingroup Radiometry + * + * \example Radiometry/AtmosphericCorrectionSequencement.cxx + * + * \ingroup OTBOpticalCalibration + */ +template <class TInputImage, class TOutputImage> +class ITK_EXPORT ReflectanceToRadianceImageFilter : + public UnaryImageFunctorWithVectorImageFilter<TInputImage, + TOutputImage, + typename Functor::ReflectanceToRadianceImageFunctor<typename + TInputImage:: + InternalPixelType, + typename + TOutputImage:: + InternalPixelType> > +{ +public: + /** Extract input and output images dimensions.*/ + itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension); + itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension); + + /** "typedef" to simplify the variables definition and the declaration. */ + typedef TInputImage InputImageType; + typedef TOutputImage OutputImageType; + typedef typename Functor::ReflectanceToRadianceImageFunctor<typename InputImageType::InternalPixelType, + typename OutputImageType::InternalPixelType> + FunctorType; + + /** "typedef" for standard classes. */ + typedef ReflectanceToRadianceImageFilter Self; + typedef UnaryImageFunctorWithVectorImageFilter<InputImageType, OutputImageType, FunctorType> Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + /** object factory method. */ + itkNewMacro(Self); + + /** return class name. */ + itkTypeMacro(ReflectanceToRadianceImageFilter, UnaryImageFunctorWithVectorImageFiltermageFilter); + + /** Supported images definition. */ + typedef typename InputImageType::PixelType InputPixelType; + typedef typename InputImageType::InternalPixelType InputInternalPixelType; + typedef typename InputImageType::RegionType InputImageRegionType; + typedef typename OutputImageType::PixelType OutputPixelType; + typedef typename OutputImageType::InternalPixelType OutputInternalPixelType; + typedef typename OutputImageType::RegionType OutputImageRegionType; + + typedef typename itk::VariableLengthVector<double> VectorType; + + /** Image size "typedef" definition. */ + typedef typename InputImageType::SizeType SizeType; + + /** Set the solar illumination value. */ + itkSetMacro(SolarIllumination, VectorType); + /** Give the solar illumination value. */ + itkGetConstReferenceMacro(SolarIllumination, VectorType); + + /** Set the zenithal solar angle. */ + itkSetMacro(ZenithalSolarAngle, double); + /** Give the zenithal solar angle. */ + itkGetConstReferenceMacro(ZenithalSolarAngle, double); + + /** Set/Get the sun elevation angle (internally handled by the zenithal angle)*/ + virtual void SetElevationSolarAngle(double elevationAngle) + { + double zenithalAngle = 90.0 - elevationAngle; + if (this->m_ZenithalSolarAngle != zenithalAngle) + { + this->m_ZenithalSolarAngle = zenithalAngle; + this->Modified(); + } + } + + virtual double GetElevationSolarAngle() const + { + return 90.0 - this->m_ZenithalSolarAngle; + } + + /** Set the day. */ + itkSetClampMacro(Day, int, 1, 31); + /** Give the day. */ + itkGetConstReferenceMacro(Day, int); + + /** Set the month. */ + itkSetClampMacro(Month, int, 1, 12); + /** Give the month. */ + itkGetConstReferenceMacro(Month, int); + + /** Set the flux normalization coefficient. */ + void SetFluxNormalizationCoefficient(double coef) + { + m_FluxNormalizationCoefficient = coef; + m_IsSetFluxNormalizationCoefficient = true; + this->Modified(); + } + /** Give the flux normalization coefficient. */ + itkGetConstReferenceMacro(FluxNormalizationCoefficient, double); + + /** Set the IsSetFluxNormalizationCoefficient boolean. */ + itkSetMacro(IsSetFluxNormalizationCoefficient, bool); + /** Give the IsSetFluxNormalizationCoefficient boolean. */ + itkGetConstReferenceMacro(IsSetFluxNormalizationCoefficient, bool); + + /** Set the UseClamp boolean. */ + itkSetMacro(UseClamp, bool); + /** Give the UseClamp boolean. */ + itkGetConstReferenceMacro(UseClamp, bool); + +protected: + /** Constructor */ + ReflectanceToRadianceImageFilter() : + m_ZenithalSolarAngle(120.0), //invalid value which will lead to negative radiometry + m_FluxNormalizationCoefficient(1.), + m_Day(0), + m_Month(0), + m_IsSetFluxNormalizationCoefficient(false) + { + m_SolarIllumination.SetSize(0); + }; + + /** Destructor */ + ~ReflectanceToRadianceImageFilter() ITK_OVERRIDE {} + + /** Update the functor list and input parameters */ + void BeforeThreadedGenerateData(void) ITK_OVERRIDE + { + OpticalImageMetadataInterface::Pointer imageMetadataInterface = OpticalImageMetadataInterfaceFactory::CreateIMI( + this->GetInput()->GetMetaDataDictionary()); + if ((m_Day == 0) && (!m_IsSetFluxNormalizationCoefficient)) + { + m_Day = imageMetadataInterface->GetDay(); + } + + if ((m_Month == 0) && (!m_IsSetFluxNormalizationCoefficient)) + { + m_Month = imageMetadataInterface->GetMonth(); + } + + if (m_SolarIllumination.GetSize() == 0) + { + m_SolarIllumination = imageMetadataInterface->GetSolarIrradiance(); + } + + if (m_ZenithalSolarAngle == 120.0) + { + //the zenithal angle is the complementary of the elevation angle + m_ZenithalSolarAngle = 90.0 - imageMetadataInterface->GetSunElevation(); + } + + std::cout << "Using correction parameters: " << std::endl; + std::cout<< "Day: " << m_Day << std::endl; + std::cout<< "Month: " << m_Month << std::endl; + std::cout<< "Solar irradiance: " << m_SolarIllumination << std::endl; + std::cout<< "Zenithal angle: " << m_ZenithalSolarAngle << std::endl; + + if ((m_SolarIllumination.GetSize() != this->GetInput()->GetNumberOfComponentsPerPixel())) + { + itkExceptionMacro(<< "SolarIllumination parameter should have the same size as the number of bands"); + } + + this->GetFunctorVector().clear(); + + for (unsigned int i = 0; i < this->GetInput()->GetNumberOfComponentsPerPixel(); ++i) + { + FunctorType functor; + double coefTemp = 0.; + if (!m_IsSetFluxNormalizationCoefficient) + { + if (m_Day * m_Month != 0 && m_Day < 32 && m_Month < 13) + { + coefTemp = vcl_cos(m_ZenithalSolarAngle * CONST_PI_180) * VarSol::GetVarSol(m_Day,m_Month); + } + else + { + itkExceptionMacro(<< "Day has to be included between 1 and 31, Month between 1 and 12."); + } + } + else + { + coefTemp = + vcl_cos(m_ZenithalSolarAngle * + CONST_PI_180) * m_FluxNormalizationCoefficient * m_FluxNormalizationCoefficient; + } + functor.SetIlluminationCorrectionCoefficient(coefTemp); + functor.SetSolarIllumination(static_cast<double>(m_SolarIllumination[i])); + + this->GetFunctorVector().push_back(functor); + } + } + +private: + + /** Set the zenithal soalr angle. */ + double m_ZenithalSolarAngle; + /** Flux normalization coefficient. */ + double m_FluxNormalizationCoefficient; + /** Acquisition day. */ + int m_Day; + /** Acquisition month. */ + int m_Month; + /** Solar illumination value. */ + VectorType m_SolarIllumination; + /** Used to know if the user has set a value for the FluxNormalizationCoefficient parameter + * or if the class has to compute it */ + bool m_IsSetFluxNormalizationCoefficient; + /** Clamp values to [0,1] */ + bool m_UseClamp; + +}; + +} // end namespace otb +#endif diff --git a/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToSurfaceReflectanceImageFilter.h b/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToSurfaceReflectanceImageFilter.h index bf354881adb00d955b719c4ada42bf48f172d274..7fc9c223503f3d4f51da64949e15efb3f3297740 100644 --- a/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToSurfaceReflectanceImageFilter.h +++ b/Modules/Radiometry/OpticalCalibration/include/otbReflectanceToSurfaceReflectanceImageFilter.h @@ -119,7 +119,7 @@ private: * * \ingroup AtmosphericRadiativeTerms * \ingroup AtmosphericCorrectionParameters - * \ingroup LuminanceToReflectanceImageFilter + * \ingroup RadianceToReflectanceImageFilter * \ingroup ImageToReflectanceImageFilter * \ingroup ImageMetadataCorrectionParameters * \ingroup otbRadiometryCorrectionParametersToAtmosphericRadiativeTerms diff --git a/Modules/Radiometry/OpticalCalibration/otb-module.cmake b/Modules/Radiometry/OpticalCalibration/otb-module.cmake index 0df5e31decf78485c15018253a9ebd89015385a2..104d2b013b27cc66de92d43cb596f07629804ce7 100644 --- a/Modules/Radiometry/OpticalCalibration/otb-module.cmake +++ b/Modules/Radiometry/OpticalCalibration/otb-module.cmake @@ -18,7 +18,7 @@ # limitations under the License. # -set(DOCUMENTATION "Digital number to luminance correction. luminance to +set(DOCUMENTATION "Digital number to radiance correction. radiance to refletance image conversion. atmospheric correction for TOA (top of atmosphere) to TOC (top of canopy) reflectance estimation. correction of the adjacency effects taking into account the neighborhood contribution.") diff --git a/Modules/Radiometry/OpticalCalibration/test/CMakeLists.txt b/Modules/Radiometry/OpticalCalibration/test/CMakeLists.txt index dc0a87b1ec54d0fbce0e2e5e1b706cd73273f6dc..a835c8048cd531fa177fcb8b85743a1580e2bd1b 100644 --- a/Modules/Radiometry/OpticalCalibration/test/CMakeLists.txt +++ b/Modules/Radiometry/OpticalCalibration/test/CMakeLists.txt @@ -24,14 +24,14 @@ set(OTBOpticalCalibrationTests otbOpticalCalibrationTestDriver.cxx otbSpectralSensitivityReaderTest.cxx otbReflectanceToImageImageFilter.cxx -otbReflectanceToLuminanceImageFilterNew.cxx -otbLuminanceToReflectanceImageFilterNew.cxx -otbLuminanceToReflectanceImageFilterAuto.cxx -otbImageToLuminanceImageFilterNew.cxx +otbReflectanceToRadianceImageFilterNew.cxx +otbRadianceToReflectanceImageFilterNew.cxx +otbRadianceToReflectanceImageFilterAuto.cxx +otbImageToRadianceImageFilterNew.cxx otbRadiometryCorrectionParametersToAtmosphericRadiativeTermsNew.cxx -otbLuminanceToImageImageFilterAuto.cxx -otbLuminanceToImageImageFilterNew.cxx -otbReflectanceToLuminanceImageFilterAuto.cxx +otbRadianceToImageImageFilterAuto.cxx +otbRadianceToImageImageFilterNew.cxx +otbReflectanceToRadianceImageFilterAuto.cxx otbAeronetExtractDataBadData.cxx otbRomaniaReflectanceToRomaniaSurfaceReflectanceImageFilter.cxx otbRadiometryCorrectionParametersToAtmosphericRadiativeTerms.cxx @@ -42,21 +42,21 @@ otbImageToReflectanceImageFilterNew.cxx otbWavelengthSpectralBandsTest.cxx otbAtmosphericRadiativeTermsTest.cxx otbImageToReflectanceImageFilter.cxx -otbLuminanceToReflectanceImageFilter.cxx +otbRadianceToReflectanceImageFilter.cxx otbReflectanceToImageImageFilterAuto.cxx otbAeronetNew.cxx otbAeronetExtractData.cxx otbReflectanceToSurfaceReflectanceImageFilterTest.cxx otbImageMetadataCorrectionParametersNew.cxx -otbImageToLuminanceImageFilterAuto.cxx +otbImageToRadianceImageFilterAuto.cxx otbAtmosphericCorrectionSequencement.cxx otbSIXSTraitsTest.cxx otbSIXSTraitsComputeAtmosphericParameters.cxx otbReflectanceToImageImageFilterNew.cxx otbSurfaceAdjacencyEffectCorrectionSchemeFilter.cxx -otbLuminanceToImageImageFilter.cxx -otbReflectanceToLuminanceImageFilter.cxx -otbImageToLuminanceImageFilter.cxx +otbRadianceToImageImageFilter.cxx +otbReflectanceToRadianceImageFilter.cxx +otbImageToRadianceImageFilter.cxx ) add_executable(otbOpticalCalibrationTestDriver ${OTBOpticalCalibrationTests}) @@ -170,80 +170,80 @@ otb_add_test(NAME raTvRomaniaReflectanceToImage COMMAND otbOpticalCalibrationTes 0.9889145564708814 #= sqrt(0.977952) d/d0 corresponding to the date 03/05 ) -otb_add_test(NAME raTuReflectanceToLuminanceImageFilterNew COMMAND otbOpticalCalibrationTestDriver - otbReflectanceToLuminanceImageFilterNew +otb_add_test(NAME raTuReflectanceToRadianceImageFilterNew COMMAND otbOpticalCalibrationTestDriver + otbReflectanceToRadianceImageFilterNew ) -otb_add_test(NAME raTuLuminanceToReflectanceImageFilterNew COMMAND otbOpticalCalibrationTestDriver - otbLuminanceToReflectanceImageFilterNew +otb_add_test(NAME raTuRadianceToReflectanceImageFilterNew COMMAND otbOpticalCalibrationTestDriver + otbRadianceToReflectanceImageFilterNew ) -otb_add_test(NAME raTvLuminanceToReflectanceImageFilterAutoQuickbirdPAN COMMAND otbOpticalCalibrationTestDriver - --compare-image ${EPSILON_12} ${BASELINE}/raTvLuminanceToReflectanceImageFilterAutoQuickbirdPAN.tif - ${TEMP}/raTvLuminanceToReflectanceImageFilterAutoQuickbirdPAN.tif - otbLuminanceToReflectanceImageFilterAuto +otb_add_test(NAME raTvRadianceToReflectanceImageFilterAutoQuickbirdPAN COMMAND otbOpticalCalibrationTestDriver + --compare-image ${EPSILON_12} ${BASELINE}/raTvRadianceToReflectanceImageFilterAutoQuickbirdPAN.tif + ${TEMP}/raTvRadianceToReflectanceImageFilterAutoQuickbirdPAN.tif + otbRadianceToReflectanceImageFilterAuto LARGEINPUT{QUICKBIRD/TOULOUSE/000000128955_01_P001_PAN/02APR01105228-P1BS-000000128955_01_P001.TIF} - ${TEMP}/raTvLuminanceToReflectanceImageFilterAutoQuickbirdPAN.tif + ${TEMP}/raTvRadianceToReflectanceImageFilterAutoQuickbirdPAN.tif ) -otb_add_test(NAME raTvLuminanceToReflectanceImageFilterAutoWV2PAN COMMAND otbOpticalCalibrationTestDriver - --compare-image ${EPSILON_12} ${BASELINE}/raTvLuminanceToReflectanceImageFilterAutoWV2PAN.tif - ${TEMP}/raTvLuminanceToReflectanceImageFilterAutoWV2PAN.tif - otbLuminanceToReflectanceImageFilterAuto +otb_add_test(NAME raTvRadianceToReflectanceImageFilterAutoWV2PAN COMMAND otbOpticalCalibrationTestDriver + --compare-image ${EPSILON_12} ${BASELINE}/raTvRadianceToReflectanceImageFilterAutoWV2PAN.tif + ${TEMP}/raTvRadianceToReflectanceImageFilterAutoWV2PAN.tif + otbRadianceToReflectanceImageFilterAuto LARGEINPUT{WORLDVIEW2/ROME/WV-2_standard_8band_bundle_16bit/052298844010_01_P001_PAN/09DEC10103019-P2AS-052298844010_01_P001.TIF} - ${TEMP}/raTvLuminanceToReflectanceImageFilterAutoWV2PAN.tif + ${TEMP}/raTvRadianceToReflectanceImageFilterAutoWV2PAN.tif ) -otb_add_test(NAME raTvLuminanceToReflectanceImageFilterAutoSpot5 COMMAND otbOpticalCalibrationTestDriver - --compare-image ${EPSILON_12} ${BASELINE}/raTvLuminanceToReflectanceImageFilterAutoSpot5.tif - ${TEMP}/raTvLuminanceToReflectanceImageFilterAutoSpot5.img - otbLuminanceToReflectanceImageFilterAuto +otb_add_test(NAME raTvRadianceToReflectanceImageFilterAutoSpot5 COMMAND otbOpticalCalibrationTestDriver + --compare-image ${EPSILON_12} ${BASELINE}/raTvRadianceToReflectanceImageFilterAutoSpot5.tif + ${TEMP}/raTvRadianceToReflectanceImageFilterAutoSpot5.img + otbRadianceToReflectanceImageFilterAuto LARGEINPUT{SPOT5/TEHERAN/IMAGERY.TIF} - ${TEMP}/raTvLuminanceToReflectanceImageFilterAutoSpot5.img + ${TEMP}/raTvRadianceToReflectanceImageFilterAutoSpot5.img ) -otb_add_test(NAME raTvLuminanceToReflectanceImageFilterAutoIkonos COMMAND otbOpticalCalibrationTestDriver - --compare-image ${EPSILON_12} ${BASELINE}/raTvLuminanceToReflectanceImageFilterAutoIkonos.tif - ${TEMP}/raTvLuminanceToReflectanceImageFilterAutoIkonos.tif - otbLuminanceToReflectanceImageFilterAuto +otb_add_test(NAME raTvRadianceToReflectanceImageFilterAutoIkonos COMMAND otbOpticalCalibrationTestDriver + --compare-image ${EPSILON_12} ${BASELINE}/raTvRadianceToReflectanceImageFilterAutoIkonos.tif + ${TEMP}/raTvRadianceToReflectanceImageFilterAutoIkonos.tif + otbRadianceToReflectanceImageFilterAuto LARGEINPUT{IKONOS/BLOSSEVILLE/po_2619900_pan_0000000.tif} - ${TEMP}/raTvLuminanceToReflectanceImageFilterAutoIkonos.tif + ${TEMP}/raTvRadianceToReflectanceImageFilterAutoIkonos.tif ) -otb_add_test(NAME raTvLuminanceToReflectanceImageFilterAutoWV2MULTI COMMAND otbOpticalCalibrationTestDriver - --compare-image ${EPSILON_12} ${BASELINE}/raTvLuminanceToReflectanceImageFilterAutoWV2Multi.tif - ${TEMP}/raTvLuminanceToReflectanceImageFilterAutoWV2Multi.tif - otbLuminanceToReflectanceImageFilterAuto +otb_add_test(NAME raTvRadianceToReflectanceImageFilterAutoWV2MULTI COMMAND otbOpticalCalibrationTestDriver + --compare-image ${EPSILON_12} ${BASELINE}/raTvRadianceToReflectanceImageFilterAutoWV2Multi.tif + ${TEMP}/raTvRadianceToReflectanceImageFilterAutoWV2Multi.tif + otbRadianceToReflectanceImageFilterAuto LARGEINPUT{WORLDVIEW2/ROME/WV-2_standard_8band_bundle_16bit/052298844010_01_P001_MUL/09DEC10103019-M2AS-052298844010_01_P001.TIF} - ${TEMP}/raTvLuminanceToReflectanceImageFilterAutoWV2Multi.tif + ${TEMP}/raTvRadianceToReflectanceImageFilterAutoWV2Multi.tif ) -otb_add_test(NAME raTvLuminanceToReflectanceImageFilterAutoQuickbirdXS COMMAND otbOpticalCalibrationTestDriver - --compare-image ${EPSILON_12} ${BASELINE}/raTvLuminanceToReflectanceImageFilterAutoQuickbirdXS.tif - ${TEMP}/raTvLuminanceToReflectanceImageFilterAutoQuickbirdXS.tif - otbLuminanceToReflectanceImageFilterAuto +otb_add_test(NAME raTvRadianceToReflectanceImageFilterAutoQuickbirdXS COMMAND otbOpticalCalibrationTestDriver + --compare-image ${EPSILON_12} ${BASELINE}/raTvRadianceToReflectanceImageFilterAutoQuickbirdXS.tif + ${TEMP}/raTvRadianceToReflectanceImageFilterAutoQuickbirdXS.tif + otbRadianceToReflectanceImageFilterAuto LARGEINPUT{QUICKBIRD/TOULOUSE/000000128955_01_P001_MUL/02APR01105228-M1BS-000000128955_01_P001.TIF} - ${TEMP}/raTvLuminanceToReflectanceImageFilterAutoQuickbirdXS.tif + ${TEMP}/raTvRadianceToReflectanceImageFilterAutoQuickbirdXS.tif ) -otb_add_test(NAME raTvLuminanceToReflectanceImageFilterAutoFORMOSAT COMMAND otbOpticalCalibrationTestDriver - --compare-image ${EPSILON_12} ${BASELINE}/raTvLuminanceToReflectanceImageFilterAutoFormosat.tif - ${TEMP}/raTvLuminanceToReflectanceImageFilterAutoFormosat.img - otbLuminanceToReflectanceImageFilterAuto +otb_add_test(NAME raTvRadianceToReflectanceImageFilterAutoFORMOSAT COMMAND otbOpticalCalibrationTestDriver + --compare-image ${EPSILON_12} ${BASELINE}/raTvRadianceToReflectanceImageFilterAutoFormosat.tif + ${TEMP}/raTvRadianceToReflectanceImageFilterAutoFormosat.img + otbRadianceToReflectanceImageFilterAuto LARGEINPUT{FORMOSAT/Sudouest_20071013_MS_fmsat/IMAGERY.TIF} - ${TEMP}/raTvLuminanceToReflectanceImageFilterAutoFormosat.img + ${TEMP}/raTvRadianceToReflectanceImageFilterAutoFormosat.img ) -otb_add_test(NAME raTuImageToLuminanceImageFilterNew COMMAND otbOpticalCalibrationTestDriver - otbImageToLuminanceImageFilterNew +otb_add_test(NAME raTuImageToRadianceImageFilterNew COMMAND otbOpticalCalibrationTestDriver + otbImageToRadianceImageFilterNew ) otb_add_test(NAME raTuRadiometryCorrectionParametersToAtmosphericRadiativeTermsNew COMMAND otbOpticalCalibrationTestDriver otbRadiometryCorrectionParametersToAtmosphericRadiativeTermsNew) -otb_add_test(NAME raTuLuminanceToImageImageFilterNew COMMAND otbOpticalCalibrationTestDriver - otbLuminanceToImageImageFilterNew +otb_add_test(NAME raTuRadianceToImageImageFilterNew COMMAND otbOpticalCalibrationTestDriver + otbRadianceToImageImageFilterNew ) #FIXME Those tests have performing local copies of header, baselines...They were migrate "as it" for now in version 5.0 but @@ -256,16 +256,16 @@ if(OTB_DATA_USE_LARGEINPUT AND OTB_DATA_ROOT) set(MTDATADIR ${OTB_DATA_LARGEINPUT_ROOT}/QUICKBIRD/TOULOUSE/000000128955_01_P001_PAN) file(GLOB MTDATA ${MTDATADIR}/*TIL ${MTDATADIR}/*RPB ${MTDATADIR}/*XML ${MTDATADIR}/*IMD) file(COPY ${MTDATA} DESTINATION ${TOULOUSEQBDIR}) - otb_copy_rename(${BASELINE}/raTvImageToLuminanceImageFilterAutoQuickbirdPAN.tif ${TOULOUSEQBDIR}/02APR01105228-P1BS-000000128955_01_P001.TIF) + otb_copy_rename(${BASELINE}/raTvImageToRadianceImageFilterAutoQuickbirdPAN.tif ${TOULOUSEQBDIR}/02APR01105228-P1BS-000000128955_01_P001.TIF) - otb_add_test(NAME raTvLuminanceToImageImageFilterAutoQuickbirdPAN COMMAND otbOpticalCalibrationTestDriver - --compare-image ${EPSILON_12} ${TOULOUSEQBDIR}/raTvSMALLTOULOUSELuminanceToImageImageFilterAutoQuickbirdPAN.tif - ${TOULOUSEQBDIR}/raTvLuminanceToImageImageFilterAutoQuickbirdPAN.tif - otbLuminanceToImageImageFilterAuto + otb_add_test(NAME raTvRadianceToImageImageFilterAutoQuickbirdPAN COMMAND otbOpticalCalibrationTestDriver + --compare-image ${EPSILON_12} ${TOULOUSEQBDIR}/raTvSMALLTOULOUSERadianceToImageImageFilterAutoQuickbirdPAN.tif + ${TOULOUSEQBDIR}/raTvRadianceToImageImageFilterAutoQuickbirdPAN.tif + otbRadianceToImageImageFilterAuto ${TOULOUSEQBDIR}/02APR01105228-P1BS-000000128955_01_P001.TIF LARGEINPUT{QUICKBIRD/TOULOUSE/000000128955_01_P001_PAN/02APR01105228-P1BS-000000128955_01_P001.TIF} - ${TOULOUSEQBDIR}/raTvLuminanceToImageImageFilterAutoQuickbirdPAN.tif - ${TOULOUSEQBDIR}/raTvSMALLTOULOUSELuminanceToImageImageFilterAutoQuickbirdPAN.tif + ${TOULOUSEQBDIR}/raTvRadianceToImageImageFilterAutoQuickbirdPAN.tif + ${TOULOUSEQBDIR}/raTvSMALLTOULOUSERadianceToImageImageFilterAutoQuickbirdPAN.tif ) @@ -274,16 +274,16 @@ if(OTB_DATA_USE_LARGEINPUT AND OTB_DATA_ROOT) set(MTDATADIR ${OTB_DATA_LARGEINPUT_ROOT}/QUICKBIRD/TOULOUSE/000000128955_01_P001_MUL) file(GLOB MTDATA ${MTDATADIR}/*TIL ${MTDATADIR}/*RPB ${MTDATADIR}/*XML ${MTDATADIR}/*IMD) file(COPY ${MTDATA} DESTINATION ${TOULOUSEQBDIR}) - otb_copy_rename(${BASELINE}/raTvImageToLuminanceImageFilterAutoQuickbirdXS.tif ${TOULOUSEQBDIR}/02APR01105228-M1BS-000000128955_01_P001.TIF) + otb_copy_rename(${BASELINE}/raTvImageToRadianceImageFilterAutoQuickbirdXS.tif ${TOULOUSEQBDIR}/02APR01105228-M1BS-000000128955_01_P001.TIF) - otb_add_test(NAME raTvLuminanceToImageImageFilterAutoQuickbirdXS COMMAND otbOpticalCalibrationTestDriver - --compare-image ${EPSILON_12} ${TOULOUSEQBDIR}/raTvSMALLTOULOUSELuminanceToImageImageFilterAutoQuickbirdXS.tif - ${TOULOUSEQBDIR}/raTvLuminanceToImageImageFilterAutoQuickbirdXS.tif - otbLuminanceToImageImageFilterAuto + otb_add_test(NAME raTvRadianceToImageImageFilterAutoQuickbirdXS COMMAND otbOpticalCalibrationTestDriver + --compare-image ${EPSILON_12} ${TOULOUSEQBDIR}/raTvSMALLTOULOUSERadianceToImageImageFilterAutoQuickbirdXS.tif + ${TOULOUSEQBDIR}/raTvRadianceToImageImageFilterAutoQuickbirdXS.tif + otbRadianceToImageImageFilterAuto ${TOULOUSEQBDIR}/02APR01105228-M1BS-000000128955_01_P001.TIF LARGEINPUT{QUICKBIRD/TOULOUSE/000000128955_01_P001_MUL/02APR01105228-M1BS-000000128955_01_P001.TIF} - ${TOULOUSEQBDIR}/raTvLuminanceToImageImageFilterAutoQuickbirdXS.tif - ${TOULOUSEQBDIR}/raTvSMALLTOULOUSELuminanceToImageImageFilterAutoQuickbirdXS.tif + ${TOULOUSEQBDIR}/raTvRadianceToImageImageFilterAutoQuickbirdXS.tif + ${TOULOUSEQBDIR}/raTvSMALLTOULOUSERadianceToImageImageFilterAutoQuickbirdXS.tif ) set(ROMEWV2DIR ${TEMP}/OpticalCalibLumToImWv2MULTI) @@ -291,48 +291,48 @@ if(OTB_DATA_USE_LARGEINPUT AND OTB_DATA_ROOT) set(MTDATADIR ${OTB_DATA_LARGEINPUT_ROOT}/WORLDVIEW2/ROME/WV-2_standard_8band_bundle_16bit/052298844010_01_P001_MUL) file(GLOB MTDATA ${MTDATADIR}/*TIL ${MTDATADIR}/*RPB ${MTDATADIR}/*XML ${MTDATADIR}/*IMD) file(COPY ${MTDATA} DESTINATION ${ROMEWV2DIR}) - otb_copy_rename(${BASELINE}/raTvImageToLuminanceImageFilterAutoWV2Multi.tif ${ROMEWV2DIR}/09DEC10103019-M2AS-052298844010_01_P001.TIF) + otb_copy_rename(${BASELINE}/raTvImageToRadianceImageFilterAutoWV2Multi.tif ${ROMEWV2DIR}/09DEC10103019-M2AS-052298844010_01_P001.TIF) - otb_add_test(NAME raTvLuminanceToImageImageFilterAutoWV2MULTI COMMAND otbOpticalCalibrationTestDriver - --compare-image ${EPSILON_12} ${ROMEWV2DIR}/raTvSMALLROMELuminanceToImageImageFilterAutoWV2Multi.tif - ${ROMEWV2DIR}/raTvLuminanceToImageImageFilterAutoWV2Multi.tif - otbLuminanceToImageImageFilterAuto + otb_add_test(NAME raTvRadianceToImageImageFilterAutoWV2MULTI COMMAND otbOpticalCalibrationTestDriver + --compare-image ${EPSILON_12} ${ROMEWV2DIR}/raTvSMALLROMERadianceToImageImageFilterAutoWV2Multi.tif + ${ROMEWV2DIR}/raTvRadianceToImageImageFilterAutoWV2Multi.tif + otbRadianceToImageImageFilterAuto ${ROMEWV2DIR}/09DEC10103019-M2AS-052298844010_01_P001.TIF LARGEINPUT{WORLDVIEW2/ROME/WV-2_standard_8band_bundle_16bit/052298844010_01_P001_MUL/09DEC10103019-M2AS-052298844010_01_P001.TIF} - ${ROMEWV2DIR}/raTvLuminanceToImageImageFilterAutoWV2Multi.tif - ${ROMEWV2DIR}/raTvSMALLROMELuminanceToImageImageFilterAutoWV2Multi.tif + ${ROMEWV2DIR}/raTvRadianceToImageImageFilterAutoWV2Multi.tif + ${ROMEWV2DIR}/raTvSMALLROMERadianceToImageImageFilterAutoWV2Multi.tif ) set(BLOSSEVILLEIKONOSDIR ${TEMP}/OpticalCalibLumToImIkonos) file(MAKE_DIRECTORY ${BLOSSEVILLEIKONOSDIR}) file(GLOB MTDATA ${OTB_DATA_LARGEINPUT_ROOT}/IKONOS/BLOSSEVILLE/*metadata.txt ${OTB_DATA_LARGEINPUT_ROOT}/IKONOS/BLOSSEVILLE/*pan*) file(COPY ${MTDATA} DESTINATION ${BLOSSEVILLEIKONOSDIR}) - otb_copy_rename(${BASELINE}/raTvImageToLuminanceImageFilterAutoIkonos.tif ${BLOSSEVILLEIKONOSDIR}/po_2619900_pan_0000000.tif) + otb_copy_rename(${BASELINE}/raTvImageToRadianceImageFilterAutoIkonos.tif ${BLOSSEVILLEIKONOSDIR}/po_2619900_pan_0000000.tif) - otb_add_test(NAME raTvLuminanceToImageImageFilterAutoIkonos COMMAND otbOpticalCalibrationTestDriver - --compare-image ${EPSILON_12} ${BLOSSEVILLEIKONOSDIR}/raTvSMALLBLOSSEVILLELuminanceToImageImageFilterAutoIkonos.tif - ${BLOSSEVILLEIKONOSDIR}/raTvLuminanceToImageImageFilterAutoIkonos.tif - otbLuminanceToImageImageFilterAuto + otb_add_test(NAME raTvRadianceToImageImageFilterAutoIkonos COMMAND otbOpticalCalibrationTestDriver + --compare-image ${EPSILON_12} ${BLOSSEVILLEIKONOSDIR}/raTvSMALLBLOSSEVILLERadianceToImageImageFilterAutoIkonos.tif + ${BLOSSEVILLEIKONOSDIR}/raTvRadianceToImageImageFilterAutoIkonos.tif + otbRadianceToImageImageFilterAuto ${BLOSSEVILLEIKONOSDIR}/po_2619900_pan_0000000.tif LARGEINPUT{IKONOS/BLOSSEVILLE/po_2619900_pan_0000000.tif} - ${BLOSSEVILLEIKONOSDIR}/raTvLuminanceToImageImageFilterAutoIkonos.tif - ${BLOSSEVILLEIKONOSDIR}/raTvSMALLBLOSSEVILLELuminanceToImageImageFilterAutoIkonos.tif + ${BLOSSEVILLEIKONOSDIR}/raTvRadianceToImageImageFilterAutoIkonos.tif + ${BLOSSEVILLEIKONOSDIR}/raTvSMALLBLOSSEVILLERadianceToImageImageFilterAutoIkonos.tif ) set(TEHERANSPOT5DIR ${TEMP}/OpticalCalibLumToImSPOT5) file(MAKE_DIRECTORY ${TEHERANSPOT5DIR}) file(GLOB MTDATA ${OTB_DATA_LARGEINPUT_ROOT}/SPOT5/TEHERAN/*.DIM) file(COPY ${MTDATA} DESTINATION ${TEHERANSPOT5DIR}) - otb_copy_rename(${BASELINE}/raTvImageToLuminanceImageFilterAutoSpot5.tif ${TEHERANSPOT5DIR}/IMAGERY.TIF) + otb_copy_rename(${BASELINE}/raTvImageToRadianceImageFilterAutoSpot5.tif ${TEHERANSPOT5DIR}/IMAGERY.TIF) - otb_add_test(NAME raTvLuminanceToImageImageFilterAutoSpot5 COMMAND otbOpticalCalibrationTestDriver - --compare-image ${EPSILON_12} ${TEHERANSPOT5DIR}/raTvSMALLTEHERANLuminanceToImageImageFilterAutoSpot5.img - ${TEHERANSPOT5DIR}/raTvLuminanceToImageImageFilterAutoSpot5.tif - otbLuminanceToImageImageFilterAuto + otb_add_test(NAME raTvRadianceToImageImageFilterAutoSpot5 COMMAND otbOpticalCalibrationTestDriver + --compare-image ${EPSILON_12} ${TEHERANSPOT5DIR}/raTvSMALLTEHERANRadianceToImageImageFilterAutoSpot5.img + ${TEHERANSPOT5DIR}/raTvRadianceToImageImageFilterAutoSpot5.tif + otbRadianceToImageImageFilterAuto ${TEHERANSPOT5DIR}/IMAGERY.TIF LARGEINPUT{SPOT5/TEHERAN/IMAGERY.TIF} - ${TEHERANSPOT5DIR}/raTvLuminanceToImageImageFilterAutoSpot5.tif - ${TEHERANSPOT5DIR}/raTvSMALLTEHERANLuminanceToImageImageFilterAutoSpot5.img + ${TEHERANSPOT5DIR}/raTvRadianceToImageImageFilterAutoSpot5.tif + ${TEHERANSPOT5DIR}/raTvSMALLTEHERANRadianceToImageImageFilterAutoSpot5.img ) set(ROMEWV2DIR ${TEMP}/OpticalCalibLumToImWv2PAN) @@ -340,16 +340,16 @@ if(OTB_DATA_USE_LARGEINPUT AND OTB_DATA_ROOT) set(MTDATADIR ${OTB_DATA_LARGEINPUT_ROOT}/WORLDVIEW2/ROME/WV-2_standard_8band_bundle_16bit/052298844010_01_P001_PAN) file(GLOB MTDATA ${MTDATADIR}/*TIL ${MTDATADIR}/*RPB ${MTDATADIR}/*XML ${MTDATADIR}/*IMD) file(COPY ${MTDATA} DESTINATION ${ROMEWV2DIR}) - otb_copy_rename(${BASELINE}/raTvImageToLuminanceImageFilterAutoWV2PAN.tif ${ROMEWV2DIR}/09DEC10103019-P2AS-052298844010_01_P001.TIF) + otb_copy_rename(${BASELINE}/raTvImageToRadianceImageFilterAutoWV2PAN.tif ${ROMEWV2DIR}/09DEC10103019-P2AS-052298844010_01_P001.TIF) - otb_add_test(NAME raTvLuminanceToImageImageFilterAutoWV2PAN COMMAND otbOpticalCalibrationTestDriver - --compare-image ${EPSILON_12} ${ROMEWV2DIR}/raTvSMALLROMELuminanceToImageImageFilterAutoWV2PAN.tif - ${ROMEWV2DIR}/raTvLuminanceToImageImageFilterAutoWV2PAN.tif - otbLuminanceToImageImageFilterAuto + otb_add_test(NAME raTvRadianceToImageImageFilterAutoWV2PAN COMMAND otbOpticalCalibrationTestDriver + --compare-image ${EPSILON_12} ${ROMEWV2DIR}/raTvSMALLROMERadianceToImageImageFilterAutoWV2PAN.tif + ${ROMEWV2DIR}/raTvRadianceToImageImageFilterAutoWV2PAN.tif + otbRadianceToImageImageFilterAuto ${ROMEWV2DIR}/09DEC10103019-P2AS-052298844010_01_P001.TIF LARGEINPUT{WORLDVIEW2/ROME/WV-2_standard_8band_bundle_16bit/052298844010_01_P001_PAN/09DEC10103019-P2AS-052298844010_01_P001.TIF} - ${ROMEWV2DIR}/raTvLuminanceToImageImageFilterAutoWV2PAN.tif - ${ROMEWV2DIR}/raTvSMALLROMELuminanceToImageImageFilterAutoWV2PAN.tif + ${ROMEWV2DIR}/raTvRadianceToImageImageFilterAutoWV2PAN.tif + ${ROMEWV2DIR}/raTvSMALLROMERadianceToImageImageFilterAutoWV2PAN.tif ) set(SUDOUESTFORMOSATDIR ${TEMP}/OpticalCalibLumToImFormosat) @@ -357,16 +357,16 @@ if(OTB_DATA_USE_LARGEINPUT AND OTB_DATA_ROOT) set(MTDATADIR ${OTB_DATA_LARGEINPUT_ROOT}/FORMOSAT/Sudouest_20071013_MS_fmsat) file(GLOB MTDATA ${MTDATADIR}/*.DIM) file(COPY ${MTDATA} DESTINATION ${SUDOUESTFORMOSATDIR}) - otb_copy_rename(${BASELINE}/raTvImageToLuminanceImageFilterAutoFormosat.tif ${SUDOUESTFORMOSATDIR}/IMAGERY.TIF) + otb_copy_rename(${BASELINE}/raTvImageToRadianceImageFilterAutoFormosat.tif ${SUDOUESTFORMOSATDIR}/IMAGERY.TIF) - otb_add_test(NAME raTvLuminanceToImageImageFilterAutoFORMOSAT COMMAND otbOpticalCalibrationTestDriver - --compare-image ${EPSILON_12} ${SUDOUESTFORMOSATDIR}/raTvSMALLSOLuminanceToImageImageFilterAutoFormosat.img - ${SUDOUESTFORMOSATDIR}/raTvLuminanceToImageImageFilterAutoFormosat.tif - otbLuminanceToImageImageFilterAuto + otb_add_test(NAME raTvRadianceToImageImageFilterAutoFORMOSAT COMMAND otbOpticalCalibrationTestDriver + --compare-image ${EPSILON_12} ${SUDOUESTFORMOSATDIR}/raTvSMALLSORadianceToImageImageFilterAutoFormosat.img + ${SUDOUESTFORMOSATDIR}/raTvRadianceToImageImageFilterAutoFormosat.tif + otbRadianceToImageImageFilterAuto ${SUDOUESTFORMOSATDIR}/IMAGERY.TIF LARGEINPUT{FORMOSAT/Sudouest_20071013_MS_fmsat/IMAGERY.TIF} - ${SUDOUESTFORMOSATDIR}/raTvLuminanceToImageImageFilterAutoFormosat.tif - ${SUDOUESTFORMOSATDIR}/raTvSMALLSOLuminanceToImageImageFilterAutoFormosat.img + ${SUDOUESTFORMOSATDIR}/raTvRadianceToImageImageFilterAutoFormosat.tif + ${SUDOUESTFORMOSATDIR}/raTvSMALLSORadianceToImageImageFilterAutoFormosat.img ) set(TOULOUSEQBDIR ${TEMP}/OpticalCalibRefToLumQBPAN) @@ -374,14 +374,14 @@ if(OTB_DATA_USE_LARGEINPUT AND OTB_DATA_ROOT) set(MTDATADIR ${OTB_DATA_LARGEINPUT_ROOT}/QUICKBIRD/TOULOUSE/000000128955_01_P001_PAN) file(GLOB MTDATA ${MTDATADIR}/*TIL ${MTDATADIR}/*RPB ${MTDATADIR}/*XML ${MTDATADIR}/*IMD) file(COPY ${MTDATA} DESTINATION ${TOULOUSEQBDIR}) - otb_copy_rename(${BASELINE}/raTvLuminanceToReflectanceImageFilterAutoQuickbirdPAN.tif ${TOULOUSEQBDIR}/02APR01105228-P1BS-000000128955_01_P001.TIF) + otb_copy_rename(${BASELINE}/raTvRadianceToReflectanceImageFilterAutoQuickbirdPAN.tif ${TOULOUSEQBDIR}/02APR01105228-P1BS-000000128955_01_P001.TIF) - otb_add_test(NAME raTvReflectanceToLuminanceImageFilterAutoQuickbirdPAN COMMAND otbOpticalCalibrationTestDriver - --compare-image ${EPSILON_12} ${BASELINE}/raTvImageToLuminanceImageFilterAutoQuickbirdPAN.tif - ${TOULOUSEQBDIR}/raTvReflectanceToLuminanceImageFilterAutoQuickbirdPAN.tif - otbReflectanceToLuminanceImageFilterAuto + otb_add_test(NAME raTvReflectanceToRadianceImageFilterAutoQuickbirdPAN COMMAND otbOpticalCalibrationTestDriver + --compare-image ${EPSILON_12} ${BASELINE}/raTvImageToRadianceImageFilterAutoQuickbirdPAN.tif + ${TOULOUSEQBDIR}/raTvReflectanceToRadianceImageFilterAutoQuickbirdPAN.tif + otbReflectanceToRadianceImageFilterAuto ${TOULOUSEQBDIR}/02APR01105228-P1BS-000000128955_01_P001.TIF - ${TOULOUSEQBDIR}/raTvReflectanceToLuminanceImageFilterAutoQuickbirdPAN.tif + ${TOULOUSEQBDIR}/raTvReflectanceToRadianceImageFilterAutoQuickbirdPAN.tif ) set(ROMEWV2DIR ${TEMP}/OpticalCalibRefToLumWv2PAN) @@ -389,42 +389,42 @@ if(OTB_DATA_USE_LARGEINPUT AND OTB_DATA_ROOT) set(MTDATADIR ${OTB_DATA_LARGEINPUT_ROOT}/WORLDVIEW2/ROME/WV-2_standard_8band_bundle_16bit/052298844010_01_P001_PAN) file(GLOB MTDATA ${MTDATADIR}/*TIL ${MTDATADIR}/*RPB ${MTDATADIR}/*XML ${MTDATADIR}/*IMD) file(COPY ${MTDATA} DESTINATION ${ROMEWV2DIR}) - otb_copy_rename(${BASELINE}/raTvLuminanceToReflectanceImageFilterAutoWV2PAN.tif ${ROMEWV2DIR}/09DEC10103019-P2AS-052298844010_01_P001.TIF) + otb_copy_rename(${BASELINE}/raTvRadianceToReflectanceImageFilterAutoWV2PAN.tif ${ROMEWV2DIR}/09DEC10103019-P2AS-052298844010_01_P001.TIF) - otb_add_test(NAME raTvReflectanceToLuminanceImageFilterAutoWV2PAN COMMAND otbOpticalCalibrationTestDriver - --compare-image ${EPSILON_12} ${BASELINE}/raTvImageToLuminanceImageFilterAutoWV2PAN.tif - ${ROMEWV2DIR}/raTvReflectanceToLuminanceImageFilterAutoWV2PAN.tif - otbReflectanceToLuminanceImageFilterAuto + otb_add_test(NAME raTvReflectanceToRadianceImageFilterAutoWV2PAN COMMAND otbOpticalCalibrationTestDriver + --compare-image ${EPSILON_12} ${BASELINE}/raTvImageToRadianceImageFilterAutoWV2PAN.tif + ${ROMEWV2DIR}/raTvReflectanceToRadianceImageFilterAutoWV2PAN.tif + otbReflectanceToRadianceImageFilterAuto ${ROMEWV2DIR}/09DEC10103019-P2AS-052298844010_01_P001.TIF - ${ROMEWV2DIR}/raTvReflectanceToLuminanceImageFilterAutoWV2PAN.tif + ${ROMEWV2DIR}/raTvReflectanceToRadianceImageFilterAutoWV2PAN.tif ) set(TEHERANSPOT5DIR ${TEMP}/OpticalCalibRefToLumSPOT5) file(MAKE_DIRECTORY ${TEHERANSPOT5DIR}) file(GLOB MTDATA ${OTB_DATA_LARGEINPUT_ROOT}/SPOT5/TEHERAN/*.DIM) file(COPY ${MTDATA} DESTINATION ${TEHERANSPOT5DIR}) - otb_copy_rename(${BASELINE}/raTvLuminanceToReflectanceImageFilterAutoSpot5.tif ${TEHERANSPOT5DIR}/IMAGERY.TIF) + otb_copy_rename(${BASELINE}/raTvRadianceToReflectanceImageFilterAutoSpot5.tif ${TEHERANSPOT5DIR}/IMAGERY.TIF) - otb_add_test(NAME raTvReflectanceToLuminanceImageFilterAutoSpot5 COMMAND otbOpticalCalibrationTestDriver - --compare-image ${EPSILON_12} ${BASELINE}/raTvImageToLuminanceImageFilterAutoSpot5.tif - ${TEHERANSPOT5DIR}/raTvReflectanceToLuminanceImageFilterAutoSpot5.img - otbReflectanceToLuminanceImageFilterAuto + otb_add_test(NAME raTvReflectanceToRadianceImageFilterAutoSpot5 COMMAND otbOpticalCalibrationTestDriver + --compare-image ${EPSILON_12} ${BASELINE}/raTvImageToRadianceImageFilterAutoSpot5.tif + ${TEHERANSPOT5DIR}/raTvReflectanceToRadianceImageFilterAutoSpot5.img + otbReflectanceToRadianceImageFilterAuto ${TEHERANSPOT5DIR}/IMAGERY.TIF - ${TEHERANSPOT5DIR}/raTvReflectanceToLuminanceImageFilterAutoSpot5.img + ${TEHERANSPOT5DIR}/raTvReflectanceToRadianceImageFilterAutoSpot5.img ) set(BLOSSEVILLEIKONOSDIR ${TEMP}/OpticalCalibRefToLumIkonos) file(MAKE_DIRECTORY ${BLOSSEVILLEIKONOSDIR}) file(GLOB MTDATA ${OTB_DATA_LARGEINPUT_ROOT}/IKONOS/BLOSSEVILLE/*metadata.txt ${OTB_DATA_LARGEINPUT_ROOT}/IKONOS/BLOSSEVILLE/*pan*) file(COPY ${MTDATA} DESTINATION ${BLOSSEVILLEIKONOSDIR}) - otb_copy_rename(${BASELINE}/raTvLuminanceToReflectanceImageFilterAutoIkonos.tif ${BLOSSEVILLEIKONOSDIR}/po_2619900_pan_0000000.tif) + otb_copy_rename(${BASELINE}/raTvRadianceToReflectanceImageFilterAutoIkonos.tif ${BLOSSEVILLEIKONOSDIR}/po_2619900_pan_0000000.tif) - otb_add_test(NAME raTvReflectanceToLuminanceImageFilterAutoIkonos COMMAND otbOpticalCalibrationTestDriver - --compare-image ${EPSILON_12} ${BASELINE}/raTvImageToLuminanceImageFilterAutoIkonos.tif - ${BLOSSEVILLEIKONOSDIR}/raTvReflectanceToLuminanceImageFilterAutoIkonos.tif - otbReflectanceToLuminanceImageFilterAuto + otb_add_test(NAME raTvReflectanceToRadianceImageFilterAutoIkonos COMMAND otbOpticalCalibrationTestDriver + --compare-image ${EPSILON_12} ${BASELINE}/raTvImageToRadianceImageFilterAutoIkonos.tif + ${BLOSSEVILLEIKONOSDIR}/raTvReflectanceToRadianceImageFilterAutoIkonos.tif + otbReflectanceToRadianceImageFilterAuto ${BLOSSEVILLEIKONOSDIR}/po_2619900_pan_0000000.tif - ${BLOSSEVILLEIKONOSDIR}/raTvReflectanceToLuminanceImageFilterAutoIkonos.tif + ${BLOSSEVILLEIKONOSDIR}/raTvReflectanceToRadianceImageFilterAutoIkonos.tif ) set(TOULOUSEQBDIR ${TEMP}/OpticalCalibRefToLumQBXS) @@ -432,14 +432,14 @@ if(OTB_DATA_USE_LARGEINPUT AND OTB_DATA_ROOT) set(MTDATADIR ${OTB_DATA_LARGEINPUT_ROOT}/QUICKBIRD/TOULOUSE/000000128955_01_P001_MUL) file(GLOB MTDATA ${MTDATADIR}/*TIL ${MTDATADIR}/*RPB ${MTDATADIR}/*XML ${MTDATADIR}/*IMD) file(COPY ${MTDATA} DESTINATION ${TOULOUSEQBDIR}) - otb_copy_rename(${BASELINE}/raTvLuminanceToReflectanceImageFilterAutoQuickbirdXS.tif ${TOULOUSEQBDIR}/02APR01105228-M1BS-000000128955_01_P001.TIF) + otb_copy_rename(${BASELINE}/raTvRadianceToReflectanceImageFilterAutoQuickbirdXS.tif ${TOULOUSEQBDIR}/02APR01105228-M1BS-000000128955_01_P001.TIF) - otb_add_test(NAME raTvReflectanceToLuminanceImageFilterAutoQuickbirdXS COMMAND otbOpticalCalibrationTestDriver - --compare-image ${EPSILON_12} ${BASELINE}/raTvImageToLuminanceImageFilterAutoQuickbirdXS.tif - ${TOULOUSEQBDIR}/raTvReflectanceToLuminanceImageFilterAutoQuickbirdXS.tif - otbReflectanceToLuminanceImageFilterAuto + otb_add_test(NAME raTvReflectanceToRadianceImageFilterAutoQuickbirdXS COMMAND otbOpticalCalibrationTestDriver + --compare-image ${EPSILON_12} ${BASELINE}/raTvImageToRadianceImageFilterAutoQuickbirdXS.tif + ${TOULOUSEQBDIR}/raTvReflectanceToRadianceImageFilterAutoQuickbirdXS.tif + otbReflectanceToRadianceImageFilterAuto ${TOULOUSEQBDIR}/02APR01105228-M1BS-000000128955_01_P001.TIF - ${TOULOUSEQBDIR}/raTvReflectanceToLuminanceImageFilterAutoQuickbirdXS.tif + ${TOULOUSEQBDIR}/raTvReflectanceToRadianceImageFilterAutoQuickbirdXS.tif ) set(ROMEWV2DIR ${TEMP}/OpticalCalibRefToLumWv2MULTI) @@ -447,14 +447,14 @@ if(OTB_DATA_USE_LARGEINPUT AND OTB_DATA_ROOT) set(MTDATADIR ${OTB_DATA_LARGEINPUT_ROOT}/WORLDVIEW2/ROME/WV-2_standard_8band_bundle_16bit/052298844010_01_P001_MUL) file(GLOB MTDATA ${MTDATADIR}/*TIL ${MTDATADIR}/*RPB ${MTDATADIR}/*XML ${MTDATADIR}/*IMD) file(COPY ${MTDATA} DESTINATION ${ROMEWV2DIR}) - otb_copy_rename(${BASELINE}/raTvLuminanceToReflectanceImageFilterAutoWV2Multi.tif ${ROMEWV2DIR}/09DEC10103019-M2AS-052298844010_01_P001.TIF) + otb_copy_rename(${BASELINE}/raTvRadianceToReflectanceImageFilterAutoWV2Multi.tif ${ROMEWV2DIR}/09DEC10103019-M2AS-052298844010_01_P001.TIF) - otb_add_test(NAME raTvReflectanceToLuminanceImageFilterAutoWV2MULTI COMMAND otbOpticalCalibrationTestDriver - --compare-image ${EPSILON_12} ${BASELINE}/raTvImageToLuminanceImageFilterAutoWV2Multi.tif - ${ROMEWV2DIR}/raTvReflectanceToLuminanceImageFilterAutoWV2Multi.tif - otbReflectanceToLuminanceImageFilterAuto + otb_add_test(NAME raTvReflectanceToRadianceImageFilterAutoWV2MULTI COMMAND otbOpticalCalibrationTestDriver + --compare-image ${EPSILON_12} ${BASELINE}/raTvImageToRadianceImageFilterAutoWV2Multi.tif + ${ROMEWV2DIR}/raTvReflectanceToRadianceImageFilterAutoWV2Multi.tif + otbReflectanceToRadianceImageFilterAuto ${ROMEWV2DIR}/09DEC10103019-M2AS-052298844010_01_P001.TIF - ${ROMEWV2DIR}/raTvReflectanceToLuminanceImageFilterAutoWV2Multi.tif + ${ROMEWV2DIR}/raTvReflectanceToRadianceImageFilterAutoWV2Multi.tif ) endif() @@ -621,12 +621,12 @@ otb_add_test(NAME raTvRomaniaImageToReflectance COMMAND otbOpticalCalibrationTes 0.9889145564708814 #= sqrt(0.977952) d/d0 corresponding to the date 03/05 ) -otb_add_test(NAME raTvLuminanceToReflectanceImageFilterDayMonth COMMAND otbOpticalCalibrationTestDriver - --compare-image ${EPSILON_12} ${BASELINE}/raTvLuminanceToReflectanceImageFilter.tif - ${TEMP}/raTvLuminanceToReflectanceImageFilterDayMonth.tif - otbLuminanceToReflectanceImageFilter +otb_add_test(NAME raTvRadianceToReflectanceImageFilterDayMonth COMMAND otbOpticalCalibrationTestDriver + --compare-image ${EPSILON_12} ${BASELINE}/raTvRadianceToReflectanceImageFilter.tif + ${TEMP}/raTvRadianceToReflectanceImageFilterDayMonth.tif + otbRadianceToReflectanceImageFilter ${INPUTDATA}/verySmallFSATSW.tif - ${TEMP}/raTvLuminanceToReflectanceImageFilterDayMonth.tif + ${TEMP}/raTvRadianceToReflectanceImageFilterDayMonth.tif 0.2 #radius 10 #channel 1 illumination 20 #channel 2 illumination @@ -636,12 +636,12 @@ otb_add_test(NAME raTvLuminanceToReflectanceImageFilterDayMonth COMMAND otbOptic 5 #month ) -otb_add_test(NAME raTvLuminanceToReflectanceImageFilter COMMAND otbOpticalCalibrationTestDriver - --compare-image ${EPSILON_12} ${BASELINE}/raTvLuminanceToReflectanceImageFilterDsol.tif - ${TEMP}/raTvLuminanceToReflectanceImageFilterDsol.tif - otbLuminanceToReflectanceImageFilter +otb_add_test(NAME raTvRadianceToReflectanceImageFilter COMMAND otbOpticalCalibrationTestDriver + --compare-image ${EPSILON_12} ${BASELINE}/raTvRadianceToReflectanceImageFilterDsol.tif + ${TEMP}/raTvRadianceToReflectanceImageFilterDsol.tif + otbRadianceToReflectanceImageFilter ${INPUTDATA}/verySmallFSATSW.tif - ${TEMP}/raTvLuminanceToReflectanceImageFilterDsol.tif + ${TEMP}/raTvRadianceToReflectanceImageFilterDsol.tif 0.2 #radius 10 #channel 1 illumination 20 #channel 2 illumination @@ -748,60 +748,60 @@ otb_add_test(NAME raTuImageMetadataCorrectionParametersNew COMMAND otbOpticalCal otbImageMetadataCorrectionParametersNew ) -otb_add_test(NAME raTvImageToLuminanceImageFilterAutoFORMOSAT COMMAND otbOpticalCalibrationTestDriver - --compare-image ${EPSILON_12} ${BASELINE}/raTvImageToLuminanceImageFilterAutoFormosat.tif - ${TEMP}/raTvImageToLuminanceImageFilterAutoFormosat.img - otbImageToLuminanceImageFilterAuto +otb_add_test(NAME raTvImageToRadianceImageFilterAutoFORMOSAT COMMAND otbOpticalCalibrationTestDriver + --compare-image ${EPSILON_12} ${BASELINE}/raTvImageToRadianceImageFilterAutoFormosat.tif + ${TEMP}/raTvImageToRadianceImageFilterAutoFormosat.img + otbImageToRadianceImageFilterAuto LARGEINPUT{FORMOSAT/Sudouest_20071013_MS_fmsat/IMAGERY.TIF} - ${TEMP}/raTvImageToLuminanceImageFilterAutoFormosat.img + ${TEMP}/raTvImageToRadianceImageFilterAutoFormosat.img ) -otb_add_test(NAME raTvImageToLuminanceImageFilterAutoIkonos COMMAND otbOpticalCalibrationTestDriver - --compare-image ${EPSILON_12} ${BASELINE}/raTvImageToLuminanceImageFilterAutoIkonos.tif - ${TEMP}/raTvImageToLuminanceImageFilterAutoIkonos.tif - otbImageToLuminanceImageFilterAuto +otb_add_test(NAME raTvImageToRadianceImageFilterAutoIkonos COMMAND otbOpticalCalibrationTestDriver + --compare-image ${EPSILON_12} ${BASELINE}/raTvImageToRadianceImageFilterAutoIkonos.tif + ${TEMP}/raTvImageToRadianceImageFilterAutoIkonos.tif + otbImageToRadianceImageFilterAuto LARGEINPUT{IKONOS/BLOSSEVILLE/po_2619900_pan_0000000.tif} - ${TEMP}/raTvImageToLuminanceImageFilterAutoIkonos.tif + ${TEMP}/raTvImageToRadianceImageFilterAutoIkonos.tif ) -otb_add_test(NAME raTvImageToLuminanceImageFilterAutoQuickbirdXS COMMAND otbOpticalCalibrationTestDriver - --compare-image ${EPSILON_12} ${BASELINE}/raTvImageToLuminanceImageFilterAutoQuickbirdXS.tif - ${TEMP}/raTvImageToLuminanceImageFilterAutoQuickbirdXS.tif - otbImageToLuminanceImageFilterAuto +otb_add_test(NAME raTvImageToRadianceImageFilterAutoQuickbirdXS COMMAND otbOpticalCalibrationTestDriver + --compare-image ${EPSILON_12} ${BASELINE}/raTvImageToRadianceImageFilterAutoQuickbirdXS.tif + ${TEMP}/raTvImageToRadianceImageFilterAutoQuickbirdXS.tif + otbImageToRadianceImageFilterAuto LARGEINPUT{QUICKBIRD/TOULOUSE/000000128955_01_P001_MUL/02APR01105228-M1BS-000000128955_01_P001.TIF} - ${TEMP}/raTvImageToLuminanceImageFilterAutoQuickbirdXS.tif + ${TEMP}/raTvImageToRadianceImageFilterAutoQuickbirdXS.tif ) -otb_add_test(NAME raTvImageToLuminanceImageFilterAutoQuickbirdPAN COMMAND otbOpticalCalibrationTestDriver - --compare-image ${EPSILON_12} ${BASELINE}/raTvImageToLuminanceImageFilterAutoQuickbirdPAN.tif - ${TEMP}/raTvImageToLuminanceImageFilterAutoQuickbirdPAN.tif - otbImageToLuminanceImageFilterAuto +otb_add_test(NAME raTvImageToRadianceImageFilterAutoQuickbirdPAN COMMAND otbOpticalCalibrationTestDriver + --compare-image ${EPSILON_12} ${BASELINE}/raTvImageToRadianceImageFilterAutoQuickbirdPAN.tif + ${TEMP}/raTvImageToRadianceImageFilterAutoQuickbirdPAN.tif + otbImageToRadianceImageFilterAuto LARGEINPUT{QUICKBIRD/TOULOUSE/000000128955_01_P001_PAN/02APR01105228-P1BS-000000128955_01_P001.TIF} - ${TEMP}/raTvImageToLuminanceImageFilterAutoQuickbirdPAN.tif + ${TEMP}/raTvImageToRadianceImageFilterAutoQuickbirdPAN.tif ) -otb_add_test(NAME raTvImageToLuminanceImageFilterAutoWV2MULTI COMMAND otbOpticalCalibrationTestDriver - --compare-image ${EPSILON_12} ${BASELINE}/raTvImageToLuminanceImageFilterAutoWV2Multi.tif - ${TEMP}/raTvImageToLuminanceImageFilterAutoWV2Multi.tif - otbImageToLuminanceImageFilterAuto +otb_add_test(NAME raTvImageToRadianceImageFilterAutoWV2MULTI COMMAND otbOpticalCalibrationTestDriver + --compare-image ${EPSILON_12} ${BASELINE}/raTvImageToRadianceImageFilterAutoWV2Multi.tif + ${TEMP}/raTvImageToRadianceImageFilterAutoWV2Multi.tif + otbImageToRadianceImageFilterAuto LARGEINPUT{WORLDVIEW2/ROME/WV-2_standard_8band_bundle_16bit/052298844010_01_P001_MUL/09DEC10103019-M2AS-052298844010_01_P001.TIF} - ${TEMP}/raTvImageToLuminanceImageFilterAutoWV2Multi.tif + ${TEMP}/raTvImageToRadianceImageFilterAutoWV2Multi.tif ) -otb_add_test(NAME raTvImageToLuminanceImageFilterAutoSpot5 COMMAND otbOpticalCalibrationTestDriver - --compare-image ${EPSILON_12} ${BASELINE}/raTvImageToLuminanceImageFilterAutoSpot5.tif - ${TEMP}/raTvImageToLuminanceImageFilterAutoSpot5.img - otbImageToLuminanceImageFilterAuto +otb_add_test(NAME raTvImageToRadianceImageFilterAutoSpot5 COMMAND otbOpticalCalibrationTestDriver + --compare-image ${EPSILON_12} ${BASELINE}/raTvImageToRadianceImageFilterAutoSpot5.tif + ${TEMP}/raTvImageToRadianceImageFilterAutoSpot5.img + otbImageToRadianceImageFilterAuto LARGEINPUT{SPOT5/TEHERAN/IMAGERY.TIF} - ${TEMP}/raTvImageToLuminanceImageFilterAutoSpot5.img + ${TEMP}/raTvImageToRadianceImageFilterAutoSpot5.img ) -otb_add_test(NAME raTvImageToLuminanceImageFilterAutoWV2PAN COMMAND otbOpticalCalibrationTestDriver - --compare-image ${EPSILON_12} ${BASELINE}/raTvImageToLuminanceImageFilterAutoWV2PAN.tif - ${TEMP}/raTvImageToLuminanceImageFilterAutoWV2PAN.tif - otbImageToLuminanceImageFilterAuto +otb_add_test(NAME raTvImageToRadianceImageFilterAutoWV2PAN COMMAND otbOpticalCalibrationTestDriver + --compare-image ${EPSILON_12} ${BASELINE}/raTvImageToRadianceImageFilterAutoWV2PAN.tif + ${TEMP}/raTvImageToRadianceImageFilterAutoWV2PAN.tif + otbImageToRadianceImageFilterAuto LARGEINPUT{WORLDVIEW2/ROME/WV-2_standard_8band_bundle_16bit/052298844010_01_P001_PAN/09DEC10103019-P2AS-052298844010_01_P001.TIF} - ${TEMP}/raTvImageToLuminanceImageFilterAutoWV2PAN.tif + ${TEMP}/raTvImageToRadianceImageFilterAutoWV2PAN.tif ) otb_add_test(NAME raTvAtmosphericCorrectionSequencementTest COMMAND otbOpticalCalibrationTestDriver @@ -860,11 +860,11 @@ otb_add_test(NAME raTvSurfaceAdjacencyEffectCorrectionSchemeFilter COMMAND otbOp ${TEMP}/raTvSurfaceAdjacencyEffect6SCorrectionSchemeFilterOutput6SVallues.txt ) -otb_add_test(NAME raTvLuminanceToImageImageFilter COMMAND otbOpticalCalibrationTestDriver +otb_add_test(NAME raTvRadianceToImageImageFilter COMMAND otbOpticalCalibrationTestDriver --compare-image ${EPSILON_12} ${INPUTDATA}/verySmallFSATSW.tif ${TEMP}/raTvverySmallFSATSWImageFilter.tif - otbLuminanceToImageImageFilter - ${BASELINE}/raTvImageToLuminanceImageFilter.tif + otbRadianceToImageImageFilter + ${BASELINE}/raTvImageToRadianceImageFilter.tif ${TEMP}/raTvverySmallFSATSWImageFilter.tif 10 #channel 1 alpha 20 #channel 2 alpha @@ -876,11 +876,11 @@ otb_add_test(NAME raTvLuminanceToImageImageFilter COMMAND otbOpticalCalibrationT 4 #channel 4 beta ) -otb_add_test(NAME raTvReflectanceToLuminanceImageFilter COMMAND otbOpticalCalibrationTestDriver +otb_add_test(NAME raTvReflectanceToRadianceImageFilter COMMAND otbOpticalCalibrationTestDriver --compare-image ${EPSILON_12} ${INPUTDATA}/verySmallFSATSW.tif ${TEMP}/raTvverySmallFSATSWImageFilterDsol.tif - otbReflectanceToLuminanceImageFilter - ${BASELINE}/raTvLuminanceToReflectanceImageFilterDsol.tif + otbReflectanceToRadianceImageFilter + ${BASELINE}/raTvRadianceToReflectanceImageFilterDsol.tif ${TEMP}/raTvverySmallFSATSWImageFilterDsol.tif 0.2 #radius 10 #channel 1 illumination @@ -890,11 +890,11 @@ otb_add_test(NAME raTvReflectanceToLuminanceImageFilter COMMAND otbOpticalCalibr 0.9923885328 ) -otb_add_test(NAME raTvReflectanceToLuminanceImageFilterDayMonth COMMAND otbOpticalCalibrationTestDriver +otb_add_test(NAME raTvReflectanceToRadianceImageFilterDayMonth COMMAND otbOpticalCalibrationTestDriver --compare-image ${EPSILON_12} ${INPUTDATA}/verySmallFSATSW.tif ${TEMP}/raTvverySmallFSATSWImageFilterDayMonth.tif - otbReflectanceToLuminanceImageFilter - ${BASELINE}/raTvLuminanceToReflectanceImageFilter.tif + otbReflectanceToRadianceImageFilter + ${BASELINE}/raTvRadianceToReflectanceImageFilter.tif ${TEMP}/raTvverySmallFSATSWImageFilterDayMonth.tif 0.2 #radius 10 #channel 1 illumination @@ -905,12 +905,12 @@ otb_add_test(NAME raTvReflectanceToLuminanceImageFilterDayMonth COMMAND otbOptic 5 #month ) -otb_add_test(NAME raTvImageToLuminanceImageFilter COMMAND otbOpticalCalibrationTestDriver - --compare-image ${EPSILON_12} ${BASELINE}/raTvImageToLuminanceImageFilter.tif - ${TEMP}/raTvImageToLuminanceImageFilter.tif - otbImageToLuminanceImageFilter +otb_add_test(NAME raTvImageToRadianceImageFilter COMMAND otbOpticalCalibrationTestDriver + --compare-image ${EPSILON_12} ${BASELINE}/raTvImageToRadianceImageFilter.tif + ${TEMP}/raTvImageToRadianceImageFilter.tif + otbImageToRadianceImageFilter ${INPUTDATA}/verySmallFSATSW.tif - ${TEMP}/raTvImageToLuminanceImageFilter.tif + ${TEMP}/raTvImageToRadianceImageFilter.tif 10 #channel 1 alpha 20 #channel 2 alpha 30 #channel 3 alpha diff --git a/Modules/Radiometry/OpticalCalibration/test/otbAtmosphericCorrectionSequencement.cxx b/Modules/Radiometry/OpticalCalibration/test/otbAtmosphericCorrectionSequencement.cxx index 5603540ec5174a4f2c39ae927ecf1978ab30816a..0e1d8a94c3b8e30b856ff83f71531985bdb13dbf 100644 --- a/Modules/Radiometry/OpticalCalibration/test/otbAtmosphericCorrectionSequencement.cxx +++ b/Modules/Radiometry/OpticalCalibration/test/otbAtmosphericCorrectionSequencement.cxx @@ -20,8 +20,8 @@ -#include "otbImageToLuminanceImageFilter.h" -#include "otbLuminanceToReflectanceImageFilter.h" +#include "otbImageToRadianceImageFilter.h" +#include "otbRadianceToReflectanceImageFilter.h" #include "otbReflectanceToSurfaceReflectanceImageFilter.h" #include "otbSurfaceAdjacencyEffectCorrectionSchemeFilter.h" @@ -63,9 +63,9 @@ int otbAtmosphericCorrectionSequencementTest(int argc, char *argv[]) //------------------------------- - typedef otb::ImageToLuminanceImageFilter<ImageType, ImageType> - ImageToLuminanceImageFilterType; - typedef ImageToLuminanceImageFilterType::VectorType VectorType; + typedef otb::ImageToRadianceImageFilter<ImageType, ImageType> + ImageToRadianceImageFilterType; + typedef ImageToRadianceImageFilterType::VectorType VectorType; VectorType alpha(nbOfComponent); VectorType beta(nbOfComponent); @@ -84,16 +84,16 @@ int otbAtmosphericCorrectionSequencementTest(int argc, char *argv[]) } fin.close(); - ImageToLuminanceImageFilterType::Pointer filterImageToLuminance = ImageToLuminanceImageFilterType::New(); - filterImageToLuminance->SetAlpha(alpha); - filterImageToLuminance->SetBeta(beta); - filterImageToLuminance->SetInput(reader->GetOutput()); + ImageToRadianceImageFilterType::Pointer filterImageToRadiance = ImageToRadianceImageFilterType::New(); + filterImageToRadiance->SetAlpha(alpha); + filterImageToRadiance->SetBeta(beta); + filterImageToRadiance->SetInput(reader->GetOutput()); //------------------------------- - typedef otb::LuminanceToReflectanceImageFilter<ImageType, ImageType> - LuminanceToReflectanceImageFilterType; + typedef otb::RadianceToReflectanceImageFilter<ImageType, ImageType> + RadianceToReflectanceImageFilterType; - typedef LuminanceToReflectanceImageFilterType::VectorType VectorType; + typedef RadianceToReflectanceImageFilterType::VectorType VectorType; VectorType solarIllumination(nbOfComponent); solarIllumination.Fill(0); @@ -107,16 +107,16 @@ int otbAtmosphericCorrectionSequencementTest(int argc, char *argv[]) } fin.close(); - LuminanceToReflectanceImageFilterType::Pointer filterLuminanceToReflectance = - LuminanceToReflectanceImageFilterType::New(); + RadianceToReflectanceImageFilterType::Pointer filterRadianceToReflectance = + RadianceToReflectanceImageFilterType::New(); const int day(atoi(argv[5])); const int month(atoi(argv[6])); - filterLuminanceToReflectance->SetZenithalSolarAngle(static_cast<double>(atof(argv[4]))); - filterLuminanceToReflectance->SetDay(day); - filterLuminanceToReflectance->SetMonth(month); - filterLuminanceToReflectance->SetSolarIllumination(solarIllumination); - filterLuminanceToReflectance->SetInput(filterImageToLuminance->GetOutput()); + filterRadianceToReflectance->SetZenithalSolarAngle(static_cast<double>(atof(argv[4]))); + filterRadianceToReflectance->SetDay(day); + filterRadianceToReflectance->SetMonth(month); + filterRadianceToReflectance->SetSolarIllumination(solarIllumination); + filterRadianceToReflectance->SetInput(filterImageToRadiance->GetOutput()); //------------------------------- /*typedef otb::RadiometryCorrectionParametersToAtmosphericRadiativeTerms RadiometryCorrectionParametersToRadiativeTermsType; @@ -189,7 +189,7 @@ int otbAtmosphericCorrectionSequencementTest(int argc, char *argv[]) fin.close(); // Set parameters - /*dataAtmosphericCorrectionParameters->SetSolarZenithalAngle(filterLuminanceToReflectance->GetZenithalSolarAngle()); + /*dataAtmosphericCorrectionParameters->SetSolarZenithalAngle(filterRadianceToReflectance->GetZenithalSolarAngle()); dataAtmosphericCorrectionParameters->SetSolarAzimutalAngle(static_cast<double>(atof(argv[8]))); dataAtmosphericCorrectionParameters->SetViewingZenithalAngle(static_cast<double>(atof(argv[9]))); dataAtmosphericCorrectionParameters->SetViewingAzimutalAngle(static_cast<double>(atof(argv[10]))); @@ -208,7 +208,7 @@ int otbAtmosphericCorrectionSequencementTest(int argc, char *argv[]) filterAtmosphericCorrectionParametersTo6SRadiativeTerms->SetInput(dataAtmosphericCorrectionParameters); filterAtmosphericCorrectionParametersTo6SRadiativeTerms->Update(); */ - paramAcqui->SetSolarZenithalAngle(filterLuminanceToReflectance->GetZenithalSolarAngle()); + paramAcqui->SetSolarZenithalAngle(filterRadianceToReflectance->GetZenithalSolarAngle()); paramAcqui->SetSolarAzimutalAngle(static_cast<double>(atof(argv[8]))); paramAcqui->SetViewingZenithalAngle(static_cast<double>(atof(argv[9]))); paramAcqui->SetViewingAzimutalAngle(static_cast<double>(atof(argv[10]))); @@ -231,7 +231,7 @@ int otbAtmosphericCorrectionSequencementTest(int argc, char *argv[]) ReflectanceToSurfaceReflectanceImageFilterType::New(); filterReflectanceToSurfaceReflectanceImageFilter->SetAtmosphericRadiativeTerms(radiative); - filterReflectanceToSurfaceReflectanceImageFilter->SetInput(filterLuminanceToReflectance->GetOutput()); + filterReflectanceToSurfaceReflectanceImageFilter->SetInput(filterRadianceToReflectance->GetOutput()); //------------------------------- typedef otb::SurfaceAdjacencyEffectCorrectionSchemeFilter<ImageType, diff --git a/Modules/Radiometry/OpticalCalibration/test/otbImageToLuminanceImageFilter.cxx b/Modules/Radiometry/OpticalCalibration/test/otbImageToRadianceImageFilter.cxx similarity index 84% rename from Modules/Radiometry/OpticalCalibration/test/otbImageToLuminanceImageFilter.cxx rename to Modules/Radiometry/OpticalCalibration/test/otbImageToRadianceImageFilter.cxx index ff31be6ee0bede01f03e50e013a5971ee25f157a..130e08b2af3bae75ef839a0fa0827bfb700616fd 100644 --- a/Modules/Radiometry/OpticalCalibration/test/otbImageToLuminanceImageFilter.cxx +++ b/Modules/Radiometry/OpticalCalibration/test/otbImageToRadianceImageFilter.cxx @@ -20,11 +20,11 @@ #include "itkMacro.h" -#include "otbImageToLuminanceImageFilter.h" +#include "otbImageToRadianceImageFilter.h" #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbImageToLuminanceImageFilter(int itkNotUsed(argc), char * argv[]) +int otbImageToRadianceImageFilter(int itkNotUsed(argc), char * argv[]) { const char * inputFileName = argv[1]; const char * outputFileName = argv[2]; @@ -35,8 +35,8 @@ int otbImageToLuminanceImageFilter(int itkNotUsed(argc), char * argv[]) typedef otb::VectorImage<PixelType, Dimension> OutputImageType; typedef otb::ImageFileReader<InputImageType> ReaderType; typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::ImageToLuminanceImageFilter<InputImageType, OutputImageType> ImageToLuminanceImageFilterType; - typedef ImageToLuminanceImageFilterType::VectorType VectorType; + typedef otb::ImageToRadianceImageFilter<InputImageType, OutputImageType> ImageToRadianceImageFilterType; + typedef ImageToRadianceImageFilterType::VectorType VectorType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); @@ -58,7 +58,7 @@ int otbImageToLuminanceImageFilter(int itkNotUsed(argc), char * argv[]) } // Instantiating object - ImageToLuminanceImageFilterType::Pointer filter = ImageToLuminanceImageFilterType::New(); + ImageToRadianceImageFilterType::Pointer filter = ImageToRadianceImageFilterType::New(); filter->SetAlpha(alpha); filter->SetBeta(beta); filter->SetInput(reader->GetOutput()); diff --git a/Modules/Radiometry/OpticalCalibration/test/otbImageToLuminanceImageFilterAuto.cxx b/Modules/Radiometry/OpticalCalibration/test/otbImageToRadianceImageFilterAuto.cxx similarity index 86% rename from Modules/Radiometry/OpticalCalibration/test/otbImageToLuminanceImageFilterAuto.cxx rename to Modules/Radiometry/OpticalCalibration/test/otbImageToRadianceImageFilterAuto.cxx index fccdd66e52d30d250bc835bd6aa07d59a611fb82..a5225ac94c108809cac4f8166e37f9778957fddf 100644 --- a/Modules/Radiometry/OpticalCalibration/test/otbImageToLuminanceImageFilterAuto.cxx +++ b/Modules/Radiometry/OpticalCalibration/test/otbImageToRadianceImageFilterAuto.cxx @@ -19,13 +19,13 @@ */ -#include "otbImageToLuminanceImageFilter.h" +#include "otbImageToRadianceImageFilter.h" #include "otbImageFileReader.h" #include "otbImageFileWriter.h" #include "otbMultiChannelExtractROI.h" //Test the retrieval of parameters from the image metadata -int otbImageToLuminanceImageFilterAuto(int itkNotUsed(argc), char * argv[]) +int otbImageToRadianceImageFilterAuto(int itkNotUsed(argc), char * argv[]) { const char * inputFileName = argv[1]; const char * outputFileName = argv[2]; @@ -36,7 +36,7 @@ int otbImageToLuminanceImageFilterAuto(int itkNotUsed(argc), char * argv[]) typedef otb::VectorImage<PixelType, Dimension> OutputImageType; typedef otb::ImageFileReader<InputImageType> ReaderType; typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::ImageToLuminanceImageFilter<InputImageType, OutputImageType> ImageToLuminanceImageFilterType; + typedef otb::ImageToRadianceImageFilter<InputImageType, OutputImageType> ImageToRadianceImageFilterType; typedef otb::MultiChannelExtractROI<PixelType, PixelType> RoiFilterType; ReaderType::Pointer reader = ReaderType::New(); @@ -46,7 +46,7 @@ int otbImageToLuminanceImageFilterAuto(int itkNotUsed(argc), char * argv[]) reader->UpdateOutputInformation(); // Instantiating object - ImageToLuminanceImageFilterType::Pointer filter = ImageToLuminanceImageFilterType::New(); + ImageToRadianceImageFilterType::Pointer filter = ImageToRadianceImageFilterType::New(); filter->SetInput(reader->GetOutput()); RoiFilterType::Pointer roiFilter = RoiFilterType::New(); diff --git a/Modules/Radiometry/OpticalCalibration/test/otbImageToLuminanceImageFilterNew.cxx b/Modules/Radiometry/OpticalCalibration/test/otbImageToRadianceImageFilterNew.cxx similarity index 75% rename from Modules/Radiometry/OpticalCalibration/test/otbImageToLuminanceImageFilterNew.cxx rename to Modules/Radiometry/OpticalCalibration/test/otbImageToRadianceImageFilterNew.cxx index ebc20d764e3e10c54cb42ec27cf845d335c367de..83086a2c3c69fcb25c04d367a35208cd0c810035 100644 --- a/Modules/Radiometry/OpticalCalibration/test/otbImageToLuminanceImageFilterNew.cxx +++ b/Modules/Radiometry/OpticalCalibration/test/otbImageToRadianceImageFilterNew.cxx @@ -20,18 +20,18 @@ #include "itkMacro.h" -#include "otbImageToLuminanceImageFilter.h" +#include "otbImageToRadianceImageFilter.h" -int otbImageToLuminanceImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) +int otbImageToRadianceImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { const unsigned int Dimension = 2; typedef double PixelType; typedef otb::VectorImage<PixelType, Dimension> InputImageType; - typedef otb::ImageToLuminanceImageFilter<InputImageType, InputImageType> ImageToLuminanceImageFilterType; + typedef otb::ImageToRadianceImageFilter<InputImageType, InputImageType> ImageToRadianceImageFilterType; // Instantiating object - ImageToLuminanceImageFilterType::Pointer filter = ImageToLuminanceImageFilterType::New(); + ImageToRadianceImageFilterType::Pointer filter = ImageToRadianceImageFilterType::New(); std::cout << filter << std::endl; diff --git a/Modules/Radiometry/OpticalCalibration/test/otbOpticalCalibrationTestDriver.cxx b/Modules/Radiometry/OpticalCalibration/test/otbOpticalCalibrationTestDriver.cxx index 244ebdc5c71e0199f4da97eeb262ce58cd69c877..d9d6d93a700f8d18e3bc0393602c9bac1432f456 100644 --- a/Modules/Radiometry/OpticalCalibration/test/otbOpticalCalibrationTestDriver.cxx +++ b/Modules/Radiometry/OpticalCalibration/test/otbOpticalCalibrationTestDriver.cxx @@ -26,14 +26,14 @@ void RegisterTests() REGISTER_TEST(otbSpectralSensitivityReaderTest); REGISTER_TEST(otbSpectralSensitivityReaderGenericTest); REGISTER_TEST(otbReflectanceToImageImageFilter); - REGISTER_TEST(otbReflectanceToLuminanceImageFilterNew); - REGISTER_TEST(otbLuminanceToReflectanceImageFilterNew); - REGISTER_TEST(otbLuminanceToReflectanceImageFilterAuto); - REGISTER_TEST(otbImageToLuminanceImageFilterNew); + REGISTER_TEST(otbReflectanceToRadianceImageFilterNew); + REGISTER_TEST(otbRadianceToReflectanceImageFilterNew); + REGISTER_TEST(otbRadianceToReflectanceImageFilterAuto); + REGISTER_TEST(otbImageToRadianceImageFilterNew); REGISTER_TEST(otbRadiometryCorrectionParametersToAtmosphericRadiativeTermsNew); - REGISTER_TEST(otbLuminanceToImageImageFilterAuto); - REGISTER_TEST(otbLuminanceToImageImageFilterNew); - REGISTER_TEST(otbReflectanceToLuminanceImageFilterAuto); + REGISTER_TEST(otbRadianceToImageImageFilterAuto); + REGISTER_TEST(otbRadianceToImageImageFilterNew); + REGISTER_TEST(otbReflectanceToRadianceImageFilterAuto); REGISTER_TEST(otbAeronetExtractDataBadData); REGISTER_TEST(otbRomaniaReflectanceToRomaniaSurfaceReflectanceImageFilter); REGISTER_TEST(otbRadiometryCorrectionParametersToAtmosphericRadiativeTerms); @@ -47,7 +47,7 @@ void RegisterTests() REGISTER_TEST(otbAtmosphericRadiativeTermsSingleChannelNew); REGISTER_TEST(otbAtmosphericRadiativeTermsTest); REGISTER_TEST(otbImageToReflectanceImageFilter); - REGISTER_TEST(otbLuminanceToReflectanceImageFilter); + REGISTER_TEST(otbRadianceToReflectanceImageFilter); REGISTER_TEST(otbReflectanceToImageImageFilterAuto); REGISTER_TEST(otbAeronetNew); REGISTER_TEST(otbAeronetExtractData); @@ -55,13 +55,13 @@ void RegisterTests() REGISTER_TEST(otbReflectanceToSurfaceReflectanceImageFilterTest); REGISTER_TEST(otbReflectanceToSurfaceReflectanceImageFilterTest2); REGISTER_TEST(otbImageMetadataCorrectionParametersNew); - REGISTER_TEST(otbImageToLuminanceImageFilterAuto); + REGISTER_TEST(otbImageToRadianceImageFilterAuto); REGISTER_TEST(otbAtmosphericCorrectionSequencementTest); REGISTER_TEST(otbSIXSTraitsTest); REGISTER_TEST(otbSIXSTraitsComputeAtmosphericParametersTest); REGISTER_TEST(otbReflectanceToImageImageFilterNew); REGISTER_TEST(otbSurfaceAdjacencyEffectCorrectionSchemeFilter); - REGISTER_TEST(otbLuminanceToImageImageFilter); - REGISTER_TEST(otbReflectanceToLuminanceImageFilter); - REGISTER_TEST(otbImageToLuminanceImageFilter); + REGISTER_TEST(otbRadianceToImageImageFilter); + REGISTER_TEST(otbReflectanceToRadianceImageFilter); + REGISTER_TEST(otbImageToRadianceImageFilter); } diff --git a/Modules/Radiometry/OpticalCalibration/test/otbLuminanceToImageImageFilter.cxx b/Modules/Radiometry/OpticalCalibration/test/otbRadianceToImageImageFilter.cxx similarity index 84% rename from Modules/Radiometry/OpticalCalibration/test/otbLuminanceToImageImageFilter.cxx rename to Modules/Radiometry/OpticalCalibration/test/otbRadianceToImageImageFilter.cxx index 1b75114f867aced692181352347a76525e8e1926..3753231f96dd13597a2fefe1abbe94a29deec28d 100644 --- a/Modules/Radiometry/OpticalCalibration/test/otbLuminanceToImageImageFilter.cxx +++ b/Modules/Radiometry/OpticalCalibration/test/otbRadianceToImageImageFilter.cxx @@ -20,13 +20,13 @@ #include "itkMacro.h" -#include "otbLuminanceToImageImageFilter.h" +#include "otbRadianceToImageImageFilter.h" #include "otbVectorImage.h" #include "otbImageFileReader.h" #include "otbImageFileWriter.h" #include "itkVariableLengthVector.h" -int otbLuminanceToImageImageFilter(int itkNotUsed(argc), char * argv[]) +int otbRadianceToImageImageFilter(int itkNotUsed(argc), char * argv[]) { const char * inputFileName = argv[1]; const char * outputFileName = argv[2]; @@ -37,8 +37,8 @@ int otbLuminanceToImageImageFilter(int itkNotUsed(argc), char * argv[]) typedef otb::VectorImage<PixelType, Dimension> OutputImageType; typedef otb::ImageFileReader<InputImageType> ReaderType; typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::LuminanceToImageImageFilter<InputImageType, OutputImageType> LuminanceToImageImageFilterType; - typedef LuminanceToImageImageFilterType::VectorType VectorType; + typedef otb::RadianceToImageImageFilter<InputImageType, OutputImageType> RadianceToImageImageFilterType; + typedef RadianceToImageImageFilterType::VectorType VectorType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); @@ -60,7 +60,7 @@ int otbLuminanceToImageImageFilter(int itkNotUsed(argc), char * argv[]) } // Instantiating object - LuminanceToImageImageFilterType::Pointer filter = LuminanceToImageImageFilterType::New(); + RadianceToImageImageFilterType::Pointer filter = RadianceToImageImageFilterType::New(); filter->SetAlpha(alpha); filter->SetBeta(beta); filter->SetInput(reader->GetOutput()); diff --git a/Modules/Radiometry/OpticalCalibration/test/otbLuminanceToImageImageFilterAuto.cxx b/Modules/Radiometry/OpticalCalibration/test/otbRadianceToImageImageFilterAuto.cxx similarity index 88% rename from Modules/Radiometry/OpticalCalibration/test/otbLuminanceToImageImageFilterAuto.cxx rename to Modules/Radiometry/OpticalCalibration/test/otbRadianceToImageImageFilterAuto.cxx index a7d7c2fde19531672ffbfe767869e0f1db93750d..55dfb6d0266d80e861bb998e4dc5e88bd8b6d419 100644 --- a/Modules/Radiometry/OpticalCalibration/test/otbLuminanceToImageImageFilterAuto.cxx +++ b/Modules/Radiometry/OpticalCalibration/test/otbRadianceToImageImageFilterAuto.cxx @@ -19,13 +19,13 @@ */ -#include "otbLuminanceToImageImageFilter.h" +#include "otbRadianceToImageImageFilter.h" #include "otbImageFileReader.h" #include "otbImageFileWriter.h" #include "otbMultiChannelExtractROI.h" //Test the retrieval of parameters from the image metadata -int otbLuminanceToImageImageFilterAuto(int itkNotUsed(argc), char * argv[]) +int otbRadianceToImageImageFilterAuto(int itkNotUsed(argc), char * argv[]) { const char * inputFileName = argv[1]; const char * inputFileName2 = argv[2]; @@ -38,7 +38,7 @@ int otbLuminanceToImageImageFilterAuto(int itkNotUsed(argc), char * argv[]) typedef otb::VectorImage<PixelType, Dimension> OutputImageType; typedef otb::ImageFileReader<InputImageType> ReaderType; typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::LuminanceToImageImageFilter<InputImageType, OutputImageType> LuminanceToImageImageFilterType; + typedef otb::RadianceToImageImageFilter<InputImageType, OutputImageType> RadianceToImageImageFilterType; typedef otb::MultiChannelExtractROI<PixelType, PixelType> RoiFilterType; ReaderType::Pointer reader = ReaderType::New(); @@ -54,7 +54,7 @@ int otbLuminanceToImageImageFilterAuto(int itkNotUsed(argc), char * argv[]) reader2->UpdateOutputInformation(); // Instantiating object - LuminanceToImageImageFilterType::Pointer filter = LuminanceToImageImageFilterType::New(); + RadianceToImageImageFilterType::Pointer filter = RadianceToImageImageFilterType::New(); filter->SetInput(reader->GetOutput()); writer->SetInput(filter->GetOutput()); diff --git a/Modules/Radiometry/OpticalCalibration/test/otbLuminanceToImageImageFilterNew.cxx b/Modules/Radiometry/OpticalCalibration/test/otbRadianceToImageImageFilterNew.cxx similarity index 75% rename from Modules/Radiometry/OpticalCalibration/test/otbLuminanceToImageImageFilterNew.cxx rename to Modules/Radiometry/OpticalCalibration/test/otbRadianceToImageImageFilterNew.cxx index b33f89f7bf5ffb8ecfdaeed872d1996cd1c24a39..ca4a7be9fa5fb7865a0f1d56f671b0025b6b1e98 100644 --- a/Modules/Radiometry/OpticalCalibration/test/otbLuminanceToImageImageFilterNew.cxx +++ b/Modules/Radiometry/OpticalCalibration/test/otbRadianceToImageImageFilterNew.cxx @@ -20,19 +20,19 @@ #include "itkMacro.h" -#include "otbLuminanceToImageImageFilter.h" +#include "otbRadianceToImageImageFilter.h" #include "otbVectorImage.h" -int otbLuminanceToImageImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) +int otbRadianceToImageImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { const unsigned int Dimension = 2; typedef double PixelType; typedef otb::VectorImage<PixelType, Dimension> InputImageType; - typedef otb::LuminanceToImageImageFilter<InputImageType, InputImageType> LuminanceToImageImageFilterType; + typedef otb::RadianceToImageImageFilter<InputImageType, InputImageType> RadianceToImageImageFilterType; // Instantiating object - LuminanceToImageImageFilterType::Pointer filter = LuminanceToImageImageFilterType::New(); + RadianceToImageImageFilterType::Pointer filter = RadianceToImageImageFilterType::New(); std::cout << filter << std::endl; diff --git a/Modules/Radiometry/OpticalCalibration/test/otbLuminanceToReflectanceImageFilter.cxx b/Modules/Radiometry/OpticalCalibration/test/otbRadianceToReflectanceImageFilter.cxx similarity index 86% rename from Modules/Radiometry/OpticalCalibration/test/otbLuminanceToReflectanceImageFilter.cxx rename to Modules/Radiometry/OpticalCalibration/test/otbRadianceToReflectanceImageFilter.cxx index 111a0c6f9aa435112445569eaa23fb17d5611c60..144781ca743e7c7e6e2f811fa1182ff0ec6d0d44 100644 --- a/Modules/Radiometry/OpticalCalibration/test/otbLuminanceToReflectanceImageFilter.cxx +++ b/Modules/Radiometry/OpticalCalibration/test/otbRadianceToReflectanceImageFilter.cxx @@ -20,12 +20,12 @@ #include "itkMacro.h" -#include "otbLuminanceToReflectanceImageFilter.h" +#include "otbRadianceToReflectanceImageFilter.h" #include "otbVectorImage.h" #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbLuminanceToReflectanceImageFilter(int argc, char * argv[]) +int otbRadianceToReflectanceImageFilter(int argc, char * argv[]) { const char * inputFileName = argv[1]; const char * outputFileName = argv[2]; @@ -50,8 +50,8 @@ int otbLuminanceToReflectanceImageFilter(int argc, char * argv[]) typedef otb::VectorImage<PixelType, Dimension> OutputImageType; typedef otb::ImageFileReader<InputImageType> ReaderType; typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::LuminanceToReflectanceImageFilter<InputImageType, OutputImageType> LuminanceToReflectanceImageFilterType; - typedef LuminanceToReflectanceImageFilterType::VectorType VectorType; + typedef otb::RadianceToReflectanceImageFilter<InputImageType, OutputImageType> RadianceToReflectanceImageFilterType; + typedef RadianceToReflectanceImageFilterType::VectorType VectorType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); @@ -69,7 +69,7 @@ int otbLuminanceToReflectanceImageFilter(int argc, char * argv[]) solarIllumination[3] = static_cast<double>(atof(argv[7])); // Instantiating object - LuminanceToReflectanceImageFilterType::Pointer filter = LuminanceToReflectanceImageFilterType::New(); + RadianceToReflectanceImageFilterType::Pointer filter = RadianceToReflectanceImageFilterType::New(); filter->SetZenithalSolarAngle(angle); filter->SetSolarIllumination(solarIllumination); diff --git a/Modules/Radiometry/OpticalCalibration/test/otbLuminanceToReflectanceImageFilterAuto.cxx b/Modules/Radiometry/OpticalCalibration/test/otbRadianceToReflectanceImageFilterAuto.cxx similarity index 73% rename from Modules/Radiometry/OpticalCalibration/test/otbLuminanceToReflectanceImageFilterAuto.cxx rename to Modules/Radiometry/OpticalCalibration/test/otbRadianceToReflectanceImageFilterAuto.cxx index fda44a1edb5cd2bc2d76240e2c9256d600fd4f44..511b4d658a52f29a549d909e97ba5f9a1090ee08 100644 --- a/Modules/Radiometry/OpticalCalibration/test/otbLuminanceToReflectanceImageFilterAuto.cxx +++ b/Modules/Radiometry/OpticalCalibration/test/otbRadianceToReflectanceImageFilterAuto.cxx @@ -19,13 +19,13 @@ */ -#include "otbImageToLuminanceImageFilter.h" -#include "otbLuminanceToReflectanceImageFilter.h" +#include "otbImageToRadianceImageFilter.h" +#include "otbRadianceToReflectanceImageFilter.h" #include "otbImageFileReader.h" #include "otbImageFileWriter.h" #include "otbMultiChannelExtractROI.h" -int otbLuminanceToReflectanceImageFilterAuto(int itkNotUsed(argc), char * argv[]) +int otbRadianceToReflectanceImageFilterAuto(int itkNotUsed(argc), char * argv[]) { const char * inputFileName = argv[1]; const char * outputFileName = argv[2]; @@ -36,9 +36,9 @@ int otbLuminanceToReflectanceImageFilterAuto(int itkNotUsed(argc), char * argv[] typedef otb::VectorImage<PixelType, Dimension> OutputImageType; typedef otb::ImageFileReader<InputImageType> ReaderType; typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::ImageToLuminanceImageFilter<InputImageType, OutputImageType> ImageToLuminanceImageFilterType; - typedef otb::LuminanceToReflectanceImageFilter<OutputImageType, - OutputImageType> LuminanceToReflectanceImageFilterType; + typedef otb::ImageToRadianceImageFilter<InputImageType, OutputImageType> ImageToRadianceImageFilterType; + typedef otb::RadianceToReflectanceImageFilter<OutputImageType, + OutputImageType> RadianceToReflectanceImageFilterType; typedef otb::MultiChannelExtractROI<PixelType, PixelType> RoiFilterType; ReaderType::Pointer reader = ReaderType::New(); @@ -48,11 +48,11 @@ int otbLuminanceToReflectanceImageFilterAuto(int itkNotUsed(argc), char * argv[] reader->UpdateOutputInformation(); // Instantiating object - ImageToLuminanceImageFilterType::Pointer filterToLuminance = ImageToLuminanceImageFilterType::New(); - filterToLuminance->SetInput(reader->GetOutput()); + ImageToRadianceImageFilterType::Pointer filterToRadiance = ImageToRadianceImageFilterType::New(); + filterToRadiance->SetInput(reader->GetOutput()); - LuminanceToReflectanceImageFilterType::Pointer filterToReflectance = LuminanceToReflectanceImageFilterType::New(); - filterToReflectance->SetInput(filterToLuminance->GetOutput()); + RadianceToReflectanceImageFilterType::Pointer filterToReflectance = RadianceToReflectanceImageFilterType::New(); + filterToReflectance->SetInput(filterToRadiance->GetOutput()); filterToReflectance->SetUseClamp(false); RoiFilterType::Pointer roiFilter = RoiFilterType::New(); diff --git a/Modules/Radiometry/OpticalCalibration/test/otbLuminanceToReflectanceImageFilterNew.cxx b/Modules/Radiometry/OpticalCalibration/test/otbRadianceToReflectanceImageFilterNew.cxx similarity index 73% rename from Modules/Radiometry/OpticalCalibration/test/otbLuminanceToReflectanceImageFilterNew.cxx rename to Modules/Radiometry/OpticalCalibration/test/otbRadianceToReflectanceImageFilterNew.cxx index 12b467122bc0ed7ce90d617671c942609151a001..2d208d12717ff0ebdd74bd903b28e1247552b95d 100644 --- a/Modules/Radiometry/OpticalCalibration/test/otbLuminanceToReflectanceImageFilterNew.cxx +++ b/Modules/Radiometry/OpticalCalibration/test/otbRadianceToReflectanceImageFilterNew.cxx @@ -20,19 +20,19 @@ #include "itkMacro.h" -#include "otbLuminanceToReflectanceImageFilter.h" +#include "otbRadianceToReflectanceImageFilter.h" #include "otbVectorImage.h" -int otbLuminanceToReflectanceImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) +int otbRadianceToReflectanceImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { const unsigned int Dimension = 2; typedef double PixelType; typedef otb::VectorImage<PixelType, Dimension> InputImageType; - typedef otb::LuminanceToReflectanceImageFilter<InputImageType, InputImageType> LuminanceToReflectanceImageFilterType; + typedef otb::RadianceToReflectanceImageFilter<InputImageType, InputImageType> RadianceToReflectanceImageFilterType; // Instantiating object - LuminanceToReflectanceImageFilterType::Pointer filter = LuminanceToReflectanceImageFilterType::New(); + RadianceToReflectanceImageFilterType::Pointer filter = RadianceToReflectanceImageFilterType::New(); std::cout << filter << std::endl; diff --git a/Modules/Radiometry/OpticalCalibration/test/otbReflectanceToImageImageFilter.cxx b/Modules/Radiometry/OpticalCalibration/test/otbReflectanceToImageImageFilter.cxx index a61ae86a8256144feb3676d964eeb70eddb7cdd9..c52c21e17a04618244b3d487ea728e040d7be932 100644 --- a/Modules/Radiometry/OpticalCalibration/test/otbReflectanceToImageImageFilter.cxx +++ b/Modules/Radiometry/OpticalCalibration/test/otbReflectanceToImageImageFilter.cxx @@ -22,8 +22,8 @@ #include "otbReflectanceToImageImageFilter.h" -//#include "otbReflectanceToLuminanceImageFilter.h" -//#include "otbLuminanceToImageImageFilter.h" +//#include "otbReflectanceToRadianceImageFilter.h" +//#include "otbRadianceToImageImageFilter.h" #include "otbVectorImage.h" #include "otbImageFileReader.h" @@ -129,10 +129,10 @@ int otbReflectanceToImageImageFilter(int argc, char * argv[]) typedef otb::ImageFileReader<InputImageType> ReaderType; typedef otb::ImageFileWriter<OutputImageType> WriterType; -typedef otb::ReflectanceToLuminanceImageFilter<InputImageType, InputImageType> ReflectanceToLuminanceImageFilterType; -typedef otb::LuminanceToImageImageFilter<InputImageType, OutputImageType> LuminanceToImageImageFilterType; +typedef otb::ReflectanceToRadianceImageFilter<InputImageType, InputImageType> ReflectanceToRadianceImageFilterType; +typedef otb::RadianceToImageImageFilter<InputImageType, OutputImageType> RadianceToImageImageFilterType; - typedef ReflectanceToLuminanceImageFilterType::VectorType VectorType; + typedef ReflectanceToRadianceImageFilterType::VectorType VectorType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); @@ -158,8 +158,8 @@ typedef otb::LuminanceToImageImageFilter<InputImageType, OutputImageType> Lumina // Instantiating object -ReflectanceToLuminanceImageFilterType::Pointer filter = ReflectanceToLuminanceImageFilterType::New(); -LuminanceToImageImageFilterType::Pointer filter2 = LuminanceToImageImageFilterType::New(); +ReflectanceToRadianceImageFilterType::Pointer filter = ReflectanceToRadianceImageFilterType::New(); +RadianceToImageImageFilterType::Pointer filter2 = RadianceToImageImageFilterType::New(); filter2->SetAlpha(alpha); filter2->SetBeta(beta); diff --git a/Modules/Radiometry/OpticalCalibration/test/otbReflectanceToLuminanceImageFilter.cxx b/Modules/Radiometry/OpticalCalibration/test/otbReflectanceToRadianceImageFilter.cxx similarity index 86% rename from Modules/Radiometry/OpticalCalibration/test/otbReflectanceToLuminanceImageFilter.cxx rename to Modules/Radiometry/OpticalCalibration/test/otbReflectanceToRadianceImageFilter.cxx index b7fcc26964ba68d487b139819fbce7d521bf207a..3bd797486075bfac16f06cc21c7e9d94787e866a 100644 --- a/Modules/Radiometry/OpticalCalibration/test/otbReflectanceToLuminanceImageFilter.cxx +++ b/Modules/Radiometry/OpticalCalibration/test/otbReflectanceToRadianceImageFilter.cxx @@ -20,11 +20,11 @@ #include "itkMacro.h" -#include "otbReflectanceToLuminanceImageFilter.h" +#include "otbReflectanceToRadianceImageFilter.h" #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbReflectanceToLuminanceImageFilter(int argc, char * argv[]) +int otbReflectanceToRadianceImageFilter(int argc, char * argv[]) { const char * inputFileName = argv[1]; const char * outputFileName = argv[2]; @@ -49,8 +49,8 @@ int otbReflectanceToLuminanceImageFilter(int argc, char * argv[]) typedef otb::VectorImage<PixelType, Dimension> OutputImageType; typedef otb::ImageFileReader<InputImageType> ReaderType; typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::ReflectanceToLuminanceImageFilter<InputImageType, OutputImageType> ReflectanceToLuminanceImageFilterType; - typedef ReflectanceToLuminanceImageFilterType::VectorType VectorType; + typedef otb::ReflectanceToRadianceImageFilter<InputImageType, OutputImageType> ReflectanceToRadianceImageFilterType; + typedef ReflectanceToRadianceImageFilterType::VectorType VectorType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); @@ -68,7 +68,7 @@ int otbReflectanceToLuminanceImageFilter(int argc, char * argv[]) solarIllumination[3] = static_cast<double>(atof(argv[7])); // Instantiating object - ReflectanceToLuminanceImageFilterType::Pointer filter = ReflectanceToLuminanceImageFilterType::New(); + ReflectanceToRadianceImageFilterType::Pointer filter = ReflectanceToRadianceImageFilterType::New(); filter->SetZenithalSolarAngle(angle); filter->SetSolarIllumination(solarIllumination); diff --git a/Modules/Radiometry/OpticalCalibration/test/otbReflectanceToLuminanceImageFilterAuto.cxx b/Modules/Radiometry/OpticalCalibration/test/otbReflectanceToRadianceImageFilterAuto.cxx similarity index 77% rename from Modules/Radiometry/OpticalCalibration/test/otbReflectanceToLuminanceImageFilterAuto.cxx rename to Modules/Radiometry/OpticalCalibration/test/otbReflectanceToRadianceImageFilterAuto.cxx index 08d6ba55fea34eb0c180102e314e1a13ca4a224c..034a714a39f54485661c3beee2788c6da27b27b7 100644 --- a/Modules/Radiometry/OpticalCalibration/test/otbReflectanceToLuminanceImageFilterAuto.cxx +++ b/Modules/Radiometry/OpticalCalibration/test/otbReflectanceToRadianceImageFilterAuto.cxx @@ -19,12 +19,12 @@ */ -#include "otbReflectanceToLuminanceImageFilter.h" +#include "otbReflectanceToRadianceImageFilter.h" #include "otbImageFileReader.h" #include "otbImageFileWriter.h" #include "otbMultiChannelExtractROI.h" -int otbReflectanceToLuminanceImageFilterAuto(int itkNotUsed(argc), char * argv[]) +int otbReflectanceToRadianceImageFilterAuto(int itkNotUsed(argc), char * argv[]) { const char * inputFileName = argv[1]; @@ -36,8 +36,8 @@ const char * inputFileName = argv[1]; typedef otb::VectorImage<PixelType, Dimension> OutputImageType; typedef otb::ImageFileReader<InputImageType> ReaderType; typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::ReflectanceToLuminanceImageFilter<OutputImageType, - OutputImageType> ReflectanceToLuminanceImageFilterType; + typedef otb::ReflectanceToRadianceImageFilter<OutputImageType, + OutputImageType> ReflectanceToRadianceImageFilterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); @@ -46,10 +46,10 @@ const char * inputFileName = argv[1]; reader->UpdateOutputInformation(); // Instantiating object - ReflectanceToLuminanceImageFilterType::Pointer filterToLuminance = ReflectanceToLuminanceImageFilterType::New(); + ReflectanceToRadianceImageFilterType::Pointer filterToRadiance = ReflectanceToRadianceImageFilterType::New(); - filterToLuminance->SetInput(reader->GetOutput()); - writer->SetInput(filterToLuminance->GetOutput()); + filterToRadiance->SetInput(reader->GetOutput()); + writer->SetInput(filterToRadiance->GetOutput()); writer->Update(); return EXIT_SUCCESS; diff --git a/Modules/Radiometry/OpticalCalibration/test/otbReflectanceToLuminanceImageFilterNew.cxx b/Modules/Radiometry/OpticalCalibration/test/otbReflectanceToRadianceImageFilterNew.cxx similarity index 73% rename from Modules/Radiometry/OpticalCalibration/test/otbReflectanceToLuminanceImageFilterNew.cxx rename to Modules/Radiometry/OpticalCalibration/test/otbReflectanceToRadianceImageFilterNew.cxx index 072248351ca021ebd497b7500fa29a9c48a197f4..c6eb5895ad04fd0de8749e454180a21e294f4841 100644 --- a/Modules/Radiometry/OpticalCalibration/test/otbReflectanceToLuminanceImageFilterNew.cxx +++ b/Modules/Radiometry/OpticalCalibration/test/otbReflectanceToRadianceImageFilterNew.cxx @@ -20,18 +20,18 @@ #include "itkMacro.h" -#include "otbReflectanceToLuminanceImageFilter.h" +#include "otbReflectanceToRadianceImageFilter.h" -int otbReflectanceToLuminanceImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) +int otbReflectanceToRadianceImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { const unsigned int Dimension = 2; typedef double PixelType; typedef otb::VectorImage<PixelType, Dimension> InputImageType; - typedef otb::ReflectanceToLuminanceImageFilter<InputImageType, InputImageType> ReflectanceToLuminanceImageFilterType; + typedef otb::ReflectanceToRadianceImageFilter<InputImageType, InputImageType> ReflectanceToRadianceImageFilterType; // Instantiating object - ReflectanceToLuminanceImageFilterType::Pointer filter = ReflectanceToLuminanceImageFilterType::New(); + ReflectanceToRadianceImageFilterType::Pointer filter = ReflectanceToRadianceImageFilterType::New(); std::cout << filter << std::endl; diff --git a/Modules/Radiometry/Simulation/include/otbReduceSpectralResponse.h b/Modules/Radiometry/Simulation/include/otbReduceSpectralResponse.h index dd3a116b26c54fd287f895a3c8567584780adb3f..d9a944bf7d1c9f639b718d6aeee7e030f2fd8646 100644 --- a/Modules/Radiometry/Simulation/include/otbReduceSpectralResponse.h +++ b/Modules/Radiometry/Simulation/include/otbReduceSpectralResponse.h @@ -39,7 +39,7 @@ namespace otb * compute the satellite spectral bands. * * There are 2 operating modes: - * - luminance mode (default): integrates the spectral response over each band + * - radiance mode (default): integrates the spectral response over each band * - reflectance mode (needs to call SetReflectanceMode(true)): takes into account * the solar irradiance in the integration * @@ -154,7 +154,7 @@ private: /** the computed response */ InputSpectralResponsePointerType m_ReduceResponse; - /** Choose between reflectance or luminance mode */ + /** Choose between reflectance or radiance mode */ bool m_ReflectanceMode; }; diff --git a/Modules/Radiometry/Simulation/include/otbReduceSpectralResponse.txx b/Modules/Radiometry/Simulation/include/otbReduceSpectralResponse.txx index e14cfb9f34e67ade7b301b87279119ff117cb692..2c7af98309f7d1bf1dbdb08042dcd8bb1cd689e8 100644 --- a/Modules/Radiometry/Simulation/include/otbReduceSpectralResponse.txx +++ b/Modules/Radiometry/Simulation/include/otbReduceSpectralResponse.txx @@ -109,7 +109,7 @@ ReduceSpectralResponse<TSpectralResponse , TRSR> /* In order to simplify the computation for the reflectance mode, we introduce the solar irradiance in the general formula with - a value of 1.0 for the luminance case. + a value of 1.0 for the radiance case. In this way the formula is the same if we weight the RSR by the solar irradiance before the integration. @@ -197,7 +197,7 @@ ReduceSpectralResponse<TSpectralResponse , TRSR> os <<indent << "[Center Wavelength (micrometers), Reflectance (percent)]" << std::endl; } else{ - os <<indent << "[Center Wavelength (micrometers), Luminance (percent)]" << std::endl; + os <<indent << "[Center Wavelength (micrometers), Radiance (percent)]" << std::endl; } for(typename VectorPairType::const_iterator it = m_ReduceResponse->GetResponse().begin(); it != m_ReduceResponse->GetResponse().end(); ++it) diff --git a/Modules/Radiometry/Simulation/include/otbSurfaceReflectanceToReflectanceFilter.h b/Modules/Radiometry/Simulation/include/otbSurfaceReflectanceToReflectanceFilter.h index 62050167d329f38c746a213a520fed10629a64cb..c07fbd4c97638e0154b88e1d2c2a4df8d614ecda 100644 --- a/Modules/Radiometry/Simulation/include/otbSurfaceReflectanceToReflectanceFilter.h +++ b/Modules/Radiometry/Simulation/include/otbSurfaceReflectanceToReflectanceFilter.h @@ -153,7 +153,7 @@ private: * * \ingroup AtmosphericRadiativeTerms * \ingroup AtmosphericCorrectionParameters - * \ingroup LuminanceToReflectanceImageFilter + * \ingroup RadianceToReflectanceImageFilter * \ingroup ImageToReflectanceImageFilter * \ingroup Radiometry * diff --git a/Modules/Radiometry/Simulation/src/otbSailModel.cxx b/Modules/Radiometry/Simulation/src/otbSailModel.cxx index 1049da6833319c037cbe4ab92ce4512ca8add577..e2c1ef00022c070a7e6dfde9af09a86da8d92bd7 100644 --- a/Modules/Radiometry/Simulation/src/otbSailModel.cxx +++ b/Modules/Radiometry/Simulation/src/otbSailModel.cxx @@ -34,7 +34,7 @@ namespace otb /** Constructor */ SailModel ::SailModel() : m_LAI(2), m_Angl(50), m_PSoil(1), m_Skyl(70), m_HSpot(0.2), - m_TTS(30), m_TTO(0), m_PSI(0), m_FCoverView(0.0), m_UseSoilFile(false) + m_TTS(30), m_TTO(0), m_PSI(0), m_FCoverView(0.0), m_UseSoilFile(false), m_SoilIndex(0) { this->ProcessObject::SetNumberOfRequiredInputs(2); this->ProcessObject::SetNumberOfRequiredOutputs(4); diff --git a/Modules/Radiometry/Simulation/test/otbReduceSpectralResponse.cxx b/Modules/Radiometry/Simulation/test/otbReduceSpectralResponse.cxx index 1d03b3a6a0f4ba9e50a8790eeb9faa30f2bd9705..388f66977591e377c4c30bab58112cd857f4e7c0 100644 --- a/Modules/Radiometry/Simulation/test/otbReduceSpectralResponse.cxx +++ b/Modules/Radiometry/Simulation/test/otbReduceSpectralResponse.cxx @@ -62,7 +62,7 @@ int otbReduceSpectralResponse(int argc, char * argv[]) myReduceResponse->SetInputSatRSR(myRSR); /** Load the spectral response of the object in the simulator*/ myReduceResponse->SetInputSpectralResponse(mySpectralResponse); - /** Set the reflectance or luminance mode */ + /** Set the reflectance or radiance mode */ myReduceResponse->SetReflectanceMode(reflectanceMode); myReduceResponse->CalculateResponse(); /** Print the Reduce SR*/ @@ -194,7 +194,7 @@ int otbReduceSpectralResponseSimpleValues(int argc, char * argv[]) if(fabs(b0Result-b0Expected)>tolerance) { - std::cout << "Wrong value for B0: expected eq. luminance = " << b0Expected + std::cout << "Wrong value for B0: expected eq. radiance = " << b0Expected << "; got " << b0Result << std::endl; return EXIT_FAILURE; @@ -207,7 +207,7 @@ int otbReduceSpectralResponseSimpleValues(int argc, char * argv[]) if(fabs(b1Result-b1Expected)>tolerance) { - std::cout << "Wrong value for B1: expected eq. luminance = " << b1Expected + std::cout << "Wrong value for B1: expected eq. radiance = " << b1Expected << "; got " << b1Result << std::endl; return EXIT_FAILURE; diff --git a/Modules/Remote/Mosaic.remote.cmake b/Modules/Remote/Mosaic.remote.cmake index c6f4a068dfbc4a348c9ca7bd1370a02682353100..035a5bc8101097fe9adbd3b7fc852198abba7a92 100644 --- a/Modules/Remote/Mosaic.remote.cmake +++ b/Modules/Remote/Mosaic.remote.cmake @@ -5,5 +5,5 @@ A more detailed description can be found on the project website: https://github.com/remicres/otb-mosaic " GIT_REPOSITORY https://github.com/remicres/otb-mosaic.git - GIT_TAG master + GIT_TAG 56426908db01f33a5b96311e2a7eaac30ecd8e5d ) diff --git a/Modules/Remote/SertitObject.remote.cmake b/Modules/Remote/SertitObject.remote.cmake index e424926127c501f9886aeb0d0efbd11561dfb24d..75cf492f5fd30f6bb092587a6b469b744c554c45 100644 --- a/Modules/Remote/SertitObject.remote.cmake +++ b/Modules/Remote/SertitObject.remote.cmake @@ -26,5 +26,5 @@ median, variance, kurtosis, skewness. The result could be use to perform further object-oriented image analysis. " GIT_REPOSITORY https://github.com/sertit/SertitObject.git - GIT_TAG 49b6540c774ddb7c2d56e39f6f118c4dfb9b8bd3 + GIT_TAG master ) diff --git a/Modules/Remote/otb-bv.remote.cmake b/Modules/Remote/otb-bv.remote.cmake index 4816ae226460fae6d54424daa86edad2e8888ddd..06e067e6586cc345fed2d1f6aade487cf08350b3 100644 --- a/Modules/Remote/otb-bv.remote.cmake +++ b/Modules/Remote/otb-bv.remote.cmake @@ -25,5 +25,5 @@ A more detailed description can be found on the project website: http://tully.ups-tlse.fr/jordi/otb-bv " GIT_REPOSITORY http://tully.ups-tlse.fr/jordi/otb-bv.git - GIT_TAG master + GIT_TAG 0e56e487aebc4a493e25223960560e9ef0ca27ec ) diff --git a/Modules/Remote/otbFFSforGMM.remote.cmake b/Modules/Remote/otbFFSforGMM.remote.cmake index 06e69cfb7759dcec18c01abb3201a80213a87b01..08bfd90bfd136bd4a369e30d4f99c13778de709d 100644 --- a/Modules/Remote/otbFFSforGMM.remote.cmake +++ b/Modules/Remote/otbFFSforGMM.remote.cmake @@ -25,5 +25,5 @@ A more detailed description can be found on the project website: https://github.com/Laadr/otbFFSforGMM " GIT_REPOSITORY https://github.com/Laadr/otbFFSforGMM.git - GIT_TAG 20f3938ffa585a3ec6e735c48e8d5e6ec77fe80a + GIT_TAG master ) diff --git a/Modules/Remote/otbGRM.remote.cmake b/Modules/Remote/otbGRM.remote.cmake index c6ac506a316a2b019656563ce6bcaaf728b478b1..7083c522f2429f630c70049ea3b3e9998de2afb0 100644 --- a/Modules/Remote/otbGRM.remote.cmake +++ b/Modules/Remote/otbGRM.remote.cmake @@ -11,6 +11,6 @@ to see which format you must respect to add a new criterion. A more detailed description can be found on the project website: http://tully.ups-tlse.fr/lassallep/grm " - GIT_REPOSITORY http://tully.ups-tlse.fr/lassallep/grm.git - GIT_TAG a08d2309bc8d4f4ceaf1dba8bda33aa1e21fc4aa + GIT_REPOSITORY https://github.com/orfeotoolbox/GRM + GIT_TAG develop ) diff --git a/Modules/Remote/phenotb.remote.cmake b/Modules/Remote/phenotb.remote.cmake index d76b4f1cc1b30d88f22aab7c036e413eeaf4c068..aa9e9a8ead204e1b3a4f8492e16825c838da95d7 100644 --- a/Modules/Remote/phenotb.remote.cmake +++ b/Modules/Remote/phenotb.remote.cmake @@ -27,5 +27,5 @@ A more detailed description can be found on the project website: http://tully.ups-tlse.fr/jordi/phenotb " GIT_REPOSITORY http://tully.ups-tlse.fr/jordi/phenotb.git - GIT_TAG master + GIT_TAG c9349eb89a652a18b28a40dfb3fa352b76388527 ) diff --git a/Modules/Remote/temporal-gapfilling.remote.cmake b/Modules/Remote/temporal-gapfilling.remote.cmake index 5570ceee08dc704ed1ea8e5897db93d88e03d711..a33a9e0acbf7143a25163b999418e8d7568b111a 100644 --- a/Modules/Remote/temporal-gapfilling.remote.cmake +++ b/Modules/Remote/temporal-gapfilling.remote.cmake @@ -26,5 +26,5 @@ A more detailed description can be found on the project website: http://tully.ups-tlse.fr/jordi/temporalgapfilling " GIT_REPOSITORY http://tully.ups-tlse.fr/jordi/temporalgapfilling.git - GIT_TAG master + GIT_TAG 4180f28091fb10029860ada2dcf9c9526d3a55d2 ) diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimCosmoSkymedModel.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimCosmoSkymedModel.cpp index 8e7671c9636dac89080c186b2beed25f47f121f3..ca120f900184cc7ba600c3881b0515a4db80a5d7 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimCosmoSkymedModel.cpp +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimCosmoSkymedModel.cpp @@ -99,7 +99,7 @@ bool ossimCosmoSkymedModel::InitSensorParams(const ossimKeywordlist &kwl, const /** - * @todo : see on real products (for exemple DESCENDING and ASCENDING) + * @todo : see on real products (for example DESCENDING and ASCENDING) */ const char* orbitDirection_str = kwl.find(prefix,"orbitDirection"); std::string orbitDirection(orbitDirection_str) ; diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTerraSarModel.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTerraSarModel.cpp index a783c83558dfd3d71a0ec86bcf096edeb2580457..0b599285ba306a87c71e00a4a5648e753f3d32a5 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTerraSarModel.cpp +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTerraSarModel.cpp @@ -2400,56 +2400,36 @@ bool ossimplugins::ossimTerraSarModel::findTSXLeader(const ossimFilename& file, } else { - if (traceDebug()) - { - ossimNotify(ossimNotifyLevel_DEBUG) - << "ossimplugins::ossimTerraSarModel::findTSXLeader " - << " directory scan turned off. This is killing the factory open." - << " We should never scan a directory. Need to resolve. " - << std::endl; - } - -//#if 0 - ossimFilename imagePath = file.path(); - if (imagePath.empty()) - imagePath = ossimEnvironmentUtility::instance()->getCurrentWorkingDir(); - - ossimDirectory directory = ossimDirectory(imagePath.path()); - std::vector<ossimFilename> vectName; - ossimString reg = ".xml"; - directory.findAllFilesThatMatch( vectName, reg, 1 ); - - bool goodFileFound = false; - unsigned int loop = 0; - while(loop<vectName.size() && !goodFileFound) - { - ossimFilename curFile = vectName[loop]; - if(curFile.file().beforePos(3) == ossimString("TSX")) - goodFileFound = true; - else - loop++; - } - if(goodFileFound) - { - metadataFile = vectName[loop]; - res = true; - } - else - { - if (traceDebug()) - { - if (res) - { - this->print(ossimNotify(ossimNotifyLevel_DEBUG)); - } - - ossimNotify(ossimNotifyLevel_DEBUG) - << "ossimplugins::ossimTerraSarModel::findTSXLeader " - << " exit status = " << (res?"true":"false\n") - << std::endl; - } + ossimFilename imagePath = file.expand().path(); + + if (imagePath.file() == ossimString("IMAGEDATA")) + { + std::cerr << "SCANNING DIRECTORY" << std::endl; + ossimFilename productPath = imagePath.path(); + ossimDirectory directory = ossimDirectory(productPath); + std::vector<ossimFilename> vectName; + ossimString reg = "^T(S|D)X1_SAR__.*\\.xml$"; + directory.findAllFilesThatMatch( vectName, reg, 1 ); + if (vectName.size()) + { + metadataFile = vectName[0]; + res = true; + } + else + { + if (traceDebug()) + { + if (res) + { + this->print(ossimNotify(ossimNotifyLevel_DEBUG)); + } + ossimNotify(ossimNotifyLevel_DEBUG) + << "ossimplugins::ossimTerraSarModel::findTSXLeader " + << " exit status = " << (res?"true":"false\n") + << std::endl; + } + } } -//#endif } return res; diff --git a/Modules/Visualization/Monteverdi/src/mvdMainWindow.cxx b/Modules/Visualization/Monteverdi/src/mvdMainWindow.cxx index 136343a139cb84f0e804a452e49e6288be0fd154..6b1d92cf582d251cb2a3c6a7936f8842d73ee0a4 100644 --- a/Modules/Visualization/Monteverdi/src/mvdMainWindow.cxx +++ b/Modules/Visualization/Monteverdi/src/mvdMainWindow.cxx @@ -1562,6 +1562,14 @@ MainWindow this, SLOT( OnReferenceLayerChanged( size_t ) ) ); + + QObject::connect( + model, + SIGNAL( LayerRenamed() ), + // to: + this, + SLOT( RefreshReferenceLayerComboBox() ) + ); } /*****************************************************************************/ @@ -1597,21 +1605,11 @@ MainWindow AbstractLayerModel * layer = model->At( i ); assert( layer!=NULL ); - if( layer->inherits( VectorImageModel::staticMetaObject.className() ) ) - { - const VectorImageModel * vectorImageModel = - qobject_cast< const VectorImageModel * >( layer ); - - assert( vectorImageModel!=NULL ); - - comboBox->addItem( - QString( "%1 (%2)" ) - .arg( layer->GetAuthorityCode( true ).c_str() ) - .arg( QFileInfo( vectorImageModel->GetFilename() ).fileName() ) - ); - } - else - qDebug() << "Unhandled AbstractLayerModel subclass."; + comboBox->addItem( + QString( "%1 (%2)" ) + .arg( layer->GetAuthorityCode( true ).c_str() ) + .arg( layer->GetName() ) + ); } { @@ -1683,6 +1681,14 @@ MainWindow this, SLOT( OnReferenceLayerChanged( size_t ) ) ); + + QObject::connect( + model, + SIGNAL( LayerRenamed() ), + // to: + this, + SLOT( RefreshReferenceLayerComboBox() ) + ); } comboBox->clear(); diff --git a/Modules/Visualization/Monteverdi/src/mvdPreferencesDialog.ui b/Modules/Visualization/Monteverdi/src/mvdPreferencesDialog.ui index 300d4072f3c8cc439ba7bcb92f0403d416bb7901..c715d1eb560445763ca9cf4fd63fc23860e596d3 100644 --- a/Modules/Visualization/Monteverdi/src/mvdPreferencesDialog.ui +++ b/Modules/Visualization/Monteverdi/src/mvdPreferencesDialog.ui @@ -120,6 +120,9 @@ <verstretch>0</verstretch> </sizepolicy> </property> + <property name="toolTip"> + <string>When the image width or height is lower than this minimum, overview generation is not proposed</string> + </property> <property name="text"> <string>Minimum size:</string> </property> @@ -127,6 +130,9 @@ </item> <item row="1" column="2"> <widget class="QSpinBox" name="overviewsSpinBox"> + <property name="toolTip"> + <string>When the image width or height is lower than this minimum, overview generation is not proposed</string> + </property> <property name="maximum"> <number>999999999</number> </property> diff --git a/Modules/Visualization/MonteverdiCore/include/mvdAbstractLayerModel.h b/Modules/Visualization/MonteverdiCore/include/mvdAbstractLayerModel.h index ce0c2bdff632b08ced8aed91824fc8a4ec4ab6b2..ab4065a91b1882092f79319c6f0222d792b89037 100644 --- a/Modules/Visualization/MonteverdiCore/include/mvdAbstractLayerModel.h +++ b/Modules/Visualization/MonteverdiCore/include/mvdAbstractLayerModel.h @@ -139,6 +139,12 @@ public: */ void ToWgs84( const PointType &, PointType & wgs84, double & alt ) const; + /** Setter for the m_Name attribute ( should be initialized by subclasses )*/ + void SetName(const QString & name); + + /** Getter for the m_Name attribute */ + const QString & GetName() const; + /*-[ PUBLIC SLOTS SECTION ]------------------------------------------------*/ // @@ -155,6 +161,9 @@ signals: void VisibilityChanged( bool =true ); void VisibilityChanged( AbstractLayerModel *, bool ); + /** Signal to other components that the name has changed */ + void NameChanged(); + /*-[ PROTECTED SECTION ]---------------------------------------------------*/ // @@ -198,6 +207,7 @@ private: // Private attributes. private: + QString m_Name; /*-[ PRIVATE SLOTS SECTION ]-----------------------------------------------*/ // diff --git a/Modules/Visualization/MonteverdiCore/include/mvdStackedLayerModel.h b/Modules/Visualization/MonteverdiCore/include/mvdStackedLayerModel.h index ff767958923d06772e1dfbfce77412f52a62d73b..035914cb210f692825e2bf440373f924f7062282 100644 --- a/Modules/Visualization/MonteverdiCore/include/mvdStackedLayerModel.h +++ b/Modules/Visualization/MonteverdiCore/include/mvdStackedLayerModel.h @@ -254,6 +254,8 @@ signals: void ResolutionsChanged( const PixelInfo::Vector & ); + void LayerRenamed(); + /*-[ PROTECTED SECTION ]---------------------------------------------------*/ // diff --git a/Modules/Visualization/MonteverdiCore/src/mvdAbstractLayerModel.cxx b/Modules/Visualization/MonteverdiCore/src/mvdAbstractLayerModel.cxx index 4598db5f84b13df0807164d089451fe6191c5f86..7d59542eee23dc06e5ccd29edcaaa5de634cbc1e 100644 --- a/Modules/Visualization/MonteverdiCore/src/mvdAbstractLayerModel.cxx +++ b/Modules/Visualization/MonteverdiCore/src/mvdAbstractLayerModel.cxx @@ -37,7 +37,7 @@ // // OTB includes (sorted by alphabetic order) - +#include "otbGeoInformationConversion.h" // // Monteverdi includes (sorted by alphabetic order) #include "mvdAlgorithm.h" @@ -62,6 +62,7 @@ namespace { char const * const STR_SENSOR = QT_TRANSLATE_NOOP( "mvd::AbstractLayerModel", "Sensor" ); char const * const STR_UNKNOWN = QT_TRANSLATE_NOOP( "mvd::AbstractLayerModel", "Unknown" ); +char const * const STR_NOEPSG = QT_TRANSLATE_NOOP( "mvd::AbstractLayerModel", "No EPSG" ); } // end of anonymous namespace. @@ -98,16 +99,12 @@ GetSpatialReferenceType( const std::string & wkt, bool hasKwl ) OGRSpatialReference ogr_sr( wkt.c_str() ); - const char * epsg = ogr_sr.GetAuthorityCode( "PROJCS" ); + if(ogr_sr.IsGeographic()) + return SRT_GEO; - if( epsg!=NULL && strcmp( epsg, "" )!=0 ) + if(ogr_sr.IsProjected()) return SRT_CARTO; - epsg = ogr_sr.GetAuthorityCode( "GEOGCS" ); - - if( epsg!=NULL && strcmp( epsg, "" )!=0 ) - return SRT_GEO; - return SRT_UNKNOWN; } @@ -117,7 +114,8 @@ GetSpatialReferenceType( const std::string & wkt, bool hasKwl ) AbstractLayerModel ::AbstractLayerModel( QObject* p ) : AbstractModel( p ), - VisibleInterface() + VisibleInterface(), + m_Name(QString()) { } @@ -158,19 +156,13 @@ AbstractLayerModel ? ToStdString( tr( STR_SENSOR ) ) : ToStdString( tr( STR_UNKNOWN ) ) ); - OGRSpatialReference ogr_sr( wkt.c_str() ); - - const char * epsg = ogr_sr.GetAuthorityCode( "PROJCS" ); - - if( epsg!=NULL && strcmp( epsg, "" )!=0 ) - return epsg; - - epsg = ogr_sr.GetAuthorityCode( "GEOGCS" ); - - if( epsg==NULL || strcmp( epsg, "" )==0 ) + int code = otb::GeoInformationConversion::ToEPSG(wkt); + if(code < 0) return ToStdString( tr( STR_UNKNOWN ) ); + else if(code == 0) + return ToStdString( tr( STR_NOEPSG ) ); - return epsg; + return boost::lexical_cast<std::string>(code); } /*******************************************************************************/ @@ -189,6 +181,26 @@ AbstractLayerModel virtual_ToWgs84( p, wgs84, alt ); } +/*****************************************************************************/ +void +AbstractLayerModel +::SetName(const QString & name) +{ + if (name != m_Name) + { + m_Name = name; + emit NameChanged(); + } +} + +/*****************************************************************************/ +const QString & +AbstractLayerModel +::GetName() const +{ + return m_Name; +} + /*******************************************************************************/ bool AbstractLayerModel diff --git a/Modules/Visualization/MonteverdiCore/src/mvdStackedLayerModel.cxx b/Modules/Visualization/MonteverdiCore/src/mvdStackedLayerModel.cxx index 607d9bdca10f90bc2864532669459f0c04497817..c4d050b792d0e318ce71a5f884206bcd284c5e1c 100644 --- a/Modules/Visualization/MonteverdiCore/src/mvdStackedLayerModel.cxx +++ b/Modules/Visualization/MonteverdiCore/src/mvdStackedLayerModel.cxx @@ -270,6 +270,15 @@ StackedLayerModel // Remove layer-model. AbstractLayerModel * layer = it->second; + // Disconnect the renaming signals + QObject::disconnect( + layer, + SIGNAL( NameChanged() ), + // from: + this, + SIGNAL( LayerRenamed() ) + ); + m_LayerModels.erase( it ); m_Keys.erase( m_Keys.begin() + index ); @@ -394,6 +403,15 @@ StackedLayerModel m_LayerModels.insert( LayerModelMap::value_type( key, model ) ); m_Keys.insert( m_Keys.begin() + index, key ); + // Connect the renaming signals + QObject::connect( + model, + SIGNAL( NameChanged() ), + // to: + this, + SIGNAL( LayerRenamed() ) + ); + // // Update pointer to current. if( emitCurrentChanged ) diff --git a/Modules/Visualization/MonteverdiCore/src/mvdVectorImageModel.cxx b/Modules/Visualization/MonteverdiCore/src/mvdVectorImageModel.cxx index c60019e18f46af3927d9534b8907b09f87760878..378763d26e561bbc8bae2c0c51ac923dd80a3e58 100644 --- a/Modules/Visualization/MonteverdiCore/src/mvdVectorImageModel.cxx +++ b/Modules/Visualization/MonteverdiCore/src/mvdVectorImageModel.cxx @@ -94,6 +94,7 @@ VectorImageModel ::SetFilename( const QString& filename , int w, int h) { setObjectName( filename ); + SetName( QFileInfo( filename ).fileName() ); // 1. store the input filename FilenameInterface::SetFilename( filename ); diff --git a/Modules/Visualization/MonteverdiGui/include/mvdHistogramPlotPicker.h b/Modules/Visualization/MonteverdiGui/include/mvdHistogramPlotPicker.h index 7f574d738bd6ba392fc71c9223db745e16132dc9..0e58a1f5d8ee6f56b1477259b2276744685b0203 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdHistogramPlotPicker.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdHistogramPlotPicker.h @@ -131,7 +131,7 @@ public: /** */ - void SetGrayscaleActivated( bool activated ); + void SetGrayscaleActivated( bool isGrayscale ); // // QwtPlotPicker methods. diff --git a/Modules/Visualization/MonteverdiGui/include/mvdImageViewWidget.h b/Modules/Visualization/MonteverdiGui/include/mvdImageViewWidget.h index 4ce167accb88e5f54e1110b33c80b6e39e6dcd63..c32699f712f9c97cfe2af01fbb7fc1f47452002f 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdImageViewWidget.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdImageViewWidget.h @@ -163,7 +163,7 @@ public: void SetPickingEnabled( bool ); /** - * This allows to set the fallback behaviour for picking + * This allows setting the fallback behaviour for picking */ void SetPickingDefaultStatus( bool ); /** diff --git a/Modules/Visualization/MonteverdiGui/include/mvdProjectionBarWidget.h b/Modules/Visualization/MonteverdiGui/include/mvdProjectionBarWidget.h index 5a2d40ee7936b0b6ddb52cf00c65b7d9318050bc..be92647e6135ad430e80e4c61f7d30de4f2070ee 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdProjectionBarWidget.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdProjectionBarWidget.h @@ -69,7 +69,7 @@ class ProjectionBarWidget; * \ingroup OTBMonteverdiGUI * \brief ProjectionBarWidget widget class. * - * This Widget allow to change the zoom level of the current selected projection. + * This Widget allows changing the zoom level of the current selected projection. */ class OTBMonteverdiGUI_EXPORT ProjectionBarWidget : public QWidget { diff --git a/Modules/Visualization/MonteverdiGui/include/mvdQtWidgetParameterInitializers.h b/Modules/Visualization/MonteverdiGui/include/mvdQtWidgetParameterInitializers.h index 4d92b3749d465a2aaf4f2e3f300d66d30182529b..61d425e75d7597f248933b7c80b066f1bda3aaf8 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdQtWidgetParameterInitializers.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdQtWidgetParameterInitializers.h @@ -59,6 +59,8 @@ #include "otbWrapperQtWidgetOutputImageParameter.h" #include "otbWrapperQtWidgetOutputProcessXMLParameter.h" #include "otbWrapperQtWidgetOutputVectorDataParameter.h" +#include "otbWrapperQtWidgetComplexInputImageParameter.h" +#include "otbWrapperQtWidgetComplexOutputImageParameter.h" #include "otbWrapperQtWidgetParameterFactory.h" #endif //tag=QT4-boost-compatibility @@ -175,6 +177,23 @@ private: QWidget * m_View; }; +/** + * \class ComplexInputImageInitializer + * + * \ingroup OTBMonteverdiGUI + * + * \brief WIP. + */ +class ComplexInputImageInitializer : public std::unary_function< + otb::Wrapper::QtWidgetComplexInputImageParameter*, + void + > +{ +public: + inline ComplexInputImageInitializer(); + inline result_type operator () ( argument_type widget ) const; +}; + /** * \class InputVectorDataInitializer * @@ -281,6 +300,26 @@ private: QString m_Prefix; }; +/** + * \class ComplexOutputImageInitializer + * + * \ingroup OTBMonteverdiGUI + * + * \brief WIP. + */ +class ComplexOutputImageInitializer : public std::unary_function< + otb::Wrapper::QtWidgetComplexOutputImageParameter*, + void + > +{ +public: + inline ComplexOutputImageInitializer( const QString & prefix ); + inline result_type operator () ( argument_type widget ) const; + +private: + QString m_Prefix; +}; + /** * \class OutputVectorDataInitializer * @@ -441,6 +480,24 @@ InputImageListInitializer SetupWidget( widget, FileSelectionInitializer() ); } +/*****************************************************************************/ +inline +ComplexInputImageInitializer +::ComplexInputImageInitializer() +{ +} + +/*****************************************************************************/ +inline +ComplexInputImageInitializer::result_type +ComplexInputImageInitializer +::operator () ( argument_type widget ) const +{ + assert( widget!=NULL ); + + SetupForFilenameDrop( widget, "You can drop filename here." ); +} + /*****************************************************************************/ inline InputFilenameInitializer::result_type @@ -576,6 +633,41 @@ OutputImageInitializer ); } +/*****************************************************************************/ +inline +ComplexOutputImageInitializer +::ComplexOutputImageInitializer( const QString& prefix) : + m_Prefix( prefix ) +{ +} + +/*****************************************************************************/ +inline +ComplexOutputImageInitializer::result_type +ComplexOutputImageInitializer +::operator () ( argument_type widget ) const +{ + assert( widget!=NULL ); + assert( I18nCoreApplication::ConstInstance()!=NULL ); + + if( m_Prefix.isEmpty() ) + { + SetupForFilenameDrop( widget, "You can drop filename here." ); + + assert( qApp!=NULL ); + assert( !qApp->arguments().empty() ); + + SetupOutputFilename( widget ); + } + else + SetupOutputFilename( + widget, + I18nCoreApplication::ConstInstance()->GetResultsDir(), + m_Prefix, + ".tif" + ); +} + /*****************************************************************************/ inline OutputVectorDataInitializer::result_type @@ -671,13 +763,29 @@ SetupForFilenameDrop( W* widget, const char* text ) lineEdit->installEventFilter( eventFilter ); - QObject::connect( - eventFilter, - SIGNAL( FilenameDropped( const QString& ) ), - // to: - lineEdit, - SLOT( setText( const QString& ) ) - ); + // BUG : temporary fix for drag & drop in InputImageParameter + // in the future, all "filename" parameters should have the same behaviour + if (dynamic_cast<otb::Wrapper::QtWidgetInputImageParameter*>(widget) || + dynamic_cast<otb::Wrapper::QtFileSelectionWidget*>(widget)) + { + QObject::connect( + eventFilter, + SIGNAL( FilenameDropped( const QString& ) ), + // to: + widget, + SLOT( SetFileName( const QString& ) ) + ); + } + else + { + QObject::connect( + eventFilter, + SIGNAL( FilenameDropped( const QString& ) ), + // to: + lineEdit, + SLOT( setText( const QString& ) ) + ); + } } /*****************************************************************************/ diff --git a/Modules/Visualization/MonteverdiGui/src/mvdHistogramPlotPicker.cxx b/Modules/Visualization/MonteverdiGui/src/mvdHistogramPlotPicker.cxx index 9f4bcca63df03bd8ac842f4e17619042bdc22af0..a7f9e3020ea16706dd30ebffc3ba9f1fa87a9b1c 100644 --- a/Modules/Visualization/MonteverdiGui/src/mvdHistogramPlotPicker.cxx +++ b/Modules/Visualization/MonteverdiGui/src/mvdHistogramPlotPicker.cxx @@ -169,9 +169,9 @@ HistogramPlotPicker /*******************************************************************************/ void HistogramPlotPicker -::SetGrayscaleActivated( bool activated ) +::SetGrayscaleActivated( bool isGrayscale ) { - m_IsGrayscaleActivated = activated; + m_IsGrayscaleActivated = isGrayscale; } /*******************************************************************************/ diff --git a/Modules/Visualization/MonteverdiGui/src/mvdLayerStackItemModel.cxx b/Modules/Visualization/MonteverdiGui/src/mvdLayerStackItemModel.cxx index e6c7a548b4f5d8257ee7c4b0e4cf4f3b1db68b2f..cc073ecd5faf604eb108b92a48e7eccfde4e58c6 100644 --- a/Modules/Visualization/MonteverdiGui/src/mvdLayerStackItemModel.cxx +++ b/Modules/Visualization/MonteverdiGui/src/mvdLayerStackItemModel.cxx @@ -423,6 +423,7 @@ LayerStackItemModel } break; + case Qt::EditRole: case Qt::DisplayRole: switch( idx.column() ) { @@ -447,21 +448,7 @@ LayerStackItemModel break; case COLUMN_NAME: - if( layer->inherits( - VectorImageModel::staticMetaObject.className() ) ) - { - const VectorImageModel * vectorImageModel = - qobject_cast< const VectorImageModel * >( layer ); - assert( vectorImageModel!=NULL ); - - // qDebug() << "filename:" << vectorImageModel->GetFilename(); - - return QFileInfo( vectorImageModel->GetFilename() ).fileName(); - } - else - { - qDebug() << "Unhandled AbstractLayerModel subclass."; - } + return layer->GetName(); break; case COLUMN_EFFECT: @@ -842,7 +829,7 @@ LayerStackItemModel // qDebug() // << this << "::setData(" << idx << "," << value << "," << role << ")"; - if( idx.column()==COLUMN_NAME && role==Qt::CheckStateRole ) + if( idx.column()==COLUMN_NAME ) { // qDebug() << idx.row() << "check-state:" << value; @@ -856,30 +843,45 @@ LayerStackItemModel assert( layer!=NULL ); assert( layer==dynamic_cast< VisibleInterface * >( layer ) ); - VisibleInterface * interface = dynamic_cast< VisibleInterface * >( layer ); assert( interface!=NULL ); - switch( value.toInt() ) + switch( role ) { - case Qt::Checked: - interface->SetVisible( true ); + case Qt::EditRole: + { + QString strValue = value.toString(); + if( !strValue.isEmpty() ) + { + layer->SetName( strValue ); + emit dataChanged( idx, idx ); + return true; + } + } break; - - case Qt::Unchecked: - interface->SetVisible( false ); + case Qt::CheckStateRole: + switch( value.toInt() ) + { + case Qt::Checked: + interface->SetVisible( true ); + break; + + case Qt::Unchecked: + interface->SetVisible( false ); + break; + + default: + assert( false && "Unhandled Qt::CheckedState value." ); + break; + } + emit dataChanged( idx, idx ); + return true; break; default: - assert( false && "Unhandled Qt::CheckedState value." ); break; } - - emit dataChanged( idx, idx ); - - return true; } - return false; } diff --git a/Modules/Visualization/MonteverdiGui/src/mvdQtWidgetView.cxx b/Modules/Visualization/MonteverdiGui/src/mvdQtWidgetView.cxx index 12640d6bec8182f2046b933b8568683f8717266b..ff6d14ecc26aa84d14d8f6418160b2d80adb9595 100644 --- a/Modules/Visualization/MonteverdiGui/src/mvdQtWidgetView.cxx +++ b/Modules/Visualization/MonteverdiGui/src/mvdQtWidgetView.cxx @@ -348,6 +348,7 @@ QtWidgetView SetupWidget( widget, InputFilenameListInitializer( this ) ); SetupWidget( widget, InputImageInitializer() ); SetupWidget( widget, InputImageListInitializer( this ) ); + SetupWidget( widget, ComplexInputImageInitializer() ); SetupWidget( widget, InputProcessXMLInitializer() ); SetupWidget( widget, InputVectorDataInitializer() ); SetupWidget( widget, InputVectorDataListInitializer( this ) ); @@ -362,6 +363,10 @@ QtWidgetView widget, OutputImageInitializer( m_Application->GetName() ) ); + SetupWidget( + widget, + ComplexOutputImageInitializer( m_Application->GetName() ) + ); SetupWidget( widget, OutputVectorDataInitializer() ); } diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h index aa0cdd076ad93109e8acd054fc920c4a3892304e..cbc0f7f2736f9ffecb4933b6616032067acdd8bb 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h @@ -622,9 +622,9 @@ public: { \ Image##Type::Pointer ret; \ Parameter* param = GetParameterByKey(parameter); \ - if (dynamic_cast<ComplexInputImageParameter*>(param)) \ + ComplexInputImageParameter* paramDown = dynamic_cast<ComplexInputImageParameter*>(param); \ + if (paramDown) \ { \ - ComplexInputImageParameter* paramDown = dynamic_cast<ComplexInputImageParameter*>(param); \ ret = paramDown->Get##Image(); \ } \ return ret; \ diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperCompositeApplication.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperCompositeApplication.h index 859e6a81e733f238b81e51a80bf8bf665d72d653..601b9450a9bf51cc6340b7d969076e2204d3309b 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperCompositeApplication.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperCompositeApplication.h @@ -32,7 +32,7 @@ namespace Wrapper /** \class CompositeApplication * \brief This class is a base class for composite applications * - * This class allows to create & store internal applications with the same logic + * This class allows creating & storing internal applications with the same logic * as parameters. You choose the application type to create, you choose an * identifier (alphanumeric string), and you can give a short description. * Later, you will refer to this application using the identifier. In the diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperProxyParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperProxyParameter.h index 7715c9796c706299721b5379df7258a031a66d89..1a93c2445479aaadc84e3303f01722181bdb4505 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperProxyParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperProxyParameter.h @@ -35,7 +35,7 @@ namespace Wrapper * \brief Parameter class acting as a proxy to a different parameter * * The target parameter of this proxy is defined as a pair of a group parameter - * containing the target and the targets key. It allows to define proxies on + * containing the target and the targets key. It allows defining proxies on * parameters that may be themselves replaced by a proxy * * \ingroup OTBApplicationEngine diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx index 178a8d55608661aa4253607f272cd54b5bddb6ad..47c4e85d5fef4371e1454c0c65f35166ffea32a9 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx @@ -250,6 +250,10 @@ void Application::SetParameterString(std::string parameter, std::string value, b if ( !paramDown->SetFileName(value) ) otbAppLogCRITICAL( <<"Invalid XML parameter filename " << value <<"."); } + else + { + otbAppLogWARNING( <<"This parameter can't be set using SetParameterString()."); + } this->SetParameterUserValue(parameter, hasUserValueFlag); } @@ -752,30 +756,31 @@ std::vector<std::string> Application::GetChoiceNames(std::string name) void Application::SetDefaultParameterInt(std::string parameter, int value) { Parameter* param = GetParameterByKey(parameter); + bool hasUserValue = param->HasUserValue(); if (dynamic_cast<RadiusParameter*>(param)) { RadiusParameter* paramRadius = dynamic_cast<RadiusParameter*>(param); paramRadius->SetDefaultValue(value); - paramRadius->SetValue(value); + if (!hasUserValue) paramRadius->SetValue(value); } else if (dynamic_cast<IntParameter*>(param)) { IntParameter* paramInt = dynamic_cast<IntParameter*>(param); paramInt->SetDefaultValue(value); - paramInt->SetValue(value); + if (!hasUserValue) paramInt->SetValue(value); } else if (dynamic_cast<FloatParameter*>(param)) { FloatParameter* paramFloat = dynamic_cast<FloatParameter*>(param); paramFloat->SetDefaultValue(static_cast<float>(value)); - paramFloat->SetValue(static_cast<float>(value)); + if (!hasUserValue) paramFloat->SetValue(static_cast<float>(value)); } else if (dynamic_cast<RAMParameter*>(param)) { RAMParameter* paramRAM = dynamic_cast<RAMParameter*>(param); paramRAM->SetDefaultValue(static_cast<unsigned int>(value)); - paramRAM->SetValue(static_cast<unsigned int>(value)); + if (!hasUserValue) paramRAM->SetValue(static_cast<unsigned int>(value)); } } @@ -787,7 +792,7 @@ void Application::SetDefaultParameterFloat(std::string parameter, float value) { FloatParameter* paramFloat = dynamic_cast<FloatParameter*>(param); paramFloat->SetDefaultValue(value); - paramFloat->SetValue(value); + if (!param->HasUserValue()) paramFloat->SetValue(value); } } diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageListParameter.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageListParameter.cxx index cd41fcf1d80f0ffd3edcfeb1980ee6195a8654dc..01c31e196abfc40267f0291f703fe4db20ed0c52 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageListParameter.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageListParameter.cxx @@ -125,6 +125,10 @@ InputImageListParameter::GetFileNameList() const for(InputImageParameterVectorType::const_iterator it = m_InputImageParameterVector.begin(); it!=m_InputImageParameterVector.end();++it) { + if(it->IsNull()) + { + itkExceptionMacro(<< "Empty image in InputImageListParameter."); + } filenames.push_back( (*it)->GetFileName() ); } @@ -139,7 +143,10 @@ InputImageListParameter::GetNthFileName( unsigned int i ) const { itkExceptionMacro(<< "No image "<<i<<". Only "<<m_InputImageParameterVector.size()<<" images available."); } - + if(m_InputImageParameterVector[i].IsNull()) + { + itkExceptionMacro(<< "Requested image "<<i<<" has no filename"); + } return m_InputImageParameterVector[i]->GetFileName(); } @@ -149,6 +156,10 @@ InputImageListParameter::GetImageList() const m_ImageList->Clear(); for (unsigned int i=0 ; i < this->Size() ; ++i) { + if(m_InputImageParameterVector[i].IsNull()) + { + itkExceptionMacro(<< "Image "<<i<<" is empty."); + } m_ImageList->PushBack(m_InputImageParameterVector[i]->GetFloatVectorImage()); } return m_ImageList; @@ -161,6 +172,10 @@ InputImageListParameter::GetNthImage(unsigned int i) const { itkExceptionMacro(<< "No image "<<i<<". Only "<<this->Size()<<" images available."); } + if(m_InputImageParameterVector[i].IsNull()) + { + itkExceptionMacro(<< "Image "<<i<<" is empty."); + } return m_InputImageParameterVector[i]->GetFloatVectorImage(); } diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputProcessXMLParameter.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputProcessXMLParameter.cxx index 3d8be1944de6a8a9052cae436d931320ac28b3ad..5ba103723d9d93908d66f14330570e515f9caadd 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputProcessXMLParameter.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputProcessXMLParameter.cxx @@ -320,7 +320,10 @@ OutputProcessXMLParameter::ParseGroup(const std::string& group) //Nothing to do. copy emptyValue value = emptyValue; } - + else if (type == ParameterType_InputProcessXML) + { + continue; + } //get only file name /* if(type == ParameterType_InputFilename || type == ParameterType_InputImage || diff --git a/Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx b/Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx index 736ad395b5255f46e4ff29d725bbeb64f38f5e36..5d57a8337e73ee2298f313f08c13dc9f2ec5258f 100644 --- a/Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx +++ b/Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx @@ -817,18 +817,22 @@ std::string CommandLineLauncher::DisplayParameterHelp(const Parameter::Pointer & if (type == ParameterType_Choice) { - std::vector<std::string> keys = dynamic_cast<ChoiceParameter*>(param.GetPointer())->GetChoiceKeys(); - std::vector<std::string> names = dynamic_cast<ChoiceParameter*>(param.GetPointer())->GetChoiceNames(); + ChoiceParameter* paramDown = dynamic_cast<ChoiceParameter*>(param.GetPointer()); + if (paramDown) + { + std::vector<std::string> keys = paramDown->GetChoiceKeys(); + std::vector<std::string> names = paramDown->GetChoiceNames(); - oss << "["; - for(unsigned int i=0; i<keys.size(); i++) + oss << "["; + for(unsigned int i=0; i<keys.size(); i++) { - oss<<keys[i]; - if( i != keys.size()-1 ) - oss << "/"; + oss<<keys[i]; + if( i != keys.size()-1 ) + oss << "/"; } - oss << "]"; + oss << "]"; + } } if(m_Application->IsMandatory(paramKey)) diff --git a/Modules/Wrappers/QtWidget/include/otbQtFileSelectionWidget.h b/Modules/Wrappers/QtWidget/include/otbQtFileSelectionWidget.h index d7b42e3083116faed0e1d51627f39c48206114d6..ec1977b33a45fb3cfaf3c5f6f77bd80e135a3545 100644 --- a/Modules/Wrappers/QtWidget/include/otbQtFileSelectionWidget.h +++ b/Modules/Wrappers/QtWidget/include/otbQtFileSelectionWidget.h @@ -87,6 +87,7 @@ signals: protected slots: void SelectFile(); void CallFilenameChanged(); + void SetFileName(const QString &); private: QtFileSelectionWidget(const QtFileSelectionWidget&); //purposely not implemented diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetComplexInputImageParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetComplexInputImageParameter.h index da397a519e74687e19513ef9e67c513c8fb34c66..249283011ea5b85fbe7f85aeb32ac1ece4c19691 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetComplexInputImageParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetComplexInputImageParameter.h @@ -45,6 +45,9 @@ public: QtWidgetComplexInputImageParameter(ComplexInputImageParameter*, QtWidgetModel*); ~QtWidgetComplexInputImageParameter() ITK_OVERRIDE; + inline const QLineEdit* GetInput() const; + inline QLineEdit* GetInput(); + protected slots: bool SetFileName( const QString& value ); void SelectFile(); @@ -65,6 +68,21 @@ private: QPushButton * m_Button; }; +inline +const QLineEdit* +QtWidgetComplexInputImageParameter +::GetInput() const +{ + return m_Input; +} + +inline +QLineEdit* +QtWidgetComplexInputImageParameter +::GetInput() +{ + return m_Input; +} } } diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetComplexOutputImageParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetComplexOutputImageParameter.h index af01fc7f5143665eff8cfd97882c0ab941c17ad1..1ec7b3f3250570a5dcb66887de841a40606cd039 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetComplexOutputImageParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetComplexOutputImageParameter.h @@ -45,11 +45,16 @@ public: QtWidgetComplexOutputImageParameter(ComplexOutputImageParameter*, QtWidgetModel*); ~QtWidgetComplexOutputImageParameter() ITK_OVERRIDE; + inline const QLineEdit* GetInput() const; + inline QLineEdit* GetInput(); + /** Get the PixelType*/ //itkGetMacro(PixelType, int); -protected slots: +public slots: void SetFileName( const QString& value ); + +protected slots: void SelectFile(); void SetPixelType(int pixelType); @@ -72,6 +77,21 @@ private: }; +inline +const QLineEdit* +QtWidgetComplexOutputImageParameter +::GetInput() const +{ + return m_Input; +} + +inline +QLineEdit* +QtWidgetComplexOutputImageParameter +::GetInput() +{ + return m_Input; +} } } diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputImageParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputImageParameter.h index 01684af9326ed3b20133ddedcce04d9f29f4c8ae..5c970fc5c7b6e41a5c57eed44931d5e3172e1f0d 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputImageParameter.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputImageParameter.h @@ -52,9 +52,12 @@ signals: void FileNameIsSet(); protected slots: - bool SetFileName(); + bool SetFileName(const QString& value); void SelectFile(); +private slots: + void OnEditingFinished(); + private: QtWidgetInputImageParameter(const QtWidgetInputImageParameter&); //purposely not implemented void operator=(const QtWidgetInputImageParameter&); //purposely not implemented diff --git a/Modules/Wrappers/QtWidget/src/itkQtProgressBar.cxx b/Modules/Wrappers/QtWidget/src/itkQtProgressBar.cxx index 0cb434483496fa3ba56ec42359fd8eb5694ac712..ba8070ca0bdd637259fdc6ba9d76828320279c42 100644 --- a/Modules/Wrappers/QtWidget/src/itkQtProgressBar.cxx +++ b/Modules/Wrappers/QtWidget/src/itkQtProgressBar.cxx @@ -62,10 +62,12 @@ QtProgressBar::ProcessEvent( itk::Object * caller, ::itk::ProcessObject::Pointer process = dynamic_cast< itk::ProcessObject *>( caller ); - const int value2 = static_cast<int>( - process->GetProgress() * this->maximum() ); - - emit SetValueChanged( value2 ); + if (process) + { + const int value2 = static_cast<int>( + process->GetProgress() * this->maximum() ); + emit SetValueChanged( value2 ); + } } } @@ -78,10 +80,13 @@ QtProgressBar::ConstProcessEvent( const itk::Object * caller, itk::ProcessObject::ConstPointer process = dynamic_cast< const itk::ProcessObject *>( caller ); - const int v = static_cast<int>( - process->GetProgress() * this->maximum() ); + if (process) + { + const int v = static_cast<int>( + process->GetProgress() * this->maximum() ); - emit SetValueChanged( v ); + emit SetValueChanged( v ); + } } } diff --git a/Modules/Wrappers/QtWidget/src/otbApplicationLauncherQt.cxx b/Modules/Wrappers/QtWidget/src/otbApplicationLauncherQt.cxx index d0c6d7842dcc57df46c4e1f701db3b8d5cd78c76..5b4225f479ec6bf70e325f9643b09bcd3ca016fe 100644 --- a/Modules/Wrappers/QtWidget/src/otbApplicationLauncherQt.cxx +++ b/Modules/Wrappers/QtWidget/src/otbApplicationLauncherQt.cxx @@ -109,7 +109,7 @@ int main(int argc, char* argv[]) int ret = qtApp.exec(); // Clean resources - if (mainWindow) delete mainWindow; + delete mainWindow; app = ITK_NULLPTR; ApplicationRegistry::CleanRegistry(); diff --git a/Modules/Wrappers/QtWidget/src/otbQtFileSelectionWidget.cxx b/Modules/Wrappers/QtWidget/src/otbQtFileSelectionWidget.cxx index 37e4f3eed3ee02c97da7956d506f55d3c82ab98c..44eb911061301a5c3373857794a037ac2059f088 100644 --- a/Modules/Wrappers/QtWidget/src/otbQtFileSelectionWidget.cxx +++ b/Modules/Wrappers/QtWidget/src/otbQtFileSelectionWidget.cxx @@ -116,15 +116,22 @@ QtFileSelectionWidget if( filename.isEmpty() ) return; - m_Input->setText( filename ); + SetFileName(filename); +} +void +QtFileSelectionWidget +::CallFilenameChanged() +{ emit FilenameChanged(); } void QtFileSelectionWidget -::CallFilenameChanged() +::SetFileName(const QString & filename) { + m_Input->setText( filename ); + emit FilenameChanged(); } diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputImageParameter.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputImageParameter.cxx index 2929d528a5515d1f4696b390e99e4ef46b0b0b20..e41c35dc01c1ede50efab19452972e0970abd9ce 100644 --- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputImageParameter.cxx +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputImageParameter.cxx @@ -69,7 +69,7 @@ void QtWidgetInputImageParameter::DoCreateWidget() m_HLayout->setContentsMargins(0, 0, 0, 0); m_Input = new QLineEdit; m_Input->setToolTip( m_InputImageParam->GetDescription() ); - connect( m_Input, SIGNAL(editingFinished()), this, SLOT(SetFileName()) ); + connect( m_Input, SIGNAL(editingFinished()), this, SLOT(OnEditingFinished()) ); connect( this, SIGNAL(FileNameIsSet()), GetModel(), SLOT(NotifyUpdate()) ); m_HLayout->addWidget(m_Input); @@ -105,9 +105,7 @@ QtWidgetInputImageParameter if( filename.isEmpty() ) return; - m_Input->setText( filename ); - - if( !SetFileName() ) + if( !SetFileName(filename) ) { std::ostringstream oss; @@ -123,13 +121,14 @@ QtWidgetInputImageParameter } } -bool QtWidgetInputImageParameter::SetFileName() +bool QtWidgetInputImageParameter::SetFileName(const QString& value) { bool res = true; // save value if( m_InputImageParam->SetFromFileName( - QFile::encodeName( m_Input->text() ).constData() ) == true ) + QFile::encodeName( value ).constData() ) == true ) { + m_Input->setText( value ); // notify of value change QString key( m_InputImageParam->GetKey() ); @@ -142,5 +141,10 @@ bool QtWidgetInputImageParameter::SetFileName() return res; } +void QtWidgetInputImageParameter::OnEditingFinished() +{ + SetFileName( m_Input->text() ); +} + } } diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetListViewParameter.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetListViewParameter.cxx index 7f1111939e40c1df5b14e8789c7f091d00967514..7f7b3ab995b85f92afeee24954d29ee971c1c2ba 100644 --- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetListViewParameter.cxx +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetListViewParameter.cxx @@ -49,7 +49,7 @@ void QtWidgetListViewParameter::DoUpdateGUI() { for (unsigned int i = 0; i < m_ListViewParam->GetNbChoices(); ++i) { - QString key = m_ListViewParam->GetChoiceKey(i).c_str(); + QString key = m_ListViewParam->GetChoiceName(i).c_str(); if (key != m_ListView->item(i)->text() ) { resetNeeded = true; @@ -73,7 +73,7 @@ void QtWidgetListViewParameter::DoUpdateGUI() for (unsigned int i = 0; i < m_ListViewParam->GetNbChoices(); ++i) { // Add listBox items - QString key = m_ListViewParam->GetChoiceKey(i).c_str(); + QString key = m_ListViewParam->GetChoiceName(i).c_str(); m_ListView->addItem( key); } } diff --git a/Packaging/CMakeLists.txt b/Packaging/CMakeLists.txt index 55dee29e7d807e4ddffe3e60d5a5a85bcdeba706..e2ef02debc16ac329c37da880217b9ab0eb21a2c 100644 --- a/Packaging/CMakeLists.txt +++ b/Packaging/CMakeLists.txt @@ -63,7 +63,7 @@ find_program(ZIP_EXECUTABLE NAMES 7z 7za) set(CMAKE_INSTALL_PREFIX "${SUPERBUILD_INSTALL_DIR}") #set CMAKE_MODULE_PATH to be the current source directory. -# This will allow to include all cmake files without full path and .cmake extension! +# This will allow including all cmake files without full path and .cmake extension! set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) #include superbuild_macro for get_version() @@ -93,13 +93,10 @@ set(PKG_OTB_VERSION_STRING ${PKG_OTB_VERSION_MAJOR}.${PKG_OTB_VERSION_MINOR}.${P set(PACKAGE_LONG_NAME OrfeoToolBox) set(NAME_SUFFIX "" CACHE STRING "extra suffix for package name") set(PACKAGE_NAME OTB) -if(NAME_SUFFIX) - set(PACKAGE_NAME OTB${NAME_SUFFIX}) -endif() if(APPLE) set(PACKAGE_PLATFORM_NAME "Darwin") elseif(WIN32) - set(PACKAGE_PLATFORM_NAME "win") + set(PACKAGE_PLATFORM_NAME "Win") elseif(LINUX) set(PACKAGE_PLATFORM_NAME "Linux") endif() @@ -110,7 +107,7 @@ endif() # This directory is important. # We stage/keep files that goes into final package in this directory -set(PKG_STAGE_DIR ${PACKAGE_NAME}-${PKG_OTB_VERSION_STRING}-${PACKAGE_PLATFORM_NAME}${PACKAGE_ARCH}) +set(PKG_STAGE_DIR ${PACKAGE_NAME}-${PKG_OTB_VERSION_STRING}-${PACKAGE_PLATFORM_NAME}${PACKAGE_ARCH}${NAME_SUFFIX}) set(PATCHELF_PROGRAM "${CMAKE_BINARY_DIR}/PATCHELF/src/patchelf/src/patchelf") include(External_patchelf) @@ -198,8 +195,7 @@ prepare_search_dirs(PKG_SEARCHDIRS) set(PKG_PEFILES) prepare_file_list(PKG_PEFILES) foreach(pfile ${PKG_PEFILES}) - get_filename_component(pfile_name ${pfile} NAME) - process_file_recurse(${pfile_name}) + process_file_recurse(${pfile}) endforeach() install_include_dirs() diff --git a/Packaging/Files/linux_pkgsetup.in b/Packaging/Files/linux_pkgsetup.in index 6c56a3b976e7a54cb041a244b4f917ff073ef125..93d5a6a082b7010519334e23bf71d8d5ed230588 100644 --- a/Packaging/Files/linux_pkgsetup.in +++ b/Packaging/Files/linux_pkgsetup.in @@ -20,6 +20,17 @@ # set -e +# verify basic tools are here +which sh >/dev/null 2>&1 || ret=$? +if [ ! -z "$ret" ] ; then echo "ERROR: Missing tool 'which'"; exit 1 ; fi +for tool in dirname find file grep cut sed chmod cat readlink ; do + if [ -z "$(which $tool)" ] ; then + echo "ERROR: Missing tool '${tool}'" + echo "Please install it and make sure it can be found from PATH" + exit 1; + fi +done + DIRNAME_0=$(dirname "$0") cd "$DIRNAME_0" @@ -32,20 +43,16 @@ PATCH_ELF_EXE="$OUT_DIR/patchelf" #do not move below block. it must be before "unset LD_LIBRARY_PATH" code #check if we have any python bindings -set OTB_PYTHON_LIB_PATH= if [ -f "$OUT_DIR/lib/python/_otbApplication.so" ] ; then - sed -i "s,OUT_DIR,$OUT_DIR,g" "$OUT_DIR/setup_python.sh" - chmod +x $OUT_DIR/setup_python.sh - . ./setup_python.sh - set OTB_PYTHON_LIB_PATH=$OUT_DIR/lib/python + chmod +x "$OUT_DIR/setup_python.sh" + ./setup_python.sh || setup_python_ret=$? fi # No no interference with LD_LIBRARY_PATH unset LD_LIBRARY_PATH -#RK: We cannot avoid -maxdepth 1 option in find command below because, -# there are files in $OUT_DIR/lib/gtk which we CANNOT add new rpath -BINARY_FILES=$(find $OTB_PYTHON_LIB_PATH $OUT_DIR/lib $OUT_DIR/bin $OUT_DIR/lib/otb/applications -maxdepth 1 -type f -exec file {} \; | grep -i elf|cut -f1 -d':') +# 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':') # run patchelf for bin_file in $BINARY_FILES; do #echo "adding rpath to $bin_file" diff --git a/Packaging/Files/macx_pkgsetup.in b/Packaging/Files/macx_pkgsetup.in index 46606ffb164881b7afe4639c42cb1ff6ce3ab519..7c4b5c8e941362bbaf7c68364122b5f52917d2c8 100755 --- a/Packaging/Files/macx_pkgsetup.in +++ b/Packaging/Files/macx_pkgsetup.in @@ -20,6 +20,17 @@ # set -e +# verify basic tools are here (install_name_tool is specific macOS) +which sh >/dev/null 2>&1 || ret=$? +if [ ! -z "$ret" ] ; then echo "ERROR: Missing tool 'which'"; exit 1 ; fi +for tool in dirname find file grep cut sed chmod cat readlink install_name_tool ; do + if [ -z "$(which $tool)" ] ; then + echo "ERROR: Missing tool '${tool}'" + echo "Please install it and make sure it can be found from PATH" + exit 1; + fi +done + DIRNAME_0=$(dirname "$0") cd "$DIRNAME_0" || exit 1 @@ -29,16 +40,9 @@ cd "$DIRNAME_0" || exit 1 OUT_DIR=$(pwd) #do not move below 3 lines. it must be before "unset LD_LIBRARY_PATH" code -sed -i "" "s,OUT_DIR,$OUT_DIR,g" "$OUT_DIR/setup_python.sh" -chmod +x $OUT_DIR/setup_python.sh -./setup_python.sh - -# find install_name_tool -INSTALL_NAME_TOOL=$(which install_name_tool) -if [ -z "$INSTALL_NAME_TOOL" ]; then - echo "install_name_tool does not exists.." - echo "please install install_name_tool and make sure it can be found from PATH" - exit 1; +if [ -f "$OUT_DIR/lib/python/_otbApplication.so" ] ; then + chmod +x "$OUT_DIR/setup_python.sh" + ./setup_python.sh || setup_python_ret=$? fi # no interference with DYLD_LIBRARY_PATH and DYLD_FALLBACK_LIBRARY_PATH @@ -55,9 +59,9 @@ for input_file in $LIB_FILES $BIN_FILES; do if [ -f "$input_file" ]; then input_file_old_rpaths=$(otool -l "$input_file" | grep -A 3 "LC_RPATH" | grep -oE 'path .* \(offset' | cut -d ' ' -f 2) for rpath_old in $input_file_old_rpaths; do - $INSTALL_NAME_TOOL "-delete_rpath" "$rpath_old" "$input_file" + install_name_tool "-delete_rpath" "$rpath_old" "$input_file" done - $INSTALL_NAME_TOOL "-add_rpath" "$OUT_DIR/lib" "$input_file" + install_name_tool "-add_rpath" "$OUT_DIR/lib" "$input_file" fi done diff --git a/Packaging/Files/selftester.sh b/Packaging/Files/selftester.sh index 69d42e1304a79770bca9ffc2831ab3ac2d9be221..8137cfa29979d09df9e4615a2b618a552cb60d70 100755 --- a/Packaging/Files/selftester.sh +++ b/Packaging/Files/selftester.sh @@ -70,7 +70,7 @@ for name in $OTB_SO_LIBRARIES $OTB_DY_LIBRARIES $OTB_EXE; do elif echo "$F_OUTPUT" | grep -q ': broken symbolic link'; then echo_and_report "$F_OUTPUT" elif echo "$F_OUTPUT" | grep -q -i -e ': ELF .*shared object' -e ': ELF .*executable'; then - LDD_ERRORS=$(ldd "$name" | grep -i -e '=> not found' -e 'not a dynamic executable') + LDD_ERRORS=$(ldd "$name" 2>&1 | grep -v 'you do not have execution permission' | grep -i -e '=> not found' -e 'not a dynamic executable') if [ -n "$LDD_ERRORS" ]; then echo_and_report "ldd $name" echo_and_report "$LDD_ERRORS" @@ -122,25 +122,32 @@ for app in $OTB_APPS; do echo "" >tmp.log "bin/otbgui_$app" >tmp.log 2>&1 & GUI_PID=$! - sleep 5s - # Check process tree - CHILD_PROC=$(ps_children $GUI_PID | grep "bin/otbgui $app") - if [ -n "$CHILD_PROC" ]; then - CHILD_PID=$(echo "$CHILD_PROC" | cut -d ' ' -f 1) - NEXT_CHILD_PROC=$(ps_children "$CHILD_PID" | grep 'otbApplicationLauncherQt') - if [ -n "$NEXT_CHILD_PROC" ]; then - NEXT_CHILD_PID=$(echo "$NEXT_CHILD_PROC" | cut -d ' ' -f 1) - kill -9 "$NEXT_CHILD_PID" - wait "$NEXT_CHILD_PID" 2>/dev/null - else - echo "ERROR: otbApplicationLauncherQt $app failed to launch" - tee -a selftest_report.log < tmp.log - exit_if + CHILD_PID="" + NEXT_CHILD_PID="" + nb_try=0 + while [ -z "$NEXT_CHILD_PID" -a $nb_try -lt 10 ]; do + sleep 1s + CHILD_PROC=$(ps_children $GUI_PID | grep "bin/otbgui $app") + if [ -n "$CHILD_PROC" ]; then + CHILD_PID=$(echo "$CHILD_PROC" | cut -d ' ' -f 1) + NEXT_CHILD_PROC=$(ps_children "$CHILD_PID" | grep 'otbApplicationLauncherQt') + if [ -n "$NEXT_CHILD_PROC" ]; then + NEXT_CHILD_PID=$(echo "$NEXT_CHILD_PROC" | cut -d ' ' -f 1) + fi fi + nb_try=$(( nb_try + 1 )) + done + if [ -n "$NEXT_CHILD_PID" ]; then + kill -9 "$NEXT_CHILD_PID" + wait "$NEXT_CHILD_PID" 2>/dev/null + elif [ -n "$CHILD_PID" ]; then + echo "ERROR: otbApplicationLauncherQt $app failed to launch" + tee -a selftest_report.log < tmp.log + exit_if else - echo "ERROR: bin/otbgui_$app failed to launch" - tee -a selftest_report.log < tmp.log - exit_if + echo "ERROR: bin/otbgui_$app failed to launch" + tee -a selftest_report.log < tmp.log + exit_if fi fi app_index=$(( app_index + 1 )) diff --git a/Packaging/Files/setup_python.sh b/Packaging/Files/setup_python.sh index e24731a88ca3579ff40925d97cf9ffaa87dccd0a..e0f03205ed966f18365d144ed493f805f46eaffc 100755 --- a/Packaging/Files/setup_python.sh +++ b/Packaging/Files/setup_python.sh @@ -19,11 +19,20 @@ # limitations under the License. # +# get current working dir (this should be the install directory) +CWD=$(pwd) + # Setup python environment if [ ! -f "$OTB_PYTHON_EXE" ] ; then OTB_PYTHON_EXE=$(which python) fi +if [ ! -f "$OTB_PYTHON_EXE" ] ; then + printf %s\\n "*****Error occurred during installation******" + printf %s\\n "Python executable not found" + exit 1 +fi + python_major_version=$($OTB_PYTHON_EXE -c "import sys;print(sys.version_info[0])") python_minor_version=$($OTB_PYTHON_EXE -c "import sys;print(sys.version_info[1])") python_patch_version=$($OTB_PYTHON_EXE -c "import sys;print(sys.version_info[2])") @@ -35,7 +44,7 @@ python_check_failed() { printf %s\\n "If you have python2.6 or Python2.7 installed in your system " printf %s\\n "You should set OTB_PYTHON_EXE and re-run this installation script." printf %s\\n "eg: OTB_PYTHON_EXE=/path/to/python2.7 ./OTB-X.Y-Linux64.run" - exit 1; + exit 1 } if [ "$python_major_version" -gt 2 ]; then python_check_failed @@ -64,18 +73,19 @@ do done if [ "$found_python_lib" -eq "1" ]; then - numpy_import_result="$($OTB_PYTHON_EXE -c 'import numpy' 2>&1)" + numpy_import_result="$($OTB_PYTHON_EXE -c 'import numpy' 2>&1)" || numpy_ret=$? if [ ! -z "$numpy_import_result" ]; then - printf %s\\n "*****Error occurred during installation******" - printf %s\\n "Python interpreter detected is : $OTB_PYTHON_EXE ( version: $python_version )" - printf %s\\n "numpy not installed with '$OTB_PYTHON_EXE'" - printf %s\\n "Check failed with result:" - printf %s\\n "$numpy_import_result" - exit 1; - fi; - printf %s\\n "OTB python bindings will be configured for $OTB_PYTHON_EXE ( version: $python_version )" - printf %s\\n "Found python library: $python_lib_file_path" - #ln -sf "$python_lib_file_path" "OUT_DIR/lib/$python_INSTALLED_SONAME" + printf %s\\n "*****Error occurred during installation******" + printf %s\\n "Python interpreter detected is : $OTB_PYTHON_EXE ( version: $python_version )" + printf %s\\n "numpy not installed with '$OTB_PYTHON_EXE'" + printf %s\\n "Check failed with result:" + printf %s\\n "$numpy_import_result" + exit 1 + else + printf %s\\n "OTB python bindings will be configured for $OTB_PYTHON_EXE ( version: $python_version )" + printf %s\\n "Found python library: $python_lib_file_path" + fi + #ln -sf "$python_lib_file_path" "$CWD/lib/$python_INSTALLED_SONAME" else printf %s\\n "*****Error occurred during installation******" printf %s\\n "Python interpreter detected is : $OTB_PYTHON_EXE ( version: $python_version )" @@ -83,5 +93,6 @@ else printf %s\\n "We had searched following directories $python_lib_dirs" printf %s\\n "If you don't have python-dev package installed, install it and make a symlink" printf %s\\n "If you don't have python headers and so installed on a custom location, then make a symlink" - printf %s\\n "eg: ln -s /usr/lib/x86_64-linux-gnu/$python_INSTSONAME OUT_DIR/lib/$python_INSTSONAME" + printf %s\\n "eg: ln -s /usr/lib/x86_64-linux-gnu/$python_INSTSONAME $CWD/lib/$python_INSTSONAME" + exit 1 fi diff --git a/Packaging/install_rule.cmake b/Packaging/install_rule.cmake index e404a59fe6ea212d03a5055a08b3a0cc2321d0f9..b4d40f0757648b7b4742a54aab722c935e960977 100644 --- a/Packaging/install_rule.cmake +++ b/Packaging/install_rule.cmake @@ -78,6 +78,8 @@ function(install_rule src_file) continue() elseif("${sfile_ABS_LOWER}" MATCHES "\\.la$") continue() + elseif("${sfile_ABS_LOWER}" MATCHES "\\.settings$") + continue() else() if(UNIX) #the last else() loop where we run a 'file' command to find file type and directory diff --git a/Packaging/makeself/README.md b/Packaging/makeself/README.md index 04b9de80bbc0a71f0d1df86bd7453f1019704c36..116b503c1a38237db7c29a51a0b397a24d218d21 100644 --- a/Packaging/makeself/README.md +++ b/Packaging/makeself/README.md @@ -112,7 +112,7 @@ makeself.sh [args] archive_dir file_name label startup_script [script_args] * _archive_dir_ is the name of the directory that contains the files to be archived * _file_name_ is the name of the archive to be created * _label_ is an arbitrary text string describing the package. It will be displayed while extracting the files. - * _startup_script_ is the command to be executed _from within_ the directory of extracted files. Thus, if you wish to execute a program contain in this directory, you must prefix your command with `./`. For example, `./program` will be fine. The _script_args_ are additionnal arguments for this command. + * _startup_script_ is the command to be executed _from within_ the directory of extracted files. Thus, if you wish to execute a program contain in this directory, you must prefix your command with `./`. For example, `./program` will be fine. The _script_args_ are additional arguments for this command. Here is an example, assuming the user has a package image stored in a **/home/joe/mysoft**, and he wants to generate a self-extracting package named **mysoft.sh**, which will launch the "setup" script initially stored in /home/joe/mysoft : @@ -128,7 +128,7 @@ Archives generated with Makeself can be passed the following arguments: * _--keep_ : Prevent the files to be extracted in a temporary directory that will be removed after the embedded script's execution. The files will then be extracted in the current working directory and will stay here until you remove them. * _--verbose_ : Will prompt the user before executing the embedded command - * _--target dir_ : Allows to extract the archive in an arbitrary place. + * _--target dir_ : Allows extracting the archive in an arbitrary place. * _--nox11_ : Do not spawn a X11 terminal. * _--confirm_ : Prompt the user for confirmation before running the embedded command. * _--info_ : Print out general information about the archive (does not extract). @@ -181,7 +181,7 @@ The latest development version can be grabbed from [GitHub][10]. Feel free to su * **v2.1.5:** Made the md5sum detection consistent with the header code. Check for the presence of the archive directory. Added --encrypt for symmetric encryption through gpg (Eric Windisch). Added support for the digest command on Solaris 10 for MD5 checksums. Check for available disk space before extracting to the target directory (Andreas Schweitzer). Allow extraction to run asynchronously (patch by Peter Hatch). Use file descriptors internally to avoid error messages (patch by Kay Tiong Khoo). * **v2.1.6:** Replaced one dot per file progress with a realtime progress percentage and a spining cursor. Added --noprogress to prevent showing the progress during the decompression. Added --target dir to allow extracting directly to a target directory. (Guy Baconniere) * **v2.2.0:** First major new release in years! Includes many bugfixes and user contributions. Please look at the [project page on Github][10] for all the details. - * **v2.3.0:** Support for archive encryption via GPG or OpenSSL. Added LZO and LZ4 compression support. Options to set the packaging date and stop the umask from being overriden. Optionally ignore check for available disk space when extracting. New option to check for root permissions before extracting. + * **v2.3.0:** Support for archive encryption via GPG or OpenSSL. Added LZO and LZ4 compression support. Options to set the packaging date and stop the umask from being overridden. Optionally ignore check for available disk space when extracting. New option to check for root permissions before extracting. * **v2.3.1:** Various compatibility updates. Added unit tests for Travis CI in the GitHub repo. New --tar-extra, --untar-extra, --gpg-extra, --gpg-asymmetric-encrypt-sign options. ## Links diff --git a/Packaging/makeself/makeself.sh b/Packaging/makeself/makeself.sh index a2bb226d1ece2a46139dd6e8a1866100e10b65cb..5e3990514edf9e585842fcd03f3fd8ee60d1f017 100755 --- a/Packaging/makeself/makeself.sh +++ b/Packaging/makeself/makeself.sh @@ -6,7 +6,7 @@ # Utility to create self-extracting tar.gz archives. # The resulting archive is a file holding the tar.gz archive with # a small Shell script stub that uncompresses the archive to a temporary -# directory and then executes a given script from withing that directory. +# directory and then executes a given script from within that directory. # # Makeself home page: http://makeself.io/ # @@ -39,7 +39,7 @@ # - 2.0.1 : Added --copy # - 2.1.0 : Allow multiple tarballs to be stored in one archive, and incremental updates. # Added --nochown for archives -# Stopped doing redundant checksums when not necesary +# Stopped doing redundant checksums when not necessary # - 2.1.1 : Work around insane behavior from certain Linux distros with no 'uncompress' command # Cleaned up the code to handle error codes from compress. Simplified the extraction code. # - 2.1.2 : Some bug fixes. Use head -n to avoid problems. diff --git a/Packaging/post_install.cmake b/Packaging/post_install.cmake index 29c937e02fcafbfbf7799a00502f3aa1fedf412a..25837facd80d94bb2f1b8ee26f693b6a03dc498f 100644 --- a/Packaging/post_install.cmake +++ b/Packaging/post_install.cmake @@ -18,6 +18,55 @@ # limitations under the License. # +function(sanitize_system_paths input_file) + # does not support Windows ... + if(APPLE) + set(SHARED_EXT "\\.dylib") + elseif(UNIX) + set(SHARED_EXT "\\.so") + endif() + set(filtered_content) + + file(STRINGS "${input_file}" source_file_content NEWLINE_CONSUME) + string(REGEX REPLACE "\n" "\n;" source_file_content "${source_file_content}") + set(SEARCH_REGEX "(^[^#\"]+(LIBRARIES|INCLUDE_DIR[A-Z]*) +\")(.+)(\"[^\"]*)") + + foreach(line ${source_file_content}) + set(filtered_line "${line}") + if(line MATCHES "${SEARCH_REGEX}") + string(REGEX REPLACE "${SEARCH_REGEX}" "\\3" extract_str "${line}" ) + string(REGEX REPLACE ";;" ";" extract_str "${extract_str}") + set(_to_be_removed) + set(_to_be_added) + foreach(path ${extract_str}) + if(IS_ABSOLUTE ${path}) + list(APPEND _to_be_removed "${path}") + if(NOT IS_DIRECTORY ${path}) + if(path MATCHES "^.*/lib[^\\.]+${SHARED_EXT}.*") + string(REGEX REPLACE "^.*/lib([^\\.]+)${SHARED_EXT}.*" "\\1" _lib_name "${path}") + list(APPEND _to_be_added "${_lib_name}") + endif() + endif() + endif() + endforeach() + if(_to_be_removed) + list(REMOVE_ITEM extract_str ${_to_be_removed}) + endif() + if(_to_be_added) + list(INSERT extract_str 0 ${_to_be_added}) + endif() + if(extract_str) + list(REMOVE_DUPLICATES extract_str) + endif() + string(REGEX REPLACE "${SEARCH_REGEX}" "\\1${extract_str}\\4" filtered_line "${line}" ) + endif() + list(APPEND filtered_content "${filtered_line}") + endforeach() + + string(REGEX REPLACE "\n;" "\n" filtered_content "${filtered_content}") + file(WRITE "${input_file}" "${filtered_content}") +endfunction() + #check variables are set foreach(var P_DIRS P_MATCH P_REPLACE) if(NOT ${var}) @@ -42,5 +91,8 @@ foreach( p_dir ${P_DIRS} ) file(WRITE "${cmake_file}" "# This file is modified by OTB after installation. \n${cmake_file_CONTENTS}") endif() + if(UNIX) + sanitize_system_paths(${cmake_file}) + endif() endforeach() # foreach( cmake_file endforeach() # foreach( p_dir diff --git a/Packaging/prepare_file_list.cmake b/Packaging/prepare_file_list.cmake index 4d83bc601da079a89f57d98bda00e54a00b08501..8ba085b74570773bfd99c5a7c067c72b978f63f4 100644 --- a/Packaging/prepare_file_list.cmake +++ b/Packaging/prepare_file_list.cmake @@ -29,22 +29,23 @@ function(prepare_file_list file_list_result) return() endif() - set(file_list "${otbapp_launcher}") - - if(HAVE_QT4) - list(APPEND file_list "otbApplicationLauncherQt${EXE_EXT}") - endif() + # find OTB targets + set(_otb_targets_path + "${SUPERBUILD_INSTALL_DIR}/lib/cmake/OTB-${PKG_OTB_VERSION_MAJOR}.${PKG_OTB_VERSION_MINOR}") + file(GLOB _targets_config_files "${_otb_targets_path}/OTBTargets-*.cmake") + set(_IMPORT_PREFIX ${SUPERBUILD_INSTALL_DIR}) + foreach(f ${_targets_config_files}) + file(STRINGS ${f} _f_content REGEX " IMPORTED_LOCATION_[A-Z]+ ") + string(REGEX REPLACE " +IMPORTED_LOCATION_[A-Z]+ \"([^\"]+)\"" "\\1;" _filtered ${_f_content}) + string(CONFIGURE "${_filtered}" _configured) + list(APPEND file_list "${_configured}") + endforeach() - if(HAVE_MVD) - list(APPEND file_list "monteverdi${EXE_EXT}") - list(APPEND file_list "mapla${EXE_EXT}") - endif() - if(HAVE_PYTHON) list(APPEND file_list "_otbApplication${PYMODULE_EXT}") endif() - foreach(exe_file "iceViewer" "otbTestDriver" "SharkVersion") + foreach(exe_file "SharkVersion") if(EXISTS "${SUPERBUILD_INSTALL_DIR}/bin/${exe_file}${EXE_EXT}") list(APPEND file_list "${exe_file}${EXE_EXT}") else() @@ -88,12 +89,7 @@ function(prepare_file_list file_list_result) if(MSVC) list(APPEND file_list "ucrtbase.dll") list(APPEND file_list "proj.dll") - endif() - - set(otb_applications_dir "${SUPERBUILD_INSTALL_DIR}/lib/otb/applications") - file(GLOB OTB_APPS_LIST "${otb_applications_dir}/otbapp_*${LIB_EXT}") # /lib/otb - list(APPEND file_list ${OTB_APPS_LIST}) - + endif() set(${file_list_result} ${file_list} PARENT_SCOPE) endfunction() diff --git a/Packaging/process_file_recurse.cmake b/Packaging/process_file_recurse.cmake index b83616ad864c070e3d3b390b809d20dca00303df..b8f31b4ededfb3faa10d848c5a2e0bbc9f4f7155 100644 --- a/Packaging/process_file_recurse.cmake +++ b/Packaging/process_file_recurse.cmake @@ -19,7 +19,14 @@ # function(process_file_recurse input_file) set(input_file_full_path) - search_library(${input_file} PKG_SEARCHDIRS input_file_full_path) + if(IS_ABSOLUTE "${input_file}" AND EXISTS "${input_file}") + set(input_file_full_path ${input_file}) + if(PKG_DEBUG) + message("Found '${input_file}' (return)") + endif() + else() + search_library(${input_file} PKG_SEARCHDIRS input_file_full_path) + endif() if(NOT input_file_full_path) if(LINUX) setif_value_in_list(is_gtk_lib "${input_file}" ALLOWED_SYSTEM_DLLS) diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt index 51d05f450e770d662bd8bc6ed3c82642777a3316..1f7046b54e1b88e5a70ab7d4afe033b84f40a0bf 100644 --- a/RELEASE_NOTES.txt +++ b/RELEASE_NOTES.txt @@ -1,3 +1,90 @@ +OTB-v.6.2.0 - Changes since version 6.0.0 (October 26th, 2017) +---------------------------------------------------------- + +* Request for Changes (http://wiki.orfeo-toolbox.org/index.php/Requests_for_Changes): + * Request for Changes-91: Better error messages (adopted, merged) + * Request for Changes-92: Build remote modules as standalone cmake projects (adopted, merged) + * Request for Changes-93: Update third party versions in Superbuild for 6.2 (adopted, merged) + * Request for Changes-94: CookBook licensed under cc-by-sa (adopted, merged) + * Request for Changes-95: Compile OTB with C++14 by default (adopted, merged) + * Request for Changes-96: Long help in otbcli (adopted, merged) + * Request for Changes-97: KMeansClassification reimplemented (adopted, merged) + * Request for Changes-98: Upgrade Monteverdi dependency from QWT 5 to QWT 6 (adopted, merged) + * Request for Changes-99: Refactor ExtractROI application (adopted, merged) + * Request for Changes-100: Add external soil file to Sail model (adopted, merged) + * Request for changes-102: Extend MachineLearningModel sample and target types (adopted, merged) + * Request for changes-103: Improve OTB Applications documentation (part 1) (adopted, merged) + * Request for changes-105: Simplify logging of composite applications (adopted, merged) + * Request for changes-106: All-in-one LSMS application (adopted, merged) + * Request for changes-107: Refactor Convert application (adopted, merged) + * Request for changes-108: Make OTB package great again (adopted, merged) + * Request for changes-109: Refactor PixelValue application (adopted, merged) + * Request for changes-111: SuperBuild dependencies additions for GDAL (adopted, merged) + * Request for changes-112: New-functor-filters (adopted, merged) + * Request for changes-114: Add Daniel McInerney as a new committer (adopted) + * Request for changes-115: Refactoring of DownloadSRTMTiles (adopted, merged) + +* Bugfixes : + * OTB-Qgis + * 0001445: Mean shift segmentation ignoring mask OTB QGIS + + * Documentation + * 0001434: Bibliography references are not set in the Software Guide (PDF version) + * 0001400: Training applications reference documentation do not include shark parameters + * 0001471: Issue with Boolean parameter in the Python application API documentation + + * Monteverdi + * 0001431: RGE Alti files inverted on Monteverdi + * 0001432: RGE Alti files inverted on Monteverdi + * 0001408: Issue in Monteverdi French translation (typo) + + * OTB-Packaging + * 0001449: Issues with OTB 6.1 standalone packages (Linux) + * 0001404: OTB xdk 5.10.1 is not able to compile a simple program on a Ubuntu 16.04 VM + * 0001430: building 6.0.0 fails at otbSFSTextureExtraction.cxx.o + * 0001474: OTB XDK is not working on Linux + * 0001460: Unable to compile OTB 6.2.0 RC1 with superbuild (CURL issue) + + * Orfeo Toolbox (OTB) + * 0001453: Applications crash with inxml paramter (GUI mode) + * 0001405: Crash on optical calibration, TOC mode, GUI only (command line works), only on Mac + * 0001422: Optical Calibration application crash on MacOSX + * 0001401: ktrace reports too many file open for any otbapplication + * 0001439: GUI of ComputeOGRLayersFeaturesStatistics and OGRLayerClassifier crash on certain shape files + * 0001399: missing include_directories call when building external projects + * 0001438: Input Value Type of Classification apps + * 0001420: Change layer name in Monteverdi has no effect + * 0001446: Write mode on the SampleExtraction application + * 0001435: Performance issue on OTB 6.0 otbcli_MeanShiftSmoothing + * 0001407: In TrainImagesClassifier, field selection gets reset all the time + * 0001448: VectorClassifier isn't working for me... + * 0001397: OTBIOkml links only with base, dom, and engine but cmake includes all kml libs + * 0001413: set GDAL_DRIVER_PATH to avoid autoload of gdal driver from another installation + * 0001443: Fails to build with cmake 3.9.0 + * 0001444: cmake fails if OTB_DATA_LARGEINPUT_ROOT is set and OTB_DATA_ROOT is not set + * 0001398: OTB won't parse *.xml metadata file on newest Pleiades data + * 0001418: Two more InXML incorrect tests + * 0001416: Parameter names different in cli and gui version + * 0001417: In windows packages otbenv.cmd and otbenv.bat, GDAL_DATA is set to a folder that does not exist + * 0001425: Cli Command line produced by otbgui_TrainImagesClassifier is wrong + * 0001424: ComputeConfusionMatrix crashes because proj.dll is missing + * 0001403: InXML1 tests fail but report as passed + * 0001419: Fix detection of OpenCV on i386 architecture. + * 0001426: GUI TrainimagesClassifier resets "field name" parameter when another parameter is set + * 0001421: otbenv.bash has windows endline + * 0001402: 404 link on otb-users + * 0001469: Superbuild with Visual Studio 15 2017 + * 0001464: otb_module_impl() called twice in ExternalModuleTemplate + * 0001459: Patch to fix spelling errors + + * OTB-applications + * 0001441: Error in param in template otbTrainLibSVM.txx + * 0001411: Training applications needs field name of type integer + * 0001410: BundleToPerfectSensor composite application does not expose parameters of internal applications + * 0001467: Convert application memory allocation issue + * 0001463: BandMathX not accepting global statistics + + OTB-v.6.0.0 - Changes since version 5.10.1 (May 2th, 2017) ---------------------------------------------------------- diff --git a/SuperBuild/CMake/External_curl.cmake b/SuperBuild/CMake/External_curl.cmake index 8728bdeb7e8a02c4af70125d157e3cd492862015..37cb2e861cb9750fc6710f933a89fe6d32db4fb0 100644 --- a/SuperBuild/CMake/External_curl.cmake +++ b/SuperBuild/CMake/External_curl.cmake @@ -24,14 +24,30 @@ SETUP_SUPERBUILD(CURL) # declare dependencies ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(CURL ZLIB) -if(NOT APPLE) +if(NOT APPLE AND NOT WIN32) ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(CURL OPENSSL) + ADD_SUPERBUILD_CMAKE_VAR(CURL OPENSSL_INCLUDE_DIR) + ADD_SUPERBUILD_CMAKE_VAR(CURL OPENSSL_SSL_LIBRARY) + ADD_SUPERBUILD_CMAKE_VAR(CURL OPENSSL_CRYPTO_LIBRARY) + list(APPEND CURL_SB_CONFIG + -DCMAKE_USE_OPENSSL:BOOL=ON + -DCMAKE_C_FLAGS:STRING=-fPIC) +elseif(APPLE) + list(APPEND CURL_SB_CONFIG + -DCMAKE_USE_DARWINSSL:BOOL=ON + -DHAVE_LIBNETWORK:STRING=0 + -DCMAKE_C_FLAGS:STRING=-fPIC) +elseif(WIN32) + list(APPEND CURL_SB_CONFIG + -DCMAKE_USE_WINSSL:BOOL=ON + -DCURL_WINDOWS_SSPI:BOOL=ON + -DHAVE_INET_PTON:STRING=0) endif() ExternalProject_Add(CURL PREFIX CURL - URL "http://curl.haxx.se/download/curl-7.40.0.tar.gz" - URL_MD5 58943642ea0ed050ab0431ea1caf3a6f + URL "http://curl.haxx.se/download/curl-7.54.1.tar.gz" + URL_MD5 21a6e5658fd55103a90b11de7b2a8a8c BINARY_DIR ${CURL_SB_BUILD_DIR} INSTALL_DIR ${SB_INSTALL_PREFIX} DOWNLOAD_DIR ${DOWNLOAD_LOCATION} @@ -39,12 +55,40 @@ ExternalProject_Add(CURL ${SB_CMAKE_CACHE_ARGS} -DBUILD_CURL_TESTS:BOOL=OFF -DBUILD_CURL_EXE:BOOL=ON - -DCMAKE_USE_OPENSSL:BOOL=OFF + -DBUILD_DASHBOARD_REPORTS:BOOL=OFF + -DBUILD_RELEASE_DEBUG_DIRS:BOOL=OFF + -DCMAKE_USE_GSSAPI:BOOL=OFF -DCMAKE_USE_LIBSSH2:BOOL=OFF - -DCURL_DISABLE_LDAP:BOOL=ON -DCMAKE_USE_OPENLDAP:BOOL=OFF - -DENABLE_MANUAL:BOOL=OFF + -DCMAKE_USE_MBEDTLS:BOOL=OFF + -DCURL_DISABLE_COOKIES:BOOL=OFF + -DCURL_DISABLE_CRYPTO_AUTH:BOOL=OFF + -DCURL_DISABLE_DICT:BOOL=ON + -DCURL_DISABLE_FILE:BOOL=OFF + -DCURL_DISABLE_FTP:BOOL=OFF + -DCURL_DISABLE_GOPHER:BOOL=ON + -DCURL_DISABLE_HTTP:BOOL=OFF + -DCURL_DISABLE_IMAP:BOOL=ON + -DCURL_DISABLE_LDAP:BOOL=ON + -DCURL_DISABLE_LDAPS:BOOL=ON + -DCURL_DISABLE_POP3:BOOL=ON + -DCURL_DISABLE_PROXY:BOOL=OFF + -DCURL_DISABLE_RTSP:BOOL=ON + -DCURL_DISABLE_SMTP:BOOL=ON + -DCURL_DISABLE_TELNET:BOOL=ON + -DCURL_DISABLE_TFTP:BOOL=ON + -DCURL_DISABLE_VERBOSE_STRINGS:BOOL=OFF + -DCURL_HIDDEN_SYMBOLS:BOOL=OFF + -DCURL_STATICLIB:BOOL=OFF + -DDISABLED_THREADSAFE:BOOL=OFF + -DENABLE_ARES:BOOL=OFF + -DENABLE_CURLDEBUG:BOOL=OFF + -DENABLE_DEBUG:BOOL=OFF -DENABLE_IPV6:BOOL=OFF + -DENABLE_UNIX_SOCKETS:BOOL=OFF + -DENABLE_MANUAL:BOOL=OFF + -DHTTP_ONLY:BOOL=OFF + -DUSE_WIN32_LDAP:BOOL=OFF ${CURL_SB_CONFIG} DEPENDS ${CURL_DEPENDENCIES} CMAKE_COMMAND ${SB_CMAKE_COMMAND} @@ -54,7 +98,7 @@ ExternalProject_Add(CURL LOG_INSTALL 1 ) -SUPERBUILD_PATCH_SOURCE(CURL) +# SUPERBUILD_PATCH_SOURCE(CURL) set(_SB_CURL_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) if(WIN32) diff --git a/SuperBuild/CMake/External_gdal.cmake b/SuperBuild/CMake/External_gdal.cmake index fd7ed1836132c30fe132e67c14c3add1ca92f11e..d9a526757444340aaa130c07fca9fcdb66e4d6b5 100644 --- a/SuperBuild/CMake/External_gdal.cmake +++ b/SuperBuild/CMake/External_gdal.cmake @@ -23,7 +23,7 @@ INCLUDE_ONCE_MACRO(GDAL) SETUP_SUPERBUILD(GDAL) # declare dependencies -ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(GDAL CURL OPENJPEG TIFF GEOTIFF PNG JPEG SQLITE GEOS ZLIB EXPAT) +ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(GDAL CURL OPENJPEG TIFF GEOTIFF PNG JPEG SQLITE GEOS ZLIB EXPAT HDF5 NETCDF HDF4) ADD_SUPERBUILD_CONFIGURE_VAR(GDAL TIFF_ROOT --with-libtiff) ADD_SUPERBUILD_CONFIGURE_VAR(GDAL GEOTIFF_ROOT --with-geotiff) @@ -35,6 +35,9 @@ ADD_SUPERBUILD_CONFIGURE_VAR(GDAL ZLIB_ROOT --with-libz) ADD_SUPERBUILD_CONFIGURE_VAR(GDAL EXPAT_ROOT --with-expat) ADD_SUPERBUILD_CONFIGURE_VAR(GDAL CURL_ROOT --with-curl "/bin/curl-config") ADD_SUPERBUILD_CONFIGURE_VAR(GDAL GEOS_ROOT --with-geos "/bin/geos-config") +ADD_SUPERBUILD_CONFIGURE_VAR(GDAL HDF5_ROOT --with-hdf5) +ADD_SUPERBUILD_CONFIGURE_VAR(GDAL NETCDF_ROOT --with-netcdf) +ADD_SUPERBUILD_CONFIGURE_VAR(GDAL HDF4_ROOT --with-hdf4) set(GDAL_CONFIGURE_COMMAND) set(GDAL_BUILD_COMMAND) @@ -71,8 +74,6 @@ if(UNIX) --with-gif=no --with-grass=no --with-gta=no - --with-hdf4=no - --with-hdf5=no --with-idb=no --with-ingres=no --with-jp2mrsid=no @@ -82,7 +83,6 @@ if(UNIX) --with-mrsid=no --with-msg=no --with-mysql=no - --with-netcdf=no --with-oci=no --with-odbc=no --with-ogdi=no diff --git a/SuperBuild/CMake/External_geos.cmake b/SuperBuild/CMake/External_geos.cmake index 921aa4d667cf4ba7f621cb8965ca47af08742c61..477317716e9a893a85feb5df2081d9139d087b84 100644 --- a/SuperBuild/CMake/External_geos.cmake +++ b/SuperBuild/CMake/External_geos.cmake @@ -36,7 +36,7 @@ ExternalProject_Add(GEOS -DGEOS_ENABLE_MACOSX_FRAMEWORK:BOOL=OFF -DGEOS_BUILD_STATIC:BOOL=${BUILD_STATIC_LIBS} -DGEOS_BUILD_SHARED:BOOL=${BUILD_SHARED_LIBS} - CMAKE_COMMAND ${GEOS_CMAKE_COMMAND} + CMAKE_COMMAND ${SB_CMAKE_COMMAND} LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 diff --git a/SuperBuild/CMake/External_glew.cmake b/SuperBuild/CMake/External_glew.cmake index 3f370e28e0642d584cfbdecfb881fa28d71a07e4..964cd1abce2c7bb5702074aa3440aa256bafff18 100644 --- a/SuperBuild/CMake/External_glew.cmake +++ b/SuperBuild/CMake/External_glew.cmake @@ -30,7 +30,7 @@ ExternalProject_Add(GLEW BINARY_DIR ${GLEW_SB_BUILD_DIR} DOWNLOAD_DIR ${DOWNLOAD_LOCATION} INSTALL_DIR ${SB_INSTALL_PREFIX} - CONFIGURE_COMMAND ${SB_CMAKE_COMMAND} ${SB_CMAKE_CACHE_ARGS} -DBUILD_UTILS:BOOL=OFF ${GLEW_SB_SRC}/build/cmake/ + CONFIGURE_COMMAND ${SB_CMAKE_COMMAND} ${SB_CMAKE_ARGS} ${SB_CMAKE_CACHE_ARGS} -DBUILD_UTILS:BOOL=OFF ${GLEW_SB_SRC}/build/cmake/ LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 diff --git a/SuperBuild/CMake/External_glut.cmake b/SuperBuild/CMake/External_glut.cmake index 8894a4931c3619b58bb01125b85494ecf2fbb37c..a4a37ca63ed57d4be316aff66679e7d43e15e1d3 100644 --- a/SuperBuild/CMake/External_glut.cmake +++ b/SuperBuild/CMake/External_glut.cmake @@ -41,7 +41,7 @@ else(MSVC) ${GLUT_SB_SRC} ) - set(GLUT_CONFIGURE_COMMAND ${SB_CMAKE_COMMAND} ${SB_CMAKE_CACHE_ARGS} ${GLUT_SB_SRC} ) + set(GLUT_CONFIGURE_COMMAND ${SB_CMAKE_COMMAND} ${SB_CMAKE_ARGS} ${SB_CMAKE_CACHE_ARGS} ${GLUT_SB_SRC} ) endif() ExternalProject_Add(GLUT diff --git a/SuperBuild/CMake/External_hdf4.cmake b/SuperBuild/CMake/External_hdf4.cmake new file mode 100644 index 0000000000000000000000000000000000000000..63c27e23546290eee4693d32ce40d0e620d1d1ff --- /dev/null +++ b/SuperBuild/CMake/External_hdf4.cmake @@ -0,0 +1,74 @@ +# +# 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(HDF4) + +SETUP_SUPERBUILD(HDF4) + +# declare dependencies +ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(HDF4 ZLIB JPEG) + +set(HDF4_SB_CONFIG) + +set(HDF4_SB_DF_LIB dfalt) +set(HDF4_SB_MF_LIB mfhdfalt) + +ExternalProject_Add(HDF4 + PREFIX HDF4 + URL "http://support.hdfgroup.org/ftp/HDF/HDF_Current/src/hdf-4.2.13.tar.gz" + URL_MD5 a6aa950b3fce5162b96496d8ea0b82bf + SOURCE_DIR ${HDF4_SB_SRC} + BINARY_DIR ${HDF4_SB_BUILD_DIR} + INSTALL_DIR ${SB_INSTALL_PREFIX} + DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + DEPENDS ${HDF4_DEPENDENCIES} + CMAKE_CACHE_ARGS + ${SB_CMAKE_CACHE_ARGS} + -DBUILD_TESTING:BOOL=OFF + -DHDF4_ALLOW_EXTERNAL_SUPPORT:BOOL=OFF + -DHDF4_BUILD_EXAMPLES:BOOL=OFF + -DHDF4_BUILD_JAVA:BOOL=OFF + -DHDF4_BUILD_TOOLS:BOOL=OFF + -DHDF4_BUILD_UTILS:BOOL=OFF + -DHDF4_PACK_EXAMPLES:BOOL=OFF + -DHDF4_BUILD_FORTRAN:BOOL=OFF + -DHDF4_BUILD_XDR_LIB:BOOL=OFF + -DHDF4_DISABLE_COMPILER_WARNINGS:BOOL=OFF + -DHDF4_ENABLE_COVERAGE:BOOL=OFF + -DHDF4_ENABLE_DEPRECATED_SYMBOLS:BOOL=ON + -DHDF4_ENABLE_JPEG_LIB_SUPPORT:BOOL=ON + -DHDF4_ENABLE_NETCDF:BOOL=OFF + -DHDF4_ENABLE_PARALLEL:BOOL=OFF + -DHDF4_ENABLE_SZIP_SUPPORT:BOOL=OFF + -DHDF4_ENABLE_Z_LIB_SUPPORT:BOOL=ON + -DHDF4_NO_PACKAGES:BOOL=ON + -DHDF4_PACKAGE_EXTLIBS:BOOL=OFF + -DHDF_ENABLE_LARGE_FILE:BOOL=ON + -DHDF4_SRC_LIB_CORENAME:STRING=${HDF4_SB_DF_LIB} + -DHDF4_MF_LIB_CORENAME:STRING=${HDF4_SB_MF_LIB} + ${HDF4_SB_CONFIG} + CMAKE_COMMAND ${SB_CMAKE_COMMAND} + LOG_DOWNLOAD 1 + LOG_CONFIGURE 1 + LOG_BUILD 1 + LOG_INSTALL 1 + ) + +SUPERBUILD_PATCH_SOURCE(HDF4) diff --git a/SuperBuild/CMake/External_hdf5.cmake b/SuperBuild/CMake/External_hdf5.cmake new file mode 100644 index 0000000000000000000000000000000000000000..ce3d2a07e61d3d394265aed4c3c96860597fca0b --- /dev/null +++ b/SuperBuild/CMake/External_hdf5.cmake @@ -0,0 +1,63 @@ +# +# 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(HDF5) + +SETUP_SUPERBUILD(HDF5) + +# declare dependencies +ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(HDF5 ZLIB) + +set(HDF5_SB_CONFIG) + +ExternalProject_Add(HDF5 + PREFIX HDF5 + URL "http://support.hdfgroup.org/ftp/HDF5/current/src/hdf5-1.10.1.tar.gz" + URL_MD5 43a2f9466702fb1db31df98ae6677f15 + SOURCE_DIR ${HDF5_SB_SRC} + BINARY_DIR ${HDF5_SB_BUILD_DIR} + INSTALL_DIR ${SB_INSTALL_PREFIX} + DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + DEPENDS ${HDF5_DEPENDENCIES} + CMAKE_CACHE_ARGS + ${SB_CMAKE_CACHE_ARGS} + -DBUILD_TESTING:BOOL=OFF + -DHDF5_BUILD_CPP_LIB:BOOL=OFF + -DHDF5_BUILD_EXAMPLES:BOOL=ON + -DHDF5_BUILD_FORTRAN:BOOL=OFF + -DHDF5_BUILD_HL_LIB:BOOL=ON + -DHDF5_BUILD_JAVA:BOOL=OFF + -DHDF5_BUILD_TOOLS:BOOL=OFF + -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF + -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=ON + ${HDF5_SB_CONFIG} + CMAKE_COMMAND ${SB_CMAKE_COMMAND} + LOG_DOWNLOAD 1 + LOG_CONFIGURE 1 + LOG_BUILD 1 + LOG_INSTALL 1 + ) + +# this should not be needed but see Mantis-1457 +if(UNIX) + set(_SB_HDF5_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) + set(_SB_HDF5_C_LIBRARY ${SB_INSTALL_PREFIX}/lib/libhdf5${CMAKE_SHARED_LIBRARY_SUFFIX}) + set(_SB_HDF5_HL_LIBRARY ${SB_INSTALL_PREFIX}/lib/libhdf5_hl${CMAKE_SHARED_LIBRARY_SUFFIX}) +endif() diff --git a/SuperBuild/CMake/External_jpeg.cmake b/SuperBuild/CMake/External_jpeg.cmake index 38e1460e508505e880d72656f47142ce118d3ee2..ca4ffbe146265fb0693c62ec5805d72b8d30b409 100644 --- a/SuperBuild/CMake/External_jpeg.cmake +++ b/SuperBuild/CMake/External_jpeg.cmake @@ -24,6 +24,7 @@ SETUP_SUPERBUILD(JPEG) if(WIN32) set(JPEG_CONFIGURE_COMMAND "${SB_CMAKE_COMMAND}" + ${SB_CMAKE_ARGS} ${SB_CMAKE_CACHE_ARGS} -DENABLE_SHARED=TRUE -DENABLE_STATIC=FALSE @@ -61,3 +62,10 @@ ExternalProject_Add(JPEG SUPERBUILD_PATCH_SOURCE(JPEG) SUPERBUILD_UPDATE_CMAKE_VARIABLES(JPEG FALSE) + +set(_SB_JPEGLIB_H_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) +if(WIN32) + set(_SB_JPEG_LIB ${SB_INSTALL_PREFIX}/lib/jpeg_i.lib) +elseif(UNIX) + set(_SB_JPEG_LIB ${SB_INSTALL_PREFIX}/lib/libjpeg${CMAKE_SHARED_LIBRARY_SUFFIX}) +endif() diff --git a/SuperBuild/CMake/External_netcdf.cmake b/SuperBuild/CMake/External_netcdf.cmake new file mode 100644 index 0000000000000000000000000000000000000000..12f2eb3b1ef6ff315a20add843ed2b4d10e7bfaf --- /dev/null +++ b/SuperBuild/CMake/External_netcdf.cmake @@ -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_ONCE_MACRO(NETCDF) + +SETUP_SUPERBUILD(NETCDF) + +# declare dependencies +ADDTO_DEPENDENCIES_IF_NOT_SYSTEM(NETCDF HDF5 ZLIB CURL HDF4 JPEG) + +set(NETCDF_SB_CONFIG) + +# this should not be needed but see Mantis-1457 +if(UNIX) + ADD_SUPERBUILD_CMAKE_VAR(NETCDF HDF5_INCLUDE_DIR) + ADD_SUPERBUILD_CMAKE_VAR(NETCDF HDF5_C_LIBRARY) + ADD_SUPERBUILD_CMAKE_VAR(NETCDF HDF5_HL_LIBRARY) +endif() + +ExternalProject_Add(NETCDF + PREFIX NETCDF + URL "ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4.4.1.1.tar.gz" + URL_MD5 503a2d6b6035d116ed53b1d80c811bda + SOURCE_DIR ${NETCDF_SB_SRC} + BINARY_DIR ${NETCDF_SB_BUILD_DIR} + INSTALL_DIR ${SB_INSTALL_PREFIX} + DOWNLOAD_DIR ${DOWNLOAD_LOCATION} + DEPENDS ${NETCDF_DEPENDENCIES} + CMAKE_CACHE_ARGS + ${SB_CMAKE_CACHE_ARGS} + -DBUILD_TESTING:BOOL=OFF + -DENABLE_CONVERSION_WARNINGS:BOOL=ON + -DENABLE_DAP:BOOL=ON + -DENABLE_DAP_GROUPS:BOOL=ON + -DENABLE_DISKLESS:BOOL=ON + -DENABLE_DOXYGEN:BOOL=OFF + -DENABLE_DYNAMIC_LOADING:BOOL=ON + -DENABLE_EXAMPLES:BOOL=ON + -DENABLE_EXTREME_NUMBERS:BOOL=ON + -DENABLE_FFIO:BOOL=OFF + -DENABLE_FSYNC:BOOL=OFF + -DENABLE_HDF4:BOOL=ON + -DENABLE_HDF4_FILE_TESTS:BOOL=OFF + -DENABLE_JNA:BOOL=OFF + -DENABLE_LARGE_FILE_SUPPORT:BOOL=ON + -DENABLE_LOGGING:BOOL=OFF + -DENABLE_MMAP:BOOL=OFF + -DENABLE_NETCDF4:BOOL=ON + -DENABLE_NETCDF_4:BOOL=ON + -DENABLE_PARALLEL4:BOOL=OFF + -DENABLE_PNETCDF:BOOL=OFF + -DENABLE_REMOTE_FORTRAN_BOOTSTRA:BOOL=OFF + -DENABLE_RPC:BOOL=OFF + -DENABLE_STDIO:BOOL=OFF + -DENABLE_TESTS:BOOL=OFF + -DENABLE_V2_API:BOOL=ON + -DUSE_HDF5:BOOL=ON + -DUSE_NETCDF4:BOOL=ON + ${NETCDF_SB_CONFIG} + CMAKE_COMMAND ${SB_CMAKE_COMMAND} + LOG_DOWNLOAD 1 + LOG_CONFIGURE 1 + LOG_BUILD 1 + LOG_INSTALL 1 + ) + +SUPERBUILD_PATCH_SOURCE(NETCDF) diff --git a/SuperBuild/CMake/External_openjpeg.cmake b/SuperBuild/CMake/External_openjpeg.cmake index 09de9cb472905cfb0473061051b6447d217ec556..47b57983cd208171fc0cbc439160768e317f0465 100644 --- a/SuperBuild/CMake/External_openjpeg.cmake +++ b/SuperBuild/CMake/External_openjpeg.cmake @@ -38,8 +38,8 @@ ADD_SUPERBUILD_CMAKE_VAR(OPENJPEG PNG_LIBRARY) ExternalProject_Add(OPENJPEG PREFIX OPENJPEG - URL "https://github.com/uclouvain/openjpeg/archive/d0babeb6f6cdd1887308137df37bb2b4724a6592.zip" - URL_MD5 e84a8cca9892a5f80ce91c1174c3fd41 + URL "https://github.com/uclouvain/openjpeg/archive/v2.2.0.tar.gz" + URL_MD5 269bb0b175476f3addcc0d03bd9a97b6 BINARY_DIR ${OPENJPEG_SB_BUILD_DIR} INSTALL_DIR ${SB_INSTALL_PREFIX} DOWNLOAD_DIR ${DOWNLOAD_LOCATION} diff --git a/SuperBuild/CMake/External_openssl.cmake b/SuperBuild/CMake/External_openssl.cmake index 80dbcccca0c781b33783ea50c2dafbfc9616c8dc..581f696ad2becadeff3e9f1c2ca02bd94484ae15 100644 --- a/SuperBuild/CMake/External_openssl.cmake +++ b/SuperBuild/CMake/External_openssl.cmake @@ -104,5 +104,6 @@ set(_SB_OPENSSL_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) if(WIN32) set(_SB_OPENSSL_LIBRARY "${SB_INSTALL_PREFIX}/lib/ssleay32.lib;${SB_INSTALL_PREFIX}/lib/libeay32.lib") elseif(UNIX) - set(_SB_OPENSSL_LIBRARY ${SB_INSTALL_PREFIX}/lib/libssl${CMAKE_SHARED_LIBRARY_SUFFIX}) + set(_SB_OPENSSL_SSL_LIBRARY ${SB_INSTALL_PREFIX}/lib/libssl${CMAKE_SHARED_LIBRARY_SUFFIX}) + set(_SB_OPENSSL_CRYPTO_LIBRARY ${SB_INSTALL_PREFIX}/lib/libcrypto${CMAKE_SHARED_LIBRARY_SUFFIX}) endif() diff --git a/SuperBuild/CMake/External_otb.cmake b/SuperBuild/CMake/External_otb.cmake index 465683a9b48222947d20f7fdf5354dc4d8f6c0ce..6890d46d7163864f57a6934ab2cf438e8074a903 100644 --- a/SuperBuild/CMake/External_otb.cmake +++ b/SuperBuild/CMake/External_otb.cmake @@ -131,7 +131,7 @@ ADD_SUPERBUILD_CMAKE_VAR(OTB Boost_LIBRARY_DIR) set(OTB_MODULES_CONFIG) if(WITH_REMOTE_MODULES) - foreach(remote_module SertitObject Mosaic otbGRM) + foreach(remote_module SertitObject Mosaic otbGRM OTBFFSforGMM) list(APPEND OTB_MODULES_CONFIG -DModule_${remote_module}:BOOL=ON) endforeach() else() diff --git a/SuperBuild/CMake/External_qt4.cmake b/SuperBuild/CMake/External_qt4.cmake index c460c649d5442b758ea2c211d52c2711cca0977b..a0b4eeeae66f759b4ba2e796a500da1472c530bb 100644 --- a/SuperBuild/CMake/External_qt4.cmake +++ b/SuperBuild/CMake/External_qt4.cmake @@ -39,10 +39,27 @@ set(QT4_SB_ENABLE_GTK OFF CACHE INTERNAL "Enable GTK+ style with qt using -gtkst 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 -set(QT4_SB_CONFIG) + +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 "-I ${PNG_PNG_INCLUDE_DIR}") + set(QT4_SB_CONFIG "${QT4_SB_CONFIG} -I ${PNG_PNG_INCLUDE_DIR}") endif() if(UNIX) @@ -57,17 +74,11 @@ if(UNIX) endif() endif() #common for all unix - set(QT4_SB_CONFIG "${QT4_SB_CONFIG} -no-nis -no-javascript-jit -v") + 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(SB_INSTALL_PREFIX) - file(TO_NATIVE_PATH ${SB_INSTALL_PREFIX} QT4_INSTALL_PREFIX_NATIVE) - file(TO_NATIVE_PATH ${SB_INSTALL_PREFIX}/include QT4_INCLUDE_PREFIX_NATIVE) - file(TO_NATIVE_PATH ${SB_INSTALL_PREFIX}/lib QT4_LIB_PREFIX_NATIVE) -endif() - if(WIN32) set(QT4_BIN_EXT ".exe") file(TO_NATIVE_PATH ${QT4_SB_SRC}/configure.exe QT4_CONFIGURE_SCRIPT) diff --git a/SuperBuild/CMake/External_qwt.cmake b/SuperBuild/CMake/External_qwt.cmake index 8c2077615c8667d11a070299b376907263c2909a..3755e3958fa62f91385adf87acfe8a1547faa133 100644 --- a/SuperBuild/CMake/External_qwt.cmake +++ b/SuperBuild/CMake/External_qwt.cmake @@ -62,21 +62,13 @@ ExternalProject_Add(QWT INSTALL_DIR ${SB_INSTALL_PREFIX} DOWNLOAD_DIR ${DOWNLOAD_LOCATION} DEPENDS ${QWT_DEPENDENCIES} -PATCH_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/patches/QWT/qwtconfig.pri ${QWT_SB_SRC} - CONFIGURE_COMMAND -${QWT_SB_CONFIGURE_PROGRAM} ${QWT_SB_SRC}/qwt.pro + PATCH_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/qwtconfig.pri ${QWT_SB_SRC} + CONFIGURE_COMMAND ${QWT_SB_CONFIGURE_PROGRAM} ${QWT_SB_SRC}/qwt.pro BUILD_COMMAND ${QWT_SB_MAKE_PROGRAM} - INSTALL_COMMAND ${QWT_SB_MAKE_PROGRAM} install INSTALL_ROOT=${SB_INSTALL_PREFIX} + INSTALL_COMMAND ${QWT_SB_MAKE_PROGRAM} install LOG_CONFIGURE 0 LOG_BUILD 0 LOG_INSTALL 0 ) -#SUPERBUILD_PATCH_SOURCE(QWT) - -# set(_SB_QWT_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) -# if(WIN32) -# set(_SB_QWT_LIBRARY ${SB_INSTALL_PREFIX}/lib/qwt5.lib) -# elseif(UNIX) -# set(_SB_QWT_LIBRARY ${SB_INSTALL_PREFIX}/lib/libqwt${CMAKE_SHARED_LIBRARY_SUFFIX}) -# endif() +SUPERBUILD_PATCH_SOURCE(QWT) diff --git a/SuperBuild/CMake/External_zlib.cmake b/SuperBuild/CMake/External_zlib.cmake index 6948e1f54244176e582864c1f958a139ea559402..4d68aae34c68274cd70212b3e75d4d3ac7491507 100644 --- a/SuperBuild/CMake/External_zlib.cmake +++ b/SuperBuild/CMake/External_zlib.cmake @@ -49,7 +49,7 @@ endif() #check who uses zdll.lib and remove this hack if(MSVC) ExternalProject_Add_Step(ZLIB msvc_copy_hell - COMMAND ${CMAKE_COMMAND} -E copy ${ZLIB_SB_BUILD_DIR}/zlib.lib ${SB_INSTALL_PREFIX}/lib/zdll.lib + COMMAND ${CMAKE_COMMAND} -E copy ${SB_INSTALL_PREFIX}/lib/zlib.lib ${SB_INSTALL_PREFIX}/lib/zdll.lib DEPENDEES install) endif() diff --git a/SuperBuild/CMakeLists.txt b/SuperBuild/CMakeLists.txt index ee0ee6ac9c29a0d3f5a45dc22571ae3799a4154f..affdfdb14115e716864c3ac60205785975b13fe6 100644 --- a/SuperBuild/CMakeLists.txt +++ b/SuperBuild/CMakeLists.txt @@ -222,22 +222,12 @@ else() endif() if(UNIX) - if(APPLE) - set(SB_CMAKE_COMMAND env CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} ${CMAKE_COMMAND} ${SB_CMAKE_ARGS}) - set(SB_ENV_CONFIGURE_CMD env CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER}) - else() - if( DEFINED ENV{LD_LIBRARY_PATH} ) - set(LD_LIBRARY_PATH_VALUE ${SB_INSTALL_PREFIX}/lib:$ENV{LD_LIBRARY_PATH}) - else() - set(LD_LIBRARY_PATH_VALUE ${SB_INSTALL_PREFIX}/lib) - endif() - set(SB_ENV_CONFIGURE_CMD env LD_LIBRARY_PATH=${LD_LIBRARY_PATH_VALUE} CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER}) - set(SB_CMAKE_COMMAND env LD_LIBRARY_PATH=${LD_LIBRARY_PATH_VALUE} CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} ${CMAKE_COMMAND} ${SB_CMAKE_ARGS}) - endif() + set(SB_CMAKE_COMMAND env CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} ${CMAKE_COMMAND} ${SB_CMAKE_ARGS}) + set(SB_ENV_CONFIGURE_CMD env CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER}) message(STATUS "Environment setup for Configure (SB_ENV_CONFIGURE_CMD): ${SB_ENV_CONFIGURE_CMD}") else() #windows - set(SB_CMAKE_COMMAND ${CMAKE_COMMAND} ${SB_CMAKE_ARGS}) + set(SB_CMAKE_COMMAND ${CMAKE_COMMAND}) endif() if(CMAKE_C_FLAGS) @@ -298,7 +288,9 @@ option(USE_SYSTEM_GLFW "Use a system build of glfw" OFF) option(USE_SYSTEM_GLUT "Use a system build of glut" OFF) option(USE_SYSTEM_FREETYPE "Use a system build of freetype" OFF) option(USE_SYSTEM_SHARK "Use a system build of Shark" OFF) - +option(USE_SYSTEM_HDF4 "Use a system build of HDF4" OFF) +option(USE_SYSTEM_HDF5 "Use a system build of HDF5" OFF) +option(USE_SYSTEM_NETCDF "Use a system build of NetCDF" OFF) # Call OTB option(OTB_USE_6S "Enable module 6S in OTB" ON) diff --git a/SuperBuild/patches/GDAL/gdal-4-fixhdf5-win.diff b/SuperBuild/patches/GDAL/gdal-4-fixhdf5-win.diff new file mode 100644 index 0000000000000000000000000000000000000000..23e9fb0d748ddcc1ec8aec384434bde8754bd2fb --- /dev/null +++ b/SuperBuild/patches/GDAL/gdal-4-fixhdf5-win.diff @@ -0,0 +1,11 @@ +--- GDAL-orig/frmts/hdf5/makefile.vc 2017-08-30 18:45:33.632677939 +0200 ++++ GDAL/frmts/hdf5/makefile.vc 2017-08-30 18:46:05.316972947 +0200 +@@ -7,7 +7,7 @@ + + PLUGIN_DLL = gdal_HDF5.dll + +-EXTRAFLAGS = -I$(HDF5_DIR)\include -DWIN32 -D_HDF5USEDLL_ ++EXTRAFLAGS = -I$(HDF5_DIR)\include -DWIN32 -DH5_BUILT_AS_DYNAMIC_LIB + + !IF "$(HDF5_PLUGIN)" == "YES" + EXTRAFLAGS = $(EXTRAFLAGS) -DHDF5_PLUGIN diff --git a/SuperBuild/patches/GDAL/gdal-5-fixOpenJPEG22_rev39821-all.diff b/SuperBuild/patches/GDAL/gdal-5-fixOpenJPEG22_rev39821-all.diff new file mode 100644 index 0000000000000000000000000000000000000000..c82ddc28ab75d6c36bd16d6ec7ee3e1e3bf77636 --- /dev/null +++ b/SuperBuild/patches/GDAL/gdal-5-fixOpenJPEG22_rev39821-all.diff @@ -0,0 +1,177 @@ +Index: gdal/configure +=================================================================== +--- gdal/configure (revision 39820) ++++ gdal/configure (revision 39821) +@@ -25116,10 +25116,10 @@ + elif test "$with_openjpeg" = "yes" -o "$with_openjpeg" = "" ; then + +- for ac_header in openjpeg-2.0/openjpeg.h ++ for ac_header in openjpeg-2.2/openjpeg.h + do : +- ac_fn_c_check_header_mongrel "$LINENO" "openjpeg-2.0/openjpeg.h" "ac_cv_header_openjpeg_2_0_openjpeg_h" "$ac_includes_default" +-if test "x$ac_cv_header_openjpeg_2_0_openjpeg_h" = xyes; then : ++ ac_fn_c_check_header_mongrel "$LINENO" "openjpeg-2.2/openjpeg.h" "ac_cv_header_openjpeg_2_2_openjpeg_h" "$ac_includes_default" ++if test "x$ac_cv_header_openjpeg_2_2_openjpeg_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +-#define HAVE_OPENJPEG_2_0_OPENJPEG_H 1 ++#define HAVE_OPENJPEG_2_2_OPENJPEG_H 1 + _ACEOF + +@@ -25128,5 +25128,5 @@ + done + +- if test "$ac_cv_header_openjpeg_2_0_openjpeg_h" = "yes"; then ++ if test "$ac_cv_header_openjpeg_2_2_openjpeg_h" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for opj_stream_set_user_data_length in -lopenjp2" >&5 + $as_echo_n "checking for opj_stream_set_user_data_length in -lopenjp2... " >&6; } +@@ -25172,4 +25172,5 @@ + + if test "$HAVE_OPENJPEG" = "yes"; then ++ OPENJPEG_VERSION=20200 + LIBS="-lopenjp2 $LIBS" + fi +@@ -25234,4 +25235,64 @@ + LIBS="-lopenjp2 $LIBS" + fi ++ else ++ for ac_header in openjpeg-2.0/openjpeg.h ++do : ++ ac_fn_c_check_header_mongrel "$LINENO" "openjpeg-2.0/openjpeg.h" "ac_cv_header_openjpeg_2_0_openjpeg_h" "$ac_includes_default" ++if test "x$ac_cv_header_openjpeg_2_0_openjpeg_h" = xyes; then : ++ cat >>confdefs.h <<_ACEOF ++#define HAVE_OPENJPEG_2_0_OPENJPEG_H 1 ++_ACEOF ++ ++fi ++ ++done ++ ++ if test "$ac_cv_header_openjpeg_2_0_openjpeg_h" = "yes"; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for opj_stream_set_user_data_length in -lopenjp2" >&5 ++$as_echo_n "checking for opj_stream_set_user_data_length in -lopenjp2... " >&6; } ++if ${ac_cv_lib_openjp2_opj_stream_set_user_data_length+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ ac_check_lib_save_LIBS=$LIBS ++LIBS="-lopenjp2 $LIBS" ++cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++ ++/* Override any GCC internal prototype to avoid an error. ++ Use char because int might match the return type of a GCC ++ builtin and then its argument prototype would still apply. */ ++#ifdef __cplusplus ++extern "C" ++#endif ++char opj_stream_set_user_data_length (); ++int ++main () ++{ ++return opj_stream_set_user_data_length (); ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_link "$LINENO"; then : ++ ac_cv_lib_openjp2_opj_stream_set_user_data_length=yes ++else ++ ac_cv_lib_openjp2_opj_stream_set_user_data_length=no ++fi ++rm -f core conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext conftest.$ac_ext ++LIBS=$ac_check_lib_save_LIBS ++fi ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_openjp2_opj_stream_set_user_data_length" >&5 ++$as_echo "$ac_cv_lib_openjp2_opj_stream_set_user_data_length" >&6; } ++if test "x$ac_cv_lib_openjp2_opj_stream_set_user_data_length" = xyes; then : ++ HAVE_OPENJPEG=yes ++else ++ HAVE_OPENJPEG=no ++fi ++ ++ if test "$HAVE_OPENJPEG" = "yes"; then ++ LIBS="-lopenjp2 $LIBS" ++ fi ++ fi + fi + fi +@@ -25244,6 +25305,9 @@ + OPENJPEG_VERSION=20100 + EXTRA_INCLUDES="-I$with_openjpeg/include $EXTRA_INCLUDES" ++ elif test -r $with_openjpeg/include/openjpeg-2.2/openjpeg.h ; then ++ OPENJPEG_VERSION=20200 ++ EXTRA_INCLUDES="-I$with_openjpeg/include $EXTRA_INCLUDES" + else +- as_fn_error $? "openjpeg.h not found in $with_openjpeg/include/openjpeg-2.0 or $with_openjpeg/include/openjpeg-2.1" "$LINENO" 5 ++ as_fn_error $? "openjpeg.h not found in $with_openjpeg/include/openjpeg-2.0 or $with_openjpeg/include/openjpeg-2.1 or $with_openjpeg/include/openjpeg-2.2" "$LINENO" 5 + fi + +Index: gdal/configure.ac +=================================================================== +--- gdal/configure.ac (revision 39820) ++++ gdal/configure.ac (revision 39821) +@@ -2540,8 +2540,9 @@ + elif test "$with_openjpeg" = "yes" -o "$with_openjpeg" = "" ; then + +- AC_CHECK_HEADERS([openjpeg-2.0/openjpeg.h]) +- if test "$ac_cv_header_openjpeg_2_0_openjpeg_h" = "yes"; then ++ AC_CHECK_HEADERS([openjpeg-2.2/openjpeg.h]) ++ if test "$ac_cv_header_openjpeg_2_2_openjpeg_h" = "yes"; then + AC_CHECK_LIB(openjp2,opj_stream_set_user_data_length,HAVE_OPENJPEG=yes,HAVE_OPENJPEG=no,) + if test "$HAVE_OPENJPEG" = "yes"; then ++ OPENJPEG_VERSION=20200 + LIBS="-lopenjp2 $LIBS" + fi +@@ -2554,4 +2555,12 @@ + LIBS="-lopenjp2 $LIBS" + fi ++ else ++ AC_CHECK_HEADERS([openjpeg-2.0/openjpeg.h]) ++ if test "$ac_cv_header_openjpeg_2_0_openjpeg_h" = "yes"; then ++ AC_CHECK_LIB(openjp2,opj_stream_set_user_data_length,HAVE_OPENJPEG=yes,HAVE_OPENJPEG=no,) ++ if test "$HAVE_OPENJPEG" = "yes"; then ++ LIBS="-lopenjp2 $LIBS" ++ fi ++ fi + fi + fi +@@ -2564,6 +2573,9 @@ + OPENJPEG_VERSION=20100 + EXTRA_INCLUDES="-I$with_openjpeg/include $EXTRA_INCLUDES" +- else +- AC_MSG_ERROR([openjpeg.h not found in $with_openjpeg/include/openjpeg-2.0 or $with_openjpeg/include/openjpeg-2.1]) ++ elif test -r $with_openjpeg/include/openjpeg-2.2/openjpeg.h ; then ++ OPENJPEG_VERSION=20200 ++ EXTRA_INCLUDES="-I$with_openjpeg/include $EXTRA_INCLUDES" ++ else ++ AC_MSG_ERROR([openjpeg.h not found in $with_openjpeg/include/openjpeg-2.0 or $with_openjpeg/include/openjpeg-2.1 or $with_openjpeg/include/openjpeg-2.2]) + fi + +Index: gdal/frmts/openjpeg/openjpegdataset.cpp +=================================================================== +--- gdal/frmts/openjpeg/openjpegdataset.cpp (revision 39820) ++++ gdal/frmts/openjpeg/openjpegdataset.cpp (revision 39821) +@@ -35,5 +35,7 @@ + #endif + +-#if defined(OPENJPEG_VERSION) && OPENJPEG_VERSION >= 20100 ++#if defined(OPENJPEG_VERSION) && OPENJPEG_VERSION >= 20200 ++#include <openjpeg-2.2/openjpeg.h> ++#elif defined(OPENJPEG_VERSION) && OPENJPEG_VERSION >= 20100 + #include <openjpeg-2.1/openjpeg.h> + #else +Index: gdal/nmake.opt +=================================================================== +--- gdal/nmake.opt (revision 39820) ++++ gdal/nmake.opt (revision 39821) +@@ -608,6 +608,8 @@ + #OPENJPEG_CFLAGS = -IC:\openjpeg\include + #OPENJPEG_LIB = C:\openjpeg\lib\openjp2.lib +-# For OpenJpeg >= 2.1, uncomment ++# For OpenJpeg 2.1.x, uncomment + #OPENJPEG_VERSION = 20100 ++# For OpenJpeg 2.2.x, uncomment ++#OPENJPEG_VERSION = 20200 + + #if using an external zlib uncomment the following lines + diff --git a/SuperBuild/patches/GDAL/gdal-fix-rpath-for-macx.diff b/SuperBuild/patches/GDAL/gdal-fix-rpath-for-macx.diff index f122ad7609462495c50195e78331897d2f13de1d..1074669b42e22ebbf9cf5b2a602e5f759505f8d5 100755 --- a/SuperBuild/patches/GDAL/gdal-fix-rpath-for-macx.diff +++ b/SuperBuild/patches/GDAL/gdal-fix-rpath-for-macx.diff @@ -1,7 +1,7 @@ diff -burN gdal-1.11.2.orig/configure gdal-1.11.2/configure --- gdal-1.11.2.orig/configure 2016-04-19 12:27:26.000000000 +0200 +++ gdal-1.11.2/configure 2016-04-19 13:05:25.000000000 +0200 -@@ -10595,9 +10595,9 @@ +@@ -12510,9 +12510,9 @@ esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all @@ -13,7 +13,7 @@ diff -burN gdal-1.11.2.orig/configure gdal-1.11.2/configure module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" else -@@ -13542,13 +13542,13 @@ +@@ -15457,13 +15457,13 @@ esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all diff --git a/SuperBuild/patches/GDAL/nmake_gdal_extra.opt.in b/SuperBuild/patches/GDAL/nmake_gdal_extra.opt.in index 72824d4104ed4ef7ae04e073ea4e264a9945be2d..f17412ac067d1dd8a8052ae3a083f2261b7d1a62 100644 --- a/SuperBuild/patches/GDAL/nmake_gdal_extra.opt.in +++ b/SuperBuild/patches/GDAL/nmake_gdal_extra.opt.in @@ -62,7 +62,7 @@ GEOS_LIB = $(GEOS_DIR)\lib\geos.lib $(GEOS_DIR)\lib\geos_c.lib # Uncomment for OpenJpeg support HAVE_OPENJPEG = YES OPENJPEG_ENABLED = YES -OPENJPEG_VERSION = 20100 +OPENJPEG_VERSION = 20200 OPENJPEG_CFLAGS = -I@SB_INSTALL_PREFIX_NATIVE@\include OPENJPEG_LIB = @SB_INSTALL_PREFIX_NATIVE@\lib\openjp2.lib @@ -92,11 +92,21 @@ ZLIB_INC = -I@SB_INSTALL_PREFIX_NATIVE@\include ZLIB_LIB = @SB_INSTALL_PREFIX_NATIVE@\lib\zlib.lib # Uncomment the following and update to enable NCSA HDF Release 4 support. -#HDF4_PLUGIN = NO -#HDF4_DIR = D:\warmerda\HDF41r5 +HDF4_PLUGIN = NO +HDF4_DIR = @SB_INSTALL_PREFIX_NATIVE@ #HDF4_LIB = /LIBPATH:$(HDF4_DIR)\lib Ws2_32.lib +HDF4_LIB = $(HDF4_DIR)\lib\@HDF4_SB_DF_LIB@.lib $(HDF4_DIR)\lib\@HDF4_SB_MF_LIB@.lib $(JPEG_LIB) $(ZLIB_LIB) +HDF4_INCLUDE = $(HDF4_DIR)\include +HDF4_HAS_MAXOPENFILES = YES # Uncomment the following and update to enable NCSA HDF Release 5 support. -#HDF5_PLUGIN = NO -#HDF5_DIR = c:\warmerda\supportlibs\hdf5\5-164-win -#HDF5_LIB = $(HDF5_DIR)\dll\hdf5dll.lib +HDF5_PLUGIN = NO +HDF5_DIR = @SB_INSTALL_PREFIX_NATIVE@ +HDF5_LIB = $(HDF5_DIR)\lib\hdf5.lib $(ZLIB_LIB) + +NETCDF_PLUGIN = NO +NETCDF_SETTING = YES +NETCDF_LIB = @SB_INSTALL_PREFIX_NATIVE@\lib\netcdf.lib +NETCDF_INC_DIR = @SB_INSTALL_PREFIX_NATIVE@\include +NETCDF_HAS_NC4 = YES +NETCDF_HAS_HDF4 = YES diff --git a/SuperBuild/patches/HDF4/hdf4-1-alternative-all.diff b/SuperBuild/patches/HDF4/hdf4-1-alternative-all.diff new file mode 100644 index 0000000000000000000000000000000000000000..fdc4554ffdc357a73575583d4796a16371d255dd --- /dev/null +++ b/SuperBuild/patches/HDF4/hdf4-1-alternative-all.diff @@ -0,0 +1,38 @@ +diff -burN hdf-4.2.13.orig/CMakeLists.txt hdf-4.2.13/CMakeLists.txt +--- hdf-4.2.13.orig/CMakeLists.txt 2017-08-28 11:51:04.115548046 +0200 ++++ hdf-4.2.13/CMakeLists.txt 2017-08-28 16:57:09.495243479 +0200 +@@ -119,10 +119,10 @@ + #----------------------------------------------------------------------------- + # Set the core names of all the libraries + #----------------------------------------------------------------------------- +-set (HDF4_SRC_LIB_CORENAME "hdf") ++set (HDF4_SRC_LIB_CORENAME "hdf" CACHE STRING "Name of the HDF library") + set (HDF4_SRC_FCSTUB_LIB_CORENAME "hdf_fcstub") + set (HDF4_SRC_FORTRAN_LIB_CORENAME "hdf_fortran") +-set (HDF4_MF_LIB_CORENAME "mfhdf") ++set (HDF4_MF_LIB_CORENAME "mfhdf" CACHE STRING "Name of the MFHDF library") + set (HDF4_MF_XDR_LIB_CORENAME "xdr") + set (HDF4_HDF_TEST_LIB_CORENAME "hdf_test") + set (HDF4_HDF_TEST_FCSTUB_LIB_CORENAME "hdf_test_fcstub") +diff -burN hdf-4.2.13.orig/hdf/src/CMakeLists.txt hdf-4.2.13/hdf/src/CMakeLists.txt +--- hdf-4.2.13.orig/hdf/src/CMakeLists.txt 2017-08-28 11:51:04.123547659 +0200 ++++ hdf-4.2.13/hdf/src/CMakeLists.txt 2017-08-29 11:54:50.984708306 +0200 +@@ -145,6 +145,7 @@ + COMPILE_DEFINITIONS "H4_BUILT_AS_DYNAMIC_LIB" + INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" + INTERFACE_COMPILE_DEFINITIONS H4_BUILT_AS_DYNAMIC_LIB=1 ++ DEFINE_SYMBOL "hdf_shared_EXPORTS" + ) + if (WIN32) + set_property (TARGET ${HDF4_SRC_LIBSH_TARGET} APPEND PROPERTY COMPILE_DEFINITIONS "DOS_FS") +diff -burN hdf-4.2.13.orig/mfhdf/libsrc/CMakeLists.txt hdf-4.2.13/mfhdf/libsrc/CMakeLists.txt +--- hdf-4.2.13.orig/mfhdf/libsrc/CMakeLists.txt 2017-08-28 11:51:04.131547427 +0200 ++++ hdf-4.2.13/mfhdf/libsrc/CMakeLists.txt 2017-08-29 14:09:23.159803355 +0200 +@@ -92,6 +92,7 @@ + COMPILE_DEFINITIONS "HDF;H4_BUILT_AS_DYNAMIC_LIB" + INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" + INTERFACE_COMPILE_DEFINITIONS H4_BUILT_AS_DYNAMIC_LIB=1 ++ DEFINE_SYMBOL "mfhdf_shared_EXPORTS" + ) + if (WIN32) + set_property (TARGET ${HDF4_MF_LIBSH_TARGET} APPEND PROPERTY COMPILE_DEFINITIONS "DOS_FS;SWAP") diff --git a/SuperBuild/patches/NETCDF/netcdf-1-hdfAlt-all.diff b/SuperBuild/patches/NETCDF/netcdf-1-hdfAlt-all.diff new file mode 100644 index 0000000000000000000000000000000000000000..3cb3b494fee6e2847eae140abe23da9e306283ca --- /dev/null +++ b/SuperBuild/patches/NETCDF/netcdf-1-hdfAlt-all.diff @@ -0,0 +1,26 @@ +diff -burN netcdf-4.4.1.1-orig/CMakeLists.txt netcdf-4.4.1.1/CMakeLists.txt +--- netcdf-4.4.1.1-orig/CMakeLists.txt 2017-09-18 19:22:31.832817084 +0200 ++++ netcdf-4.4.1.1/CMakeLists.txt 2017-09-30 20:40:55.921482581 +0200 +@@ -76,6 +76,7 @@ + + # For CMAKE_INSTALL_LIBDIR + INCLUDE(GNUInstallDirs) ++SET(CMAKE_INSTALL_LIBDIR lib) + + IF(MSVC) + SET(GLOBAL PROPERTY USE_FOLDERS ON) +@@ -434,12 +435,12 @@ + INCLUDE_DIRECTORIES(${MFHDF_H_INCLUDE_DIR}) + ENDIF() + +- FIND_LIBRARY(HDF4_DF_LIB NAMES df libdf hdf) ++ FIND_LIBRARY(HDF4_DF_LIB NAMES dfalt df libdf hdf) + IF(NOT HDF4_DF_LIB) + MESSAGE(FATAL_ERROR "Can't find or link to the hdf4 df library.") + ENDIF() + +- FIND_LIBRARY(HDF4_MFHDF_LIB NAMES mfhdf libmfhdf) ++ FIND_LIBRARY(HDF4_MFHDF_LIB NAMES mfhdfalt mfhdf libmfhdf) + IF(NOT HDF4_MFHDF_LIB) + MESSAGE(FATAL_ERROR "Can't find or link to the hdf4 mfhdf library.") + ENDIF() diff --git a/SuperBuild/patches/OPENJPEG/openjpeg-1-pr786-all.diff b/SuperBuild/patches/OPENJPEG/openjpeg-1-pr786-all.diff deleted file mode 100644 index 960f888dbbfa43227fd29c499d868934d9c4b431..0000000000000000000000000000000000000000 --- a/SuperBuild/patches/OPENJPEG/openjpeg-1-pr786-all.diff +++ /dev/null @@ -1,4448 +0,0 @@ -diff --git a/.travis.yml b/.travis.yml -index 0618f26..3d73f75 100644 ---- a/.travis.yml -+++ b/.travis.yml -@@ -10,6 +10,9 @@ matrix: - env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release OPJ_CI_INCLUDE_IF_DEPLOY=1 - - os: linux - compiler: gcc -+ env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release OPJ_NUM_THREADS=2 -+ - os: linux -+ compiler: gcc - env: OPJ_CI_ARCH=i386 OPJ_CI_BUILD_CONFIGURATION=Release - addons: - apt: -diff --git a/src/bin/jp2/CMakeLists.txt b/src/bin/jp2/CMakeLists.txt -index dc013c2..ad7bce7 100644 ---- a/src/bin/jp2/CMakeLists.txt -+++ b/src/bin/jp2/CMakeLists.txt -@@ -57,6 +57,9 @@ foreach(exe opj_decompress opj_compress opj_dump) - # On unix you need to link to the math library: - if(UNIX) - target_link_libraries(${exe} m) -+ IF("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") -+ target_link_libraries(${exe} rt) -+ endif() - endif() - # Install exe - install(TARGETS ${exe} -diff --git a/src/bin/jp2/opj_decompress.c b/src/bin/jp2/opj_decompress.c -index ab7ff04..57fe554 100644 ---- a/src/bin/jp2/opj_decompress.c -+++ b/src/bin/jp2/opj_decompress.c -@@ -43,6 +43,7 @@ - #include <string.h> - #include <stdlib.h> - #include <math.h> -+#include <time.h> - - #ifdef _WIN32 - #include "windirent.h" -@@ -150,6 +151,8 @@ typedef struct opj_decompress_params - int upsample; - /* split output components to different files */ - int split_pnm; -+ /** number of threads */ -+ int num_threads; - }opj_decompress_parameters; - - /* -------------------------------------------------------------------------- */ -@@ -224,8 +227,11 @@ static void decode_help_display(void) { - " -upsample\n" - " Downsampled components will be upsampled to image size\n" - " -split-pnm\n" -- " Split output components to different files when writing to PNM\n" -- "\n"); -+ " Split output components to different files when writing to PNM\n"); -+ if( opj_has_thread_support() ) { -+ fprintf(stdout," -threads <num_threads>\n" -+ " Number of threads to use for decoding.\n"); -+ } - /* UniPG>> */ - #ifdef USE_JPWL - fprintf(stdout," -W <options>\n" -@@ -520,7 +526,8 @@ int parse_cmdline_decoder(int argc, char **argv, opj_decompress_parameters *para - {"OutFor", REQ_ARG, NULL,'O'}, - {"force-rgb", NO_ARG, NULL, 1}, - {"upsample", NO_ARG, NULL, 1}, -- {"split-pnm", NO_ARG, NULL, 1} -+ {"split-pnm", NO_ARG, NULL, 1}, -+ {"threads", REQ_ARG, NULL, 'T'} - }; - - const char optlist[] = "i:o:r:l:x:d:t:p:" -@@ -808,6 +815,22 @@ int parse_cmdline_decoder(int argc, char **argv, opj_decompress_parameters *para - break; - #endif /* USE_JPWL */ - /* <<UniPG */ -+ -+ /* ----------------------------------------------------- */ -+ case 'T': /* Number of threads */ -+ { -+ if( strcmp(opj_optarg, "ALL_CPUS") == 0 ) -+ { -+ parameters->num_threads = opj_get_num_cpus(); -+ if( parameters->num_threads == 1 ) -+ parameters->num_threads = 0; -+ } -+ else -+ { -+ sscanf(opj_optarg, "%d", ¶meters->num_threads); -+ } -+ } -+ break; - - /* ----------------------------------------------------- */ - -@@ -885,17 +908,22 @@ OPJ_FLOAT64 opj_clock(void) { - /* t is the high resolution performance counter (see MSDN) */ - QueryPerformanceCounter ( & t ) ; - return freq.QuadPart ? (t.QuadPart / (OPJ_FLOAT64)freq.QuadPart) : 0; -+#elif defined(__linux) -+ struct timespec ts; -+ clock_gettime(CLOCK_REALTIME, &ts); -+ return( ts.tv_sec + ts.tv_nsec * 1e-9 ); - #else -- /* Unix or Linux: use resource usage */ -- struct rusage t; -- OPJ_FLOAT64 procTime; -- /* (1) Get the rusage data structure at this moment (man getrusage) */ -- getrusage(0,&t); -- /* (2) What is the elapsed time ? - CPU time = User time + System time */ -+ /* Unix : use resource usage */ -+ /* FIXME: this counts the total CPU time, instead of the user perceived time */ -+ struct rusage t; -+ OPJ_FLOAT64 procTime; -+ /* (1) Get the rusage data structure at this moment (man getrusage) */ -+ getrusage(0,&t); -+ /* (2) What is the elapsed time ? - CPU time = User time + System time */ - /* (2a) Get the seconds */ -- procTime = (OPJ_FLOAT64)(t.ru_utime.tv_sec + t.ru_stime.tv_sec); -- /* (2b) More precisely! Get the microseconds part ! */ -- return ( procTime + (OPJ_FLOAT64)(t.ru_utime.tv_usec + t.ru_stime.tv_usec) * 1e-6 ) ; -+ procTime = (OPJ_FLOAT64)(t.ru_utime.tv_sec + t.ru_stime.tv_sec); -+ /* (2b) More precisely! Get the microseconds part ! */ -+ return ( procTime + (OPJ_FLOAT64)(t.ru_utime.tv_usec + t.ru_stime.tv_usec) * 1e-6 ) ; - #endif - } - -@@ -1306,7 +1334,13 @@ int main(int argc, char **argv) - opj_destroy_codec(l_codec); - failed = 1; goto fin; - } -- -+ -+ if( parameters.num_threads >= 1 && !opj_codec_set_threads(l_codec, parameters.num_threads) ) { -+ fprintf(stderr, "ERROR -> opj_decompress: failed to set number of threads\n"); -+ opj_stream_destroy(l_stream); -+ opj_destroy_codec(l_codec); -+ failed = 1; goto fin; -+ } - - /* Read the main header of the codestream and if necessary the JP2 boxes*/ - if(! opj_read_header(l_stream, l_codec, &image)){ -diff --git a/src/lib/openjp2/CMakeLists.txt b/src/lib/openjp2/CMakeLists.txt -index 367a7a8..f45ceb3 100644 ---- a/src/lib/openjp2/CMakeLists.txt -+++ b/src/lib/openjp2/CMakeLists.txt -@@ -9,6 +9,8 @@ include_directories( - ) - # Defines the source code for the library - set(OPENJPEG_SRCS -+ ${CMAKE_CURRENT_SOURCE_DIR}/thread.c -+ ${CMAKE_CURRENT_SOURCE_DIR}/thread.h - ${CMAKE_CURRENT_SOURCE_DIR}/bio.c - ${CMAKE_CURRENT_SOURCE_DIR}/bio.h - ${CMAKE_CURRENT_SOURCE_DIR}/cio.c -@@ -29,6 +31,7 @@ set(OPENJPEG_SRCS - ${CMAKE_CURRENT_SOURCE_DIR}/mct.h - ${CMAKE_CURRENT_SOURCE_DIR}/mqc.c - ${CMAKE_CURRENT_SOURCE_DIR}/mqc.h -+ ${CMAKE_CURRENT_SOURCE_DIR}/mqc_inl.h - ${CMAKE_CURRENT_SOURCE_DIR}/openjpeg.c - ${CMAKE_CURRENT_SOURCE_DIR}/openjpeg.h - ${CMAKE_CURRENT_SOURCE_DIR}/opj_clock.c -@@ -73,6 +76,11 @@ if(OPJ_DISABLE_TPSOT_FIX) - add_definitions(-DOPJ_DISABLE_TPSOT_FIX) - endif() - -+# Special case for old i586-mingw32msvc-gcc cross compiler -+if(NOT WIN32 AND CMAKE_COMPILER_IS_GNUCC AND CMAKE_C_COMPILER MATCHES ".*mingw32msvc.*" ) -+ set(WIN32 YES) -+endif() -+ - # Build the library - if(WIN32) - if(BUILD_SHARED_LIBS) -@@ -142,3 +150,36 @@ if(OPJ_USE_DSYMUTIL) - DEPENDS ${OPENJPEG_LIBRARY_NAME}) - endif() - endif() -+ -+################################################################################# -+# threading configuration -+################################################################################# -+set(CMAKE_THREAD_PREFER_PTHREAD TRUE) -+ -+option(USE_THREAD "Build with thread/mutex support " ON) -+if(NOT USE_THREAD) -+ add_definitions( -DMUTEX_stub) -+endif(NOT USE_THREAD) -+ -+find_package(Threads QUIET) -+ -+if(USE_THREAD AND WIN32 AND NOT Threads_FOUND ) -+ add_definitions( -DMUTEX_win32) -+ set(Threads_FOUND YES) -+endif() -+ -+if(USE_THREAD AND Threads_FOUND AND CMAKE_USE_WIN32_THREADS_INIT ) -+ add_definitions( -DMUTEX_win32) -+endif(USE_THREAD AND Threads_FOUND AND CMAKE_USE_WIN32_THREADS_INIT ) -+ -+if(USE_THREAD AND Threads_FOUND AND CMAKE_USE_PTHREADS_INIT ) -+ add_definitions( -DMUTEX_pthread) -+endif(USE_THREAD AND Threads_FOUND AND CMAKE_USE_PTHREADS_INIT ) -+ -+if(USE_THREAD AND NOT Threads_FOUND) -+ message(FATAL_ERROR "No thread library found and thread/mutex support is required by USE_THREAD option") -+endif(USE_THREAD AND NOT Threads_FOUND) -+ -+if(USE_THREAD AND Threads_FOUND AND CMAKE_USE_PTHREADS_INIT) -+ TARGET_LINK_LIBRARIES(${OPENJPEG_LIBRARY_NAME} ${CMAKE_THREAD_LIBS_INIT}) -+endif(USE_THREAD AND Threads_FOUND AND CMAKE_USE_PTHREADS_INIT) -diff --git a/src/lib/openjp2/dwt.c b/src/lib/openjp2/dwt.c -index a4ff01b..18f8d9c 100644 ---- a/src/lib/openjp2/dwt.c -+++ b/src/lib/openjp2/dwt.c -@@ -124,7 +124,7 @@ static void opj_dwt_encode_stepsize(OPJ_INT32 stepsize, OPJ_INT32 numbps, opj_st - /** - Inverse wavelet transform in 2-D. - */ --static OPJ_BOOL opj_dwt_decode_tile(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 i, DWT1DFN fn); -+static OPJ_BOOL opj_dwt_decode_tile(opj_thread_pool_t* tp, opj_tcd_tilecomp_t* tilec, OPJ_UINT32 i, DWT1DFN fn); - - static OPJ_BOOL opj_dwt_encode_procedure( opj_tcd_tilecomp_t * tilec, - void (*p_function)(OPJ_INT32 *, OPJ_INT32,OPJ_INT32,OPJ_INT32) ); -@@ -473,8 +473,8 @@ OPJ_BOOL opj_dwt_encode(opj_tcd_tilecomp_t * tilec) - /* <summary> */ - /* Inverse 5-3 wavelet transform in 2-D. */ - /* </summary> */ --OPJ_BOOL opj_dwt_decode(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres) { -- return opj_dwt_decode_tile(tilec, numres, &opj_dwt_decode_1); -+OPJ_BOOL opj_dwt_decode(opj_thread_pool_t* tp, opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres) { -+ return opj_dwt_decode_tile(tp, tilec, numres, &opj_dwt_decode_1); - } - - -@@ -556,10 +556,72 @@ static OPJ_UINT32 opj_dwt_max_resolution(opj_tcd_resolution_t* restrict r, OPJ_U - return mr ; - } - -+typedef struct -+{ -+ opj_dwt_t h; -+ DWT1DFN dwt_1D; -+ OPJ_UINT32 rw; -+ OPJ_UINT32 w; -+ OPJ_INT32 * restrict tiledp; -+ int min_j; -+ int max_j; -+} opj_dwd_decode_h_job_t; -+ -+static void opj_dwt_decode_h_func(void* user_data, opj_tls_t* tls) -+{ -+ int j; -+ opj_dwd_decode_h_job_t* job; -+ (void)tls; -+ -+ job = (opj_dwd_decode_h_job_t*)user_data; -+ for( j = job->min_j; j < job->max_j; j++ ) -+ { -+ opj_dwt_interleave_h(&job->h, &job->tiledp[j*job->w]); -+ (job->dwt_1D)(&job->h); -+ memcpy(&job->tiledp[j*job->w], job->h.mem, job->rw * sizeof(OPJ_INT32)); -+ } -+ -+ opj_aligned_free(job->h.mem); -+ opj_free(job); -+} -+ -+typedef struct -+{ -+ opj_dwt_t v; -+ DWT1DFN dwt_1D; -+ OPJ_UINT32 rh; -+ OPJ_UINT32 w; -+ OPJ_INT32 * restrict tiledp; -+ int min_j; -+ int max_j; -+} opj_dwd_decode_v_job_t; -+ -+static void opj_dwt_decode_v_func(void* user_data, opj_tls_t* tls) -+{ -+ int j; -+ opj_dwd_decode_v_job_t* job; -+ (void)tls; -+ -+ job = (opj_dwd_decode_v_job_t*)user_data; -+ for( j = job->min_j; j < job->max_j; j++ ) -+ { -+ OPJ_UINT32 k; -+ opj_dwt_interleave_v(&job->v, &job->tiledp[j], (OPJ_INT32)job->w); -+ (job->dwt_1D)(&job->v); -+ for(k = 0; k < job->rh; ++k) { -+ job->tiledp[k * job->w + j] = job->v.mem[k]; -+ } -+ } -+ -+ opj_aligned_free(job->v.mem); -+ opj_free(job); -+} -+ -+ - /* <summary> */ - /* Inverse wavelet transform in 2-D. */ - /* </summary> */ --static OPJ_BOOL opj_dwt_decode_tile(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres, DWT1DFN dwt_1D) { -+static OPJ_BOOL opj_dwt_decode_tile(opj_thread_pool_t* tp, opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres, DWT1DFN dwt_1D) { - opj_dwt_t h; - opj_dwt_t v; - -@@ -569,11 +631,15 @@ static OPJ_BOOL opj_dwt_decode_tile(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres - OPJ_UINT32 rh = (OPJ_UINT32)(tr->y1 - tr->y0); /* height of the resolution level computed */ - - OPJ_UINT32 w = (OPJ_UINT32)(tilec->x1 - tilec->x0); -+ size_t h_mem_size; -+ int num_threads; - - if (numres == 1U) { - return OPJ_TRUE; - } -- h.mem = (OPJ_INT32*)opj_aligned_malloc(opj_dwt_max_resolution(tr, numres) * sizeof(OPJ_INT32)); -+ num_threads = opj_thread_pool_get_thread_count(tp); -+ h_mem_size = opj_dwt_max_resolution(tr, numres) * sizeof(OPJ_INT32); -+ h.mem = (OPJ_INT32*)opj_aligned_malloc(h_mem_size); - if (! h.mem){ - /* FIXME event manager error callback */ - return OPJ_FALSE; -@@ -595,23 +661,113 @@ static OPJ_BOOL opj_dwt_decode_tile(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres - h.dn = (OPJ_INT32)(rw - (OPJ_UINT32)h.sn); - h.cas = tr->x0 % 2; - -- for(j = 0; j < rh; ++j) { -- opj_dwt_interleave_h(&h, &tiledp[j*w]); -- (dwt_1D)(&h); -- memcpy(&tiledp[j*w], h.mem, rw * sizeof(OPJ_INT32)); -- } -+ if( num_threads <= 1 || rh == 1 ) -+ { -+ for(j = 0; j < rh; ++j) { -+ opj_dwt_interleave_h(&h, &tiledp[j*w]); -+ (dwt_1D)(&h); -+ memcpy(&tiledp[j*w], h.mem, rw * sizeof(OPJ_INT32)); -+ } -+ } -+ else -+ { -+ int num_jobs = num_threads; -+ if( rh < num_jobs ) -+ num_jobs = rh; -+ for( j = 0; j < num_jobs; j++ ) -+ { -+ opj_dwd_decode_h_job_t* job; -+ -+ job = (opj_dwd_decode_h_job_t*) opj_malloc(sizeof(opj_dwd_decode_h_job_t)); -+ if( !job ) -+ { -+ /* It would be nice to fallback to single thread case, but */ -+ /* unfortunately some jobs may be launched and have modified */ -+ /* tiledp, so it is not practical to recover from that error */ -+ /* FIXME event manager error callback */ -+ opj_thread_pool_wait_completion(tp, 0); -+ opj_aligned_free(h.mem); -+ return OPJ_FALSE; -+ } -+ job->h = h; -+ job->dwt_1D = dwt_1D; -+ job->rw = rw; -+ job->w = w; -+ job->tiledp = tiledp; -+ job->min_j = j * (rh / num_jobs); -+ job->max_j = (j+1) * (rh / num_jobs); -+ if( job->max_j > rh || j == num_jobs - 1 ) -+ job->max_j = rh; -+ job->h.mem = (OPJ_INT32*)opj_aligned_malloc(h_mem_size); -+ if (!job->h.mem) -+ { -+ /* FIXME event manager error callback */ -+ opj_thread_pool_wait_completion(tp, 0); -+ opj_free(job); -+ opj_aligned_free(h.mem); -+ return OPJ_FALSE; -+ } -+ opj_thread_pool_submit_job( tp, opj_dwt_decode_h_func, job ); -+ } -+ opj_thread_pool_wait_completion(tp, 0); -+ } - - v.dn = (OPJ_INT32)(rh - (OPJ_UINT32)v.sn); - v.cas = tr->y0 % 2; - -- for(j = 0; j < rw; ++j){ -- OPJ_UINT32 k; -- opj_dwt_interleave_v(&v, &tiledp[j], (OPJ_INT32)w); -- (dwt_1D)(&v); -- for(k = 0; k < rh; ++k) { -- tiledp[k * w + j] = v.mem[k]; -- } -- } -+ if( num_threads <= 1 || rw == 1 ) -+ { -+ for(j = 0; j < rw; ++j){ -+ OPJ_UINT32 k; -+ opj_dwt_interleave_v(&v, &tiledp[j], (OPJ_INT32)w); -+ (dwt_1D)(&v); -+ for(k = 0; k < rh; ++k) { -+ tiledp[k * w + j] = v.mem[k]; -+ } -+ } -+ } -+ else -+ { -+ int num_jobs = num_threads; -+ if( rw < num_jobs ) -+ num_jobs = rw; -+ for( j = 0; j < num_jobs; j++ ) -+ { -+ opj_dwd_decode_v_job_t* job; -+ -+ job = (opj_dwd_decode_v_job_t*) opj_malloc(sizeof(opj_dwd_decode_v_job_t)); -+ if( !job ) -+ { -+ /* It would be nice to fallback to single thread case, but */ -+ /* unfortunately some jobs may be launched and have modified */ -+ /* tiledp, so it is not practical to recover from that error */ -+ /* FIXME event manager error callback */ -+ opj_thread_pool_wait_completion(tp, 0); -+ opj_aligned_free(v.mem); -+ return OPJ_FALSE; -+ } -+ job->v = v; -+ job->dwt_1D = dwt_1D; -+ job->rh = rh; -+ job->w = w; -+ job->tiledp = tiledp; -+ job->min_j = j * (rw / num_jobs); -+ job->max_j = (j+1) * (rw / num_jobs); -+ if( job->max_j > rw || j == num_jobs - 1 ) -+ job->max_j = rw; -+ job->v.mem = (OPJ_INT32*)opj_aligned_malloc(h_mem_size); -+ if (!job->v.mem) -+ { -+ /* FIXME event manager error callback */ -+ opj_thread_pool_wait_completion(tp, 0); -+ opj_free(job); -+ opj_aligned_free(v.mem); -+ return OPJ_FALSE; -+ } -+ opj_thread_pool_submit_job( tp, opj_dwt_decode_v_func, job ); -+ } -+ opj_thread_pool_wait_completion(tp, 0); -+ } - } - opj_aligned_free(h.mem); - return OPJ_TRUE; -diff --git a/src/lib/openjp2/dwt.h b/src/lib/openjp2/dwt.h -index 21fe942..9385002 100644 ---- a/src/lib/openjp2/dwt.h -+++ b/src/lib/openjp2/dwt.h -@@ -63,10 +63,11 @@ OPJ_BOOL opj_dwt_encode(opj_tcd_tilecomp_t * tilec); - /** - Inverse 5-3 wavelet transform in 2-D. - Apply a reversible inverse DWT transform to a component of an image. -+@param tp Thread pool - @param tilec Tile component information (current tile) - @param numres Number of resolution levels to decode - */ --OPJ_BOOL opj_dwt_decode(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres); -+OPJ_BOOL opj_dwt_decode(opj_thread_pool_t* tp, opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres); - - /** - Get the gain of a subband for the reversible 5-3 DWT. -diff --git a/src/lib/openjp2/j2k.c b/src/lib/openjp2/j2k.c -index 9eaa155..68b2f82 100644 ---- a/src/lib/openjp2/j2k.c -+++ b/src/lib/openjp2/j2k.c -@@ -5944,6 +5944,32 @@ void opj_j2k_setup_decoder(opj_j2k_t *j2k, opj_dparameters_t *parameters) - } - } - -+OPJ_BOOL opj_j2k_set_threads(opj_j2k_t *j2k, OPJ_UINT32 num_threads) -+{ -+ if( opj_has_thread_support() ) -+ { -+ opj_thread_pool_destroy(j2k->m_tp); -+ j2k->m_tp = opj_thread_pool_create((int)num_threads); -+ if( j2k->m_tp == 0 ) -+ { -+ j2k->m_tp = opj_thread_pool_create(0); -+ return OPJ_FALSE; -+ } -+ return OPJ_TRUE; -+ } -+ return OPJ_FALSE; -+} -+ -+static int opj_j2k_get_default_thread_count() -+{ -+ const char* num_threads = getenv("OPJ_NUM_THREADS"); -+ if( num_threads == NULL || !opj_has_thread_support() ) -+ return 0; -+ if( strcmp(num_threads, "ALL_CPUS") == 0 ) -+ return opj_get_num_cpus(); -+ return atoi(num_threads); -+} -+ - /* ----------------------------------------------------------------------- */ - /* J2K encoder interface */ - /* ----------------------------------------------------------------------- */ -@@ -5981,6 +6007,17 @@ opj_j2k_t* opj_j2k_create_compress(void) - return NULL; - } - -+ l_j2k->m_tp = opj_thread_pool_create(opj_j2k_get_default_thread_count()); -+ if( !l_j2k->m_tp ) -+ { -+ l_j2k->m_tp = opj_thread_pool_create(0); -+ } -+ if( !l_j2k->m_tp ) -+ { -+ opj_j2k_destroy(l_j2k); -+ return NULL; -+ } -+ - return l_j2k; - } - -@@ -7486,7 +7523,7 @@ static OPJ_BOOL opj_j2k_copy_default_tcp_and_create_tcd ( opj_j2k_t * p_j2 - return OPJ_FALSE; - } - -- if ( !opj_tcd_init(p_j2k->m_tcd, l_image, &(p_j2k->m_cp)) ) { -+ if ( !opj_tcd_init(p_j2k->m_tcd, l_image, &(p_j2k->m_cp), p_j2k->m_tp) ) { - opj_tcd_destroy(p_j2k->m_tcd); - p_j2k->m_tcd = 00; - opj_event_msg(p_manager, EVT_ERROR, "Cannot decode tile, memory error\n"); -@@ -7567,6 +7604,9 @@ void opj_j2k_destroy (opj_j2k_t *p_j2k) - opj_image_destroy(p_j2k->m_output_image); - p_j2k->m_output_image = NULL; - -+ opj_thread_pool_destroy(p_j2k->m_tp); -+ p_j2k->m_tp = NULL; -+ - opj_free(p_j2k); - } - -@@ -8658,6 +8698,17 @@ opj_j2k_t* opj_j2k_create_decompress(void) - return 00; - } - -+ l_j2k->m_tp = opj_thread_pool_create(opj_j2k_get_default_thread_count()); -+ if( !l_j2k->m_tp ) -+ { -+ l_j2k->m_tp = opj_thread_pool_create(0); -+ } -+ if( !l_j2k->m_tp ) -+ { -+ opj_j2k_destroy(l_j2k); -+ return NULL; -+ } -+ - return l_j2k; - } - -@@ -10934,7 +10985,7 @@ static OPJ_BOOL opj_j2k_create_tcd( opj_j2k_t *p_j2k, - return OPJ_FALSE; - } - -- if (!opj_tcd_init(p_j2k->m_tcd,p_j2k->m_private_image,&p_j2k->m_cp)) { -+ if (!opj_tcd_init(p_j2k->m_tcd,p_j2k->m_private_image,&p_j2k->m_cp, p_j2k->m_tp)) { - opj_tcd_destroy(p_j2k->m_tcd); - p_j2k->m_tcd = 00; - return OPJ_FALSE; -diff --git a/src/lib/openjp2/j2k.h b/src/lib/openjp2/j2k.h -index 358e073..be85d5d 100644 ---- a/src/lib/openjp2/j2k.h -+++ b/src/lib/openjp2/j2k.h -@@ -589,6 +589,12 @@ typedef struct opj_j2k - - /** the current tile coder/decoder **/ - struct opj_tcd * m_tcd; -+ -+ /** Number of threads to use */ -+ int m_num_threads; -+ -+ /** Thread pool */ -+ opj_thread_pool_t* m_tp; - } - opj_j2k_t; - -@@ -607,6 +613,8 @@ Decoding parameters are returned in j2k->cp. - */ - void opj_j2k_setup_decoder(opj_j2k_t *j2k, opj_dparameters_t *parameters); - -+OPJ_BOOL opj_j2k_set_threads(opj_j2k_t *j2k, OPJ_UINT32 num_threads); -+ - /** - * Creates a J2K compression structure - * -diff --git a/src/lib/openjp2/jp2.c b/src/lib/openjp2/jp2.c -index a607c8a..e156ebf 100644 ---- a/src/lib/openjp2/jp2.c -+++ b/src/lib/openjp2/jp2.c -@@ -1767,6 +1767,11 @@ void opj_jp2_setup_decoder(opj_jp2_t *jp2, opj_dparameters_t *parameters) - jp2->ignore_pclr_cmap_cdef = parameters->flags & OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG; - } - -+OPJ_BOOL opj_jp2_set_threads(opj_jp2_t *jp2, OPJ_UINT32 num_threads) -+{ -+ return opj_j2k_set_threads(jp2->j2k, num_threads); -+} -+ - /* ----------------------------------------------------------------------- */ - /* JP2 encoder interface */ - /* ----------------------------------------------------------------------- */ -diff --git a/src/lib/openjp2/jp2.h b/src/lib/openjp2/jp2.h -index 9413883..b54d0bf 100644 ---- a/src/lib/openjp2/jp2.h -+++ b/src/lib/openjp2/jp2.h -@@ -243,6 +243,8 @@ Decoding parameters are returned in jp2->j2k->cp. - */ - void opj_jp2_setup_decoder(opj_jp2_t *jp2, opj_dparameters_t *parameters); - -+OPJ_BOOL opj_jp2_set_threads(opj_jp2_t *jp2, OPJ_UINT32 num_threads); -+ - /** - * Decode an image from a JPEG-2000 file stream - * @param jp2 JP2 decompressor handle -diff --git a/src/lib/openjp2/mqc.c b/src/lib/openjp2/mqc.c -index 4e409a7..7119c3a 100644 ---- a/src/lib/openjp2/mqc.c -+++ b/src/lib/openjp2/mqc.c -@@ -70,28 +70,6 @@ Fill mqc->c with 1's for flushing - @param mqc MQC handle - */ - static void opj_mqc_setbits(opj_mqc_t *mqc); --/** --FIXME DOC --@param mqc MQC handle --@return --*/ --static INLINE OPJ_INT32 opj_mqc_mpsexchange(opj_mqc_t *const mqc); --/** --FIXME DOC --@param mqc MQC handle --@return --*/ --static INLINE OPJ_INT32 opj_mqc_lpsexchange(opj_mqc_t *const mqc); --/** --Input a byte --@param mqc MQC handle --*/ --static INLINE void opj_mqc_bytein(opj_mqc_t *const mqc); --/** --Renormalize mqc->a and mqc->c while decoding --@param mqc MQC handle --*/ --static INLINE void opj_mqc_renormd(opj_mqc_t *const mqc); - /*@}*/ - - /*@}*/ -@@ -284,82 +262,6 @@ static void opj_mqc_setbits(opj_mqc_t *mqc) { - } - } - --static INLINE OPJ_INT32 opj_mqc_mpsexchange(opj_mqc_t *const mqc) { -- OPJ_INT32 d; -- if (mqc->a < (*mqc->curctx)->qeval) { -- d = (OPJ_INT32)(1 - (*mqc->curctx)->mps); -- *mqc->curctx = (*mqc->curctx)->nlps; -- } else { -- d = (OPJ_INT32)(*mqc->curctx)->mps; -- *mqc->curctx = (*mqc->curctx)->nmps; -- } -- -- return d; --} -- --static INLINE OPJ_INT32 opj_mqc_lpsexchange(opj_mqc_t *const mqc) { -- OPJ_INT32 d; -- if (mqc->a < (*mqc->curctx)->qeval) { -- mqc->a = (*mqc->curctx)->qeval; -- d = (OPJ_INT32)(*mqc->curctx)->mps; -- *mqc->curctx = (*mqc->curctx)->nmps; -- } else { -- mqc->a = (*mqc->curctx)->qeval; -- d = (OPJ_INT32)(1 - (*mqc->curctx)->mps); -- *mqc->curctx = (*mqc->curctx)->nlps; -- } -- -- return d; --} -- --#ifdef MQC_PERF_OPT --static INLINE void opj_mqc_bytein(opj_mqc_t *const mqc) { -- unsigned int i = *((unsigned int *) mqc->bp); -- mqc->c += i & 0xffff00; -- mqc->ct = i & 0x0f; -- mqc->bp += (i >> 2) & 0x04; --} --#else --static void opj_mqc_bytein(opj_mqc_t *const mqc) { -- if (mqc->bp != mqc->end) { -- OPJ_UINT32 c; -- if (mqc->bp + 1 != mqc->end) { -- c = *(mqc->bp + 1); -- } else { -- c = 0xff; -- } -- if (*mqc->bp == 0xff) { -- if (c > 0x8f) { -- mqc->c += 0xff00; -- mqc->ct = 8; -- } else { -- mqc->bp++; -- mqc->c += c << 9; -- mqc->ct = 7; -- } -- } else { -- mqc->bp++; -- mqc->c += c << 8; -- mqc->ct = 8; -- } -- } else { -- mqc->c += 0xff00; -- mqc->ct = 8; -- } --} --#endif -- --static INLINE void opj_mqc_renormd(opj_mqc_t *const mqc) { -- do { -- if (mqc->ct == 0) { -- opj_mqc_bytein(mqc); -- } -- mqc->a <<= 1; -- mqc->c <<= 1; -- mqc->ct--; -- } while (mqc->a < 0x8000); --} -- - /* - ========================================================== - MQ-Coder interface -@@ -585,25 +487,6 @@ OPJ_BOOL opj_mqc_init_dec(opj_mqc_t *mqc, OPJ_BYTE *bp, OPJ_UINT32 len) { - return OPJ_TRUE; - } - --OPJ_INT32 opj_mqc_decode(opj_mqc_t *const mqc) { -- OPJ_INT32 d; -- mqc->a -= (*mqc->curctx)->qeval; -- if ((mqc->c >> 16) < (*mqc->curctx)->qeval) { -- d = opj_mqc_lpsexchange(mqc); -- opj_mqc_renormd(mqc); -- } else { -- mqc->c -= (*mqc->curctx)->qeval << 16; -- if ((mqc->a & 0x8000) == 0) { -- d = opj_mqc_mpsexchange(mqc); -- opj_mqc_renormd(mqc); -- } else { -- d = (OPJ_INT32)(*mqc->curctx)->mps; -- } -- } -- -- return d; --} -- - void opj_mqc_resetstates(opj_mqc_t *mqc) { - OPJ_UINT32 i; - for (i = 0; i < MQC_NUMCTXS; i++) { -diff --git a/src/lib/openjp2/mqc.h b/src/lib/openjp2/mqc.h -index 69a2d46..491ee50 100644 ---- a/src/lib/openjp2/mqc.h -+++ b/src/lib/openjp2/mqc.h -@@ -77,11 +77,14 @@ typedef struct opj_mqc { - OPJ_BYTE *end; - opj_mqc_state_t *ctxs[MQC_NUMCTXS]; - opj_mqc_state_t **curctx; -+ const OPJ_BYTE *lut_ctxno_zc_orient; /* lut_ctxno_zc shifted by 256 * bandno */ - #ifdef MQC_PERF_OPT - unsigned char *buffer; - #endif - } opj_mqc_t; - -+#include "mqc_inl.h" -+ - /** @name Exported functions */ - /*@{*/ - /* ----------------------------------------------------------------------- */ -@@ -198,7 +201,7 @@ Decode a symbol - @param mqc MQC handle - @return Returns the decoded symbol (0 or 1) - */ --OPJ_INT32 opj_mqc_decode(opj_mqc_t * const mqc); -+static INLINE OPJ_INT32 opj_mqc_decode(opj_mqc_t * const mqc); - /* ----------------------------------------------------------------------- */ - /*@}*/ - -diff --git a/src/lib/openjp2/mqc_inl.h b/src/lib/openjp2/mqc_inl.h -new file mode 100644 -index 0000000..882b59f ---- /dev/null -+++ b/src/lib/openjp2/mqc_inl.h -@@ -0,0 +1,159 @@ -+/* -+ * The copyright in this software is being made available under the 2-clauses -+ * BSD License, included below. This software may be subject to other third -+ * party and contributor rights, including patent rights, and no such rights -+ * are granted under this license. -+ * -+ * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium -+ * Copyright (c) 2002-2014, Professor Benoit Macq -+ * Copyright (c) 2001-2003, David Janssens -+ * Copyright (c) 2002-2003, Yannick Verschueren -+ * Copyright (c) 2003-2007, Francois-Olivier Devaux -+ * Copyright (c) 2003-2014, Antonin Descampe -+ * Copyright (c) 2005, Herve Drolon, FreeImage Team -+ * Copyright (c) 2008, Jerome Fimes, Communications & Systemes <jerome.fimes@c-s.fr> -+ * All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions -+ * are met: -+ * 1. Redistributions of source code must retain the above copyright -+ * notice, this list of conditions and the following disclaimer. -+ * 2. Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -+ * POSSIBILITY OF SUCH DAMAGE. -+ */ -+ -+#ifndef __MQC_INL_H -+#define __MQC_INL_H -+/** -+FIXME DOC -+@param mqc MQC handle -+@return -+*/ -+static INLINE OPJ_INT32 opj_mqc_mpsexchange(opj_mqc_t *const mqc) { -+ OPJ_INT32 d; -+ if (mqc->a < (*mqc->curctx)->qeval) { -+ d = (OPJ_INT32)(1 - (*mqc->curctx)->mps); -+ *mqc->curctx = (*mqc->curctx)->nlps; -+ } else { -+ d = (OPJ_INT32)(*mqc->curctx)->mps; -+ *mqc->curctx = (*mqc->curctx)->nmps; -+ } -+ -+ return d; -+} -+ -+/** -+FIXME DOC -+@param mqc MQC handle -+@return -+*/ -+static INLINE OPJ_INT32 opj_mqc_lpsexchange(opj_mqc_t *const mqc) { -+ OPJ_INT32 d; -+ if (mqc->a < (*mqc->curctx)->qeval) { -+ mqc->a = (*mqc->curctx)->qeval; -+ d = (OPJ_INT32)(*mqc->curctx)->mps; -+ *mqc->curctx = (*mqc->curctx)->nmps; -+ } else { -+ mqc->a = (*mqc->curctx)->qeval; -+ d = (OPJ_INT32)(1 - (*mqc->curctx)->mps); -+ *mqc->curctx = (*mqc->curctx)->nlps; -+ } -+ -+ return d; -+} -+ -+/** -+Input a byte -+@param mqc MQC handle -+*/ -+#ifdef MQC_PERF_OPT -+static INLINE void opj_mqc_bytein(opj_mqc_t *const mqc) { -+ unsigned int i = *((unsigned int *) mqc->bp); -+ mqc->c += i & 0xffff00; -+ mqc->ct = i & 0x0f; -+ mqc->bp += (i >> 2) & 0x04; -+} -+#else -+static INLINE void opj_mqc_bytein(opj_mqc_t *const mqc) { -+ if (mqc->bp != mqc->end) { -+ OPJ_UINT32 c; -+ if (mqc->bp + 1 != mqc->end) { -+ c = *(mqc->bp + 1); -+ } else { -+ c = 0xff; -+ } -+ if (*mqc->bp == 0xff) { -+ if (c > 0x8f) { -+ mqc->c += 0xff00; -+ mqc->ct = 8; -+ } else { -+ mqc->bp++; -+ mqc->c += c << 9; -+ mqc->ct = 7; -+ } -+ } else { -+ mqc->bp++; -+ mqc->c += c << 8; -+ mqc->ct = 8; -+ } -+ } else { -+ mqc->c += 0xff00; -+ mqc->ct = 8; -+ } -+} -+#endif -+ -+/** -+Renormalize mqc->a and mqc->c while decoding -+@param mqc MQC handle -+*/ -+static INLINE void opj_mqc_renormd(opj_mqc_t *const mqc) { -+ do { -+ if (mqc->ct == 0) { -+ opj_mqc_bytein(mqc); -+ } -+ mqc->a <<= 1; -+ mqc->c <<= 1; -+ mqc->ct--; -+ } while (mqc->a < 0x8000); -+} -+ -+/** -+Decode a symbol -+@param mqc MQC handle -+@return Returns the decoded symbol (0 or 1) -+*/ -+static INLINE OPJ_INT32 opj_mqc_decode(opj_mqc_t *const mqc) { -+ OPJ_INT32 d; -+ mqc->a -= (*mqc->curctx)->qeval; -+ if ((mqc->c >> 16) < (*mqc->curctx)->qeval) { -+ d = opj_mqc_lpsexchange(mqc); -+ opj_mqc_renormd(mqc); -+ } else { -+ mqc->c -= (*mqc->curctx)->qeval << 16; -+ if ((mqc->a & 0x8000) == 0) { -+ d = opj_mqc_mpsexchange(mqc); -+ opj_mqc_renormd(mqc); -+ } else { -+ d = (OPJ_INT32)(*mqc->curctx)->mps; -+ } -+ } -+ -+ return d; -+} -+ -+#endif /* __MQC_INL_H */ -diff --git a/src/lib/openjp2/openjpeg.c b/src/lib/openjp2/openjpeg.c -index 5114cc1..ee3e14b 100644 ---- a/src/lib/openjp2/openjpeg.c -+++ b/src/lib/openjp2/openjpeg.c -@@ -239,6 +239,9 @@ opj_codec_t* OPJ_CALLCONV opj_create_decompress(OPJ_CODEC_FORMAT p_format) - OPJ_UINT32 res_factor, - struct opj_event_mgr * p_manager)) opj_j2k_set_decoded_resolution_factor; - -+ l_codec->opj_set_threads = -+ (OPJ_BOOL (*) ( void * p_codec, OPJ_UINT32 num_threads )) opj_j2k_set_threads; -+ - l_codec->m_codec = opj_j2k_create_decompress(); - - if (! l_codec->m_codec) { -@@ -315,6 +318,9 @@ opj_codec_t* OPJ_CALLCONV opj_create_decompress(OPJ_CODEC_FORMAT p_format) - OPJ_UINT32 res_factor, - opj_event_mgr_t * p_manager)) opj_jp2_set_decoded_resolution_factor; - -+ l_codec->opj_set_threads = -+ (OPJ_BOOL (*) ( void * p_codec, OPJ_UINT32 num_threads )) opj_jp2_set_threads; -+ - l_codec->m_codec = opj_jp2_create(OPJ_TRUE); - - if (! l_codec->m_codec) { -@@ -354,6 +360,18 @@ void OPJ_CALLCONV opj_set_default_decoder_parameters(opj_dparameters_t *paramete - } - } - -+ -+OPJ_API OPJ_CALLCONV opj_codec_set_threads(opj_codec_t *p_codec, -+ int num_threads) -+{ -+ if (p_codec ) { -+ opj_codec_private_t * l_codec = (opj_codec_private_t *) p_codec; -+ -+ return l_codec->opj_set_threads(l_codec->m_codec, num_threads); -+ } -+ return OPJ_FALSE; -+} -+ - OPJ_BOOL OPJ_CALLCONV opj_setup_decoder(opj_codec_t *p_codec, - opj_dparameters_t *parameters - ) -diff --git a/src/lib/openjp2/openjpeg.h b/src/lib/openjp2/openjpeg.h -index c07e9c8..7912c23 100644 ---- a/src/lib/openjp2/openjpeg.h -+++ b/src/lib/openjp2/openjpeg.h -@@ -1263,6 +1263,25 @@ OPJ_API OPJ_BOOL OPJ_CALLCONV opj_setup_decoder(opj_codec_t *p_codec, - opj_dparameters_t *parameters ); - - /** -+ * Allocates worker threads for the compressor/decompressor. -+ * -+ * By default, only the main thread is used. If this function is not used, -+ * but the OPJ_NUM_THREADS environment variable is set, its value will be -+ * used to initialize the number of threads. The value can be either an integer -+ * number, or "ALL_CPUS". If OPJ_NUM_THREADS is set and this function is called, -+ * this function will override the behaviour of the environment variable. -+ * -+ * Note: currently only has effect on the decompressor. -+ * -+ * @param p_codec decompressor handler -+ * @param num_threads number of threads. -+ * -+ * @return OPJ_TRUE if the decoder is correctly set -+ */ -+OPJ_API OPJ_BOOL OPJ_CALLCONV opj_codec_set_threads(opj_codec_t *p_codec, -+ int num_threads); -+ -+/** - * Decodes an image header. - * - * @param p_stream the jpeg2000 stream. -@@ -1554,6 +1573,19 @@ OPJ_API OPJ_BOOL OPJ_CALLCONV opj_set_MCT( opj_cparameters_t *parameters, - OPJ_INT32 * p_dc_shift, - OPJ_UINT32 pNbComp); - -+/* -+========================================================== -+ Thread functions -+========================================================== -+*/ -+ -+/** Returns if the library is built with thread support. -+ * OPJ_TRUE if mutex, condition, thread, thread pool are available. -+ */ -+OPJ_API OPJ_BOOL OPJ_CALLCONV opj_has_thread_support(void); -+ -+/** Return the number of virtual CPUs */ -+OPJ_API int OPJ_CALLCONV opj_get_num_cpus(void); - - - #ifdef __cplusplus -diff --git a/src/lib/openjp2/opj_codec.h b/src/lib/openjp2/opj_codec.h -index 6bd791f..c88005d 100644 ---- a/src/lib/openjp2/opj_codec.h -+++ b/src/lib/openjp2/opj_codec.h -@@ -113,6 +113,7 @@ typedef struct opj_codec_private - OPJ_BOOL (*opj_set_decoded_resolution_factor) ( void * p_codec, - OPJ_UINT32 res_factor, - opj_event_mgr_t * p_manager); -+ - } m_decompression; - - /** -@@ -157,6 +158,9 @@ typedef struct opj_codec_private - void (*opj_dump_codec) (void * p_codec, OPJ_INT32 info_flag, FILE* output_stream); - opj_codestream_info_v2_t* (*opj_get_codec_info)(void* p_codec); - opj_codestream_index_t* (*opj_get_codec_index)(void* p_codec); -+ -+ /** Set number of threads */ -+ OPJ_BOOL (*opj_set_threads) ( void * p_codec, OPJ_UINT32 num_threads ); - } - opj_codec_private_t; - -diff --git a/src/lib/openjp2/opj_includes.h b/src/lib/openjp2/opj_includes.h -index 58a5a9a..e835fae 100644 ---- a/src/lib/openjp2/opj_includes.h -+++ b/src/lib/openjp2/opj_includes.h -@@ -182,6 +182,9 @@ static INLINE long opj_lrintf(float f) { - #include "bio.h" - #include "cio.h" - -+#include "thread.h" -+#include "tls_keys.h" -+ - #include "image.h" - #include "invert.h" - #include "j2k.h" -diff --git a/src/lib/openjp2/t1.c b/src/lib/openjp2/t1.c -index 1bf7205..b1c6128 100644 ---- a/src/lib/openjp2/t1.c -+++ b/src/lib/openjp2/t1.c -@@ -39,26 +39,27 @@ - #include "opj_includes.h" - #include "t1_luts.h" - -+/* #define CONSISTENCY_CHECK */ -+ - /** @defgroup T1 T1 - Implementation of the tier-1 coding */ - /*@{*/ - - /** @name Local static functions */ - /*@{*/ - --static INLINE OPJ_BYTE opj_t1_getctxno_zc(OPJ_UINT32 f, OPJ_UINT32 orient); -+static INLINE OPJ_BYTE opj_t1_getctxno_zc(opj_mqc_t *mqc, OPJ_UINT32 f); - static OPJ_BYTE opj_t1_getctxno_sc(OPJ_UINT32 f); - static INLINE OPJ_UINT32 opj_t1_getctxno_mag(OPJ_UINT32 f); - static OPJ_BYTE opj_t1_getspb(OPJ_UINT32 f); - static OPJ_INT16 opj_t1_getnmsedec_sig(OPJ_UINT32 x, OPJ_UINT32 bitpos); - static OPJ_INT16 opj_t1_getnmsedec_ref(OPJ_UINT32 x, OPJ_UINT32 bitpos); --static void opj_t1_updateflags(opj_flag_t *flagsp, OPJ_UINT32 s, OPJ_UINT32 stride); -+static INLINE void opj_t1_updateflags(opj_flag_t *flagsp, OPJ_UINT32 s, OPJ_UINT32 stride); - /** - Encode significant pass - */ - static void opj_t1_enc_sigpass_step(opj_t1_t *t1, - opj_flag_t *flagsp, - OPJ_INT32 *datap, -- OPJ_UINT32 orient, - OPJ_INT32 bpno, - OPJ_INT32 one, - OPJ_INT32 *nmsedec, -@@ -81,23 +82,27 @@ static void opj_t1_dec_sigpass_step(opj_t1_t *t1, - static INLINE void opj_t1_dec_sigpass_step_raw( - opj_t1_t *t1, - opj_flag_t *flagsp, -+ opj_colflag_t* colflagsp, - OPJ_INT32 *datap, -- OPJ_INT32 orient, - OPJ_INT32 oneplushalf, -- OPJ_INT32 vsc); -+ OPJ_INT32 vsc, -+ OPJ_INT32 row); - static INLINE void opj_t1_dec_sigpass_step_mqc( - opj_t1_t *t1, - opj_flag_t *flagsp, -+ opj_colflag_t* colflagsp, - OPJ_INT32 *datap, -- OPJ_INT32 orient, -- OPJ_INT32 oneplushalf); -+ OPJ_INT32 oneplushalf, -+ OPJ_INT32 row, -+ OPJ_INT32 flags_stride); - static INLINE void opj_t1_dec_sigpass_step_mqc_vsc( - opj_t1_t *t1, - opj_flag_t *flagsp, -+ opj_colflag_t* colflagsp, - OPJ_INT32 *datap, -- OPJ_INT32 orient, - OPJ_INT32 oneplushalf, -- OPJ_INT32 vsc); -+ OPJ_INT32 vsc, -+ OPJ_INT32 row); - - - /** -@@ -105,7 +110,6 @@ Encode significant pass - */ - static void opj_t1_enc_sigpass( opj_t1_t *t1, - OPJ_INT32 bpno, -- OPJ_UINT32 orient, - OPJ_INT32 *nmsedec, - OPJ_BYTE type, - OPJ_UINT32 cblksty); -@@ -116,16 +120,10 @@ Decode significant pass - static void opj_t1_dec_sigpass_raw( - opj_t1_t *t1, - OPJ_INT32 bpno, -- OPJ_INT32 orient, - OPJ_INT32 cblksty); --static void opj_t1_dec_sigpass_mqc( -- opj_t1_t *t1, -- OPJ_INT32 bpno, -- OPJ_INT32 orient); - static void opj_t1_dec_sigpass_mqc_vsc( - opj_t1_t *t1, -- OPJ_INT32 bpno, -- OPJ_INT32 orient); -+ OPJ_INT32 bpno); - - - -@@ -158,9 +156,6 @@ static void opj_t1_dec_refpass_raw( - opj_t1_t *t1, - OPJ_INT32 bpno, - OPJ_INT32 cblksty); --static void opj_t1_dec_refpass_mqc( -- opj_t1_t *t1, -- OPJ_INT32 bpno); - static void opj_t1_dec_refpass_mqc_vsc( - opj_t1_t *t1, - OPJ_INT32 bpno); -@@ -182,23 +177,28 @@ static void opj_t1_dec_refpass_step(opj_t1_t *t1, - static INLINE void opj_t1_dec_refpass_step_raw( - opj_t1_t *t1, - opj_flag_t *flagsp, -+ opj_colflag_t *colflagsp, - OPJ_INT32 *datap, - OPJ_INT32 poshalf, - OPJ_INT32 neghalf, -- OPJ_INT32 vsc); -+ OPJ_INT32 row); - static INLINE void opj_t1_dec_refpass_step_mqc( - opj_t1_t *t1, - opj_flag_t *flagsp, -+ opj_colflag_t *colflagsp, - OPJ_INT32 *datap, - OPJ_INT32 poshalf, -- OPJ_INT32 neghalf); -+ OPJ_INT32 neghalf, -+ OPJ_INT32 row); - static INLINE void opj_t1_dec_refpass_step_mqc_vsc( - opj_t1_t *t1, - opj_flag_t *flagsp, -+ opj_colflag_t *colflagsp, - OPJ_INT32 *datap, - OPJ_INT32 poshalf, - OPJ_INT32 neghalf, -- OPJ_INT32 vsc); -+ OPJ_INT32 vsc, -+ OPJ_INT32 row); - - - -@@ -209,7 +209,6 @@ static void opj_t1_enc_clnpass_step( - opj_t1_t *t1, - opj_flag_t *flagsp, - OPJ_INT32 *datap, -- OPJ_UINT32 orient, - OPJ_INT32 bpno, - OPJ_INT32 one, - OPJ_INT32 *nmsedec, -@@ -221,30 +220,32 @@ Decode clean-up pass - static void opj_t1_dec_clnpass_step_partial( - opj_t1_t *t1, - opj_flag_t *flagsp, -+ opj_colflag_t *colflagsp, - OPJ_INT32 *datap, -- OPJ_INT32 orient, -- OPJ_INT32 oneplushalf); -+ OPJ_INT32 oneplushalf, -+ OPJ_INT32 row); - static void opj_t1_dec_clnpass_step( - opj_t1_t *t1, - opj_flag_t *flagsp, -+ opj_colflag_t *colflagsp, - OPJ_INT32 *datap, -- OPJ_INT32 orient, -- OPJ_INT32 oneplushalf); -+ OPJ_INT32 oneplushalf, -+ OPJ_INT32 row); - static void opj_t1_dec_clnpass_step_vsc( - opj_t1_t *t1, - opj_flag_t *flagsp, -+ opj_colflag_t *colflagsp, - OPJ_INT32 *datap, -- OPJ_INT32 orient, - OPJ_INT32 oneplushalf, - OPJ_INT32 partial, -- OPJ_INT32 vsc); -+ OPJ_INT32 vsc, -+ OPJ_INT32 row); - /** - Encode clean-up pass - */ - static void opj_t1_enc_clnpass( - opj_t1_t *t1, - OPJ_INT32 bpno, -- OPJ_UINT32 orient, - OPJ_INT32 *nmsedec, - OPJ_UINT32 cblksty); - /** -@@ -253,7 +254,6 @@ Decode clean-up pass - static void opj_t1_dec_clnpass( - opj_t1_t *t1, - OPJ_INT32 bpno, -- OPJ_INT32 orient, - OPJ_INT32 cblksty); - - static OPJ_FLOAT64 opj_t1_getwmsedec( -@@ -305,8 +305,8 @@ static OPJ_BOOL opj_t1_allocate_buffers( opj_t1_t *t1, - - /* ----------------------------------------------------------------------- */ - --static OPJ_BYTE opj_t1_getctxno_zc(OPJ_UINT32 f, OPJ_UINT32 orient) { -- return lut_ctxno_zc[(orient << 8) | (f & T1_SIG_OTH)]; -+static OPJ_BYTE opj_t1_getctxno_zc(opj_mqc_t *mqc, OPJ_UINT32 f) { -+ return mqc->lut_ctxno_zc_orient[(f & T1_SIG_OTH)]; - } - - static OPJ_BYTE opj_t1_getctxno_sc(OPJ_UINT32 f) { -@@ -339,34 +339,73 @@ static OPJ_INT16 opj_t1_getnmsedec_ref(OPJ_UINT32 x, OPJ_UINT32 bitpos) { - return lut_nmsedec_ref0[x & ((1 << T1_NMSEDEC_BITS) - 1)]; - } - --static void opj_t1_updateflags(opj_flag_t *flagsp, OPJ_UINT32 s, OPJ_UINT32 stride) { -+static INLINE void opj_t1_updateflags(opj_flag_t *flagsp, OPJ_UINT32 s, OPJ_UINT32 stride) { - opj_flag_t *np = flagsp - stride; - opj_flag_t *sp = flagsp + stride; - -- static const opj_flag_t mod[] = { -- T1_SIG_S, T1_SIG_S|T1_SGN_S, -- T1_SIG_E, T1_SIG_E|T1_SGN_E, -- T1_SIG_W, T1_SIG_W|T1_SGN_W, -- T1_SIG_N, T1_SIG_N|T1_SGN_N -- }; -+ /* We strongly rely on (T1_SGN_N == 0x0100) == (T1_SIG_N == 0x0010) << 4 */ -+ /* and T1_SIG_E == T1_SIG_N << 1, T1_SIG_W == T1_SIG_N << 2 and T1_SIG_S == T1_SIG_N << 2 */ -+ /* and T1_SGN_E == T1_SGN_N << 1, T1_SGN_W == T1_SGN_N << 2 and T1_SGN_S == T1_SGN_N << 2 */ -+ -+ opj_flag_t flag_N = T1_SIG_N | (T1_SIG_N << (4 * s)); - - np[-1] |= T1_SIG_SE; -- np[0] |= mod[s]; -+ np[0] |= flag_N << 2; - np[1] |= T1_SIG_SW; - -- flagsp[-1] |= mod[s+2]; -+ flagsp[-1] |= flag_N << 1; - flagsp[0] |= T1_SIG; -- flagsp[1] |= mod[s+4]; -+ flagsp[1] |= flag_N << 3; - - sp[-1] |= T1_SIG_NE; -- sp[0] |= mod[s+6]; -+ sp[0] |= flag_N; - sp[1] |= T1_SIG_NW; - } - -+static INLINE void opj_t1_updateflagscolflags(opj_flag_t *flagsp, opj_colflag_t *colflagsp, OPJ_UINT32 s, OPJ_UINT32 stride, OPJ_INT32 row) -+{ -+ opj_t1_updateflags(flagsp, s, stride); -+ if( row == 0 ) -+ { -+ *colflagsp |= (T1_COLFLAG_SIG_ROW_0 << (T1_COLFLAG_RBS * row)) | -+ (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row+1))); -+ *(colflagsp - 1) |= (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * row)) | -+ (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row+1))); -+ *(colflagsp + 1) |= (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * row)) | -+ (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row+1))); -+ *(colflagsp - stride - 1) |= (T1_COLFLAG_SIG_OTHER_ROW_3); -+ *(colflagsp - stride) |= (T1_COLFLAG_SIG_OTHER_ROW_3); -+ *(colflagsp - stride + 1) |= (T1_COLFLAG_SIG_OTHER_ROW_3); -+ } -+ else if( row == 3 ) -+ { -+ *colflagsp |= (T1_COLFLAG_SIG_ROW_0 << (T1_COLFLAG_RBS * row)) | -+ (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row-1))); -+ *(colflagsp - 1) |= (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * row)) | -+ (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row-1))); -+ *(colflagsp + 1) |= (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * row)) | -+ (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS* (row-1))); -+ *(colflagsp + stride - 1) |= (T1_COLFLAG_SIG_OTHER_ROW_0); -+ *(colflagsp + stride) |= (T1_COLFLAG_SIG_OTHER_ROW_0); -+ *(colflagsp + stride + 1) |= (T1_COLFLAG_SIG_OTHER_ROW_0); -+ } -+ else -+ { -+ *(colflagsp - 1) |= (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * row)) | -+ (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row-1))) | -+ (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row+1))); -+ *colflagsp |= (T1_COLFLAG_SIG_ROW_0 << (T1_COLFLAG_RBS * row)) | -+ (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row-1))) | -+ (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row+1))); -+ *(colflagsp + 1) |= (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * row)) | -+ (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row-1))) | -+ (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * (row+1))); -+ } -+} -+ - static void opj_t1_enc_sigpass_step( opj_t1_t *t1, - opj_flag_t *flagsp, - OPJ_INT32 *datap, -- OPJ_UINT32 orient, - OPJ_INT32 bpno, - OPJ_INT32 one, - OPJ_INT32 *nmsedec, -@@ -382,7 +421,7 @@ static void opj_t1_enc_sigpass_step( opj_t1_t *t1, - flag = vsc ? (OPJ_UINT32)((*flagsp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (OPJ_UINT32)(*flagsp); - if ((flag & T1_SIG_OTH) && !(flag & (T1_SIG | T1_VISIT))) { - v = (opj_int_abs(*datap) & one) ? 1 : 0; -- opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc(flag, orient)); /* ESSAI */ -+ opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc(mqc, flag)); /* ESSAI */ - if (type == T1_TYPE_RAW) { /* BYPASS/LAZY MODE */ - opj_mqc_bypass_enc(mqc, (OPJ_UINT32)v); - } else { -@@ -407,72 +446,89 @@ static void opj_t1_enc_sigpass_step( opj_t1_t *t1, - static INLINE void opj_t1_dec_sigpass_step_raw( - opj_t1_t *t1, - opj_flag_t *flagsp, -+ opj_colflag_t* colflagsp, - OPJ_INT32 *datap, -- OPJ_INT32 orient, - OPJ_INT32 oneplushalf, -- OPJ_INT32 vsc) -+ OPJ_INT32 vsc, -+ OPJ_INT32 row) - { - OPJ_INT32 v, flag; - opj_raw_t *raw = t1->raw; /* RAW component */ -- OPJ_ARG_NOT_USED(orient); -- -+ - flag = vsc ? ((*flagsp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (*flagsp); -- if ((flag & T1_SIG_OTH) && !(flag & (T1_SIG | T1_VISIT))) { -+ if ((flag & T1_SIG_OTH) && !(*colflagsp & ((T1_COLFLAG_SIG_ROW_0 | T1_COLFLAG_VISIT_ROW_0) << (T1_COLFLAG_RBS * row)))) { - if (opj_raw_decode(raw)) { - v = (OPJ_INT32)opj_raw_decode(raw); /* ESSAI */ - *datap = v ? -oneplushalf : oneplushalf; -- opj_t1_updateflags(flagsp, (OPJ_UINT32)v, t1->flags_stride); -+ opj_t1_updateflagscolflags(flagsp, colflagsp, (OPJ_UINT32)v, t1->flags_stride, row); - } -+#ifdef CONSISTENCY_CHECK - *flagsp |= T1_VISIT; -+#endif -+ *colflagsp |= (T1_COLFLAG_VISIT_ROW_0 << (T1_COLFLAG_RBS * row)); - } - } - - static INLINE void opj_t1_dec_sigpass_step_mqc( - opj_t1_t *t1, - opj_flag_t *flagsp, -+ opj_colflag_t* colflagsp, - OPJ_INT32 *datap, -- OPJ_INT32 orient, -- OPJ_INT32 oneplushalf) -+ OPJ_INT32 oneplushalf, -+ OPJ_INT32 row, -+ OPJ_INT32 flags_stride) - { - OPJ_INT32 v, flag; - - opj_mqc_t *mqc = t1->mqc; /* MQC component */ -- -- flag = *flagsp; -- if ((flag & T1_SIG_OTH) && !(flag & (T1_SIG | T1_VISIT))) { -- opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc((OPJ_UINT32)flag, (OPJ_UINT32)orient)); -+#ifdef CONSISTENCY_CHECK -+ assert( ((*flagsp & T1_SIG_OTH) && !(*flagsp & (T1_SIG | T1_VISIT))) == -+ ((*colflagsp & ((T1_COLFLAG_SIG_ROW_0 | T1_COLFLAG_VISIT_ROW_0 | T1_COLFLAG_SIG_OTHER_ROW_0) << (T1_COLFLAG_RBS * row))) == -+ (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * row))) ); -+#endif -+ if( (*colflagsp & ((T1_COLFLAG_SIG_ROW_0 | T1_COLFLAG_VISIT_ROW_0 | T1_COLFLAG_SIG_OTHER_ROW_0) << (T1_COLFLAG_RBS * row))) == -+ (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * row)) ) { -+ flag = *flagsp; -+ opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc(mqc, (OPJ_UINT32)flag)); - if (opj_mqc_decode(mqc)) { - opj_mqc_setcurctx(mqc, opj_t1_getctxno_sc((OPJ_UINT32)flag)); - v = opj_mqc_decode(mqc) ^ opj_t1_getspb((OPJ_UINT32)flag); - *datap = v ? -oneplushalf : oneplushalf; -- opj_t1_updateflags(flagsp, (OPJ_UINT32)v, t1->flags_stride); -+ opj_t1_updateflagscolflags(flagsp, colflagsp, (OPJ_UINT32)v, flags_stride, row); - } -+#ifdef CONSISTENCY_CHECK - *flagsp |= T1_VISIT; -+#endif -+ *colflagsp |= (T1_COLFLAG_VISIT_ROW_0 << (T1_COLFLAG_RBS * row)); - } - } /* VSC and BYPASS by Antonin */ - - static INLINE void opj_t1_dec_sigpass_step_mqc_vsc( - opj_t1_t *t1, - opj_flag_t *flagsp, -+ opj_colflag_t* colflagsp, - OPJ_INT32 *datap, -- OPJ_INT32 orient, - OPJ_INT32 oneplushalf, -- OPJ_INT32 vsc) -+ OPJ_INT32 vsc, -+ OPJ_INT32 row) - { - OPJ_INT32 v, flag; - - opj_mqc_t *mqc = t1->mqc; /* MQC component */ - - flag = vsc ? ((*flagsp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (*flagsp); -- if ((flag & T1_SIG_OTH) && !(flag & (T1_SIG | T1_VISIT))) { -- opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc((OPJ_UINT32)flag, (OPJ_UINT32)orient)); -+ if ((flag & T1_SIG_OTH) && !(*colflagsp & ((T1_COLFLAG_SIG_ROW_0 | T1_COLFLAG_VISIT_ROW_0) << (T1_COLFLAG_RBS * row)))) { -+ opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc(mqc, (OPJ_UINT32)flag)); - if (opj_mqc_decode(mqc)) { - opj_mqc_setcurctx(mqc, opj_t1_getctxno_sc((OPJ_UINT32)flag)); - v = opj_mqc_decode(mqc) ^ opj_t1_getspb((OPJ_UINT32)flag); - *datap = v ? -oneplushalf : oneplushalf; -- opj_t1_updateflags(flagsp, (OPJ_UINT32)v, t1->flags_stride); -+ opj_t1_updateflagscolflags(flagsp, colflagsp, (OPJ_UINT32)v, t1->flags_stride, row); - } -+#ifdef CONSISTENCY_CHECK - *flagsp |= T1_VISIT; -+#endif -+ *colflagsp |= (T1_COLFLAG_VISIT_ROW_0 << (T1_COLFLAG_RBS * row)); - } - } /* VSC and BYPASS by Antonin */ - -@@ -480,7 +536,6 @@ static INLINE void opj_t1_dec_sigpass_step_mqc_vsc( - - static void opj_t1_enc_sigpass(opj_t1_t *t1, - OPJ_INT32 bpno, -- OPJ_UINT32 orient, - OPJ_INT32 *nmsedec, - OPJ_BYTE type, - OPJ_UINT32 cblksty -@@ -499,7 +554,6 @@ static void opj_t1_enc_sigpass(opj_t1_t *t1, - t1, - &t1->flags[((j+1) * t1->flags_stride) + i + 1], - &t1->data[(j * t1->data_stride) + i], -- orient, - bpno, - one, - nmsedec, -@@ -513,95 +567,139 @@ static void opj_t1_enc_sigpass(opj_t1_t *t1, - static void opj_t1_dec_sigpass_raw( - opj_t1_t *t1, - OPJ_INT32 bpno, -- OPJ_INT32 orient, - OPJ_INT32 cblksty) - { - OPJ_INT32 one, half, oneplushalf, vsc; - OPJ_UINT32 i, j, k; -+ opj_colflag_t *colflags1 = &t1->colflags[t1->flags_stride + 1]; - one = 1 << bpno; - half = one >> 1; - oneplushalf = one | half; - for (k = 0; k < t1->h; k += 4) { - for (i = 0; i < t1->w; ++i) { -+ opj_colflag_t *colflags2 = colflags1 + i; - for (j = k; j < k + 4 && j < t1->h; ++j) { - vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == t1->h - 1)) ? 1 : 0; - opj_t1_dec_sigpass_step_raw( - t1, - &t1->flags[((j+1) * t1->flags_stride) + i + 1], -+ colflags2, - &t1->data[(j * t1->w) + i], -- orient, - oneplushalf, -- vsc); -+ vsc, -+ j - k); - } - } -+ colflags1 += t1->flags_stride; - } - } /* VSC and BYPASS by Antonin */ - --static void opj_t1_dec_sigpass_mqc( -+#define opj_t1_dec_sigpass_mqc_internal(t1, bpno, w, h, flags_stride) \ -+{ \ -+ OPJ_INT32 one, half, oneplushalf; \ -+ OPJ_UINT32 i, j, k; \ -+ OPJ_INT32 *data1 = t1->data; \ -+ opj_flag_t *flags1 = &t1->flags[1]; \ -+ opj_colflag_t *colflags1 = &t1->colflags[flags_stride + 1]; \ -+ one = 1 << bpno; \ -+ half = one >> 1; \ -+ oneplushalf = one | half; \ -+ for (k = 0; k < (h & ~3u); k += 4) { \ -+ for (i = 0; i < w; ++i) { \ -+ OPJ_INT32 *data2 = data1 + i; \ -+ opj_flag_t *flags2 = flags1 + i; \ -+ opj_colflag_t *colflags2 = colflags1 + i; \ -+ if( *colflags2 == 0 ) continue; \ -+ flags2 += flags_stride; \ -+ opj_t1_dec_sigpass_step_mqc(t1, flags2, colflags2, data2, oneplushalf, 0, flags_stride); \ -+ data2 += w; \ -+ flags2 += flags_stride; \ -+ opj_t1_dec_sigpass_step_mqc(t1, flags2, colflags2, data2, oneplushalf, 1, flags_stride); \ -+ data2 += w; \ -+ flags2 += flags_stride; \ -+ opj_t1_dec_sigpass_step_mqc(t1, flags2, colflags2, data2, oneplushalf, 2, flags_stride); \ -+ data2 += w; \ -+ flags2 += flags_stride; \ -+ opj_t1_dec_sigpass_step_mqc(t1, flags2, colflags2, data2, oneplushalf, 3, flags_stride); \ -+ data2 += w; \ -+ } \ -+ data1 += w << 2; \ -+ flags1 += flags_stride << 2; \ -+ colflags1 += flags_stride; \ -+ } \ -+ for (i = 0; i < w; ++i) { \ -+ OPJ_INT32 *data2 = data1 + i; \ -+ opj_flag_t *flags2 = flags1 + i; \ -+ opj_colflag_t *colflags2 = colflags1 + i; \ -+ for (j = k; j < h; ++j) { \ -+ flags2 += flags_stride; \ -+ opj_t1_dec_sigpass_step_mqc(t1, flags2, colflags2, data2, oneplushalf, j - k, flags_stride); \ -+ data2 += w; \ -+ } \ -+ } \ -+} -+ -+static void opj_t1_dec_sigpass_mqc_64x64( - opj_t1_t *t1, -- OPJ_INT32 bpno, -- OPJ_INT32 orient) -+ OPJ_INT32 bpno) -+{ -+ opj_t1_dec_sigpass_mqc_internal(t1, bpno, 64, 64, 66); -+} -+ -+static void opj_t1_dec_sigpass_mqc_generic( -+ opj_t1_t *t1, -+ OPJ_INT32 bpno) -+{ -+ opj_t1_dec_sigpass_mqc_internal(t1, bpno, t1->w, t1->h, t1->flags_stride); -+} -+ -+/* VSC and BYPASS by Antonin */ -+static void opj_t1_dec_sigpass_mqc_vsc( -+ opj_t1_t *t1, -+ OPJ_INT32 bpno) - { -- OPJ_INT32 one, half, oneplushalf; -+ OPJ_INT32 one, half, oneplushalf, vsc; - OPJ_UINT32 i, j, k; - OPJ_INT32 *data1 = t1->data; - opj_flag_t *flags1 = &t1->flags[1]; -+ opj_colflag_t *colflags1 = &t1->colflags[t1->flags_stride + 1]; - one = 1 << bpno; - half = one >> 1; - oneplushalf = one | half; -- for (k = 0; k < (t1->h & ~3u); k += 4) { -+ for (k = 0; k < (t1->h & ~3); k += 4) { - for (i = 0; i < t1->w; ++i) { - OPJ_INT32 *data2 = data1 + i; - opj_flag_t *flags2 = flags1 + i; -+ opj_colflag_t *colflags2 = colflags1 + i; - flags2 += t1->flags_stride; -- opj_t1_dec_sigpass_step_mqc(t1, flags2, data2, orient, oneplushalf); -+ opj_t1_dec_sigpass_step_mqc_vsc(t1, flags2, colflags2, data2, oneplushalf, 0, 0); - data2 += t1->w; - flags2 += t1->flags_stride; -- opj_t1_dec_sigpass_step_mqc(t1, flags2, data2, orient, oneplushalf); -+ opj_t1_dec_sigpass_step_mqc_vsc(t1, flags2, colflags2, data2, oneplushalf, 0, 1); - data2 += t1->w; - flags2 += t1->flags_stride; -- opj_t1_dec_sigpass_step_mqc(t1, flags2, data2, orient, oneplushalf); -+ opj_t1_dec_sigpass_step_mqc_vsc(t1, flags2, colflags2, data2, oneplushalf, 0, 2); - data2 += t1->w; - flags2 += t1->flags_stride; -- opj_t1_dec_sigpass_step_mqc(t1, flags2, data2, orient, oneplushalf); -+ opj_t1_dec_sigpass_step_mqc_vsc(t1, flags2, colflags2, data2, oneplushalf, 1, 3); - data2 += t1->w; - } - data1 += t1->w << 2; - flags1 += t1->flags_stride << 2; -+ colflags1 += t1->flags_stride; - } - for (i = 0; i < t1->w; ++i) { -- OPJ_INT32 *data2 = data1 + i; -- opj_flag_t *flags2 = flags1 + i; -+ opj_colflag_t *colflags2 = colflags1 + i; - for (j = k; j < t1->h; ++j) { -- flags2 += t1->flags_stride; -- opj_t1_dec_sigpass_step_mqc(t1, flags2, data2, orient, oneplushalf); -- data2 += t1->w; -- } -- } --} /* VSC and BYPASS by Antonin */ -- --static void opj_t1_dec_sigpass_mqc_vsc( -- opj_t1_t *t1, -- OPJ_INT32 bpno, -- OPJ_INT32 orient) --{ -- OPJ_INT32 one, half, oneplushalf, vsc; -- OPJ_UINT32 i, j, k; -- one = 1 << bpno; -- half = one >> 1; -- oneplushalf = one | half; -- for (k = 0; k < t1->h; k += 4) { -- for (i = 0; i < t1->w; ++i) { -- for (j = k; j < k + 4 && j < t1->h; ++j) { -- vsc = (j == k + 3 || j == t1->h - 1) ? 1 : 0; -- opj_t1_dec_sigpass_step_mqc_vsc( -- t1, -- &t1->flags[((j+1) * t1->flags_stride) + i + 1], -- &t1->data[(j * t1->w) + i], -- orient, -- oneplushalf, -- vsc); -- } -+ vsc = (j == t1->h - 1) ? 1 : 0; -+ opj_t1_dec_sigpass_step_mqc_vsc( -+ t1, -+ &t1->flags[((j+1) * t1->flags_stride) + i + 1], -+ colflags2, -+ &t1->data[(j * t1->w) + i], -+ oneplushalf, -+ vsc, -+ j - k); - } - } - } /* VSC and BYPASS by Antonin */ -@@ -639,64 +737,81 @@ static void opj_t1_enc_refpass_step( opj_t1_t *t1, - static INLINE void opj_t1_dec_refpass_step_raw( - opj_t1_t *t1, - opj_flag_t *flagsp, -+ opj_colflag_t *colflagsp, - OPJ_INT32 *datap, - OPJ_INT32 poshalf, - OPJ_INT32 neghalf, -- OPJ_INT32 vsc) -+ OPJ_INT32 row) - { -- OPJ_INT32 v, t, flag; -+ OPJ_INT32 v, t; - - opj_raw_t *raw = t1->raw; /* RAW component */ - -- flag = vsc ? ((*flagsp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (*flagsp); -- if ((flag & (T1_SIG | T1_VISIT)) == T1_SIG) { -+ if ((*colflagsp & ((T1_COLFLAG_SIG_ROW_0 | T1_COLFLAG_VISIT_ROW_0) << (T1_COLFLAG_RBS * row))) == -+ ((T1_COLFLAG_SIG_ROW_0) << (T1_COLFLAG_RBS * row))) { - v = (OPJ_INT32)opj_raw_decode(raw); - t = v ? poshalf : neghalf; - *datap += *datap < 0 ? -t : t; -- *flagsp |= T1_REFINE; -+ *colflagsp |= (T1_COLFLAG_REFINE_ROW_0 << (T1_COLFLAG_RBS * row)); - } - } /* VSC and BYPASS by Antonin */ - - static INLINE void opj_t1_dec_refpass_step_mqc( - opj_t1_t *t1, -+#ifdef CONSISTENCY_CHECK - opj_flag_t *flagsp, -+#else -+ opj_flag_t *flagsp_unused, -+#endif -+ opj_colflag_t *colflagsp, - OPJ_INT32 *datap, - OPJ_INT32 poshalf, -- OPJ_INT32 neghalf) -+ OPJ_INT32 neghalf, -+ OPJ_INT32 row) - { -- OPJ_INT32 v, t, flag; -+ OPJ_INT32 v, t; - - opj_mqc_t *mqc = t1->mqc; /* MQC component */ -- -- flag = *flagsp; -- if ((flag & (T1_SIG | T1_VISIT)) == T1_SIG) { -- opj_mqc_setcurctx(mqc, opj_t1_getctxno_mag((OPJ_UINT32)flag)); /* ESSAI */ -+#ifdef CONSISTENCY_CHECK -+ assert( ((*flagsp & (T1_SIG | T1_VISIT)) == T1_SIG) == -+ ((*colflagsp & ((T1_COLFLAG_SIG_ROW_0 | T1_COLFLAG_VISIT_ROW_0) << (T1_COLFLAG_RBS * row))) == ((T1_COLFLAG_SIG_ROW_0) << (T1_COLFLAG_RBS * row))) ); -+#endif -+ if ((*colflagsp & ((T1_COLFLAG_SIG_ROW_0 | T1_COLFLAG_VISIT_ROW_0) << (T1_COLFLAG_RBS * row))) == -+ ((T1_COLFLAG_SIG_ROW_0) << (T1_COLFLAG_RBS * row))) { -+ OPJ_UINT32 tmp1 = (*colflagsp & (T1_COLFLAG_SIG_OTHER_ROW_0 << (T1_COLFLAG_RBS * row))) ? T1_CTXNO_MAG + 1 : T1_CTXNO_MAG; -+ OPJ_UINT32 tmp2 = (*colflagsp & (T1_COLFLAG_REFINE_ROW_0 << (T1_COLFLAG_RBS * row))) ? T1_CTXNO_MAG + 2 : tmp1; -+ opj_mqc_setcurctx(mqc, tmp2); /* ESSAI */ - v = opj_mqc_decode(mqc); - t = v ? poshalf : neghalf; - *datap += *datap < 0 ? -t : t; -- *flagsp |= T1_REFINE; -+ *colflagsp |= (T1_COLFLAG_REFINE_ROW_0 << (T1_COLFLAG_RBS * row)); - } - } /* VSC and BYPASS by Antonin */ - - static INLINE void opj_t1_dec_refpass_step_mqc_vsc( - opj_t1_t *t1, - opj_flag_t *flagsp, -+ opj_colflag_t *colflagsp, - OPJ_INT32 *datap, - OPJ_INT32 poshalf, - OPJ_INT32 neghalf, -- OPJ_INT32 vsc) -+ OPJ_INT32 vsc, -+ OPJ_INT32 row) - { - OPJ_INT32 v, t, flag; - - opj_mqc_t *mqc = t1->mqc; /* MQC component */ - -- flag = vsc ? ((*flagsp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (*flagsp); -- if ((flag & (T1_SIG | T1_VISIT)) == T1_SIG) { -- opj_mqc_setcurctx(mqc, opj_t1_getctxno_mag((OPJ_UINT32)flag)); /* ESSAI */ -+ if ((*colflagsp & ((T1_COLFLAG_SIG_ROW_0 | T1_COLFLAG_VISIT_ROW_0) << (T1_COLFLAG_RBS * row))) == -+ ((T1_COLFLAG_SIG_ROW_0) << (T1_COLFLAG_RBS * row))) { -+ OPJ_INT32 flag = vsc ? ((*flagsp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (*flagsp); -+ OPJ_UINT32 tmp1 = (flag & T1_SIG_OTH) ? T1_CTXNO_MAG + 1 : T1_CTXNO_MAG; -+ OPJ_UINT32 tmp2 = (*colflagsp & (T1_COLFLAG_REFINE_ROW_0 << (T1_COLFLAG_RBS * row))) ? T1_CTXNO_MAG + 2 : tmp1; -+ opj_mqc_setcurctx(mqc, tmp2); /* ESSAI */ - v = opj_mqc_decode(mqc); - t = v ? poshalf : neghalf; - *datap += *datap < 0 ? -t : t; -- *flagsp |= T1_REFINE; -+ *colflagsp |= (T1_COLFLAG_REFINE_ROW_0 << (T1_COLFLAG_RBS * row)); - } - } /* VSC and BYPASS by Antonin */ - -@@ -739,89 +854,134 @@ static void opj_t1_dec_refpass_raw( - OPJ_INT32 one, poshalf, neghalf; - OPJ_UINT32 i, j, k; - OPJ_INT32 vsc; -+ opj_colflag_t *colflags1 = &t1->colflags[t1->flags_stride + 1]; - one = 1 << bpno; - poshalf = one >> 1; - neghalf = bpno > 0 ? -poshalf : -1; - for (k = 0; k < t1->h; k += 4) { - for (i = 0; i < t1->w; ++i) { -+ opj_colflag_t *colflags2 = colflags1 + i; - for (j = k; j < k + 4 && j < t1->h; ++j) { -- vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == t1->h - 1)) ? 1 : 0; - opj_t1_dec_refpass_step_raw( - t1, - &t1->flags[((j+1) * t1->flags_stride) + i + 1], -+ colflags2, - &t1->data[(j * t1->w) + i], - poshalf, -- neghalf, -- vsc); -+ neghalf, j - k); - } - } -+ colflags1 += t1->flags_stride; - } - } /* VSC and BYPASS by Antonin */ - --static void opj_t1_dec_refpass_mqc( -+#define opj_t1_dec_refpass_mqc_internal(t1, bpno, w, h, flags_stride) \ -+{ \ -+ OPJ_INT32 one, poshalf, neghalf; \ -+ OPJ_UINT32 i, j, k; \ -+ OPJ_INT32 *data1 = t1->data; \ -+ opj_flag_t *flags1 = &t1->flags[1]; \ -+ opj_colflag_t *colflags1 = &t1->colflags[flags_stride + 1]; \ -+ one = 1 << bpno; \ -+ poshalf = one >> 1; \ -+ neghalf = bpno > 0 ? -poshalf : -1; \ -+ for (k = 0; k < (h & ~3u); k += 4) { \ -+ for (i = 0; i < w; ++i) { \ -+ OPJ_INT32 *data2 = data1 + i; \ -+ opj_flag_t *flags2 = flags1 + i; \ -+ opj_colflag_t *colflags2 = colflags1 + i; \ -+ if( *colflags2 == 0 ) continue; \ -+ flags2 += flags_stride; \ -+ opj_t1_dec_refpass_step_mqc(t1, flags2, colflags2, data2, poshalf, neghalf, 0); \ -+ data2 += w; \ -+ flags2 += flags_stride; \ -+ opj_t1_dec_refpass_step_mqc(t1, flags2, colflags2, data2, poshalf, neghalf, 1); \ -+ data2 += w; \ -+ flags2 += flags_stride; \ -+ opj_t1_dec_refpass_step_mqc(t1, flags2, colflags2, data2, poshalf, neghalf, 2); \ -+ data2 += w; \ -+ flags2 += flags_stride; \ -+ opj_t1_dec_refpass_step_mqc(t1, flags2, colflags2, data2, poshalf, neghalf, 3); \ -+ data2 += w; \ -+ } \ -+ data1 += w << 2; \ -+ flags1 += flags_stride << 2; \ -+ colflags1 += flags_stride; \ -+ } \ -+ for (i = 0; i < w; ++i) { \ -+ OPJ_INT32 *data2 = data1 + i; \ -+ opj_flag_t *flags2 = flags1 + i; \ -+ opj_colflag_t *colflags2 = colflags1 + i; \ -+ for (j = k; j < h; ++j) { \ -+ flags2 += flags_stride; \ -+ opj_t1_dec_refpass_step_mqc(t1, flags2, colflags2, data2, poshalf, neghalf, j - k); \ -+ data2 += w; \ -+ } \ -+ } \ -+} -+ -+static void opj_t1_dec_refpass_mqc_64x64( -+ opj_t1_t *t1, -+ OPJ_INT32 bpno) -+{ -+ opj_t1_dec_refpass_mqc_internal(t1, bpno, 64, 64, 66); -+} -+ -+static void opj_t1_dec_refpass_mqc_generic( -+ opj_t1_t *t1, -+ OPJ_INT32 bpno) -+{ -+ opj_t1_dec_refpass_mqc_internal(t1, bpno, t1->w, t1->h, t1->flags_stride); -+} -+ -+/* VSC and BYPASS by Antonin */ -+static void opj_t1_dec_refpass_mqc_vsc( - opj_t1_t *t1, - OPJ_INT32 bpno) - { - OPJ_INT32 one, poshalf, neghalf; - OPJ_UINT32 i, j, k; -+ OPJ_INT32 vsc; - OPJ_INT32 *data1 = t1->data; - opj_flag_t *flags1 = &t1->flags[1]; -+ opj_colflag_t *colflags1 = &t1->colflags[t1->flags_stride + 1]; - one = 1 << bpno; - poshalf = one >> 1; - neghalf = bpno > 0 ? -poshalf : -1; -- for (k = 0; k < (t1->h & ~3u); k += 4) { -+ for (k = 0; k < (t1->h & ~3); k += 4) { - for (i = 0; i < t1->w; ++i) { - OPJ_INT32 *data2 = data1 + i; - opj_flag_t *flags2 = flags1 + i; -+ opj_colflag_t *colflags2 = colflags1 + i; - flags2 += t1->flags_stride; -- opj_t1_dec_refpass_step_mqc(t1, flags2, data2, poshalf, neghalf); -+ opj_t1_dec_refpass_step_mqc_vsc(t1, flags2, colflags2, data2, poshalf, neghalf, 0, 0); - data2 += t1->w; - flags2 += t1->flags_stride; -- opj_t1_dec_refpass_step_mqc(t1, flags2, data2, poshalf, neghalf); -+ opj_t1_dec_refpass_step_mqc_vsc(t1, flags2, colflags2, data2, poshalf, neghalf, 0, 1); - data2 += t1->w; - flags2 += t1->flags_stride; -- opj_t1_dec_refpass_step_mqc(t1, flags2, data2, poshalf, neghalf); -+ opj_t1_dec_refpass_step_mqc_vsc(t1, flags2, colflags2, data2, poshalf, neghalf, 0, 2); - data2 += t1->w; - flags2 += t1->flags_stride; -- opj_t1_dec_refpass_step_mqc(t1, flags2, data2, poshalf, neghalf); -+ opj_t1_dec_refpass_step_mqc_vsc(t1, flags2, colflags2, data2, poshalf, neghalf, 1, 3); - data2 += t1->w; - } - data1 += t1->w << 2; - flags1 += t1->flags_stride << 2; -+ colflags1 += t1->flags_stride; - } - for (i = 0; i < t1->w; ++i) { -- OPJ_INT32 *data2 = data1 + i; -- opj_flag_t *flags2 = flags1 + i; -+ opj_colflag_t *colflags2 = colflags1 + i; - for (j = k; j < t1->h; ++j) { -- flags2 += t1->flags_stride; -- opj_t1_dec_refpass_step_mqc(t1, flags2, data2, poshalf, neghalf); -- data2 += t1->w; -- } -- } --} /* VSC and BYPASS by Antonin */ -- --static void opj_t1_dec_refpass_mqc_vsc( -- opj_t1_t *t1, -- OPJ_INT32 bpno) --{ -- OPJ_INT32 one, poshalf, neghalf; -- OPJ_UINT32 i, j, k; -- OPJ_INT32 vsc; -- one = 1 << bpno; -- poshalf = one >> 1; -- neghalf = bpno > 0 ? -poshalf : -1; -- for (k = 0; k < t1->h; k += 4) { -- for (i = 0; i < t1->w; ++i) { -- for (j = k; j < k + 4 && j < t1->h; ++j) { -- vsc = ((j == k + 3 || j == t1->h - 1)) ? 1 : 0; -- opj_t1_dec_refpass_step_mqc_vsc( -- t1, -- &t1->flags[((j+1) * t1->flags_stride) + i + 1], -- &t1->data[(j * t1->w) + i], -- poshalf, -- neghalf, -- vsc); -- } -+ vsc = (j == t1->h - 1) ? 1 : 0; -+ opj_t1_dec_refpass_step_mqc_vsc( -+ t1, -+ &t1->flags[((j+1) * t1->flags_stride) + i + 1], -+ colflags2, -+ &t1->data[(j * t1->w) + i], -+ poshalf, neghalf, -+ vsc, -+ j - k); - } - } - } /* VSC and BYPASS by Antonin */ -@@ -831,7 +991,6 @@ static void opj_t1_enc_clnpass_step( - opj_t1_t *t1, - opj_flag_t *flagsp, - OPJ_INT32 *datap, -- OPJ_UINT32 orient, - OPJ_INT32 bpno, - OPJ_INT32 one, - OPJ_INT32 *nmsedec, -@@ -848,7 +1007,7 @@ static void opj_t1_enc_clnpass_step( - goto LABEL_PARTIAL; - } - if (!(*flagsp & (T1_SIG | T1_VISIT))) { -- opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc(flag, orient)); -+ opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc(mqc, flag)); - v = (opj_int_abs(*datap) & one) ? 1 : 0; - opj_mqc_encode(mqc, (OPJ_UINT32)v); - if (v) { -@@ -866,55 +1025,90 @@ static void opj_t1_enc_clnpass_step( - static void opj_t1_dec_clnpass_step_partial( - opj_t1_t *t1, - opj_flag_t *flagsp, -+ opj_colflag_t *colflagsp, - OPJ_INT32 *datap, -- OPJ_INT32 orient, -- OPJ_INT32 oneplushalf) -+ OPJ_INT32 oneplushalf, -+ OPJ_INT32 row) - { - OPJ_INT32 v, flag; - opj_mqc_t *mqc = t1->mqc; /* MQC component */ - -- OPJ_ARG_NOT_USED(orient); -- - flag = *flagsp; - opj_mqc_setcurctx(mqc, opj_t1_getctxno_sc((OPJ_UINT32)flag)); - v = opj_mqc_decode(mqc) ^ opj_t1_getspb((OPJ_UINT32)flag); - *datap = v ? -oneplushalf : oneplushalf; -- opj_t1_updateflags(flagsp, (OPJ_UINT32)v, t1->flags_stride); -+ opj_t1_updateflagscolflags(flagsp, colflagsp, (OPJ_UINT32)v, t1->flags_stride, row); -+#ifdef CONSISTENCY_CHECK - *flagsp &= ~T1_VISIT; -+#endif - } /* VSC and BYPASS by Antonin */ - - static void opj_t1_dec_clnpass_step( - opj_t1_t *t1, - opj_flag_t *flagsp, -+ opj_colflag_t *colflagsp, - OPJ_INT32 *datap, -- OPJ_INT32 orient, -- OPJ_INT32 oneplushalf) -+ OPJ_INT32 oneplushalf, -+ OPJ_INT32 row) - { - OPJ_INT32 v, flag; - - opj_mqc_t *mqc = t1->mqc; /* MQC component */ -- -- flag = *flagsp; -- if (!(flag & (T1_SIG | T1_VISIT))) { -- opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc((OPJ_UINT32)flag, (OPJ_UINT32)orient)); -+#ifdef CONSISTENCY_CHECK -+ assert( (!(*flagsp & (T1_SIG | T1_VISIT))) == (!(*colflagsp & ((T1_COLFLAG_SIG_ROW_0 | T1_COLFLAG_VISIT_ROW_0) << (4*row)))) ); -+#endif -+ if (!(*colflagsp & ((T1_COLFLAG_SIG_ROW_0 | T1_COLFLAG_VISIT_ROW_0) << (4*row)))) { -+ flag = *flagsp; -+ opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc(mqc, (OPJ_UINT32)flag)); - if (opj_mqc_decode(mqc)) { - opj_mqc_setcurctx(mqc, opj_t1_getctxno_sc((OPJ_UINT32)flag)); - v = opj_mqc_decode(mqc) ^ opj_t1_getspb((OPJ_UINT32)flag); - *datap = v ? -oneplushalf : oneplushalf; -- opj_t1_updateflags(flagsp, (OPJ_UINT32)v, t1->flags_stride); -+ opj_t1_updateflagscolflags(flagsp, colflagsp, (OPJ_UINT32)v, t1->flags_stride, row); - } - } -+#ifdef CONSISTENCY_CHECK - *flagsp &= ~T1_VISIT; -+#endif - } /* VSC and BYPASS by Antonin */ - -+static void opj_t1_dec_clnpass_step_only_if_flag_not_sig_visit( -+ opj_t1_t *t1, -+ opj_flag_t *flagsp, -+ opj_colflag_t *colflagsp, -+ OPJ_INT32 *datap, -+ OPJ_INT32 oneplushalf, -+ OPJ_INT32 row, -+ OPJ_INT32 flags_stride) -+{ -+ OPJ_INT32 v; -+ OPJ_INT32 flag; -+ -+ opj_mqc_t *mqc = t1->mqc; /* MQC component */ -+ -+ flag = *flagsp; -+ /*if (!(flag & (T1_SIG | T1_VISIT)))*/ -+ { -+ opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc(mqc, (OPJ_UINT32)flag)); -+ if (opj_mqc_decode(mqc)) { -+ opj_mqc_setcurctx(mqc, opj_t1_getctxno_sc((OPJ_UINT32)flag)); -+ v = opj_mqc_decode(mqc) ^ opj_t1_getspb((OPJ_UINT32)flag); -+ *datap = v ? -oneplushalf : oneplushalf; -+ opj_t1_updateflagscolflags(flagsp, colflagsp, v, flags_stride, row); -+ } -+ } -+ /*flagsp &= ~T1_VISIT;*/ -+} -+ - static void opj_t1_dec_clnpass_step_vsc( - opj_t1_t *t1, - opj_flag_t *flagsp, -+ opj_colflag_t *colflagsp, - OPJ_INT32 *datap, -- OPJ_INT32 orient, - OPJ_INT32 oneplushalf, - OPJ_INT32 partial, -- OPJ_INT32 vsc) -+ OPJ_INT32 vsc, -+ OPJ_INT32 row) - { - OPJ_INT32 v, flag; - -@@ -924,23 +1118,24 @@ static void opj_t1_dec_clnpass_step_vsc( - if (partial) { - goto LABEL_PARTIAL; - } -- if (!(flag & (T1_SIG | T1_VISIT))) { -- opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc((OPJ_UINT32)flag, (OPJ_UINT32)orient)); -+ if (!(*colflagsp & ((T1_COLFLAG_SIG_ROW_0 | T1_COLFLAG_VISIT_ROW_0) << (T1_COLFLAG_RBS * row)))) { -+ opj_mqc_setcurctx(mqc, opj_t1_getctxno_zc(mqc, (OPJ_UINT32)flag)); - if (opj_mqc_decode(mqc)) { - LABEL_PARTIAL: - opj_mqc_setcurctx(mqc, opj_t1_getctxno_sc((OPJ_UINT32)flag)); - v = opj_mqc_decode(mqc) ^ opj_t1_getspb((OPJ_UINT32)flag); - *datap = v ? -oneplushalf : oneplushalf; -- opj_t1_updateflags(flagsp, (OPJ_UINT32)v, t1->flags_stride); -+ opj_t1_updateflagscolflags(flagsp, colflagsp, v, t1->flags_stride, row); - } - } -+#ifdef CONSISTENCY_CHECK - *flagsp &= ~T1_VISIT; -+#endif - } - - static void opj_t1_enc_clnpass( - opj_t1_t *t1, - OPJ_INT32 bpno, -- OPJ_UINT32 orient, - OPJ_INT32 *nmsedec, - OPJ_UINT32 cblksty) - { -@@ -992,7 +1187,6 @@ static void opj_t1_enc_clnpass( - t1, - &t1->flags[((j+1) * t1->flags_stride) + i + 1], - &t1->data[(j * t1->data_stride) + i], -- orient, - bpno, - one, - nmsedec, -@@ -1003,130 +1197,186 @@ static void opj_t1_enc_clnpass( - } - } - --static void opj_t1_dec_clnpass( -+#define MACRO_t1_flags_internal(x,y,flags_stride) t1->flags[((x)*(flags_stride))+(y)] -+ -+#define opj_t1_dec_clnpass_internal(consistency_check, t1, bpno, cblksty, w, h, flags_stride) \ -+{ \ -+ OPJ_INT32 one, half, oneplushalf, agg, runlen, vsc; \ -+ OPJ_UINT32 i, j, k; \ -+ OPJ_INT32 segsym = cblksty & J2K_CCP_CBLKSTY_SEGSYM; \ -+ \ -+ opj_mqc_t *mqc = t1->mqc; /* MQC component */ \ -+ \ -+ one = 1 << bpno; \ -+ half = one >> 1; \ -+ oneplushalf = one | half; \ -+ if (cblksty & J2K_CCP_CBLKSTY_VSC) { \ -+ opj_colflag_t *colflags1 = &t1->colflags[flags_stride + 1]; \ -+ for (k = 0; k < h; k += 4) { \ -+ for (i = 0; i < w; ++i) { \ -+ opj_colflag_t *colflags2 = colflags1 + i; \ -+ if (k + 3 < h) { \ -+ agg = !((*colflags2 & (T1_COLFLAG_SIG_ROW_0 | T1_COLFLAG_VISIT_ROW_0 | T1_COLFLAG_SIG_OTHER_ROW_0 | \ -+ T1_COLFLAG_SIG_ROW_1 | T1_COLFLAG_VISIT_ROW_1 | T1_COLFLAG_SIG_OTHER_ROW_1 | \ -+ T1_COLFLAG_SIG_ROW_2 | T1_COLFLAG_VISIT_ROW_2 | T1_COLFLAG_SIG_OTHER_ROW_2 | \ -+ T1_COLFLAG_SIG_ROW_3 | T1_COLFLAG_VISIT_ROW_3)) || \ -+ ((MACRO_t1_flags_internal(1 + k + 3,1 + i,flags_stride) \ -+ & ((~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) & (T1_SIG_OTH)))); \ -+ } else { \ -+ agg = 0; \ -+ } \ -+ if (agg) { \ -+ opj_mqc_setcurctx(mqc, T1_CTXNO_AGG); \ -+ if (!opj_mqc_decode(mqc)) { \ -+ continue; \ -+ } \ -+ opj_mqc_setcurctx(mqc, T1_CTXNO_UNI); \ -+ runlen = opj_mqc_decode(mqc); \ -+ runlen = (runlen << 1) | opj_mqc_decode(mqc); \ -+ } else { \ -+ runlen = 0; \ -+ } \ -+ for (j = k + (OPJ_UINT32)runlen; j < k + 4 && j < h; ++j) { \ -+ vsc = (j == k + 3 || j == h - 1) ? 1 : 0; \ -+ opj_t1_dec_clnpass_step_vsc( \ -+ t1, \ -+ &t1->flags[((j+1) * flags_stride) + i + 1], \ -+ colflags2, \ -+ &t1->data[(j * w) + i], \ -+ oneplushalf, \ -+ agg && (j == k + (OPJ_UINT32)runlen), \ -+ vsc, j - k); \ -+ } \ -+ *colflags2 &= ~(T1_COLFLAG_VISIT_ROW_0 | T1_COLFLAG_VISIT_ROW_1 | T1_COLFLAG_VISIT_ROW_2 | T1_COLFLAG_VISIT_ROW_3); \ -+ } \ -+ colflags1 += flags_stride; \ -+ } \ -+ } else { \ -+ OPJ_INT32 *data1 = t1->data; \ -+ opj_flag_t *flags1 = &t1->flags[1]; \ -+ opj_colflag_t *colflags1 = &t1->colflags[flags_stride + 1]; \ -+ for (k = 0; k < (h & ~3u); k += 4) { \ -+ for (i = 0; i < w; ++i) { \ -+ OPJ_INT32 *data2 = data1 + i; \ -+ opj_flag_t *flags2 = flags1 + i; \ -+ opj_colflag_t *colflags2 = colflags1 + i; \ -+ opj_colflag_t colflags = *colflags2; \ -+ agg = !(colflags & (T1_COLFLAG_SIG_ROW_0 | T1_COLFLAG_VISIT_ROW_0 | T1_COLFLAG_SIG_OTHER_ROW_0 | \ -+ T1_COLFLAG_SIG_ROW_1 | T1_COLFLAG_VISIT_ROW_1 | T1_COLFLAG_SIG_OTHER_ROW_1 | \ -+ T1_COLFLAG_SIG_ROW_2 | T1_COLFLAG_VISIT_ROW_2 | T1_COLFLAG_SIG_OTHER_ROW_2 | \ -+ T1_COLFLAG_SIG_ROW_3 | T1_COLFLAG_VISIT_ROW_3 | T1_COLFLAG_SIG_OTHER_ROW_3)); \ -+ if( consistency_check ) { \ -+ assert( agg == !((MACRO_t1_flags_internal(1 + k, 1 + i,flags_stride) | \ -+ MACRO_t1_flags_internal(1 + k + 1, 1 + i,flags_stride) | \ -+ MACRO_t1_flags_internal(1 + k + 2, 1 + i,flags_stride) | \ -+ MACRO_t1_flags_internal(1 + k + 3, 1 + i,flags_stride)) & (T1_SIG | T1_VISIT | T1_SIG_OTH)) ); \ -+ } \ -+ if (agg) { \ -+ opj_mqc_setcurctx(mqc, T1_CTXNO_AGG); \ -+ if (!opj_mqc_decode(mqc)) { \ -+ continue; \ -+ } \ -+ opj_mqc_setcurctx(mqc, T1_CTXNO_UNI); \ -+ runlen = opj_mqc_decode(mqc); \ -+ runlen = (runlen << 1) | opj_mqc_decode(mqc); \ -+ flags2 += (OPJ_UINT32)runlen * flags_stride; \ -+ data2 += (OPJ_UINT32)runlen * w; \ -+ for (j = (OPJ_UINT32)runlen; j < 4; ++j) { \ -+ flags2 += flags_stride; \ -+ if (j == (OPJ_UINT32)runlen) { \ -+ opj_t1_dec_clnpass_step_partial(t1, flags2, colflags2, data2, oneplushalf, j); \ -+ } else { \ -+ opj_t1_dec_clnpass_step(t1, flags2, colflags2, data2, oneplushalf, j); \ -+ } \ -+ data2 += w; \ -+ } \ -+ } else { \ -+ flags2 += flags_stride; \ -+ if( consistency_check ) { assert( (!(colflags & (T1_COLFLAG_SIG_ROW_0 | T1_COLFLAG_VISIT_ROW_0))) == (!(*flags2 & (T1_SIG | T1_VISIT))) ); } \ -+ if (!(colflags & (T1_COLFLAG_SIG_ROW_0 | T1_COLFLAG_VISIT_ROW_0))) {\ -+ opj_t1_dec_clnpass_step_only_if_flag_not_sig_visit(t1, flags2, colflags2, data2, oneplushalf, 0, flags_stride); \ -+ } \ -+ if( consistency_check ) *flags2 &= ~T1_VISIT; \ -+ data2 += w; \ -+ flags2 += flags_stride; \ -+ if( consistency_check ) { assert( (!(colflags & (T1_COLFLAG_SIG_ROW_1 | T1_COLFLAG_VISIT_ROW_1))) == (!(*flags2 & (T1_SIG | T1_VISIT))) ); } \ -+ if (!(colflags & (T1_COLFLAG_SIG_ROW_1 | T1_COLFLAG_VISIT_ROW_1))) {\ -+ opj_t1_dec_clnpass_step_only_if_flag_not_sig_visit(t1, flags2, colflags2, data2, oneplushalf, 1, flags_stride); \ -+ } \ -+ if( consistency_check ) *flags2 &= ~T1_VISIT; \ -+ data2 += w; \ -+ flags2 += flags_stride; \ -+ if( consistency_check ) { assert( (!(colflags & (T1_COLFLAG_SIG_ROW_2 | T1_COLFLAG_VISIT_ROW_2))) == (!(*flags2 & (T1_SIG | T1_VISIT))) ); } \ -+ if (!(colflags & (T1_COLFLAG_SIG_ROW_2 | T1_COLFLAG_VISIT_ROW_2))) {\ -+ opj_t1_dec_clnpass_step_only_if_flag_not_sig_visit(t1, flags2, colflags2, data2, oneplushalf, 2, flags_stride); \ -+ } \ -+ if( consistency_check ) *flags2 &= ~T1_VISIT; \ -+ data2 += w; \ -+ flags2 += flags_stride; \ -+ if( consistency_check ) { assert( (!(colflags & (T1_COLFLAG_SIG_ROW_3 | T1_COLFLAG_VISIT_ROW_3))) == (!(*flags2 & (T1_SIG | T1_VISIT))) ); } \ -+ if (!(colflags & (T1_COLFLAG_SIG_ROW_3 | T1_COLFLAG_VISIT_ROW_3))) {\ -+ opj_t1_dec_clnpass_step_only_if_flag_not_sig_visit(t1, flags2, colflags2, data2, oneplushalf, 3, flags_stride); \ -+ } \ -+ if( consistency_check ) *flags2 &= ~T1_VISIT; \ -+ data2 += w; \ -+ } \ -+ *colflags2 &= ~(T1_COLFLAG_VISIT_ROW_0 | T1_COLFLAG_VISIT_ROW_1 | T1_COLFLAG_VISIT_ROW_2 | T1_COLFLAG_VISIT_ROW_3); \ -+ } \ -+ data1 += w << 2; \ -+ flags1 += flags_stride << 2; \ -+ colflags1 += flags_stride; \ -+ } \ -+ for (i = 0; i < w; ++i) { \ -+ OPJ_INT32 *data2 = data1 + i; \ -+ opj_flag_t *flags2 = flags1 + i; \ -+ opj_colflag_t *colflags2 = colflags1 + i; \ -+ for (j = k; j < h; ++j) { \ -+ flags2 += flags_stride; \ -+ opj_t1_dec_clnpass_step(t1, flags2, colflags2, data2, oneplushalf, j - k); \ -+ data2 += w; \ -+ } \ -+ *colflags2 &= ~(T1_COLFLAG_VISIT_ROW_0 | T1_COLFLAG_VISIT_ROW_1 | T1_COLFLAG_VISIT_ROW_2 | T1_COLFLAG_VISIT_ROW_3); \ -+ } \ -+ } \ -+ \ -+ if (segsym) { \ -+ OPJ_INT32 v = 0; \ -+ opj_mqc_setcurctx(mqc, T1_CTXNO_UNI); \ -+ v = opj_mqc_decode(mqc); \ -+ v = (v << 1) | opj_mqc_decode(mqc); \ -+ v = (v << 1) | opj_mqc_decode(mqc); \ -+ v = (v << 1) | opj_mqc_decode(mqc); \ -+ /* \ -+ if (v!=0xa) { \ -+ opj_event_msg(t1->cinfo, EVT_WARNING, "Bad segmentation symbol %x\n", v); \ -+ } \ -+ */ \ -+ } \ -+} /* VSC and BYPASS by Antonin */ -+ -+static void opj_t1_dec_clnpass_64x64( - opj_t1_t *t1, - OPJ_INT32 bpno, -- OPJ_INT32 orient, - OPJ_INT32 cblksty) - { -- OPJ_INT32 one, half, oneplushalf, agg, runlen, vsc; -- OPJ_UINT32 i, j, k; -- OPJ_INT32 segsym = cblksty & J2K_CCP_CBLKSTY_SEGSYM; -- -- opj_mqc_t *mqc = t1->mqc; /* MQC component */ -- -- one = 1 << bpno; -- half = one >> 1; -- oneplushalf = one | half; -- if (cblksty & J2K_CCP_CBLKSTY_VSC) { -- for (k = 0; k < t1->h; k += 4) { -- for (i = 0; i < t1->w; ++i) { -- if (k + 3 < t1->h) { -- agg = !(MACRO_t1_flags(1 + k,1 + i) & (T1_SIG | T1_VISIT | T1_SIG_OTH) -- || MACRO_t1_flags(1 + k + 1,1 + i) & (T1_SIG | T1_VISIT | T1_SIG_OTH) -- || MACRO_t1_flags(1 + k + 2,1 + i) & (T1_SIG | T1_VISIT | T1_SIG_OTH) -- || (MACRO_t1_flags(1 + k + 3,1 + i) -- & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) & (T1_SIG | T1_VISIT | T1_SIG_OTH)); -- } else { -- agg = 0; -- } -- if (agg) { -- opj_mqc_setcurctx(mqc, T1_CTXNO_AGG); -- if (!opj_mqc_decode(mqc)) { -- continue; -- } -- opj_mqc_setcurctx(mqc, T1_CTXNO_UNI); -- runlen = opj_mqc_decode(mqc); -- runlen = (runlen << 1) | opj_mqc_decode(mqc); -- } else { -- runlen = 0; -- } -- for (j = k + (OPJ_UINT32)runlen; j < k + 4 && j < t1->h; ++j) { -- vsc = (j == k + 3 || j == t1->h - 1) ? 1 : 0; -- opj_t1_dec_clnpass_step_vsc( -- t1, -- &t1->flags[((j+1) * t1->flags_stride) + i + 1], -- &t1->data[(j * t1->w) + i], -- orient, -- oneplushalf, -- agg && (j == k + (OPJ_UINT32)runlen), -- vsc); -- } -- } -- } -- } else { -- OPJ_INT32 *data1 = t1->data; -- opj_flag_t *flags1 = &t1->flags[1]; -- for (k = 0; k < (t1->h & ~3u); k += 4) { -- for (i = 0; i < t1->w; ++i) { -- OPJ_INT32 *data2 = data1 + i; -- opj_flag_t *flags2 = flags1 + i; -- agg = !((MACRO_t1_flags(1 + k, 1 + i) | -- MACRO_t1_flags(1 + k + 1, 1 + i) | -- MACRO_t1_flags(1 + k + 2, 1 + i) | -- MACRO_t1_flags(1 + k + 3, 1 + i)) & (T1_SIG | T1_VISIT | T1_SIG_OTH)); -- if (agg) { -- opj_mqc_setcurctx(mqc, T1_CTXNO_AGG); -- if (!opj_mqc_decode(mqc)) { -- continue; -- } -- opj_mqc_setcurctx(mqc, T1_CTXNO_UNI); -- runlen = opj_mqc_decode(mqc); -- runlen = (runlen << 1) | opj_mqc_decode(mqc); -- flags2 += (OPJ_UINT32)runlen * t1->flags_stride; -- data2 += (OPJ_UINT32)runlen * t1->w; -- for (j = (OPJ_UINT32)runlen; j < 4 && j < t1->h; ++j) { -- flags2 += t1->flags_stride; -- if (agg && (j == (OPJ_UINT32)runlen)) { -- opj_t1_dec_clnpass_step_partial(t1, flags2, data2, orient, oneplushalf); -- } else { -- opj_t1_dec_clnpass_step(t1, flags2, data2, orient, oneplushalf); -- } -- data2 += t1->w; -- } -- } else { -- flags2 += t1->flags_stride; -- opj_t1_dec_clnpass_step(t1, flags2, data2, orient, oneplushalf); -- data2 += t1->w; -- flags2 += t1->flags_stride; -- opj_t1_dec_clnpass_step(t1, flags2, data2, orient, oneplushalf); -- data2 += t1->w; -- flags2 += t1->flags_stride; -- opj_t1_dec_clnpass_step(t1, flags2, data2, orient, oneplushalf); -- data2 += t1->w; -- flags2 += t1->flags_stride; -- opj_t1_dec_clnpass_step(t1, flags2, data2, orient, oneplushalf); -- data2 += t1->w; -- } -- } -- data1 += t1->w << 2; -- flags1 += t1->flags_stride << 2; -- } -- for (i = 0; i < t1->w; ++i) { -- OPJ_INT32 *data2 = data1 + i; -- opj_flag_t *flags2 = flags1 + i; -- for (j = k; j < t1->h; ++j) { -- flags2 += t1->flags_stride; -- opj_t1_dec_clnpass_step(t1, flags2, data2, orient, oneplushalf); -- data2 += t1->w; -- } -- } -- } -+#ifdef CONSISTENCY_CHECK -+ opj_t1_dec_clnpass_internal(OPJ_TRUE, t1, bpno, cblksty, 64, 64, 66); -+#else -+ opj_t1_dec_clnpass_internal(OPJ_FALSE, t1, bpno, cblksty, 64, 64, 66); -+#endif -+} - -- if (segsym) { -- OPJ_INT32 v = 0; -- opj_mqc_setcurctx(mqc, T1_CTXNO_UNI); -- v = opj_mqc_decode(mqc); -- v = (v << 1) | opj_mqc_decode(mqc); -- v = (v << 1) | opj_mqc_decode(mqc); -- v = (v << 1) | opj_mqc_decode(mqc); -- /* -- if (v!=0xa) { -- opj_event_msg(t1->cinfo, EVT_WARNING, "Bad segmentation symbol %x\n", v); -- } -- */ -- } --} /* VSC and BYPASS by Antonin */ -+static void opj_t1_dec_clnpass_generic( -+ opj_t1_t *t1, -+ OPJ_INT32 bpno, -+ OPJ_INT32 cblksty) -+{ -+#ifdef CONSISTENCY_CHECK -+ opj_t1_dec_clnpass_internal(OPJ_TRUE, t1, bpno, cblksty, t1->w, t1->h, t1->flags_stride); -+#else -+ opj_t1_dec_clnpass_internal(OPJ_FALSE, t1, bpno, cblksty, t1->w, t1->h, t1->flags_stride); -+#endif -+} - - - /** mod fixed_quality */ -@@ -1198,6 +1448,21 @@ static OPJ_BOOL opj_t1_allocate_buffers( - t1->flagssize=flagssize; - } - memset(t1->flags,0,flagssize * sizeof(opj_flag_t)); -+ -+ if (!t1->encoder) { -+ OPJ_UINT32 colflags_size=t1->flags_stride * ((h+3) / 4 + 2); -+ -+ if(colflags_size > t1->colflags_size){ -+ opj_aligned_free(t1->colflags); -+ t1->colflags = (opj_colflag_t*) opj_aligned_malloc(colflags_size * sizeof(opj_colflag_t)); -+ if(!t1->colflags){ -+ /* FIXME event manager error callback */ -+ return OPJ_FALSE; -+ } -+ t1->colflags_size=colflags_size; -+ } -+ memset(t1->colflags,0,colflags_size * sizeof(opj_colflag_t)); -+ } - - t1->w=w; - t1->h=h; -@@ -1268,16 +1533,147 @@ void opj_t1_destroy(opj_t1_t *p_t1) - p_t1->flags = 00; - } - -+ if (p_t1->colflags) { -+ opj_aligned_free(p_t1->colflags); -+ p_t1->colflags = 00; -+ } - opj_free(p_t1); - } - --OPJ_BOOL opj_t1_decode_cblks( opj_t1_t* t1, -- opj_tcd_tilecomp_t* tilec, -- opj_tccp_t* tccp -- ) -+typedef struct -+{ -+ OPJ_UINT32 resno; -+ opj_tcd_cblk_dec_t* cblk; -+ opj_tcd_band_t* band; -+ opj_tcd_tilecomp_t* tilec; -+ opj_tccp_t* tccp; -+ volatile OPJ_BOOL* pret; -+} opj_t1_cblk_decode_processing_job_t; -+ -+static void opj_t1_destroy_wrapper(void* t1) -+{ -+ opj_t1_destroy( (opj_t1_t*) t1 ); -+} -+ -+static void opj_t1_clbl_decode_processor(void* user_data, opj_tls_t* tls) -+{ -+ opj_tcd_cblk_dec_t* cblk; -+ opj_tcd_band_t* band; -+ opj_tcd_tilecomp_t* tilec; -+ opj_tccp_t* tccp; -+ OPJ_INT32* restrict datap; -+ OPJ_UINT32 cblk_w, cblk_h; -+ OPJ_INT32 x, y; -+ OPJ_UINT32 i, j; -+ opj_t1_cblk_decode_processing_job_t* job; -+ opj_t1_t* t1; -+ OPJ_UINT32 resno; -+ OPJ_UINT32 tile_w; -+ -+ job = (opj_t1_cblk_decode_processing_job_t*) user_data; -+ resno = job->resno; -+ cblk = job->cblk; -+ band = job->band; -+ tilec = job->tilec; -+ tccp = job->tccp; -+ tile_w = (OPJ_UINT32)(tilec->x1 - tilec->x0); -+ -+ if( !*(job->pret) ) -+ { -+ opj_free(job); -+ return; -+ } -+ -+ t1 = (opj_t1_t*) opj_tls_get(tls, OPJ_TLS_KEY_T1); -+ if( t1 == NULL ) -+ { -+ t1 = opj_t1_create( OPJ_FALSE ); -+ opj_tls_set( tls, OPJ_TLS_KEY_T1, t1, opj_t1_destroy_wrapper ); -+ } -+ -+ if (OPJ_FALSE == opj_t1_decode_cblk( -+ t1, -+ cblk, -+ band->bandno, -+ (OPJ_UINT32)tccp->roishift, -+ tccp->cblksty)) { -+ *(job->pret) = OPJ_FALSE; -+ opj_free(job); -+ return; -+ } -+ -+ x = cblk->x0 - band->x0; -+ y = cblk->y0 - band->y0; -+ if (band->bandno & 1) { -+ opj_tcd_resolution_t* pres = &tilec->resolutions[resno - 1]; -+ x += pres->x1 - pres->x0; -+ } -+ if (band->bandno & 2) { -+ opj_tcd_resolution_t* pres = &tilec->resolutions[resno - 1]; -+ y += pres->y1 - pres->y0; -+ } -+ -+ datap=t1->data; -+ cblk_w = t1->w; -+ cblk_h = t1->h; -+ -+ if (tccp->roishift) { -+ OPJ_INT32 thresh = 1 << tccp->roishift; -+ for (j = 0; j < cblk_h; ++j) { -+ for (i = 0; i < cblk_w; ++i) { -+ OPJ_INT32 val = datap[(j * cblk_w) + i]; -+ OPJ_INT32 mag = abs(val); -+ if (mag >= thresh) { -+ mag >>= tccp->roishift; -+ datap[(j * cblk_w) + i] = val < 0 ? -mag : mag; -+ } -+ } -+ } -+ } -+ if (tccp->qmfbid == 1) { -+ OPJ_INT32* restrict tiledp = &tilec->data[(OPJ_UINT32)y * tile_w + (OPJ_UINT32)x]; -+ for (j = 0; j < cblk_h; ++j) { -+ i = 0; -+ for (; i < (cblk_w & ~3); i += 4) { -+ OPJ_INT32 tmp0 = datap[(j * cblk_w) + i]; -+ OPJ_INT32 tmp1 = datap[(j * cblk_w) + i+1]; -+ OPJ_INT32 tmp2 = datap[(j * cblk_w) + i+2]; -+ OPJ_INT32 tmp3 = datap[(j * cblk_w) + i+3]; -+ ((OPJ_INT32*)tiledp)[(j * tile_w) + i] = tmp0/2; -+ ((OPJ_INT32*)tiledp)[(j * tile_w) + i+1] = tmp1/2; -+ ((OPJ_INT32*)tiledp)[(j * tile_w) + i+2] = tmp2/2; -+ ((OPJ_INT32*)tiledp)[(j * tile_w) + i+3] = tmp3/2; -+ } -+ for (; i < cblk_w; ++i) { -+ OPJ_INT32 tmp = datap[(j * cblk_w) + i]; -+ ((OPJ_INT32*)tiledp)[(j * tile_w) + i] = tmp/2; -+ } -+ } -+ } else { /* if (tccp->qmfbid == 0) */ -+ OPJ_FLOAT32* restrict tiledp = (OPJ_FLOAT32*) &tilec->data[(OPJ_UINT32)y * tile_w + (OPJ_UINT32)x]; -+ for (j = 0; j < cblk_h; ++j) { -+ OPJ_FLOAT32* restrict tiledp2 = tiledp; -+ for (i = 0; i < cblk_w; ++i) { -+ OPJ_FLOAT32 tmp = (OPJ_FLOAT32)*datap * band->stepsize; -+ *tiledp2 = tmp; -+ datap++; -+ tiledp2++; -+ } -+ tiledp += tile_w; -+ } -+ } -+ -+ opj_free(job); -+} -+ -+ -+void opj_t1_decode_cblks( opj_thread_pool_t* tp, -+ volatile OPJ_BOOL* pret, -+ opj_tcd_tilecomp_t* tilec, -+ opj_tccp_t* tccp -+ ) - { - OPJ_UINT32 resno, bandno, precno, cblkno; -- OPJ_UINT32 tile_w = (OPJ_UINT32)(tilec->x1 - tilec->x0); - - for (resno = 0; resno < tilec->minimum_num_resolutions; ++resno) { - opj_tcd_resolution_t* res = &tilec->resolutions[resno]; -@@ -1290,74 +1686,29 @@ OPJ_BOOL opj_t1_decode_cblks( opj_t1_t* t1, - - for (cblkno = 0; cblkno < precinct->cw * precinct->ch; ++cblkno) { - opj_tcd_cblk_dec_t* cblk = &precinct->cblks.dec[cblkno]; -- OPJ_INT32* restrict datap; -- OPJ_UINT32 cblk_w, cblk_h; -- OPJ_INT32 x, y; -- OPJ_UINT32 i, j; -- -- if (OPJ_FALSE == opj_t1_decode_cblk( -- t1, -- cblk, -- band->bandno, -- (OPJ_UINT32)tccp->roishift, -- tccp->cblksty)) { -- return OPJ_FALSE; -- } -+ opj_t1_cblk_decode_processing_job_t* job; - -- x = cblk->x0 - band->x0; -- y = cblk->y0 - band->y0; -- if (band->bandno & 1) { -- opj_tcd_resolution_t* pres = &tilec->resolutions[resno - 1]; -- x += pres->x1 - pres->x0; -- } -- if (band->bandno & 2) { -- opj_tcd_resolution_t* pres = &tilec->resolutions[resno - 1]; -- y += pres->y1 - pres->y0; -- } -- -- datap=t1->data; -- cblk_w = t1->w; -- cblk_h = t1->h; -- -- if (tccp->roishift) { -- OPJ_INT32 thresh = 1 << tccp->roishift; -- for (j = 0; j < cblk_h; ++j) { -- for (i = 0; i < cblk_w; ++i) { -- OPJ_INT32 val = datap[(j * cblk_w) + i]; -- OPJ_INT32 mag = abs(val); -- if (mag >= thresh) { -- mag >>= tccp->roishift; -- datap[(j * cblk_w) + i] = val < 0 ? -mag : mag; -- } -- } -- } -- } -- if (tccp->qmfbid == 1) { -- OPJ_INT32* restrict tiledp = &tilec->data[(OPJ_UINT32)y * tile_w + (OPJ_UINT32)x]; -- for (j = 0; j < cblk_h; ++j) { -- for (i = 0; i < cblk_w; ++i) { -- OPJ_INT32 tmp = datap[(j * cblk_w) + i]; -- ((OPJ_INT32*)tiledp)[(j * tile_w) + i] = tmp/2; -- } -- } -- } else { /* if (tccp->qmfbid == 0) */ -- OPJ_FLOAT32* restrict tiledp = (OPJ_FLOAT32*) &tilec->data[(OPJ_UINT32)y * tile_w + (OPJ_UINT32)x]; -- for (j = 0; j < cblk_h; ++j) { -- OPJ_FLOAT32* restrict tiledp2 = tiledp; -- for (i = 0; i < cblk_w; ++i) { -- OPJ_FLOAT32 tmp = (OPJ_FLOAT32)*datap * band->stepsize; -- *tiledp2 = tmp; -- datap++; -- tiledp2++; -- } -- tiledp += tile_w; -- } -- } -+ job = (opj_t1_cblk_decode_processing_job_t*) opj_calloc(1, sizeof(opj_t1_cblk_decode_processing_job_t)); -+ if( !job ) -+ { -+ *pret = OPJ_FALSE; -+ return; -+ } -+ job->resno = resno; -+ job->cblk = cblk; -+ job->band = band; -+ job->tilec = tilec; -+ job->tccp = tccp; -+ job->pret = pret; -+ opj_thread_pool_submit_job( tp, opj_t1_clbl_decode_processor, job ); -+ if( !(*pret) ) -+ return; - } /* cblkno */ - } /* precno */ - } /* bandno */ - } /* resno */ -- return OPJ_TRUE; -+ -+ return; - } - - -@@ -1369,12 +1720,14 @@ static OPJ_BOOL opj_t1_decode_cblk(opj_t1_t *t1, - { - opj_raw_t *raw = t1->raw; /* RAW component */ - opj_mqc_t *mqc = t1->mqc; /* MQC component */ -- -+ - OPJ_INT32 bpno_plus_one; - OPJ_UINT32 passtype; - OPJ_UINT32 segno, passno; - OPJ_BYTE type = T1_TYPE_MQ; /* BYPASS mode */ - -+ mqc->lut_ctxno_zc_orient = lut_ctxno_zc + orient * 256; -+ - if(!opj_t1_allocate_buffers( - t1, - (OPJ_UINT32)(cblk->x1 - cblk->x0), -@@ -1408,45 +1761,91 @@ static OPJ_BOOL opj_t1_decode_cblk(opj_t1_t *t1, - } - } - -- for (passno = 0; (passno < seg->real_num_passes) && (bpno_plus_one >= 1); ++passno) { -- switch (passtype) { -- case 0: -- if (type == T1_TYPE_RAW) { -- opj_t1_dec_sigpass_raw(t1, bpno_plus_one, (OPJ_INT32)orient, (OPJ_INT32)cblksty); -- } else { -- if (cblksty & J2K_CCP_CBLKSTY_VSC) { -- opj_t1_dec_sigpass_mqc_vsc(t1, bpno_plus_one, (OPJ_INT32)orient); -- } else { -- opj_t1_dec_sigpass_mqc(t1, bpno_plus_one, (OPJ_INT32)orient); -- } -- } -- break; -- case 1: -- if (type == T1_TYPE_RAW) { -- opj_t1_dec_refpass_raw(t1, bpno_plus_one, (OPJ_INT32)cblksty); -- } else { -- if (cblksty & J2K_CCP_CBLKSTY_VSC) { -- opj_t1_dec_refpass_mqc_vsc(t1, bpno_plus_one); -- } else { -- opj_t1_dec_refpass_mqc(t1, bpno_plus_one); -- } -- } -- break; -- case 2: -- opj_t1_dec_clnpass(t1, bpno_plus_one, (OPJ_INT32)orient, (OPJ_INT32)cblksty); -- break; -- } -- -- if ((cblksty & J2K_CCP_CBLKSTY_RESET) && type == T1_TYPE_MQ) { -- opj_mqc_resetstates(mqc); -- opj_mqc_setstate(mqc, T1_CTXNO_UNI, 0, 46); -- opj_mqc_setstate(mqc, T1_CTXNO_AGG, 0, 3); -- opj_mqc_setstate(mqc, T1_CTXNO_ZC, 0, 4); -- } -- if (++passtype == 3) { -- passtype = 0; -- bpno_plus_one--; -- } -+ if( t1->w == 64 && t1->h == 64 ) -+ { -+ for (passno = 0; (passno < seg->real_num_passes) && (bpno_plus_one >= 1); ++passno) { -+ switch (passtype) { -+ case 0: -+ if (type == T1_TYPE_RAW) { -+ opj_t1_dec_sigpass_raw(t1, bpno_plus_one, (OPJ_INT32)cblksty); -+ } else { -+ if (cblksty & J2K_CCP_CBLKSTY_VSC) { -+ opj_t1_dec_sigpass_mqc_vsc(t1, bpno_plus_one); -+ } else { -+ opj_t1_dec_sigpass_mqc_64x64(t1, bpno_plus_one); -+ } -+ } -+ break; -+ case 1: -+ if (type == T1_TYPE_RAW) { -+ opj_t1_dec_refpass_raw(t1, bpno_plus_one, (OPJ_INT32)cblksty); -+ } else { -+ if (cblksty & J2K_CCP_CBLKSTY_VSC) { -+ opj_t1_dec_refpass_mqc_vsc(t1, bpno_plus_one); -+ } else { -+ opj_t1_dec_refpass_mqc_64x64(t1, bpno_plus_one); -+ } -+ } -+ break; -+ case 2: -+ opj_t1_dec_clnpass_64x64(t1, bpno_plus_one, (OPJ_INT32)cblksty); -+ break; -+ } -+ -+ if ((cblksty & J2K_CCP_CBLKSTY_RESET) && type == T1_TYPE_MQ) { -+ opj_mqc_resetstates(mqc); -+ opj_mqc_setstate(mqc, T1_CTXNO_UNI, 0, 46); -+ opj_mqc_setstate(mqc, T1_CTXNO_AGG, 0, 3); -+ opj_mqc_setstate(mqc, T1_CTXNO_ZC, 0, 4); -+ } -+ if (++passtype == 3) { -+ passtype = 0; -+ bpno_plus_one--; -+ } -+ } -+ } -+ else -+ { -+ for (passno = 0; (passno < seg->real_num_passes) && (bpno_plus_one >= 1); ++passno) { -+ switch (passtype) { -+ case 0: -+ if (type == T1_TYPE_RAW) { -+ opj_t1_dec_sigpass_raw(t1, bpno_plus_one, (OPJ_INT32)cblksty); -+ } else { -+ if (cblksty & J2K_CCP_CBLKSTY_VSC) { -+ opj_t1_dec_sigpass_mqc_vsc(t1, bpno_plus_one); -+ } else { -+ opj_t1_dec_sigpass_mqc_generic(t1, bpno_plus_one); -+ } -+ } -+ break; -+ case 1: -+ if (type == T1_TYPE_RAW) { -+ opj_t1_dec_refpass_raw(t1, bpno_plus_one, (OPJ_INT32)cblksty); -+ } else { -+ if (cblksty & J2K_CCP_CBLKSTY_VSC) { -+ opj_t1_dec_refpass_mqc_vsc(t1, bpno_plus_one); -+ } else { -+ opj_t1_dec_refpass_mqc_generic(t1, bpno_plus_one); -+ } -+ } -+ break; -+ case 2: -+ opj_t1_dec_clnpass_generic(t1, bpno_plus_one, (OPJ_INT32)cblksty); -+ break; -+ } -+ -+ if ((cblksty & J2K_CCP_CBLKSTY_RESET) && type == T1_TYPE_MQ) { -+ opj_mqc_resetstates(mqc); -+ opj_mqc_setstate(mqc, T1_CTXNO_UNI, 0, 46); -+ opj_mqc_setstate(mqc, T1_CTXNO_AGG, 0, 3); -+ opj_mqc_setstate(mqc, T1_CTXNO_ZC, 0, 4); -+ } -+ if (++passtype == 3) { -+ passtype = 0; -+ bpno_plus_one--; -+ } -+ } - } - } - return OPJ_TRUE; -@@ -1585,6 +1984,8 @@ static void opj_t1_encode_cblk(opj_t1_t *t1, - OPJ_BYTE type = T1_TYPE_MQ; - OPJ_FLOAT64 tempwmsedec; - -+ mqc->lut_ctxno_zc_orient = lut_ctxno_zc + orient * 256; -+ - max = 0; - for (i = 0; i < t1->w; ++i) { - for (j = 0; j < t1->h; ++j) { -@@ -1611,13 +2012,13 @@ static void opj_t1_encode_cblk(opj_t1_t *t1, - - switch (passtype) { - case 0: -- opj_t1_enc_sigpass(t1, bpno, orient, &nmsedec, type, cblksty); -+ opj_t1_enc_sigpass(t1, bpno, &nmsedec, type, cblksty); - break; - case 1: - opj_t1_enc_refpass(t1, bpno, &nmsedec, type, cblksty); - break; - case 2: -- opj_t1_enc_clnpass(t1, bpno, orient, &nmsedec, cblksty); -+ opj_t1_enc_clnpass(t1, bpno, &nmsedec, cblksty); - /* code switch SEGMARK (i.e. SEGSYM) */ - if (cblksty & J2K_CCP_CBLKSTY_SEGSYM) - opj_mqc_segmark_enc(mqc); -diff --git a/src/lib/openjp2/t1.h b/src/lib/openjp2/t1.h -index 3bc0ad9..5afc649 100644 ---- a/src/lib/openjp2/t1.h -+++ b/src/lib/openjp2/t1.h -@@ -50,6 +50,9 @@ in T1.C are used by some function in TCD.C. - /* ----------------------------------------------------------------------- */ - #define T1_NMSEDEC_BITS 7 - -+/* CAUTION: the value of those constants must not be changed, otherwise the */ -+/* optimization of opj_t1_updateflags() will break! */ -+/* BEGINNING of flags that apply to opj_flag_t */ - #define T1_SIG_NE 0x0001 /**< Context orientation : North-East direction */ - #define T1_SIG_SE 0x0002 /**< Context orientation : South-East direction */ - #define T1_SIG_SW 0x0004 /**< Context orientation : South-West direction */ -@@ -67,9 +70,10 @@ in T1.C are used by some function in TCD.C. - #define T1_SGN_W 0x0800 - #define T1_SGN (T1_SGN_N|T1_SGN_E|T1_SGN_S|T1_SGN_W) - --#define T1_SIG 0x1000 --#define T1_REFINE 0x2000 --#define T1_VISIT 0x4000 -+#define T1_SIG 0x1000 /**< No longer used by decoder */ -+#define T1_REFINE 0x2000 /**< No longer used by decoder */ -+#define T1_VISIT 0x4000 /**< No longer used by decoder */ -+/* END of flags that apply to opj_flag_t */ - - #define T1_NUMCTXS_ZC 9 - #define T1_NUMCTXS_SC 5 -@@ -89,10 +93,32 @@ in T1.C are used by some function in TCD.C. - #define T1_TYPE_MQ 0 /**< Normal coding using entropy coder */ - #define T1_TYPE_RAW 1 /**< No encoding the information is store under raw format in codestream (mode switch RAW)*/ - -+/* Those flags are used by opj_colflag_t */ -+#define T1_COLFLAG_RBS 4 /* RBS = Row Bit Shift */ -+#define T1_COLFLAG_SIG_OTHER_ROW_0 (1 << 0) /**< This sample has at least one significant neighbour */ -+#define T1_COLFLAG_SIG_ROW_0 (1 << 1) /**< This sample is significant */ -+#define T1_COLFLAG_VISIT_ROW_0 (1 << 2) /**< This sample has been visited */ -+#define T1_COLFLAG_REFINE_ROW_0 (1 << 3) /**< This sample has been refined */ -+#define T1_COLFLAG_SIG_OTHER_ROW_1 (T1_COLFLAG_SIG_OTHER_ROW_0 << T1_COLFLAG_RBS) -+#define T1_COLFLAG_SIG_ROW_1 (T1_COLFLAG_SIG_ROW_0 << T1_COLFLAG_RBS) -+#define T1_COLFLAG_VISIT_ROW_1 (T1_COLFLAG_VISIT_ROW_0 << T1_COLFLAG_RBS) -+#define T1_COLFLAG_REFINE_ROW_1 (T1_COLFLAG_REFINE_ROW_0 << T1_COLFLAG_RBS) -+#define T1_COLFLAG_SIG_OTHER_ROW_2 (T1_COLFLAG_SIG_OTHER_ROW_0 << (2*T1_COLFLAG_RBS)) -+#define T1_COLFLAG_SIG_ROW_2 (T1_COLFLAG_SIG_ROW_0 << (2*T1_COLFLAG_RBS)) -+#define T1_COLFLAG_VISIT_ROW_2 (T1_COLFLAG_VISIT_ROW_0 << (2*T1_COLFLAG_RBS)) -+#define T1_COLFLAG_REFINE_ROW_2 (T1_COLFLAG_REFINE_ROW_0 << (2*T1_COLFLAG_RBS)) -+#define T1_COLFLAG_SIG_OTHER_ROW_3 (T1_COLFLAG_SIG_OTHER_ROW_0 << (3*T1_COLFLAG_RBS)) -+#define T1_COLFLAG_SIG_ROW_3 (T1_COLFLAG_SIG_ROW_0 << (3*T1_COLFLAG_RBS)) -+#define T1_COLFLAG_VISIT_ROW_3 (T1_COLFLAG_VISIT_ROW_0 << (3*T1_COLFLAG_RBS)) -+#define T1_COLFLAG_REFINE_ROW_3 (T1_COLFLAG_REFINE_ROW_0 << (3*T1_COLFLAG_RBS)) -+ - /* ----------------------------------------------------------------------- */ - - typedef OPJ_INT16 opj_flag_t; - -+/** Flags for 4 consecutive rows of a column */ -+typedef OPJ_UINT16 opj_colflag_t; -+ - /** - Tier-1 coding (coding of code-block coefficients) - */ -@@ -105,11 +131,17 @@ typedef struct opj_t1 { - - OPJ_INT32 *data; - opj_flag_t *flags; -+ /** Addition flag array such that colflags[1+0] is for state of col=0,row=0..3, -+ colflags[1+1] for col=1, row=0..3, colflags[1+flags_stride] for col=0,row=4..7, ... -+ This array avoids too much cache trashing when processing by 4 vertical samples -+ as done in the various decoding steps. */ -+ opj_colflag_t* colflags; - OPJ_UINT32 w; - OPJ_UINT32 h; - OPJ_UINT32 datasize; - OPJ_UINT32 flagssize; - OPJ_UINT32 flags_stride; -+ OPJ_UINT32 colflags_size; - OPJ_UINT32 data_stride; - OPJ_BOOL encoder; - } opj_t1_t; -@@ -140,7 +172,8 @@ Decode the code-blocks of a tile - @param tilec The tile to decode - @param tccp Tile coding parameters - */ --OPJ_BOOL opj_t1_decode_cblks( opj_t1_t* t1, -+void opj_t1_decode_cblks( opj_thread_pool_t* tp, -+ volatile OPJ_BOOL* pret, - opj_tcd_tilecomp_t* tilec, - opj_tccp_t* tccp); - -diff --git a/src/lib/openjp2/t1_generate_luts.c b/src/lib/openjp2/t1_generate_luts.c -index cba7245..1e6e7b0 100644 ---- a/src/lib/openjp2/t1_generate_luts.c -+++ b/src/lib/openjp2/t1_generate_luts.c -@@ -216,7 +216,7 @@ int main(int argc, char **argv) - } - } - -- printf("static OPJ_BYTE lut_ctxno_zc[1024] = {\n "); -+ printf("static const OPJ_BYTE lut_ctxno_zc[1024] = {\n "); - for (i = 0; i < 1023; ++i) { - printf("%i, ", lut_ctxno_zc[i]); - if(!((i+1)&0x1f)) -@@ -225,7 +225,7 @@ int main(int argc, char **argv) - printf("%i\n};\n\n", lut_ctxno_zc[1023]); - - /* lut_ctxno_sc */ -- printf("static OPJ_BYTE lut_ctxno_sc[256] = {\n "); -+ printf("static const OPJ_BYTE lut_ctxno_sc[256] = {\n "); - for (i = 0; i < 255; ++i) { - printf("0x%x, ", t1_init_ctxno_sc(i << 4)); - if(!((i+1)&0xf)) -@@ -234,7 +234,7 @@ int main(int argc, char **argv) - printf("0x%x\n};\n\n", t1_init_ctxno_sc(255 << 4)); - - /* lut_spb */ -- printf("static OPJ_BYTE lut_spb[256] = {\n "); -+ printf("static const OPJ_BYTE lut_spb[256] = {\n "); - for (i = 0; i < 255; ++i) { - printf("%i, ", t1_init_spb(i << 4)); - if(!((i+1)&0x1f)) -@@ -268,16 +268,16 @@ int main(int argc, char **argv) - (int) (floor((u * u) * pow(2, T1_NMSEDEC_FRACBITS) + 0.5) / pow(2, T1_NMSEDEC_FRACBITS) * 8192.0)); - } - -- printf("static OPJ_INT16 lut_nmsedec_sig[1 << T1_NMSEDEC_BITS] = {\n "); -+ printf("static const OPJ_INT16 lut_nmsedec_sig[1 << T1_NMSEDEC_BITS] = {\n "); - dump_array16(lut_nmsedec_sig, 1 << T1_NMSEDEC_BITS); - -- printf("static OPJ_INT16 lut_nmsedec_sig0[1 << T1_NMSEDEC_BITS] = {\n "); -+ printf("static const OPJ_INT16 lut_nmsedec_sig0[1 << T1_NMSEDEC_BITS] = {\n "); - dump_array16(lut_nmsedec_sig0, 1 << T1_NMSEDEC_BITS); - -- printf("static OPJ_INT16 lut_nmsedec_ref[1 << T1_NMSEDEC_BITS] = {\n "); -+ printf("static const OPJ_INT16 lut_nmsedec_ref[1 << T1_NMSEDEC_BITS] = {\n "); - dump_array16(lut_nmsedec_ref, 1 << T1_NMSEDEC_BITS); - -- printf("static OPJ_INT16 lut_nmsedec_ref0[1 << T1_NMSEDEC_BITS] = {\n "); -+ printf("static const OPJ_INT16 lut_nmsedec_ref0[1 << T1_NMSEDEC_BITS] = {\n "); - dump_array16(lut_nmsedec_ref0, 1 << T1_NMSEDEC_BITS); - - return 0; -diff --git a/src/lib/openjp2/t1_luts.h b/src/lib/openjp2/t1_luts.h -index 37776b6..c66a8ae 100644 ---- a/src/lib/openjp2/t1_luts.h -+++ b/src/lib/openjp2/t1_luts.h -@@ -1,6 +1,6 @@ - /* This file was automatically generated by t1_generate_luts.c */ - --static OPJ_BYTE lut_ctxno_zc[1024] = { -+static const OPJ_BYTE lut_ctxno_zc[1024] = { - 0, 1, 1, 2, 1, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, -@@ -35,7 +35,7 @@ static OPJ_BYTE lut_ctxno_zc[1024] = { - 2, 5, 5, 7, 5, 7, 7, 8, 5, 7, 7, 8, 7, 8, 8, 8, 2, 5, 5, 7, 5, 7, 7, 8, 5, 7, 7, 8, 7, 8, 8, 8 - }; - --static OPJ_BYTE lut_ctxno_sc[256] = { -+static const OPJ_BYTE lut_ctxno_sc[256] = { - 0x9, 0xa, 0xc, 0xd, 0xa, 0xa, 0xd, 0xd, 0xc, 0xd, 0xc, 0xd, 0xd, 0xd, 0xd, 0xd, - 0x9, 0xa, 0xc, 0xb, 0xa, 0x9, 0xd, 0xc, 0xc, 0xb, 0xc, 0xb, 0xd, 0xc, 0xd, 0xc, - 0x9, 0xa, 0xc, 0xb, 0xa, 0xa, 0xb, 0xb, 0xc, 0xd, 0x9, 0xa, 0xd, 0xd, 0xa, 0xa, -@@ -54,7 +54,7 @@ static OPJ_BYTE lut_ctxno_sc[256] = { - 0x9, 0xa, 0xc, 0xd, 0xa, 0xa, 0xd, 0xd, 0xc, 0xd, 0xc, 0xd, 0xd, 0xd, 0xd, 0xd - }; - --static OPJ_BYTE lut_spb[256] = { -+static const OPJ_BYTE lut_spb[256] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -@@ -65,7 +65,7 @@ static OPJ_BYTE lut_spb[256] = { - 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 - }; - --static OPJ_INT16 lut_nmsedec_sig[1 << T1_NMSEDEC_BITS] = { -+static const OPJ_INT16 lut_nmsedec_sig[1 << T1_NMSEDEC_BITS] = { - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -@@ -84,7 +84,7 @@ static OPJ_INT16 lut_nmsedec_sig[1 << T1_NMSEDEC_BITS] = { - 0x6c00, 0x6d80, 0x6f00, 0x7080, 0x7200, 0x7380, 0x7500, 0x7680 - }; - --static OPJ_INT16 lut_nmsedec_sig0[1 << T1_NMSEDEC_BITS] = { -+static const OPJ_INT16 lut_nmsedec_sig0[1 << T1_NMSEDEC_BITS] = { - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0080, 0x0080, - 0x0080, 0x0080, 0x0100, 0x0100, 0x0100, 0x0180, 0x0180, 0x0200, - 0x0200, 0x0280, 0x0280, 0x0300, 0x0300, 0x0380, 0x0400, 0x0400, -@@ -103,7 +103,7 @@ static OPJ_INT16 lut_nmsedec_sig0[1 << T1_NMSEDEC_BITS] = { - 0x7080, 0x7280, 0x7480, 0x7600, 0x7800, 0x7a00, 0x7c00, 0x7e00 - }; - --static OPJ_INT16 lut_nmsedec_ref[1 << T1_NMSEDEC_BITS] = { -+static const OPJ_INT16 lut_nmsedec_ref[1 << T1_NMSEDEC_BITS] = { - 0x1800, 0x1780, 0x1700, 0x1680, 0x1600, 0x1580, 0x1500, 0x1480, - 0x1400, 0x1380, 0x1300, 0x1280, 0x1200, 0x1180, 0x1100, 0x1080, - 0x1000, 0x0f80, 0x0f00, 0x0e80, 0x0e00, 0x0d80, 0x0d00, 0x0c80, -@@ -122,7 +122,7 @@ static OPJ_INT16 lut_nmsedec_ref[1 << T1_NMSEDEC_BITS] = { - 0x1400, 0x1480, 0x1500, 0x1580, 0x1600, 0x1680, 0x1700, 0x1780 - }; - --static OPJ_INT16 lut_nmsedec_ref0[1 << T1_NMSEDEC_BITS] = { -+static const OPJ_INT16 lut_nmsedec_ref0[1 << T1_NMSEDEC_BITS] = { - 0x2000, 0x1f00, 0x1e00, 0x1d00, 0x1c00, 0x1b00, 0x1a80, 0x1980, - 0x1880, 0x1780, 0x1700, 0x1600, 0x1500, 0x1480, 0x1380, 0x1300, - 0x1200, 0x1180, 0x1080, 0x1000, 0x0f00, 0x0e80, 0x0e00, 0x0d00, -diff --git a/src/lib/openjp2/tcd.c b/src/lib/openjp2/tcd.c -index b8cd307..2980f72 100644 ---- a/src/lib/openjp2/tcd.c -+++ b/src/lib/openjp2/tcd.c -@@ -580,7 +580,8 @@ OPJ_BOOL opj_tcd_rateallocate( opj_tcd_t *tcd, - - OPJ_BOOL opj_tcd_init( opj_tcd_t *p_tcd, - opj_image_t * p_image, -- opj_cp_t * p_cp ) -+ opj_cp_t * p_cp, -+ opj_thread_pool_t* p_tp ) - { - p_tcd->image = p_image; - p_tcd->cp = p_cp; -@@ -597,6 +598,7 @@ OPJ_BOOL opj_tcd_init( opj_tcd_t *p_tcd, - - p_tcd->tcd_image->tiles->numcomps = p_image->numcomps; - p_tcd->tp_pos = p_cp->m_specific_param.m_enc.m_tp_pos; -+ p_tcd->thread_pool = p_tp; - - return OPJ_TRUE; - } -@@ -1566,30 +1568,22 @@ static OPJ_BOOL opj_tcd_t2_decode (opj_tcd_t *p_tcd, - static OPJ_BOOL opj_tcd_t1_decode ( opj_tcd_t *p_tcd ) - { - OPJ_UINT32 compno; -- opj_t1_t * l_t1; - opj_tcd_tile_t * l_tile = p_tcd->tcd_image->tiles; - opj_tcd_tilecomp_t* l_tile_comp = l_tile->comps; - opj_tccp_t * l_tccp = p_tcd->tcp->tccps; -- -- -- l_t1 = opj_t1_create(OPJ_FALSE); -- if (l_t1 == 00) { -- return OPJ_FALSE; -- } -+ volatile OPJ_BOOL ret = OPJ_TRUE; - - for (compno = 0; compno < l_tile->numcomps; ++compno) { -- /* The +3 is headroom required by the vectorized DWT */ -- if (OPJ_FALSE == opj_t1_decode_cblks(l_t1, l_tile_comp, l_tccp)) { -- opj_t1_destroy(l_t1); -- return OPJ_FALSE; -- } -+ opj_t1_decode_cblks(p_tcd->thread_pool, &ret, l_tile_comp, l_tccp); -+ if( !ret ) -+ break; - ++l_tile_comp; - ++l_tccp; - } - -- opj_t1_destroy(l_t1); -+ opj_thread_pool_wait_completion(p_tcd->thread_pool, 0); - -- return OPJ_TRUE; -+ return ret; - } - - -@@ -1616,7 +1610,7 @@ static OPJ_BOOL opj_tcd_dwt_decode ( opj_tcd_t *p_tcd ) - */ - - if (l_tccp->qmfbid == 1) { -- if (! opj_dwt_decode(l_tile_comp, l_img_comp->resno_decoded+1)) { -+ if (! opj_dwt_decode(p_tcd->thread_pool, l_tile_comp, l_img_comp->resno_decoded+1)) { - return OPJ_FALSE; - } - } -diff --git a/src/lib/openjp2/tcd.h b/src/lib/openjp2/tcd.h -index 07f8379..77817bf 100644 ---- a/src/lib/openjp2/tcd.h -+++ b/src/lib/openjp2/tcd.h -@@ -220,6 +220,8 @@ typedef struct opj_tcd - OPJ_UINT32 tcd_tileno; - /** tell if the tcd is a decoder. */ - OPJ_UINT32 m_is_decoder : 1; -+ /** Thread pool */ -+ opj_thread_pool_t* thread_pool; - } opj_tcd_t; - - /** @name Exported functions */ -@@ -249,12 +251,14 @@ void opj_tcd_destroy(opj_tcd_t *tcd); - * @param p_tcd TCD handle. - * @param p_image raw image. - * @param p_cp coding parameters. -+ * @param p_tp thread pool - * - * @return true if the encoding values could be set (false otherwise). - */ - OPJ_BOOL opj_tcd_init( opj_tcd_t *p_tcd, - opj_image_t * p_image, -- opj_cp_t * p_cp ); -+ opj_cp_t * p_cp, -+ opj_thread_pool_t* p_tp); - - /** - * Allocates memory for decoding a specific tile. -diff --git a/src/lib/openjp2/thread.c b/src/lib/openjp2/thread.c -new file mode 100644 -index 0000000..b2f8b5b ---- /dev/null -+++ b/src/lib/openjp2/thread.c -@@ -0,0 +1,959 @@ -+/* -+ * The copyright in this software is being made available under the 2-clauses -+ * BSD License, included below. This software may be subject to other third -+ * party and contributor rights, including patent rights, and no such rights -+ * are granted under this license. -+ * -+ * Copyright (c) 2016, Even Rouault -+ * All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions -+ * are met: -+ * 1. Redistributions of source code must retain the above copyright -+ * notice, this list of conditions and the following disclaimer. -+ * 2. Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -+ * POSSIBILITY OF SUCH DAMAGE. -+ */ -+ -+#include "opj_includes.h" -+ -+#include "thread.h" -+#include <assert.h> -+ -+#ifdef MUTEX_win32 -+ -+/* Some versions of x86_64-w64-mingw32-gc -m32 resolve InterlockedCompareExchange() */ -+/* as __sync_val_compare_and_swap_4 but fails to link it. As this protects against */ -+/* a rather unlikely race, skip it */ -+#if !(defined(__MINGW32__) && defined(__i386__)) -+#define HAVE_INTERLOCKED_COMPARE_EXCHANGE 1 -+#endif -+ -+#include <windows.h> -+ -+OPJ_BOOL OPJ_CALLCONV opj_has_thread_support(void) -+{ -+ return OPJ_TRUE; -+} -+ -+int OPJ_CALLCONV opj_get_num_cpus(void) -+{ -+ SYSTEM_INFO info; -+ DWORD dwNum; -+ GetSystemInfo(&info); -+ dwNum = info.dwNumberOfProcessors; -+ if( dwNum < 1 ) -+ return 1; -+ return (int)dwNum; -+} -+ -+struct opj_mutex_t -+{ -+ CRITICAL_SECTION cs; -+}; -+ -+opj_mutex_t* opj_mutex_create(void) -+{ -+ opj_mutex_t* mutex = (opj_mutex_t*) opj_malloc(sizeof(opj_mutex_t)); -+ if( !mutex ) -+ return NULL; -+ InitializeCriticalSectionAndSpinCount(&(mutex->cs), 4000); -+ return mutex; -+} -+ -+void opj_mutex_lock(opj_mutex_t* mutex) -+{ -+ EnterCriticalSection( &(mutex->cs) ); -+} -+ -+void opj_mutex_unlock(opj_mutex_t* mutex) -+{ -+ LeaveCriticalSection( &(mutex->cs) ); -+} -+ -+void opj_mutex_destroy(opj_mutex_t* mutex) -+{ -+ if( !mutex ) return; -+ DeleteCriticalSection( &(mutex->cs) ); -+ opj_free( mutex ); -+} -+ -+struct opj_cond_waiter_list_t -+{ -+ HANDLE hEvent; -+ struct opj_cond_waiter_list_t* next; -+}; -+typedef struct opj_cond_waiter_list_t opj_cond_waiter_list_t; -+ -+struct opj_cond_t -+{ -+ opj_mutex_t *internal_mutex; -+ opj_cond_waiter_list_t *waiter_list; -+}; -+ -+static DWORD TLSKey = 0; -+static volatile LONG inTLSLockedSection = 0; -+static volatile int TLSKeyInit = OPJ_FALSE; -+ -+opj_cond_t* opj_cond_create(void) -+{ -+ opj_cond_t* cond = (opj_cond_t*) opj_malloc(sizeof(opj_cond_t)); -+ if( !cond ) -+ return NULL; -+ -+ /* Make sure that the TLS key is allocated in a thread-safe way */ -+ /* We cannot use a global mutex/critical section since its creation itself would not be */ -+ /* thread-safe, so use InterlockedCompareExchange trick */ -+ while( OPJ_TRUE ) -+ { -+ -+#if HAVE_INTERLOCKED_COMPARE_EXCHANGE -+ if( InterlockedCompareExchange(&inTLSLockedSection, 1, 0) == 0 ) -+#endif -+ { -+ if( !TLSKeyInit ) -+ { -+ TLSKey = TlsAlloc(); -+ TLSKeyInit = OPJ_TRUE; -+ } -+#if HAVE_INTERLOCKED_COMPARE_EXCHANGE -+ InterlockedCompareExchange(&inTLSLockedSection, 0, 1); -+#endif -+ break; -+ } -+ } -+ -+ if( TLSKey == TLS_OUT_OF_INDEXES ) -+ { -+ opj_free(cond); -+ return NULL; -+ } -+ cond->internal_mutex = opj_mutex_create(); -+ if (cond->internal_mutex == NULL) -+ { -+ opj_free(cond); -+ return NULL; -+ } -+ cond->waiter_list = NULL; -+ return cond; -+} -+ -+void opj_cond_wait(opj_cond_t* cond, opj_mutex_t* mutex) -+{ -+ opj_cond_waiter_list_t* item; -+ HANDLE hEvent = (HANDLE) TlsGetValue( TLSKey ); -+ if (hEvent == NULL) -+ { -+ hEvent = CreateEvent(NULL, /* security attributes */ -+ 0, /* manual reset = no */ -+ 0, /* initial state = unsignaled */ -+ NULL /* no name */); -+ assert(hEvent); -+ -+ TlsSetValue( TLSKey, hEvent ); -+ } -+ -+ /* Insert the waiter into the waiter list of the condition */ -+ opj_mutex_lock(cond->internal_mutex); -+ -+ item = (opj_cond_waiter_list_t*)opj_malloc(sizeof(opj_cond_waiter_list_t)); -+ assert(item != NULL); -+ -+ item->hEvent = hEvent; -+ item->next = cond->waiter_list; -+ -+ cond->waiter_list = item; -+ -+ opj_mutex_unlock(cond->internal_mutex); -+ -+ /* Release the client mutex before waiting for the event being signaled */ -+ opj_mutex_unlock(mutex); -+ -+ /* Ideally we would check that we do not get WAIT_FAILED but it is hard */ -+ /* to report a failure. */ -+ WaitForSingleObject(hEvent, INFINITE); -+ -+ /* Reacquire the client mutex */ -+ opj_mutex_lock(mutex); -+} -+ -+void opj_cond_signal(opj_cond_t* cond) -+{ -+ opj_cond_waiter_list_t* psIter; -+ -+ /* Signal the first registered event, and remove it from the list */ -+ opj_mutex_lock(cond->internal_mutex); -+ -+ psIter = cond->waiter_list; -+ if (psIter != NULL) -+ { -+ SetEvent(psIter->hEvent); -+ cond->waiter_list = psIter->next; -+ opj_free(psIter); -+ } -+ -+ opj_mutex_unlock(cond->internal_mutex); -+} -+ -+void opj_cond_destroy(opj_cond_t* cond) -+{ -+ if( !cond ) return; -+ opj_mutex_destroy(cond->internal_mutex); -+ assert(cond->waiter_list == NULL); -+ opj_free(cond); -+} -+ -+struct opj_thread_t -+{ -+ opj_thread_fn thread_fn; -+ void* user_data; -+ HANDLE hThread; -+}; -+ -+static DWORD WINAPI opj_thread_callback_adapter( void *info ) -+{ -+ opj_thread_t* thread = (opj_thread_t*) info; -+ HANDLE hEvent = NULL; -+ -+ thread->thread_fn( thread->user_data ); -+ -+ /* Free the handle possible allocated by a cond */ -+ while( OPJ_TRUE ) -+ { -+ /* Make sure TLSKey is not being created just at that moment... */ -+#if HAVE_INTERLOCKED_COMPARE_EXCHANGE -+ if( InterlockedCompareExchange(&inTLSLockedSection, 1, 0) == 0 ) -+#endif -+ { -+ if( TLSKeyInit ) -+ { -+ hEvent = (HANDLE) TlsGetValue( TLSKey ); -+ } -+#if HAVE_INTERLOCKED_COMPARE_EXCHANGE -+ InterlockedCompareExchange(&inTLSLockedSection, 0, 1); -+#endif -+ break; -+ } -+ } -+ if( hEvent ) -+ CloseHandle(hEvent); -+ -+ return 0; -+} -+ -+opj_thread_t* opj_thread_create( opj_thread_fn thread_fn, void* user_data ) -+{ -+ opj_thread_t* thread; -+ DWORD nThreadId = 0; -+ -+ assert( thread_fn ); -+ -+ thread = (opj_thread_t*) opj_malloc( sizeof(opj_thread_t) ); -+ if( !thread ) -+ return NULL; -+ thread->thread_fn = thread_fn; -+ thread->user_data = user_data; -+ -+ thread->hThread = CreateThread( NULL, 0, opj_thread_callback_adapter, thread, -+ 0, &nThreadId ); -+ -+ if( thread->hThread == NULL ) -+ { -+ opj_free( thread ); -+ return NULL; -+ } -+ return thread; -+} -+ -+void opj_thread_join( opj_thread_t* thread ) -+{ -+ WaitForSingleObject(thread->hThread, INFINITE); -+ CloseHandle( thread->hThread ); -+ -+ opj_free(thread); -+} -+ -+#elif MUTEX_pthread -+ -+#include <pthread.h> -+#include <stdlib.h> -+#include <unistd.h> -+ -+OPJ_BOOL OPJ_CALLCONV opj_has_thread_support(void) -+{ -+ return OPJ_TRUE; -+} -+ -+int OPJ_CALLCONV opj_get_num_cpus(void) -+{ -+#ifdef _SC_NPROCESSORS_ONLN -+ return (int)sysconf(_SC_NPROCESSORS_ONLN); -+#else -+ return 1; -+#endif -+} -+ -+struct opj_mutex_t -+{ -+ pthread_mutex_t mutex; -+}; -+ -+opj_mutex_t* opj_mutex_create(void) -+{ -+ opj_mutex_t* mutex = (opj_mutex_t*) opj_malloc(sizeof(opj_mutex_t)); -+ if( !mutex ) -+ return NULL; -+ pthread_mutex_t pthr_mutex = PTHREAD_MUTEX_INITIALIZER; -+ mutex->mutex = pthr_mutex; -+ return mutex; -+} -+ -+void opj_mutex_lock(opj_mutex_t* mutex) -+{ -+ pthread_mutex_lock(&(mutex->mutex)); -+} -+ -+void opj_mutex_unlock(opj_mutex_t* mutex) -+{ -+ pthread_mutex_unlock(&(mutex->mutex)); -+} -+ -+void opj_mutex_destroy(opj_mutex_t* mutex) -+{ -+ if( !mutex ) return; -+ pthread_mutex_destroy(&(mutex->mutex)); -+ opj_free(mutex); -+} -+ -+struct opj_cond_t -+{ -+ pthread_cond_t cond; -+}; -+ -+opj_cond_t* opj_cond_create(void) -+{ -+ opj_cond_t* cond = (opj_cond_t*) opj_malloc(sizeof(opj_cond_t)); -+ if( !cond ) -+ return NULL; -+ if( pthread_cond_init(&(cond->cond), NULL) != 0 ) -+ { -+ opj_free(cond); -+ return NULL; -+ } -+ return cond; -+} -+ -+void opj_cond_wait(opj_cond_t* cond, opj_mutex_t* mutex) -+{ -+ pthread_cond_wait(&(cond->cond), &(mutex->mutex)); -+} -+ -+void opj_cond_signal(opj_cond_t* cond) -+{ -+ int ret = pthread_cond_signal(&(cond->cond)); -+ (void)ret; -+ assert(ret == 0); -+} -+ -+void opj_cond_destroy(opj_cond_t* cond) -+{ -+ if( !cond ) return; -+ pthread_cond_destroy(&(cond->cond)); -+ opj_free(cond); -+} -+ -+ -+struct opj_thread_t -+{ -+ opj_thread_fn thread_fn; -+ void* user_data; -+ pthread_t thread; -+}; -+ -+static void* opj_thread_callback_adapter( void* info ) -+{ -+ opj_thread_t* thread = (opj_thread_t*) info; -+ thread->thread_fn( thread->user_data ); -+ return NULL; -+} -+ -+opj_thread_t* opj_thread_create( opj_thread_fn thread_fn, void* user_data ) -+{ -+ pthread_attr_t attr; -+ opj_thread_t* thread; -+ -+ assert( thread_fn ); -+ -+ thread = (opj_thread_t*) opj_malloc( sizeof(opj_thread_t) ); -+ if( !thread ) -+ return NULL; -+ thread->thread_fn = thread_fn; -+ thread->user_data = user_data; -+ -+ pthread_attr_init( &attr ); -+ pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_JOINABLE ); -+ if( pthread_create( &(thread->thread), &attr, -+ opj_thread_callback_adapter, (void *) thread ) != 0 ) -+ { -+ opj_free( thread ); -+ return NULL; -+ } -+ return thread; -+} -+ -+void opj_thread_join( opj_thread_t* thread ) -+{ -+ void* status; -+ pthread_join( thread->thread, &status); -+ -+ opj_free(thread); -+} -+ -+#else -+/* Stub implementation */ -+ -+OPJ_BOOL OPJ_CALLCONV opj_has_thread_support(void) -+{ -+ return OPJ_FALSE; -+} -+ -+int OPJ_CALLCONV opj_get_num_cpus(void) -+{ -+ return 1; -+} -+ -+opj_mutex_t* opj_mutex_create(void) -+{ -+ return NULL; -+} -+ -+void opj_mutex_lock(opj_mutex_t* mutex) -+{ -+ (void) mutex; -+} -+ -+void opj_mutex_unlock(opj_mutex_t* mutex) -+{ -+ (void) mutex; -+} -+ -+void opj_mutex_destroy(opj_mutex_t* mutex) -+{ -+ (void) mutex; -+} -+ -+opj_cond_t* opj_cond_create(void) -+{ -+ return NULL; -+} -+ -+void opj_cond_wait(opj_cond_t* cond, opj_mutex_t* mutex) -+{ -+ (void) cond; -+ (void) mutex; -+} -+ -+void opj_cond_signal(opj_cond_t* cond) -+{ -+ (void) cond; -+} -+ -+void opj_cond_destroy(opj_cond_t* cond) -+{ -+ (void) cond; -+} -+ -+opj_thread_t* opj_thread_create( opj_thread_fn thread_fn, void* user_data ) -+{ -+ (void) thread_fn; -+ (void) user_data; -+ return NULL; -+} -+ -+void opj_thread_join( opj_thread_t* thread ) -+{ -+ (void) thread; -+} -+ -+#endif -+ -+typedef struct -+{ -+ int key; -+ void* value; -+ opj_tls_free_func opj_free_func; -+} opj_tls_key_val_t; -+ -+struct opj_tls_t -+{ -+ opj_tls_key_val_t* key_val; -+ int key_val_count; -+}; -+ -+static opj_tls_t* opj_tls_new(void) -+{ -+ return (opj_tls_t*) opj_calloc(1, sizeof(opj_tls_t)); -+} -+ -+static void opj_tls_destroy(opj_tls_t* tls) -+{ -+ int i; -+ if( !tls ) return; -+ for(i=0;i<tls->key_val_count;i++) -+ { -+ if( tls->key_val[i].opj_free_func ) -+ tls->key_val[i].opj_free_func(tls->key_val[i].value); -+ } -+ opj_free(tls->key_val); -+ opj_free(tls); -+} -+ -+void* opj_tls_get(opj_tls_t* tls, int key) -+{ -+ int i; -+ for(i=0;i<tls->key_val_count;i++) -+ { -+ if( tls->key_val[i].key == key ) -+ return tls->key_val[i].value; -+ } -+ return NULL; -+} -+ -+OPJ_BOOL opj_tls_set(opj_tls_t* tls, int key, void* value, opj_tls_free_func opj_free_func) -+{ -+ opj_tls_key_val_t* new_key_val; -+ int i; -+ for(i=0;i<tls->key_val_count;i++) -+ { -+ if( tls->key_val[i].key == key ) -+ { -+ if( tls->key_val[i].opj_free_func ) -+ tls->key_val[i].opj_free_func(tls->key_val[i].value); -+ tls->key_val[i].value = value; -+ tls->key_val[i].opj_free_func = opj_free_func; -+ return OPJ_TRUE; -+ } -+ } -+ new_key_val = (opj_tls_key_val_t*) opj_realloc( tls->key_val, -+ (tls->key_val_count + 1) * sizeof(opj_tls_key_val_t) ); -+ if( !new_key_val ) -+ return OPJ_FALSE; -+ tls->key_val = new_key_val; -+ new_key_val[tls->key_val_count].key = key; -+ new_key_val[tls->key_val_count].value = value; -+ new_key_val[tls->key_val_count].opj_free_func = opj_free_func; -+ tls->key_val_count ++; -+ return OPJ_TRUE; -+} -+ -+ -+typedef struct -+{ -+ opj_job_fn job_fn; -+ void *user_data; -+} opj_worker_thread_job_t; -+ -+typedef struct -+{ -+ opj_thread_pool_t *tp; -+ opj_thread_t *thread; -+ int marked_as_waiting; -+ -+ opj_mutex_t *mutex; -+ opj_cond_t *cond; -+} opj_worker_thread_t; -+ -+typedef enum -+{ -+ OPJWTS_OK, -+ OPJWTS_STOP, -+ OPJWTS_ERROR -+} opj_worker_thread_state; -+ -+struct opj_job_list_t -+{ -+ opj_worker_thread_job_t* job; -+ struct opj_job_list_t* next; -+}; -+typedef struct opj_job_list_t opj_job_list_t; -+ -+struct opj_worker_thread_list_t -+{ -+ opj_worker_thread_t* worker_thread; -+ struct opj_worker_thread_list_t* next; -+}; -+typedef struct opj_worker_thread_list_t opj_worker_thread_list_t; -+ -+struct opj_thread_pool_t -+{ -+ opj_worker_thread_t* worker_threads; -+ int worker_threads_count; -+ opj_cond_t* cond; -+ opj_mutex_t* mutex; -+ volatile opj_worker_thread_state state; -+ opj_job_list_t* job_queue; -+ volatile int pending_jobs_count; -+ opj_worker_thread_list_t* waiting_worker_thread_list; -+ int waiting_worker_thread_count; -+ opj_tls_t* tls; -+ int signaling_threshold; -+}; -+ -+static OPJ_BOOL opj_thread_pool_setup(opj_thread_pool_t* tp, int num_threads); -+static opj_worker_thread_job_t* opj_thread_pool_get_next_job(opj_thread_pool_t* tp, -+ opj_worker_thread_t* worker_thread, -+ OPJ_BOOL signal_job_finished); -+ -+opj_thread_pool_t* opj_thread_pool_create(int num_threads) -+{ -+ opj_thread_pool_t* tp; -+ -+ tp = (opj_thread_pool_t*) opj_calloc(1, sizeof(opj_thread_pool_t)); -+ if( !tp ) -+ return NULL; -+ tp->state = OPJWTS_OK; -+ -+ if( num_threads <= 0 ) -+ { -+ tp->tls = opj_tls_new(); -+ if( !tp->tls ) -+ { -+ opj_free(tp); -+ tp = NULL; -+ } -+ return tp; -+ } -+ -+ tp->mutex = opj_mutex_create(); -+ if( !tp->mutex ) -+ { -+ opj_free(tp); -+ return NULL; -+ } -+ if( !opj_thread_pool_setup(tp, num_threads) ) -+ { -+ opj_thread_pool_destroy(tp); -+ return NULL; -+ } -+ return tp; -+} -+ -+static void opj_worker_thread_function(void* user_data) -+{ -+ opj_worker_thread_t* worker_thread; -+ opj_thread_pool_t* tp; -+ opj_tls_t* tls; -+ OPJ_BOOL job_finished = OPJ_FALSE; -+ -+ worker_thread = (opj_worker_thread_t* ) user_data; -+ tp = worker_thread->tp; -+ tls = opj_tls_new(); -+ -+ while( OPJ_TRUE ) -+ { -+ opj_worker_thread_job_t* job = opj_thread_pool_get_next_job(tp, worker_thread, job_finished); -+ if( job == NULL ) -+ break; -+ -+ if( job->job_fn ) -+ { -+ job->job_fn(job->user_data, tls); -+ } -+ opj_free(job); -+ job_finished = OPJ_TRUE; -+ } -+ -+ opj_tls_destroy(tls); -+} -+ -+static OPJ_BOOL opj_thread_pool_setup(opj_thread_pool_t* tp, int num_threads) -+{ -+ int i; -+ OPJ_BOOL bRet = OPJ_TRUE; -+ -+ assert( num_threads > 0 ); -+ -+ tp->cond = opj_cond_create(); -+ if( tp->cond == NULL ) -+ return OPJ_FALSE; -+ -+ tp->worker_threads = (opj_worker_thread_t*) opj_calloc( num_threads, -+ sizeof(opj_worker_thread_t) ); -+ if( tp->worker_threads == NULL ) -+ return OPJ_FALSE; -+ tp->worker_threads_count = num_threads; -+ -+ for(i=0;i<num_threads;i++) -+ { -+ tp->worker_threads[i].tp = tp; -+ -+ tp->worker_threads[i].mutex = opj_mutex_create(); -+ if( tp->worker_threads[i].mutex == NULL ) -+ { -+ tp->worker_threads_count = i; -+ bRet = OPJ_FALSE; -+ break; -+ } -+ -+ tp->worker_threads[i].cond = opj_cond_create(); -+ if( tp->worker_threads[i].cond == NULL ) -+ { -+ opj_mutex_destroy(tp->worker_threads[i].mutex); -+ tp->worker_threads_count = i; -+ bRet = OPJ_FALSE; -+ break; -+ } -+ -+ tp->worker_threads[i].marked_as_waiting = OPJ_FALSE; -+ -+ tp->worker_threads[i].thread = opj_thread_create(opj_worker_thread_function, -+ &(tp->worker_threads[i])); -+ if( tp->worker_threads[i].thread == NULL ) -+ { -+ tp->worker_threads_count = i; -+ bRet = OPJ_FALSE; -+ break; -+ } -+ } -+ -+ /* Wait all threads to be started */ -+ /* printf("waiting for all threads to be started\n"); */ -+ opj_mutex_lock(tp->mutex); -+ while( tp->waiting_worker_thread_count < num_threads ) -+ { -+ opj_cond_wait(tp->cond, tp->mutex); -+ } -+ opj_mutex_unlock(tp->mutex); -+ /* printf("all threads started\n"); */ -+ -+ if( tp->state == OPJWTS_ERROR ) -+ bRet = OPJ_FALSE; -+ -+ return bRet; -+} -+ -+/* -+void opj_waiting() -+{ -+ printf("waiting!\n"); -+} -+*/ -+ -+static opj_worker_thread_job_t* opj_thread_pool_get_next_job(opj_thread_pool_t* tp, -+ opj_worker_thread_t* worker_thread, -+ OPJ_BOOL signal_job_finished) -+{ -+ while( OPJ_TRUE ) -+ { -+ opj_job_list_t* top_job_iter; -+ -+ opj_mutex_lock(tp->mutex); -+ -+ if( signal_job_finished ) -+ { -+ signal_job_finished = OPJ_FALSE; -+ tp->pending_jobs_count --; -+ /*printf("tp=%p, remaining jobs: %d\n", tp, tp->pending_jobs_count);*/ -+ if( tp->pending_jobs_count <= tp->signaling_threshold ) -+ opj_cond_signal(tp->cond); -+ } -+ -+ if( tp->state == OPJWTS_STOP ) -+ { -+ opj_mutex_unlock(tp->mutex); -+ return NULL; -+ } -+ top_job_iter = tp->job_queue; -+ if( top_job_iter ) -+ { -+ opj_worker_thread_job_t* job; -+ tp->job_queue = top_job_iter->next; -+ -+ job = top_job_iter->job; -+ opj_mutex_unlock(tp->mutex); -+ opj_free(top_job_iter); -+ return job; -+ } -+ -+ /* opj_waiting(); */ -+ if( !worker_thread->marked_as_waiting ) -+ { -+ opj_worker_thread_list_t* item; -+ -+ worker_thread->marked_as_waiting = OPJ_TRUE; -+ tp->waiting_worker_thread_count ++; -+ assert(tp->waiting_worker_thread_count <= tp->worker_threads_count); -+ -+ item= (opj_worker_thread_list_t*) opj_malloc(sizeof(opj_worker_thread_list_t)); -+ if( item == NULL ) -+ { -+ tp->state = OPJWTS_ERROR; -+ opj_cond_signal(tp->cond); -+ -+ opj_mutex_unlock(tp->mutex); -+ return NULL; -+ } -+ -+ item->worker_thread = worker_thread; -+ item->next = tp->waiting_worker_thread_list; -+ tp->waiting_worker_thread_list = item; -+ } -+ -+ /* printf("signaling that worker thread is ready\n"); */ -+ opj_cond_signal(tp->cond); -+ -+ opj_mutex_lock(worker_thread->mutex); -+ opj_mutex_unlock(tp->mutex); -+ -+ /* printf("waiting for job\n"); */ -+ opj_cond_wait( worker_thread->cond, worker_thread->mutex ); -+ -+ opj_mutex_unlock(worker_thread->mutex); -+ /* printf("got job\n"); */ -+ } -+} -+ -+OPJ_BOOL opj_thread_pool_submit_job(opj_thread_pool_t* tp, -+ opj_job_fn job_fn, -+ void* user_data) -+{ -+ opj_worker_thread_job_t* job; -+ opj_job_list_t* item; -+ -+ if( tp->mutex == NULL ) -+ { -+ job_fn( user_data, tp->tls ); -+ return OPJ_TRUE; -+ } -+ -+ job = (opj_worker_thread_job_t*)opj_malloc(sizeof(opj_worker_thread_job_t)); -+ if( job == NULL ) -+ return OPJ_FALSE; -+ job->job_fn = job_fn; -+ job->user_data = user_data; -+ -+ item = (opj_job_list_t*) opj_malloc(sizeof(opj_job_list_t)); -+ if( item == NULL ) -+ { -+ opj_free(job); -+ return OPJ_FALSE; -+ } -+ item->job = job; -+ -+ opj_mutex_lock(tp->mutex); -+ -+ tp->signaling_threshold = 100 * tp->worker_threads_count; -+ while( tp->pending_jobs_count > tp->signaling_threshold ) -+ { -+ /* printf("%d jobs enqueued. Waiting\n", tp->pending_jobs_count); */ -+ opj_cond_wait(tp->cond, tp->mutex); -+ /* printf("...%d jobs enqueued.\n", tp->pending_jobs_count); */ -+ } -+ -+ item->next = tp->job_queue; -+ tp->job_queue = item; -+ tp->pending_jobs_count ++; -+ -+ if( tp->waiting_worker_thread_list ) -+ { -+ opj_worker_thread_t* worker_thread; -+ opj_worker_thread_list_t* next; -+ opj_worker_thread_list_t* to_opj_free; -+ -+ worker_thread = tp->waiting_worker_thread_list->worker_thread; -+ -+ assert( worker_thread->marked_as_waiting ); -+ worker_thread->marked_as_waiting = OPJ_FALSE; -+ -+ next = tp->waiting_worker_thread_list->next; -+ to_opj_free = tp->waiting_worker_thread_list; -+ tp->waiting_worker_thread_list = next; -+ tp->waiting_worker_thread_count --; -+ -+ opj_mutex_lock(worker_thread->mutex); -+ opj_mutex_unlock(tp->mutex); -+ opj_cond_signal(worker_thread->cond); -+ opj_mutex_unlock(worker_thread->mutex); -+ -+ opj_free(to_opj_free); -+ } -+ else -+ opj_mutex_unlock(tp->mutex); -+ -+ return OPJ_TRUE; -+} -+ -+void opj_thread_pool_wait_completion(opj_thread_pool_t* tp, int max_remaining_jobs) -+{ -+ if( tp->mutex == NULL ) -+ { -+ return; -+ } -+ -+ if( max_remaining_jobs < 0 ) -+ max_remaining_jobs = 0; -+ opj_mutex_lock(tp->mutex); -+ tp->signaling_threshold = max_remaining_jobs; -+ while( tp->pending_jobs_count > max_remaining_jobs ) -+ { -+ /*printf("tp=%p, jobs before wait = %d, max_remaining_jobs = %d\n", tp, tp->pending_jobs_count, max_remaining_jobs);*/ -+ opj_cond_wait(tp->cond, tp->mutex); -+ /*printf("tp=%p, jobs after wait = %d\n", tp, tp->pending_jobs_count);*/ -+ } -+ opj_mutex_unlock(tp->mutex); -+} -+ -+int opj_thread_pool_get_thread_count(opj_thread_pool_t* tp) -+{ -+ return tp->worker_threads_count; -+} -+ -+void opj_thread_pool_destroy(opj_thread_pool_t* tp) -+{ -+ if( !tp ) return; -+ if( tp->cond ) -+ { -+ int i; -+ opj_thread_pool_wait_completion(tp, 0); -+ -+ tp->state = OPJWTS_STOP; -+ -+ for(i=0;i<tp->worker_threads_count;i++) -+ { -+ opj_mutex_lock(tp->worker_threads[i].mutex); -+ opj_cond_signal(tp->worker_threads[i].cond); -+ opj_mutex_unlock(tp->worker_threads[i].mutex); -+ opj_thread_join(tp->worker_threads[i].thread); -+ opj_cond_destroy(tp->worker_threads[i].cond); -+ opj_mutex_destroy(tp->worker_threads[i].mutex); -+ } -+ -+ opj_free(tp->worker_threads); -+ -+ while( tp->waiting_worker_thread_list != NULL ) -+ { -+ opj_worker_thread_list_t* next = tp->waiting_worker_thread_list->next; -+ opj_free( tp->waiting_worker_thread_list ); -+ tp->waiting_worker_thread_list = next; -+ } -+ -+ opj_cond_destroy(tp->cond); -+ } -+ opj_mutex_destroy(tp->mutex); -+ opj_tls_destroy(tp->tls); -+ opj_free(tp); -+} -diff --git a/src/lib/openjp2/thread.h b/src/lib/openjp2/thread.h -new file mode 100644 -index 0000000..241e6d8 ---- /dev/null -+++ b/src/lib/openjp2/thread.h -@@ -0,0 +1,253 @@ -+/* -+ * The copyright in this software is being made available under the 2-clauses -+ * BSD License, included below. This software may be subject to other third -+ * party and contributor rights, including patent rights, and no such rights -+ * are granted under this license. -+ * -+ * Copyright (c) 2016, Even Rouault -+ * All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions -+ * are met: -+ * 1. Redistributions of source code must retain the above copyright -+ * notice, this list of conditions and the following disclaimer. -+ * 2. Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -+ * POSSIBILITY OF SUCH DAMAGE. -+ */ -+ -+#ifndef THREAD_H -+#define THREAD_H -+ -+#include "openjpeg.h" -+ -+/** -+@file thread.h -+@brief Thread API -+ -+The functions in thread.c have for goal to manage mutex, conditions, thread -+creation and thread pools that accept jobs. -+*/ -+ -+/** @defgroup THREAD THREAD - Mutex, conditions, threads and thread pools */ -+/*@{*/ -+ -+/** @name Mutex */ -+/*@{*/ -+ -+/** Opaque type for a mutex */ -+typedef struct opj_mutex_t opj_mutex_t; -+ -+/** Creates a mutex. -+ * @return the mutex or NULL in case of error (can for example happen if the library -+ * is built without thread support) -+ */ -+opj_mutex_t* opj_mutex_create(void); -+ -+/** Lock/acquire the mutex. -+ * @param mutex the mutex to acquire. -+ */ -+void opj_mutex_lock(opj_mutex_t* mutex); -+ -+/** Unlock/release the mutex. -+ * @param mutex the mutex to release. -+ */ -+void opj_mutex_unlock(opj_mutex_t* mutex); -+ -+/** Destroy a mutex -+ * @param mutex the mutex to destroy. -+ */ -+void opj_mutex_destroy(opj_mutex_t* mutex); -+ -+/*@}*/ -+ -+/** @name Condition */ -+/*@{*/ -+ -+/** Opaque type for a condition */ -+typedef struct opj_cond_t opj_cond_t; -+ -+/** Creates a condition. -+ * @return the condition or NULL in case of error (can for example happen if the library -+ * is built without thread support) -+ */ -+opj_cond_t* opj_cond_create(void); -+ -+/** Wait for the condition to be signaled. -+ * The semantics is the same as the POSIX pthread_cond_wait. -+ * The provided mutex *must* be acquired before calling this function, and -+ * released afterwards. -+ * The mutex will be released by this function while it must wait for the condition -+ * and reacquired afterwards. -+ * In some particular situations, the function might return even if the condition is not signaled -+ * with opj_cond_signal(), hence the need to check with an application level -+ * mechanism. -+ * -+ * Waiting thread : -+ * \code -+ * opj_mutex_lock(mutex); -+ * while( !some_application_level_condition ) -+ * { -+ * opj_cond_wait(cond, mutex); -+ * } -+ * opj_mutex_unlock(mutex); -+ * \endcode -+ * -+ * Signaling thread : -+ * \code -+ * opj_mutex_lock(mutex); -+ * some_application_level_condition = TRUE; -+ * opj_cond_signal(cond); -+ * opj_mutex_unlock(mutex); -+ * \endcode -+ * -+ * @param cond the condition to wait. -+ * @param mutex the mutex (in acquired state before calling this function) -+ */ -+void opj_cond_wait(opj_cond_t* cond, opj_mutex_t* mutex); -+ -+/** Signal waiting threads on a condition. -+ * One of the thread waiting with opj_cond_wait() will be waken up. -+ * It is strongly advised that this call is done with the mutex that is used -+ * by opj_cond_wait(), in a acquired state. -+ * @param cond the condition to signal. -+ */ -+void opj_cond_signal(opj_cond_t* cond); -+ -+/** Destroy a condition -+ * @param cond the condition to destroy. -+ */ -+void opj_cond_destroy(opj_cond_t* cond); -+ -+/*@}*/ -+ -+/** @name Thread */ -+/*@{*/ -+ -+/** Opaque type for a thread handle */ -+typedef struct opj_thread_t opj_thread_t; -+ -+/** User function to execute in a thread -+ * @param user_data user data provided with opj_thread_create() -+ */ -+typedef void (*opj_thread_fn)(void* user_data); -+ -+/** Creates a new thread. -+ * @param thread_fn Function to run in the new thread. -+ * @param user_data user data provided to the thread function. Might be NULL. -+ * @return a thread handle or NULL in case of failure (can for example happen if the library -+ * is built without thread support) -+ */ -+opj_thread_t* opj_thread_create( opj_thread_fn thread_fn, void* user_data ); -+ -+/** Wait for a thread to be finished and release associated resources to the -+ * thread handle. -+ * @param thread the thread to wait for being finished. -+ */ -+void opj_thread_join( opj_thread_t* thread ); -+ -+/*@}*/ -+ -+/** @name Thread local storage */ -+/*@{*/ -+/** Opaque type for a thread local storage */ -+typedef struct opj_tls_t opj_tls_t; -+ -+/** Get a thread local value corresponding to the provided key. -+ * @param tls thread local storage handle -+ * @param key key whose value to retrieve. -+ * @return value associated with the key, or NULL is missing. -+ */ -+void* opj_tls_get(opj_tls_t* tls, int key); -+ -+/** Type of the function used to free a TLS value */ -+typedef void (*opj_tls_free_func)(void* value); -+ -+/** Set a thread local value corresponding to the provided key. -+ * @param tls thread local storage handle -+ * @param key key whose value to set. -+ * @param value value to set (may be NULL). -+ * @param free_func function to call currently installed value. -+ * @return OPJ_TRUE if successful. -+ */ -+OPJ_BOOL opj_tls_set(opj_tls_t* tls, int key, void* value, opj_tls_free_func free_func); -+ -+/*@}*/ -+ -+/** @name Thread pool */ -+/*@{*/ -+ -+/** Opaque type for a thread pool */ -+typedef struct opj_thread_pool_t opj_thread_pool_t; -+ -+/** Create a new thread pool. -+ * num_thread must nominally be >= 1 to create a real thread pool. If num_threads -+ * is negative or null, then a dummy thread pool will be created. All functions -+ * operating on the thread pool will work, but job submission will be run -+ * synchronously in the calling thread. -+ * -+ * @param num_threads the number of threads to allocate for this thread pool. -+ * @return a thread pool handle, or NULL in case of failure (can for example happen if the library -+ * is built without thread support) -+ */ -+opj_thread_pool_t* opj_thread_pool_create(int num_threads); -+ -+/** User function to execute in a thread -+ * @param user_data user data provided with opj_thread_create() -+ * @param tls handle to thread local storage -+ */ -+typedef void (*opj_job_fn)(void* user_data, opj_tls_t* tls); -+ -+ -+/** Submit a new job to be run by one of the thread in the thread pool. -+ * The job ( thread_fn, user_data ) will be added in the queue of jobs managed -+ * by the thread pool, and run by the first thread that is no longer busy. -+ * -+ * @param tp the thread pool handle. -+ * @param job_fn Function to run. Must not be NULL. -+ * @param user_data User data provided to thread_fn. -+ * @return OPJ_TRUE if the job was successfully submitted. -+ */ -+OPJ_BOOL opj_thread_pool_submit_job(opj_thread_pool_t* tp, opj_job_fn job_fn, void* user_data); -+ -+/** Wait that no more than max_remaining_jobs jobs are remaining in the queue of -+ * the thread pool. The aim of this function is to avoid submitting too many -+ * jobs while the thread pool cannot cope fast enough with them, which would -+ * result potentially in out-of-memory situations with too many job descriptions -+ * being queued. -+ * -+ * @param tp the thread pool handle -+ * @param max_remaining_jobs maximum number of jobs allowed to be queued without waiting. -+ */ -+void opj_thread_pool_wait_completion(opj_thread_pool_t* tp, int max_remaining_jobs); -+ -+/** Return the number of threads associated with the thread pool. -+ * -+ * @param tp the thread pool handle. -+ * @return number of threads associated with the thread pool. -+ */ -+int opj_thread_pool_get_thread_count(opj_thread_pool_t* tp); -+ -+/** Destroy a thread pool. -+ * @param tp the thread pool handle. -+ */ -+void opj_thread_pool_destroy(opj_thread_pool_t* tp); -+ -+/*@}*/ -+ -+/*@}*/ -+ -+#endif /* THREAD_H */ -diff --git a/src/lib/openjp2/tls_keys.h b/src/lib/openjp2/tls_keys.h -new file mode 100644 -index 0000000..fb26498 ---- /dev/null -+++ b/src/lib/openjp2/tls_keys.h -@@ -0,0 +1,37 @@ -+/* -+ * The copyright in this software is being made available under the 2-clauses -+ * BSD License, included below. This software may be subject to other third -+ * party and contributor rights, including patent rights, and no such rights -+ * are granted under this license. -+ * -+ * Copyright (c) 2016, Even Rouault -+ * All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions -+ * are met: -+ * 1. Redistributions of source code must retain the above copyright -+ * notice, this list of conditions and the following disclaimer. -+ * 2. Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' -+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -+ * POSSIBILITY OF SUCH DAMAGE. -+ */ -+ -+#ifndef TLS_KEYS_H -+#define TLS_KEYS_H -+ -+#define OPJ_TLS_KEY_T1 0 -+ -+#endif diff --git a/SuperBuild/patches/OPENJPEG/openjpeg-2-fixes-macx.diff b/SuperBuild/patches/OPENJPEG/openjpeg-2-fixes-macx.diff index a0d79afeb61fb38af72dd1ef590e91c5be2e9716..871118ee722240b8515175a85f0e5a9210594e8c 100644 --- a/SuperBuild/patches/OPENJPEG/openjpeg-2-fixes-macx.diff +++ b/SuperBuild/patches/OPENJPEG/openjpeg-2-fixes-macx.diff @@ -1,7 +1,7 @@ diff -burN openjpeg-d0babeb6f6cdd1887308137df37bb2b4724a6592.orig/CMakeLists.txt openjpeg-d0babeb6f6cdd1887308137df37bb2b4724a6592/CMakeLists.txt --- openjpeg-d0babeb6f6cdd1887308137df37bb2b4724a6592.orig/CMakeLists.txt 2016-07-01 12:37:01.000000000 +0200 +++ openjpeg-d0babeb6f6cdd1887308137df37bb2b4724a6592/CMakeLists.txt 2016-07-01 12:37:20.000000000 +0200 -@@ -151,7 +151,7 @@ +@@ -153,7 +153,7 @@ endif() if (APPLE) @@ -31,9 +31,12 @@ diff -burN openjpeg-d0babeb6f6cdd1887308137df37bb2b4724a6592.orig/thirdparty/CMa find_package(LCMS2) if(LCMS2_FOUND) message(STATUS "Your system seems to have a LCMS2 lib available, we will use it") -@@ -115,4 +115,4 @@ +@@ -115,7 +115,7 @@ message(STATUS "LCMS2 or LCMS lib not found, activate BUILD_THIRDPARTY if you want build it") endif(LCMS_FOUND) endif(LCMS2_FOUND) -endif(BUILD_THIRDPARTY) +endif() + + + #------------ diff --git a/SuperBuild/patches/QT4/configure_qt4.bat.in b/SuperBuild/patches/QT4/configure_qt4.bat.in index 8ce395fc784d0c9da6743636f3f9e35713bc41d7..27bc09de1dc1f2bed5b82b81464cbd018387d951 100755 --- a/SuperBuild/patches/QT4/configure_qt4.bat.in +++ b/SuperBuild/patches/QT4/configure_qt4.bat.in @@ -4,7 +4,7 @@ set SB_SAVE_LIB=%LIB% set INCLUDE=%INCLUDE%;@QT4_INCLUDE_PREFIX_NATIVE@;@QT4_INCLUDE_PREFIX_NATIVE@\freetype2 set LIB=%LIB%;@QT4_LIB_PREFIX_NATIVE@ -@QT4_CONFIGURE_SCRIPT@ -prefix @QT4_INSTALL_PREFIX_NATIVE@ -L @QT4_LIB_PREFIX_NATIVE@ -I @QT4_INCLUDE_PREFIX_NATIVE@ -I @QT4_INCLUDE_PREFIX_NATIVE@\freetype2 -opensource -confirm-license -release -shared -nomake demos -nomake examples -nomake tools -no-phonon-backend -no-phonon -no-script -no-scripttools -no-multimedia -no-audio-backend -no-webkit -no-declarative -no-accessibility -no-qt3support -no-xmlpatterns -no-sql-sqlite -no-openssl -no-libtiff -no-libmng -system-libpng -system-libjpeg -system-zlib @QT4_SB_CONFIG@ +@QT4_CONFIGURE_SCRIPT@ @QT4_SB_CONFIG@ set INCLUDE=%SB_SAVE_INCLUDE% set LIB=%SB_SAVE_LIB% diff --git a/SuperBuild/patches/QT4/configure_qt4.sh.in b/SuperBuild/patches/QT4/configure_qt4.sh.in index ee254d3f306fa713ec12809ae7c3616485d31497..27e02be536170c3856660bd84345d74400bcdaa8 100755 --- a/SuperBuild/patches/QT4/configure_qt4.sh.in +++ b/SuperBuild/patches/QT4/configure_qt4.sh.in @@ -1 +1 @@ -@QT4_CONFIGURE_SCRIPT@ -prefix @QT4_INSTALL_PREFIX_NATIVE@ -L @QT4_LIB_PREFIX_NATIVE@ -I @QT4_INCLUDE_PREFIX_NATIVE@ -I @QT4_INCLUDE_PREFIX_NATIVE@/freetype2 -opensource -confirm-license -release -shared -nomake demos -nomake examples -nomake tools -no-phonon-backend -no-phonon -no-script -no-scripttools -no-multimedia -no-audio-backend -no-webkit -no-declarative -no-accessibility -no-qt3support -no-xmlpatterns -no-sql-sqlite -no-openssl -no-libtiff -no-libmng -system-libpng -system-libjpeg -system-zlib -no-dbus @QT4_SB_CONFIG@ +@QT4_CONFIGURE_SCRIPT@ @QT4_SB_CONFIG@ diff --git a/SuperBuild/patches/QT4/qt4-5-mantis1422-qthread-stacksize-macx.diff b/SuperBuild/patches/QT4/qt4-5-mantis1422-qthread-stacksize-macx.diff new file mode 100644 index 0000000000000000000000000000000000000000..3502ffebbaa75254c2795ab1ac4480bf3fdff6b5 --- /dev/null +++ b/SuperBuild/patches/QT4/qt4-5-mantis1422-qthread-stacksize-macx.diff @@ -0,0 +1,56 @@ +--- qt-everywhere-opensource-src-4.8.7.orig/src/corelib/thread/qthread_unix.cpp 2015-11-23 19:05:40.000000000 +0100 ++++ qt-everywhere-opensource-src-4.8.7/src/corelib/thread/qthread_unix.cpp 2015-11-24 11:22:31.000000000 +0100 +@@ -79,6 +79,7 @@ + #endif + + #if defined(Q_OS_MAC) ++#include <sys/resource.h> // getrlimit/setrlimit + # ifdef qDebug + # define old_qDebug qDebug + # undef qDebug +@@ -649,6 +650,45 @@ + #endif // QT_HAS_THREAD_PRIORITY_SCHEDULING + + ++#if defined(Q_OS_MAC) && !defined(Q_OS_IOS) ++ if (d->stackSize == 0) { ++ // Fix the default (too small) stack size for threads on OS X, ++ // which also affects the thread pool. ++ // See also: ++ // https://bugreports.qt.io/browse/QTBUG-2568 ++ // This fix can also be found in Chromium: ++ // https://chromium.googlesource.com/chromium/src.git/+/master/base/threading/platform_thread_mac.mm#186 ++ ++ // The Mac OS X default for a pthread stack size is 512kB. ++ // Libc-594.1.4/pthreads/pthread.c's pthread_attr_init uses ++ // DEFAULT_STACK_SIZE for this purpose. ++ // ++ // 512kB isn't quite generous enough for some deeply recursive threads that ++ // otherwise request the default stack size by specifying 0. Here, adopt ++ // glibc's behavior as on Linux, which is to use the current stack size ++ // limit (ulimit -s) as the default stack size. See ++ // glibc-2.11.1/nptl/nptl-init.c's __pthread_initialize_minimal_internal. To ++ // avoid setting the limit below the Mac OS X default or the minimum usable ++ // stack size, these values are also considered. If any of these values ++ // can't be determined, or if stack size is unlimited (ulimit -s unlimited), ++ // stack_size is left at 0 to get the system default. ++ // ++ // Mac OS X normally only applies ulimit -s to the main thread stack. On ++ // contemporary OS X and Linux systems alike, this value is generally 8MB ++ // or in that neighborhood. ++ size_t default_stack_size = 0; ++ struct rlimit stack_rlimit; ++ if (pthread_attr_getstacksize(&attr, &default_stack_size) == 0 && ++ getrlimit(RLIMIT_STACK, &stack_rlimit) == 0 && ++ stack_rlimit.rlim_cur != RLIM_INFINITY) { ++ default_stack_size = ++ std::max(std::max(default_stack_size, ++ static_cast<size_t>(PTHREAD_STACK_MIN)), ++ static_cast<size_t>(stack_rlimit.rlim_cur)); ++ } ++ d->stackSize = default_stack_size; ++ } ++#endif + if (d->stackSize > 0) { + #if defined(_POSIX_THREAD_ATTR_STACKSIZE) && (_POSIX_THREAD_ATTR_STACKSIZE-0 > 0) + int code = pthread_attr_setstacksize(&attr, d->stackSize); diff --git a/SuperBuild/patches/QWT/qwt-1-releaseBuild-all.diff b/SuperBuild/patches/QWT/qwt-1-releaseBuild-all.diff new file mode 100644 index 0000000000000000000000000000000000000000..3d4f6a55954d6fbeeb3a69ba3d66ac4faa7fd9c5 --- /dev/null +++ b/SuperBuild/patches/QWT/qwt-1-releaseBuild-all.diff @@ -0,0 +1,19 @@ +diff -burN qwt-6.1.3-orig/qwtbuild.pri qwt-6.1.3/qwtbuild.pri +--- qwt-6.1.3-orig/qwtbuild.pri 2017-09-07 15:00:11.755801441 +0200 ++++ qwt-6.1.3/qwtbuild.pri 2017-09-07 15:00:55.812189641 +0200 +@@ -21,14 +21,8 @@ + ###################################################################### + + win32 { +- # On Windows you can't mix release and debug libraries. +- # The designer is built in release mode. If you like to use it +- # you need a release version. For your own application development you +- # might need a debug version. +- # Enable debug_and_release + build_all if you want to build both. + +- CONFIG += debug_and_release +- CONFIG += build_all ++ CONFIG += release + } + else { + diff --git a/SuperBuild/patches/QWT/qwtconfig.pri b/SuperBuild/patches/QWT/qwtconfig.pri index 42035eb5b2604189188f1d7b6a35ccc433ee9c93..576a27cdacf5d37260b3a03f04c65816755d6daf 100644 --- a/SuperBuild/patches/QWT/qwtconfig.pri +++ b/SuperBuild/patches/QWT/qwtconfig.pri @@ -16,18 +16,7 @@ QWT_VERSION = $${QWT_VER_MAJ}.$${QWT_VER_MIN}.$${QWT_VER_PAT} # Install paths ###################################################################### -#QWT_INSTALL_PREFIX = . - -unix { - #QWT_INSTALL_PREFIX = @SB_INSTALL_PREFIX@ - # QWT_INSTALL_PREFIX = /usr/local/qwt-$$QWT_VERSION-qt-$$QT_VERSION -} - -win32 { - # QWT_INSTALL_PREFIX = @SB_INSTALL_PREFIX@ - # QWT_INSTALL_PREFIX = C:/Qwt-$$QWT_VERSION-qt-$$QT_VERSION -} - +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 @@ -93,7 +82,7 @@ QWT_CONFIG += QwtWidgets # export a plot to a SVG document ###################################################################### -QWT_CONFIG += QwtSvg +#QWT_CONFIG += QwtSvg ###################################################################### # If you want to use a OpenGL plot canvas @@ -118,7 +107,7 @@ QWT_CONFIG += QwtOpenGL # Otherwise you have to build it from the designer directory. ###################################################################### -QWT_CONFIG += QwtDesigner +#QWT_CONFIG += QwtDesigner ###################################################################### # Compile all Qwt classes into the designer plugin instead @@ -161,7 +150,7 @@ win32 { macx:!static:CONFIG(qt_framework, qt_framework|qt_no_framework) { - QWT_CONFIG += QwtFramework +# QWT_CONFIG += QwtFramework } ###################################################################### diff --git a/Utilities/Doxygen/doxygen.config.in b/Utilities/Doxygen/doxygen.config.in index f23888ac099da3173b533dbd68d4db667ca6140c..c77823e62a62e27a128e9eb45880439187afe79e 100644 --- a/Utilities/Doxygen/doxygen.config.in +++ b/Utilities/Doxygen/doxygen.config.in @@ -1121,7 +1121,7 @@ HTML_COLORSTYLE_HUE = 220 HTML_COLORSTYLE_SAT = 100 # The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the -# luminance component of the colors in the HTML output. Values below 100 +# radiance component of the colors in the HTML output. Values below 100 # gradually make the output lighter, whereas values above 100 make the output # darker. The value divided by 100 is the actual gamma applied, so 80 represents # a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not diff --git a/Utilities/Maintenance/SuperbuildDownloadList.sh b/Utilities/Maintenance/SuperbuildDownloadList.sh index d7bd8c493517194cf2ef22accbc6b0e4565d3291..da5c4cb21b1ef11fc29c35284ac361b4894d7827 100755 --- a/Utilities/Maintenance/SuperbuildDownloadList.sh +++ b/Utilities/Maintenance/SuperbuildDownloadList.sh @@ -45,9 +45,9 @@ if [[ "$GIT_BRANCH" =~ release-* ]]; then else VERSION="develop" fi -CMAKE_FILES=$(find $SB_CMAKE_DIR -maxdepth 1 -type f -name "External_*") -DOWNLOAD_LIST=$(grep -h -E '^[^#]*\"https?://.*(\.tar\.gz|\.tar\.bz2|\.tgz|\.tar\.xz|\.zip|export=download).*\"' ${CMAKE_FILES} | - grep -o -E 'https?://[^\"]*' | sort | uniq) +CMAKE_FILES=$(find "${SB_CMAKE_DIR}" -maxdepth 1 -type f -name "External_*") +DOWNLOAD_LIST=$(grep -h -E '^[^#]*\"(ftp|http|https)://.*(\.tar\.gz|\.tar\.bz2|\.tgz|\.tar\.xz|\.zip|export=download).*\"' ${CMAKE_FILES} | + grep -o -E '(ftp|http|https)://[^\"]*' | sort | uniq) DOWNLOAD_NAMES= diff --git a/i18n/fr_FR.ts b/i18n/fr_FR.ts index 54548c52973fc5df1450c1cd369fdb74a02617c0..e9ea1fe258c00eb93564b84ab05b5827bdb86122 100644 --- a/i18n/fr_FR.ts +++ b/i18n/fr_FR.ts @@ -278,8 +278,8 @@ Veuillez, s'il vous plait, supprimer votre répertoire de cache Monteverdi. <translation>Version OTB M.m.pl (nom_de_code)</translation> </message> <message> - <source><p>Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES)</p><p>Monteverdi is part of Orfeo Toolbox</p><a href="https://www.orfeo-toolbox.org/">https://www.orfeo-toolbox.org/</a><p>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</p><a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a><p>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.</p></source> - <translation></translation> + <source><html><head/><body><p>Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES)</p><p>Monteverdi is part of Orfeo Toolbox</p><p><a href="https://www.orfeo-toolbox.org/"><span style=" text-decoration: underline; color:#0000ff;">https://www.orfeo-toolbox.org/</span></a></p><p>Licensed under the Apache License, Version 2.0 (the &quot;License&quot;); you may not use this file except in compliance with<br/>the License. You may obtain a copy of the License at:</p><p><a href="http://www.apache.org/licenses/LICENSE-2.0"><span style=" text-decoration: underline; color:#0000ff;">http://www.apache.org/licenses/LICENSE-2.0</span></a></p><p>Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an <br/>&quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License<br/>for the specific language governing permissions and limitations under the License.</p></body></html></source> + <translation type="unfinished"></translation> </message> </context> <context> @@ -357,6 +357,10 @@ Veuillez, s'il vous plait, supprimer votre répertoire de cache Monteverdi. <source>Unknown</source> <translation>Inconnu</translation> </message> + <message> + <source>No EPSG</source> + <translation>Pas d'EPSG</translation> + </message> </context> <context> <name>mvd::AbstractModel</name> @@ -4607,6 +4611,10 @@ Merci d'en sélectionner un autre.</translation> <source>pixel(s)</source> <translation>pixel(s)</translation> </message> + <message> + <source>When the image width or height is lower than this minimum, overview generation is not proposed</source> + <translation>Lorsque la hauteur ou la largeur d'une image est inférieure à ce minimum, la génération des aperçus n'est pas proposée</translation> + </message> </context> <context> <name>mvd::ProcessObjectObserver</name>