Skip to content
Snippets Groups Projects

Parameter bool

Merged Guillaume Pasero requested to merge parameter_bool into develop

Summary

This branch contains a new boolean parameter for ApplicationEngine.

Rationale

The ParameterType_Empty was not correctly designed. This is part of story #1514.

Implementation Details

Classes and files

A       Modules/Wrappers/ApplicationEngine/include/otbWrapperBoolParameter.h
M       Modules/Wrappers/ApplicationEngine/include/otbWrapperEmptyParameter.h
M       Modules/Wrappers/ApplicationEngine/include/otbWrapperTypes.h
M       Modules/Wrappers/ApplicationEngine/src/CMakeLists.txt
M       Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx
A       Modules/Wrappers/ApplicationEngine/src/otbWrapperBoolParameter.cxx
M       Modules/Wrappers/ApplicationEngine/src/otbWrapperInputProcessXMLParameter.cxx
M       Modules/Wrappers/ApplicationEngine/src/otbWrapperMapProjectionParametersHandler.cxx
M       Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputProcessXMLParameter.cxx
M       Modules/Wrappers/ApplicationEngine/src/otbWrapperParameterGroup.cxx

The new parameter BoolParameter is added to ApplicationEngine, it corresponds to enum value ParameterType_Bool. Its value is independent from its m_Active flag. It is a mandatory parameter, and always has a value (False by default). The state of the parameter can be modified/retrieved using SetParameterInt(), GetParameterInt(), GetParameterString() and SetParameterString() from the class otb::Wrapper::Application. The strings "0", "1", "on", "off", "true", "false", "yes", "no" are supported (case insensitive).

M       Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx
A       Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetBoolParameter.h
M       Modules/Wrappers/QtWidget/src/CMakeLists.txt
A       Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetBoolParameter.cxx
M       Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetParameterFactory.cxx
M       Modules/Wrappers/SWIG/src/otbApplication.i

The different launchers have been updated to handle BoolParameter. Note that the design of the QtWidgetBoolParameter is a bit different from the Empty parameter.

Applications

M       Modules/Applications/AppClassification/app/otbClassificationMapRegularization.cxx
M       Modules/Applications/AppClassification/app/otbDSFuzzyModelEstimation.cxx
M       Modules/Applications/AppClassification/app/otbKMeansClassification.cxx
M       Modules/Applications/AppClassification/app/otbTrainImagesClassifier.cxx
M       Modules/Applications/AppClassification/app/otbTrainVectorClassifier.cxx
M       Modules/Applications/AppClassification/app/otbVectorClassifier.cxx
M       Modules/Applications/AppClassification/include/otbTrainDecisionTree.txx
M       Modules/Applications/AppClassification/include/otbTrainImagesBase.txx
M       Modules/Applications/AppClassification/include/otbTrainLibSVM.txx
M       Modules/Applications/AppClassification/include/otbTrainSVM.txx
M       Modules/Applications/AppClassification/include/otbTrainVectorBase.txx
M       Modules/Applications/AppDescriptors/app/otbHomologousPointsExtraction.cxx
M       Modules/Applications/AppDimensionalityReduction/app/otbDimensionalityReduction.cxx
M       Modules/Applications/AppDomainTransform/app/otbDomainTransform.cxx
M       Modules/Applications/AppEdge/app/otbLineSegmentDetection.cxx
M       Modules/Applications/AppFiltering/app/otbContrastEnhancement.cxx
M       Modules/Applications/AppImageUtils/app/otbManageNoData.cxx
M       Modules/Applications/AppImageUtils/app/otbMultiResolutionPyramid.cxx
M       Modules/Applications/AppImageUtils/app/otbReadImageInfo.cxx
M       Modules/Applications/AppOpticalCalibration/app/otbOpticalCalibration.cxx
M       Modules/Applications/AppProjection/app/otbOrthoRectification.cxx
M       Modules/Applications/AppSARCalibration/app/otbSARCalibration.cxx
M       Modules/Applications/AppSegmentation/app/otbLSMSSegmentation.cxx
M       Modules/Applications/AppSegmentation/app/otbLargeScaleMeanShift.cxx
M       Modules/Applications/AppSegmentation/app/otbMeanShiftSmoothing.cxx
M       Modules/Applications/AppSegmentation/app/otbSegmentation.cxx
M       Modules/Applications/AppStereo/app/otbBlockMatching.cxx
M       Modules/Applications/AppStereo/app/otbStereoFramework.cxx
M       Modules/Applications/AppTest/app/otbTestApplication.cxx
M       Modules/Applications/AppVectorUtils/app/otbOSMDownloader.cxx

