Display deprecation status in application wrappers
Summary
Display deprecation status in application wrappers
Rationale
Applications can be marked deprecated with AddDocTag(Tags::Deprecated);
but this is not really visible for applications users. Therefore we should display the deprecation status clearly in all wrappers, see issue #1791 (closed).
Changes in OTB
A new method IsDeprecated()
has been added to the Application
class, this method loops on the tags of the application to determine whether the application is deprecated or not, this method is used by the application wrappers to display the deprecation status in a suitable form.
In command line
The deprecation status is displayed at the beginning of the DisplayHelp()
method (the method that is called if a parameter is missing for example) and as a Warning log
at the beginning of the execution :
otbcli_Rescale
ERROR: Waiting for at least one parameter.
This is the Rescale Image (Rescale) application, version 6.7.0
WARNING: This application is deprecated, it will be removed in a future OTB release.
Rescale the image between two given values.
Complete documentation: https://www.orfeo-toolbox.org/CookBook/Applications/app_Rescale.html or -help
Parameters:
MISSING -in <string> Input Image (mandatory)
MISSING -out <string> [pixel] Output Image [pixel=uint8/uint16/int16/uint32/int32/float/double/cint16/cint32/cfloat/cdouble] (default value is float) (mandatory)
-outmin <float> Output min value (optional, off by default, default value is 0)
-outmax <float> Output max value (optional, off by default, default value is 255)
-ram <int32> Available RAM (MB) (optional, off by default, default value is 256)
-inxml <string> Load parameters from XML (optional, off by default)
-progress <boolean> Report progress
-help <string list> Display long help (empty list), or help for given parameters keys
Use -help param1 [... paramN] to see detailed documentation of those parameters.
Examples:
otbcli_Rescale -in QB_Toulouse_Ortho_PAN.tif -out rescaledImage.png uchar -outmin 0 -outmax 255
otbcli_Rescale -in /Datas/S2Data/S2A_ROI.tif -out /tmp/out.tif
2019-05-06 16:36:45 (WARNING) Rescale: This application is deprecated and will be removed in a future OTB release.
2019-05-06 16:36:45 (INFO) Rescale: Default RAM limit for OTB is 256 MB
2019-05-06 16:36:45 (INFO) Rescale: GDAL maximum cache size is 794 MB
2019-05-06 16:36:45 (INFO) Rescale: OTB will use at most 12 threads
ERROR 4: `/Datas/S2Data/S2A_ROI.tif.aux.xml' not recognized as a supported file format.
2019-05-06 16:36:45 (INFO): Estimated memory for full processing: 45.6238MB (avail.: 256 MB), optimal image partitioning: 1 blocks
2019-05-06 16:36:45 (INFO): Estimation will be performed in 1 blocks of 1000x1000 pixels
Min/Max computing: 100% [**************************************************] (0s)
2019-05-06 16:36:45 (INFO): Estimated memory for full processing: 45.6238MB (avail.: 256 MB), optimal image partitioning: 1 blocks
2019-05-06 16:36:45 (INFO): File /tmp/out.tif will be written in 1 blocks of 1000x1000 pixels
Writing /tmp/out.tif...: 100% [**************************************************] (0s)
In Python
The deprecation status is displayed upon application creation using the registry :
In [1]: import otbApplication as otb
In [2]: appli = otb.Registry.CreateApplication("Rescale")
2019-05-06 16:40:12 (WARNING) Rescale: This application is deprecated and will be removed in a future OTB release
In the Cookbook
A deprecation string has been added at the beginning of deprecated applications
In QtWidget (and Monteverdi)
A label is added to the widget main window if the application is deprecated.
In QGIS
Nothing has been done on the QGIS side. This would be hard to do as the qgis plugin does not instantiate the application. However as the plugin uses the Command Line Launcher, a deprecation warning message is issued in the logs (in red!) :
Copyright
The copyright owner is CNES and has signed the ORFEO ToolBox Contributor License Agreement.
Check before merging:
- All discussions are resolved
- At least 2
👍 votes from core developers, no👎 vote. - The feature branch is (reasonably) up-to-date with the base branch
- Dashboard is green
- Copyright owner has signed the ORFEO ToolBox Contributor License Agreement
- Optionally, run
git diff develop... -U0 --no-color | clang-format-diff.py -p1 -i
on latest changes and commit