Request for changes-106: All-in-one LSMS application

From OTBWiki
Jump to: navigation, search

[Request for Changes - 106] All-in-one LSMS application


  • Author: Guillaume
  • Additional Contributors (if different than authors)
  • Submitted on 02.08.2017
  • Proposed target release 6.2
  • Adopted : +2 (Victor, Guillaume)
  • Merged : 38f8d68e7fa94d62069f2957610bb0604268ca06


This RFC add a new composite application that gathers the 4 steps of the large-scale MeanShift segmentation framework.


It allows a simpler execution of the segmentation framework (especially for beginners).

Implementation details


M       Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h
M       Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx
M       Modules/Wrappers/ApplicationEngine/src/otbWrapperChoiceParameter.cxx
M       Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx

Changes have been made in the application engine:

  • the code that checks the missing parameters was duplicated in 3 places and had to be modified in order to support specific cases with composite applications.
  • a new function IsParameterMissing(std::string key) has been created in the class otb::Wrapper::Application. The logic to determine missing parameters has been simplified. A parameter is missing if all the following conditions are met :
    • the parameter is mandatory
    • the parameter has Role_Input
    • the parameter is not a group
    • the parameter has no value
    • the parameter ancestors are mandatory or enabled
  • The groups contained in a Choice parameter have now their mandatory flag set OFF, so that their 'Enabled' state will show which choice is selected.
  • This new function IsParameterMissing() has been used to replace duplicated code in classes Application and CommandLineLauncher.


M       Modules/Applications/AppSegmentation/app/CMakeLists.txt
A       Modules/Applications/AppSegmentation/app/otbLargeScaleMeanShift.cxx

The new application has been named "LargeScaleMeanShift". It is a composite application using:

  • MeanShiftSmoothing
  • LSMSSegmentation
  • LSMSSmallRegionsMerging
  • LSMSVectorization

A few notes about the implementation:

  • The application MeanShiftSmoothing is connected in-memory to LSMSSegmentation. Other intermediate images (label map, and merged label map) are stored as temporary datasets.
  • As usual, there is a cleanup parameter.
  • There is an optional input "imfield" that can be used to compute field values for each region during LSMSVectorization.
  • The input image "in" for LSMSSmallRegionsMerging is actually the original input image for LargeScaleMeanShift, although in some exercises the smoothed image was used for region merging.
  • There is a switch between raster and vector mode. In raster mode, the last step (LSMSVectorization) is not performed.


M       Modules/Applications/AppSegmentation/test/CMakeLists.txt

A test has been added for the all-in-one application.


Additional notes