The EmptyParameter has been replaced by BoolParameter in OTB Applications.

Tests

M       Modules/Wrappers/SWIG/test/python/PythonNewStyleParametersTest.py

One Python test has been updated.

Documentation

M       Documentation/Cookbook/Scripts/otbGenerateWrappersRstDoc.py

The CookBook generation script has been updated. Other than that, the Empty parameter is not referred to in the documentation.

Additional notes

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • What happens to the former EmptyParameter ? Is it still used somewhere ? Or can we remove it ?

  • You say that the Qt widget looks different, is it possible for you to attach a small screenshot ?

  • To use the new parameter in python, shall we use SetParameterString("param","false") or even app.PARAM=False ?

  • EmptyParameter is still working, I left it for backward compatibility (and for people doing applications outside OTB). I mentioned it was deprecated in the doxygen. It is only used by ApplicationTest

  • Here is a screenshot of QtWidgetBoolParameter. Screenshot_QtWidgetBoolParam_OnOff

  • In Python, the following commands will work:

    import otbApplication as otb
    app = otb.Registry.CreateApplication("ReadImageInfo")
    app.SetParameterInt("keywordlist",1)
    app.SetParameterString("keywordlist","Off")
    app.KEYWORDLIST = True
  • Guillaume Pasero added 68 commits

    added 68 commits

    Compare with previous version

  • You should update the otb app python recipe and the corner case related to boolean parameter settings

    Perhaps remove this corner case is sufficient or let it like this but note that the EmptyParameter class should be used instead.

    Apart from this point +1 from me

  • added 1 commit

    • a3ab4813 - DOC: clarification about EmptyParameter/BoolParameter

    Compare with previous version

  • I have clarified the situation in the python recipe.

  • mentioned in commit 751d1724

  • I think this MR broke the automatic generation of application documentation in RST for Cookbook:

    All apps: ['BandMath', 'BinaryMorphologicalOperation', 'BlockMatching', 'BundleToPerfectSensor', 'ClassificationMapRegularization', 'ColorMapping', 'CompareImages', 'ComputeConfusionMatrix', 'ComputeImagesStatistics', 'ComputeModulusAndPhase', 'ComputeOGRLayersFeaturesStatistics', 'ComputePolylineFeatureFromImage', 'ConcatenateImages', 'ConcatenateVectorData', 'ConnectedComponentSegmentation', 'ContrastEnhancement', 'Convert', 'ConvertCartoToGeoPoint', 'ConvertSensorToGeoPoint', 'DEMConvert', 'DSFuzzyModelEstimation', 'Despeckle', 'DimensionalityReduction', 'DisparityMapToElevationMap', 'DomainTransform', 'DownloadSRTMTiles', 'DynamicConvert', 'EdgeExtraction', 'ExtractROI', 'FineRegistration', 'FusionOfClassifications', 'GeneratePlyFile', 'GenerateRPCSensorModel', 'GrayScaleMorphologicalOperation', 'GridBasedImageResampling', 'HaralickTextureExtraction', 'HomologousPointsExtraction', 'HooverCompareSegmentation', 'HyperspectralUnmixing', 'ImageClassifier', 'ImageDimensionalityReduction', 'ImageEnvelope', 'KMeansClassification', 'LSMSSegmentation', 'LSMSSmallRegionsMerging', 'LSMSVectorization', 'LargeScaleMeanShift', 'LineSegmentDetection', 'LocalStatisticExtraction', 'ManageNoData', 'MeanShiftSmoothing', 'MorphologicalClassification', 'MorphologicalMultiScaleDecomposition', 'MorphologicalProfilesAnalysis', 'MultiImageSamplingRate', 'MultiResolutionPyramid', 'MultivariateAlterationDetector', 'OGRLayerClassifier', 'OSMDownloader', 'ObtainUTMZoneFromGeoPoint', 'OpticalCalibration', 'OrthoRectification', 'Pansharpening', 'PixelValue', 'PolygonClassStatistics', 'PredictRegression', 'Quicklook', 'RadiometricIndices', 'Rasterization', 'ReadImageInfo', 'RefineSensorModel', 'Rescale', 'RigidTransformResample', 'SARCalibration', 'SARDeburst', 'SARDecompositions', 'SARPolarMatrixConvert', 'SARPolarSynth', 'SFSTextureExtraction', 'SOMClassification', 'SampleExtraction', 'SampleSelection', 'Segmentation', 'Smoothing', 'SplitImage', 'StereoFramework', 'StereoRectificationGridGenerator', 'Superimpose', 'TileFusion', 'TrainDimensionalityReduction', 'TrainImagesClassifier', 'TrainRegression', 'TrainVectorClassifier', 'VectorClassifier', 'VectorDataDSValidation', 'VectorDataExtractROI', 'VectorDataReprojection', 'VectorDataSetField', 'VectorDataTransform', 'VectorDimensionalityReduction', 'VertexComponentAnalysis']
    Generating BandMath.rst on tag Miscellaneous
    Traceback (most recent call last):
      File "/home/michelj/dev/src/otb/Documentation/Cookbook/Scripts/otbGenerateWrappersRstDoc.py", line 587, in <module>
        GenerateRstForApplications()
      File "/home/michelj/dev/src/otb/Documentation/Cookbook/Scripts/otbGenerateWrappersRstDoc.py", line 567, in GenerateRstForApplications
        out = ApplicationToRst(appName)
      File "/home/michelj/dev/src/otb/Documentation/Cookbook/Scripts/otbGenerateWrappersRstDoc.py", line 460, in ApplicationToRst
        output += ApplicationParametersToRstV2(app,app.GetParametersKeys(),deep) + linesep
      File "/home/michelj/dev/src/otb/Documentation/Cookbook/Scripts/otbGenerateWrappersRstDoc.py", line 272, in ApplicationParametersToRstV2
        output += GenerateParametersTable(app,paramlist)
      File "/home/michelj/dev/src/otb/Documentation/Cookbook/Scripts/otbGenerateWrappersRstDoc.py", line 189, in GenerateParametersTable
        colLength = FindLengthOfLargestColumnText(app, paramlist)
      File "/home/michelj/dev/src/otb/Documentation/Cookbook/Scripts/otbGenerateWrappersRstDoc.py", line 159, in FindLengthOfLargestColumnText
        lenpdescr = len(GenerateParameterType(app, param))
      File "/home/michelj/dev/src/otb/Documentation/Cookbook/Scripts/otbGenerateWrappersRstDoc.py", line 99, in GenerateParameterType
        or app.GetParameterType(param) == otbApplication.ParameterType_Bool:
    AttributeError: 'module' object has no attribute 'ParameterType_Bool'
    CMakeFiles/generate_otbapps_rst.dir/build.make:57 : la recette pour la cible « CMakeFiles/generate_otbapps_rst » a échouée
    make[2]: *** [CMakeFiles/generate_otbapps_rst] Erreur 1
    CMakeFiles/Makefile2:584 : la recette pour la cible « CMakeFiles/generate_otbapps_rst.dir/all » a échouée
    make[1]: *** [CMakeFiles/generate_otbapps_rst.dir/all] Erreur 2
    Makefile:94 : la recette pour la cible « all » a échouée
    make: *** [all] Erreur 2
  • This error looks like you try to build the CookBook from develop, but you use an OTB build that is older (the Python wrappings you have are obsolete, ParameterType_Bool has been added to otbApplication.i).

  • added app feature labels

  • Victor Poughon mentioned in merge request !307 (merged)

    mentioned in merge request !307 (merged)

Please register or sign in to reply
Loading