From d867616571c46063518485ac443afd2c38111d64 Mon Sep 17 00:00:00 2001 From: Ludovic Hussonnois <ludovic.hussonnois@c-s.fr> Date: Mon, 23 Jan 2017 18:12:34 +0100 Subject: [PATCH] ENH: Change call to SetParameter*() function and set UserValue Flag default user value to true. --- .../app/otbDSFuzzyModelEstimation.cxx | 8 +- .../app/otbKMeansClassification.cxx | 2 +- .../app/otbMultiImageSamplingRate.cxx | 2 +- .../app/otbOGRLayerClassifier.cxx | 2 +- .../app/otbSampleExtraction.cxx | 2 +- .../app/otbSampleSelection.cxx | 2 +- .../app/otbTrainImagesClassifier.cxx | 64 ++-- .../app/otbTrainOGRLayersClassifier.cxx | 2 +- .../app/otbTrainRegression.cxx | 2 +- .../app/otbVectorDataDSValidation.cxx | 4 +- .../include/otbTrainBoost.txx | 8 +- .../include/otbTrainDecisionTree.txx | 10 +- .../include/otbTrainGradientBoostedTree.txx | 8 +- .../AppClassification/include/otbTrainKNN.txx | 2 +- .../include/otbTrainLibSVM.txx | 12 +- .../include/otbTrainNeuralNetwork.txx | 22 +- .../include/otbTrainRandomForests.txx | 14 +- .../AppClassification/include/otbTrainSVM.txx | 34 +- .../include/otbTrainSharkRandomForests.txx | 8 +- .../app/otbDimensionalityReduction.cxx | 8 +- .../app/otbDomainTransform.cxx | 4 +- .../AppFiltering/app/otbSmoothing.cxx | 2 +- .../app/otbBundleToPerfectSensor.cxx | 4 +- .../app/otbHyperspectralUnmixing.cxx | 2 +- .../app/otbVertexComponentAnalysis.cxx | 2 +- .../AppImageUtils/app/otbColorMapping.cxx | 14 +- .../AppImageUtils/app/otbCompareImages.cxx | 8 +- .../AppImageUtils/app/otbConvert.cxx | 2 +- .../AppImageUtils/app/otbExtractROI.cxx | 16 +- .../AppImageUtils/app/otbManageNoData.cxx | 2 +- .../AppImageUtils/app/otbPixelValue.cxx | 2 +- .../AppImageUtils/app/otbQuicklook.cxx | 16 +- .../AppImageUtils/app/otbReadImageInfo.cxx | 74 ++-- .../AppMathParserX/app/otbBandMathX.cxx | 2 +- .../app/otbOpticalCalibration.cxx | 20 +- .../app/otbConvertCartoToGeoPoint.cxx | 4 +- .../app/otbConvertSensorToGeoPoint.cxx | 8 +- .../app/otbGridBasedImageResampling.cxx | 2 +- .../app/otbObtainUTMZoneFromGeoPoint.cxx | 2 +- .../app/otbOrthoRectification.cxx | 60 ++-- .../app/otbRigidTransformResample.cxx | 2 +- .../AppProjection/app/otbSuperimpose.cxx | 2 +- .../app/otbHooverCompareSegmentation.cxx | 8 +- .../AppSegmentation/app/otbSegmentation.cxx | 4 +- .../AppStereo/app/otbStereoFramework.cxx | 4 +- .../app/otbRasterization.cxx | 2 +- .../include/otbWrapperApplication.h | 78 ++-- .../src/otbWrapperApplication.cxx | 340 +++++++++--------- Modules/Wrappers/SWIG/src/otbApplication.i | 16 +- 49 files changed, 444 insertions(+), 474 deletions(-) diff --git a/Modules/Applications/AppClassification/app/otbDSFuzzyModelEstimation.cxx b/Modules/Applications/AppClassification/app/otbDSFuzzyModelEstimation.cxx index dd9d347a1f..29a2b45989 100644 --- a/Modules/Applications/AppClassification/app/otbDSFuzzyModelEstimation.cxx +++ b/Modules/Applications/AppClassification/app/otbDSFuzzyModelEstimation.cxx @@ -140,12 +140,12 @@ private: AddParameter(ParameterType_String, "cri", "Criterion"); SetParameterDescription("cri", "Dempster Shafer criterion (by default (belief+plausibility)/2)"); MandatoryOff("cri"); - SetParameterString("cri","((Belief + Plausibility)/2.)"); + SetParameterString("cri","((Belief + Plausibility)/2.)", false); AddParameter(ParameterType_Float,"wgt","Weighting"); SetParameterDescription("wgt","Coefficient between 0 and 1 to promote undetection or false detections (default 0.5)"); MandatoryOff("wgt"); - SetParameterFloat("wgt", 0.5); + SetParameterFloat("wgt",0.5, false); AddParameter(ParameterType_InputFilename,"initmod","initialization model"); SetParameterDescription("initmod","Initialization model (xml file) to be used. If the xml initialization model is set, the descriptor list is not used (specified using the option -desclist)"); @@ -154,12 +154,12 @@ private: AddParameter(ParameterType_StringList, "desclist","Descriptor list"); SetParameterDescription("desclist","List of the descriptors to be used in the model (must be specified to perform an automatic initialization)"); MandatoryOff("desclist"); - SetParameterString("desclist",""); + SetParameterString("desclist","", false); AddParameter(ParameterType_Int,"maxnbit","Maximum number of iterations"); MandatoryOff("maxnbit"); SetParameterDescription("maxnbit","Maximum number of optimizer iteration (default 200)"); - SetParameterInt("maxnbit", 200); + SetParameterInt("maxnbit",200, false); AddParameter(ParameterType_Empty,"optobs","Optimizer Observer"); SetParameterDescription("optobs","Activate the optimizer observer"); diff --git a/Modules/Applications/AppClassification/app/otbKMeansClassification.cxx b/Modules/Applications/AppClassification/app/otbKMeansClassification.cxx index d83410e452..d511384c0e 100644 --- a/Modules/Applications/AppClassification/app/otbKMeansClassification.cxx +++ b/Modules/Applications/AppClassification/app/otbKMeansClassification.cxx @@ -245,7 +245,7 @@ private: { otbAppLogWARNING("The available RAM is too small to process this sample size of " << GetParameterInt("ts") << " pixels. The sample size will be reduced to " << maxPixNb << " pixels." << std::endl); - this->SetParameterInt("ts", maxPixNb); + this->SetParameterInt("ts",maxPixNb, false); } this->SetMaximumParameterIntValue("ts", maxPixNb); diff --git a/Modules/Applications/AppClassification/app/otbMultiImageSamplingRate.cxx b/Modules/Applications/AppClassification/app/otbMultiImageSamplingRate.cxx index f1e90e88a8..8bbd60510c 100644 --- a/Modules/Applications/AppClassification/app/otbMultiImageSamplingRate.cxx +++ b/Modules/Applications/AppClassification/app/otbMultiImageSamplingRate.cxx @@ -161,7 +161,7 @@ private: SetParameterDescription("strategy.all","Take all samples"); // Default strategy : smallest - SetParameterString("strategy","smallest"); + SetParameterString("strategy","smallest", false); AddParameter(ParameterType_Choice, "mim", "Multi-Image Mode"); diff --git a/Modules/Applications/AppClassification/app/otbOGRLayerClassifier.cxx b/Modules/Applications/AppClassification/app/otbOGRLayerClassifier.cxx index b1161dddd7..6ec4a448ed 100644 --- a/Modules/Applications/AppClassification/app/otbOGRLayerClassifier.cxx +++ b/Modules/Applications/AppClassification/app/otbOGRLayerClassifier.cxx @@ -78,7 +78,7 @@ private: AddParameter(ParameterType_String,"cfield","Field containing the predicted class."); SetParameterDescription("cfield","Field containing the predicted class"); - SetParameterString("cfield","predicted"); + SetParameterString("cfield","predicted", false); // Doc example parameter settings SetDocExampleParameterValue("inshp", "vectorData.shp"); diff --git a/Modules/Applications/AppClassification/app/otbSampleExtraction.cxx b/Modules/Applications/AppClassification/app/otbSampleExtraction.cxx index bd5f447ed7..0eb1e3a8a9 100644 --- a/Modules/Applications/AppClassification/app/otbSampleExtraction.cxx +++ b/Modules/Applications/AppClassification/app/otbSampleExtraction.cxx @@ -86,7 +86,7 @@ private: AddParameter(ParameterType_String, "outfield.prefix.name", "Output field prefix"); SetParameterDescription("outfield.prefix.name","Prefix used to form the field names that" "will contain the extracted values."); - SetParameterString("outfield.prefix.name", "value_"); + SetParameterString("outfield.prefix.name", "value_", false); AddChoice("outfield.list","Use the given name list"); SetParameterDescription("outfield.list","Use the given name list"); diff --git a/Modules/Applications/AppClassification/app/otbSampleSelection.cxx b/Modules/Applications/AppClassification/app/otbSampleSelection.cxx index 5ff2926888..81b2b33f02 100644 --- a/Modules/Applications/AppClassification/app/otbSampleSelection.cxx +++ b/Modules/Applications/AppClassification/app/otbSampleSelection.cxx @@ -197,7 +197,7 @@ private: SetParameterDescription("strategy.all","Take all samples"); // Default strategy : smallest - SetParameterString("strategy","smallest"); + SetParameterString("strategy","smallest", false); AddParameter(ParameterType_ListView, "field", "Field Name"); SetParameterDescription("field","Name of the field carrying the class name in the input vectors."); diff --git a/Modules/Applications/AppClassification/app/otbTrainImagesClassifier.cxx b/Modules/Applications/AppClassification/app/otbTrainImagesClassifier.cxx index 6fdcecf6d1..5433dcf170 100644 --- a/Modules/Applications/AppClassification/app/otbTrainImagesClassifier.cxx +++ b/Modules/Applications/AppClassification/app/otbTrainImagesClassifier.cxx @@ -155,7 +155,7 @@ void DoInit() ITK_OVERRIDE SetParameterDescription("sample.vtr", "Ratio between training and validation samples (0.0 = all training, 1.0 = " "all validation) (default = 0.5)."); - SetParameterFloat("sample.vtr", 0.5); + SetParameterFloat("sample.vtr",0.5, false); SetMaximumParameterFloatValue("sample.vtr",1.0); SetMinimumParameterFloatValue("sample.vtr",0.0); @@ -214,7 +214,7 @@ void DoUpdateParameters() ITK_OVERRIDE if ( HasValue("io.vd") ) { std::vector<std::string> vectorFileList = GetParameterStringList("io.vd"); - GetInternalApplication("polystat")->SetParameterString("vec",vectorFileList[0]); + GetInternalApplication("polystat")->SetParameterString("vec",vectorFileList[0], false); UpdateInternalParameters("polystat"); } } @@ -289,21 +289,21 @@ void DoExecute() ITK_OVERRIDE for (unsigned int i=0 ; i<nbInputs ; i++) { GetInternalApplication("polystat")->SetParameterInputImage("in",imageList->GetNthElement(i)); - GetInternalApplication("polystat")->SetParameterString("vec",vectorFileList[i]); - GetInternalApplication("polystat")->SetParameterString("out",polyStatTrainOutputs[i]); + GetInternalApplication("polystat")->SetParameterString("vec",vectorFileList[i], false); + GetInternalApplication("polystat")->SetParameterString("out",polyStatTrainOutputs[i], false); ExecuteInternal("polystat"); // analyse polygons given for validation if (dedicatedValidation) { - GetInternalApplication("polystat")->SetParameterString("vec",validationVectorFileList[i]); - GetInternalApplication("polystat")->SetParameterString("out",polyStatValidOutputs[i]); + GetInternalApplication("polystat")->SetParameterString("vec",validationVectorFileList[i], false); + GetInternalApplication("polystat")->SetParameterString("out",polyStatValidOutputs[i], false); ExecuteInternal("polystat"); } } // --------------------------------------------------------------------------- // Compute sampling rates - GetInternalApplication("rates")->SetParameterString("mim","proportional"); + GetInternalApplication("rates")->SetParameterString("mim","proportional", false); double vtr = GetParameterFloat("sample.vtr"); long mt = GetParameterInt("sample.mt"); long mv = GetParameterInt("sample.mv"); @@ -348,44 +348,44 @@ void DoExecute() ITK_OVERRIDE } // Sampling rates for training - GetInternalApplication("rates")->SetParameterStringList("il",polyStatTrainOutputs); - GetInternalApplication("rates")->SetParameterString("out",rateTrainOut); + GetInternalApplication("rates")->SetParameterStringList("il",polyStatTrainOutputs, false); + GetInternalApplication("rates")->SetParameterString("out",rateTrainOut, false); if (GetParameterInt("sample.bm") != 0) { - GetInternalApplication("rates")->SetParameterString("strategy","smallest"); + GetInternalApplication("rates")->SetParameterString("strategy","smallest", false); } else { if (fmt > -1) { - GetInternalApplication("rates")->SetParameterString("strategy","constant"); + GetInternalApplication("rates")->SetParameterString("strategy","constant", false); GetInternalApplication("rates")->SetParameterInt("strategy.constant.nb",fmt); } else { - GetInternalApplication("rates")->SetParameterString("strategy","all"); + GetInternalApplication("rates")->SetParameterString("strategy","all", false); } } ExecuteInternal("rates"); // Sampling rates for validation if (dedicatedValidation) { - GetInternalApplication("rates")->SetParameterStringList("il",polyStatValidOutputs); - GetInternalApplication("rates")->SetParameterString("out",rateValidOut); + GetInternalApplication("rates")->SetParameterStringList("il",polyStatValidOutputs, false); + GetInternalApplication("rates")->SetParameterString("out",rateValidOut, false); if (GetParameterInt("sample.bm") != 0) { - GetInternalApplication("rates")->SetParameterString("strategy","smallest"); + GetInternalApplication("rates")->SetParameterString("strategy","smallest", false); } else { if (fmv > -1) { - GetInternalApplication("rates")->SetParameterString("strategy","constant"); + GetInternalApplication("rates")->SetParameterString("strategy","constant", false); GetInternalApplication("rates")->SetParameterInt("strategy.constant.nb",fmv); } else { - GetInternalApplication("rates")->SetParameterString("strategy","all"); + GetInternalApplication("rates")->SetParameterString("strategy","all", false); } } ExecuteInternal("rates"); @@ -393,18 +393,18 @@ void DoExecute() ITK_OVERRIDE // --------------------------------------------------------------------------- // Select & extract samples - GetInternalApplication("select")->SetParameterString("sampler", "periodic"); + GetInternalApplication("select")->SetParameterString("sampler", "periodic", false); GetInternalApplication("select")->SetParameterInt("sampler.periodic.jitter",50); - GetInternalApplication("select")->SetParameterString("strategy","byclass"); - GetInternalApplication("extraction")->SetParameterString("outfield", "prefix"); - GetInternalApplication("extraction")->SetParameterString("outfield.prefix.name","value_"); + GetInternalApplication("select")->SetParameterString("strategy","byclass", false); + GetInternalApplication("extraction")->SetParameterString("outfield", "prefix", false); + GetInternalApplication("extraction")->SetParameterString("outfield.prefix.name","value_", false); for (unsigned int i=0 ; i<nbInputs ; i++) { GetInternalApplication("select")->SetParameterInputImage("in",imageList->GetNthElement(i)); - GetInternalApplication("select")->SetParameterString("vec",vectorFileList[i]); - GetInternalApplication("select")->SetParameterString("out",sampleOutputs[i]); - GetInternalApplication("select")->SetParameterString("instats",polyStatTrainOutputs[i]); - GetInternalApplication("select")->SetParameterString("strategy.byclass.in",ratesTrainOutputs[i]); + GetInternalApplication("select")->SetParameterString("vec",vectorFileList[i], false); + GetInternalApplication("select")->SetParameterString("out",sampleOutputs[i], false); + GetInternalApplication("select")->SetParameterString("instats",polyStatTrainOutputs[i], false); + GetInternalApplication("select")->SetParameterString("strategy.byclass.in",ratesTrainOutputs[i], false); // select sample positions ExecuteInternal("select"); // extract sample descriptors @@ -412,10 +412,10 @@ void DoExecute() ITK_OVERRIDE if (dedicatedValidation) { - GetInternalApplication("select")->SetParameterString("vec",validationVectorFileList[i]); - GetInternalApplication("select")->SetParameterString("out",sampleValidOutputs[i]); - GetInternalApplication("select")->SetParameterString("instats",polyStatValidOutputs[i]); - GetInternalApplication("select")->SetParameterString("strategy.byclass.in",ratesValidOutputs[i]); + GetInternalApplication("select")->SetParameterString("vec",validationVectorFileList[i], false); + GetInternalApplication("select")->SetParameterString("out",sampleValidOutputs[i], false); + GetInternalApplication("select")->SetParameterString("instats",polyStatValidOutputs[i], false); + GetInternalApplication("select")->SetParameterString("strategy.byclass.in",ratesValidOutputs[i], false); // select sample positions ExecuteInternal("select"); // extract sample descriptors @@ -473,8 +473,8 @@ void DoExecute() ITK_OVERRIDE // --------------------------------------------------------------------------- // Train model - GetInternalApplication("training")->SetParameterStringList("io.vd",sampleTrainOutputs); - GetInternalApplication("training")->SetParameterStringList("valid.vd",sampleValidOutputs); + GetInternalApplication("training")->SetParameterStringList("io.vd",sampleTrainOutputs, false); + GetInternalApplication("training")->SetParameterStringList("valid.vd",sampleValidOutputs, false); UpdateInternalParameters("training"); // set field names FloatVectorImageType::Pointer image = imageList->GetNthElement(0); @@ -486,7 +486,7 @@ void DoExecute() ITK_OVERRIDE oss << i; selectedNames.push_back("value_"+oss.str()); } - GetInternalApplication("training")->SetParameterStringList("feat",selectedNames); + GetInternalApplication("training")->SetParameterStringList("feat",selectedNames, false); ExecuteInternal("training"); // cleanup diff --git a/Modules/Applications/AppClassification/app/otbTrainOGRLayersClassifier.cxx b/Modules/Applications/AppClassification/app/otbTrainOGRLayersClassifier.cxx index b461ac2a89..0e4affaa6c 100644 --- a/Modules/Applications/AppClassification/app/otbTrainOGRLayersClassifier.cxx +++ b/Modules/Applications/AppClassification/app/otbTrainOGRLayersClassifier.cxx @@ -80,7 +80,7 @@ private: AddParameter(ParameterType_String,"cfield","Field containing the class id for supervision"); SetParameterDescription("cfield","Field containing the class id for supervision. Only geometries with this field available will be taken into account."); - SetParameterString("cfield","class"); + SetParameterString("cfield","class", false); // Doc example parameter settings SetDocExampleParameterValue("inshp", "vectorData.shp"); diff --git a/Modules/Applications/AppClassification/app/otbTrainRegression.cxx b/Modules/Applications/AppClassification/app/otbTrainRegression.cxx index 3039d44a0a..335961cfce 100644 --- a/Modules/Applications/AppClassification/app/otbTrainRegression.cxx +++ b/Modules/Applications/AppClassification/app/otbTrainRegression.cxx @@ -159,7 +159,7 @@ void DoInit() ITK_OVERRIDE AddParameter(ParameterType_Float, "sample.vtr", "Training and validation sample ratio"); SetParameterDescription("sample.vtr", "Ratio between training and validation samples (0.0 = all training, 1.0 = all validation) (default = 0.5)."); - SetParameterFloat("sample.vtr", 0.5); + SetParameterFloat("sample.vtr",0.5, false); Superclass::DoInit(); diff --git a/Modules/Applications/AppClassification/app/otbVectorDataDSValidation.cxx b/Modules/Applications/AppClassification/app/otbVectorDataDSValidation.cxx index c260e16819..234b90e767 100644 --- a/Modules/Applications/AppClassification/app/otbVectorDataDSValidation.cxx +++ b/Modules/Applications/AppClassification/app/otbVectorDataDSValidation.cxx @@ -84,12 +84,12 @@ private: AddParameter(ParameterType_String, "cri", "Criterion"); SetParameterDescription("cri", "Dempster Shafer criterion (by default (belief+plausibility)/2)"); MandatoryOff("cri"); - SetParameterString("cri", "((Belief + Plausibility)/2.)"); + SetParameterString("cri", "((Belief + Plausibility)/2.)", false); AddParameter(ParameterType_Float, "thd", "Criterion threshold"); SetParameterDescription("thd", "Criterion threshold (default 0.5)"); MandatoryOff("thd"); - SetParameterFloat("thd", 0.5); + SetParameterFloat("thd",0.5, false); AddParameter(ParameterType_OutputVectorData, "out", "Output Vector Data"); SetParameterDescription("out", "Output VectorData containing only the validated samples"); diff --git a/Modules/Applications/AppClassification/include/otbTrainBoost.txx b/Modules/Applications/AppClassification/include/otbTrainBoost.txx index fbd99531a4..ea725cc28e 100644 --- a/Modules/Applications/AppClassification/include/otbTrainBoost.txx +++ b/Modules/Applications/AppClassification/include/otbTrainBoost.txx @@ -39,22 +39,22 @@ namespace Wrapper AddChoice("classifier.boost.t.logit", "LogitBoost (technique producing good regression fits)"); AddChoice("classifier.boost.t.gentle", "Gentle AdaBoost (technique setting less weight on outlier data points " "and, for that reason, being often good with regression data)"); - SetParameterString("classifier.boost.t", "real"); + SetParameterString("classifier.boost.t", "real", false); SetParameterDescription("classifier.boost.t", "Type of Boosting algorithm."); //Do not expose SplitCriteria //WeakCount AddParameter(ParameterType_Int, "classifier.boost.w", "Weak count"); - SetParameterInt("classifier.boost.w", 100); + SetParameterInt("classifier.boost.w",100, false); SetParameterDescription("classifier.boost.w","The number of weak classifiers."); //WeightTrimRate AddParameter(ParameterType_Float, "classifier.boost.r", "Weight Trim Rate"); - SetParameterFloat("classifier.boost.r", 0.95); + SetParameterFloat("classifier.boost.r",0.95, false); SetParameterDescription("classifier.boost.r","A threshold between 0 and 1 used to save computational time. " "Samples with summary weight <= (1 - weight_trim_rate) do not participate in the next iteration of training. " "Set this parameter to 0 to turn off this functionality."); //MaxDepth : Not sure that this parameter has to be exposed. AddParameter(ParameterType_Int, "classifier.boost.m", "Maximum depth of the tree"); - SetParameterInt("classifier.boost.m", 1); + SetParameterInt("classifier.boost.m",1, false); SetParameterDescription("classifier.boost.m","Maximum depth of the tree."); } diff --git a/Modules/Applications/AppClassification/include/otbTrainDecisionTree.txx b/Modules/Applications/AppClassification/include/otbTrainDecisionTree.txx index 61cd1a34be..def7b605e5 100644 --- a/Modules/Applications/AppClassification/include/otbTrainDecisionTree.txx +++ b/Modules/Applications/AppClassification/include/otbTrainDecisionTree.txx @@ -34,7 +34,7 @@ LearningApplicationBase<TInputValue,TOutputValue> "See complete documentation here \\url{http://docs.opencv.org/modules/ml/doc/decision_trees.html}."); //MaxDepth AddParameter(ParameterType_Int, "classifier.dt.max", "Maximum depth of the tree"); - SetParameterInt("classifier.dt.max", 65535); + SetParameterInt("classifier.dt.max",65535, false); SetParameterDescription( "classifier.dt.max", "The training algorithm attempts to split each node while its depth is smaller than the maximum " "possible depth of the tree. The actual depth may be smaller if the other termination criteria are met, and/or " @@ -42,13 +42,13 @@ LearningApplicationBase<TInputValue,TOutputValue> //MinSampleCount AddParameter(ParameterType_Int, "classifier.dt.min", "Minimum number of samples in each node"); - SetParameterInt("classifier.dt.min", 10); + SetParameterInt("classifier.dt.min",10, false); SetParameterDescription("classifier.dt.min", "If the number of samples in a node is smaller than this parameter, " "then this node will not be split."); //RegressionAccuracy AddParameter(ParameterType_Float, "classifier.dt.ra", "Termination criteria for regression tree"); - SetParameterFloat("classifier.dt.ra", 0.01); + SetParameterFloat("classifier.dt.ra",0.01, false); SetParameterDescription("classifier.dt.min", "If all absolute differences between an estimated value in a node " "and the values of the train samples in this node are smaller than this regression accuracy parameter, " "then the node will not be split."); @@ -60,14 +60,14 @@ LearningApplicationBase<TInputValue,TOutputValue> //MaxCategories AddParameter(ParameterType_Int, "classifier.dt.cat", "Cluster possible values of a categorical variable into K <= cat clusters to find a suboptimal split"); - SetParameterInt("classifier.dt.cat", 10); + SetParameterInt("classifier.dt.cat",10, false); SetParameterDescription( "classifier.dt.cat", "Cluster possible values of a categorical variable into K <= cat clusters to find a suboptimal split."); //CVFolds AddParameter(ParameterType_Int, "classifier.dt.f", "K-fold cross-validations"); - SetParameterInt("classifier.dt.f", 10); + SetParameterInt("classifier.dt.f",10, false); SetParameterDescription( "classifier.dt.f", "If cv_folds > 1, then it prunes a tree with K-fold cross-validation where K is equal to cv_folds."); diff --git a/Modules/Applications/AppClassification/include/otbTrainGradientBoostedTree.txx b/Modules/Applications/AppClassification/include/otbTrainGradientBoostedTree.txx index bcf5caa861..d67f964344 100644 --- a/Modules/Applications/AppClassification/include/otbTrainGradientBoostedTree.txx +++ b/Modules/Applications/AppClassification/include/otbTrainGradientBoostedTree.txx @@ -45,7 +45,7 @@ LearningApplicationBase<TInputValue,TOutputValue> //WeakCount AddParameter(ParameterType_Int, "classifier.gbt.w", "Number of boosting algorithm iterations"); - SetParameterInt("classifier.gbt.w", 200); + SetParameterInt("classifier.gbt.w",200, false); SetParameterDescription( "classifier.gbt.w", "Number \"w\" of boosting algorithm iterations, with w*K being the total number of trees in " @@ -53,20 +53,20 @@ LearningApplicationBase<TInputValue,TOutputValue> //Shrinkage AddParameter(ParameterType_Float, "classifier.gbt.s", "Regularization parameter"); - SetParameterFloat("classifier.gbt.s", 0.01); + SetParameterFloat("classifier.gbt.s",0.01, false); SetParameterDescription("classifier.gbt.s", "Regularization parameter."); //SubSamplePortion AddParameter(ParameterType_Float, "classifier.gbt.p", "Portion of the whole training set used for each algorithm iteration"); - SetParameterFloat("classifier.gbt.p", 0.8); + SetParameterFloat("classifier.gbt.p",0.8, false); SetParameterDescription( "classifier.gbt.p", "Portion of the whole training set used for each algorithm iteration. The subset is generated randomly."); //MaxDepth AddParameter(ParameterType_Int, "classifier.gbt.max", "Maximum depth of the tree"); - SetParameterInt("classifier.gbt.max", 3); + SetParameterInt("classifier.gbt.max",3, false); SetParameterDescription( "classifier.gbt.max", "The training algorithm attempts to split each node while its depth is smaller than the maximum " "possible depth of the tree. The actual depth may be smaller if the other termination criteria are met, and/or " diff --git a/Modules/Applications/AppClassification/include/otbTrainKNN.txx b/Modules/Applications/AppClassification/include/otbTrainKNN.txx index fdf10cdf28..6fba81fe4e 100644 --- a/Modules/Applications/AppClassification/include/otbTrainKNN.txx +++ b/Modules/Applications/AppClassification/include/otbTrainKNN.txx @@ -34,7 +34,7 @@ namespace Wrapper //K parameter AddParameter(ParameterType_Int, "classifier.knn.k", "Number of Neighbors"); - SetParameterInt("classifier.knn.k", 32); + SetParameterInt("classifier.knn.k",32, false); SetParameterDescription("classifier.knn.k","The number of neighbors to use."); if (this->m_RegressionFlag) diff --git a/Modules/Applications/AppClassification/include/otbTrainLibSVM.txx b/Modules/Applications/AppClassification/include/otbTrainLibSVM.txx index f89b714156..120b572fce 100644 --- a/Modules/Applications/AppClassification/include/otbTrainLibSVM.txx +++ b/Modules/Applications/AppClassification/include/otbTrainLibSVM.txx @@ -35,7 +35,7 @@ namespace Wrapper AddChoice("classifier.libsvm.k.rbf", "Gaussian radial basis function"); AddChoice("classifier.libsvm.k.poly", "Polynomial"); AddChoice("classifier.libsvm.k.sigmoid", "Sigmoid"); - SetParameterString("classifier.libsvm.k", "linear"); + SetParameterString("classifier.libsvm.k", "linear", false); SetParameterDescription("classifier.libsvm.k", "SVM Kernel Type."); AddParameter(ParameterType_Choice, "classifier.libsvm.m", "SVM Model Type"); SetParameterDescription("classifier.libsvm.m", "Type of SVM formulation."); @@ -43,17 +43,17 @@ namespace Wrapper { AddChoice("classifier.libsvm.m.epssvr", "Epsilon Support Vector Regression"); AddChoice("classifier.libsvm.m.nusvr", "Nu Support Vector Regression"); - SetParameterString("classifier.libsvm.m", "epssvr"); + SetParameterString("classifier.libsvm.m", "epssvr", false); } else { AddChoice("classifier.libsvm.m.csvc", "C support vector classification"); AddChoice("classifier.libsvm.m.nusvc", "Nu support vector classification"); AddChoice("classifier.libsvm.m.oneclass", "Distribution estimation (One Class SVM)"); - SetParameterString("classifier.libsvm.m", "csvc"); + SetParameterString("classifier.libsvm.m", "csvc", false); } AddParameter(ParameterType_Float, "classifier.libsvm.c", "Cost parameter C"); - SetParameterFloat("classifier.libsvm.c", 1.0); + SetParameterFloat("classifier.libsvm.c",1.0, false); SetParameterDescription( "classifier.libsvm.c", "SVM models have a cost parameter C (1 by default) to control the trade-off between training errors and forcing rigid margins."); @@ -67,9 +67,9 @@ namespace Wrapper if (this->m_RegressionFlag) { AddParameter(ParameterType_Float, "classifier.libsvm.eps", "Epsilon"); - SetParameterFloat("classifier.libsvm.eps", 1e-3); + SetParameterFloat("classifier.libsvm.eps",1e-3, false); AddParameter(ParameterType_Float, "classifier.libsvm.nu", "Nu"); - SetParameterFloat("classifier.libsvm.nu", 0.5); + SetParameterFloat("classifier.libsvm.nu",0.5, false); } } diff --git a/Modules/Applications/AppClassification/include/otbTrainNeuralNetwork.txx b/Modules/Applications/AppClassification/include/otbTrainNeuralNetwork.txx index ee7bf43d47..8f9386a8d5 100644 --- a/Modules/Applications/AppClassification/include/otbTrainNeuralNetwork.txx +++ b/Modules/Applications/AppClassification/include/otbTrainNeuralNetwork.txx @@ -38,7 +38,7 @@ LearningApplicationBase<TInputValue,TOutputValue> AddParameter(ParameterType_Choice, "classifier.ann.t", "Train Method Type"); AddChoice("classifier.ann.t.reg", "RPROP algorithm"); AddChoice("classifier.ann.t.back", "Back-propagation algorithm"); - SetParameterString("classifier.ann.t", "reg"); + SetParameterString("classifier.ann.t", "reg", false); SetParameterDescription("classifier.ann.t", "Type of training method for the multilayer perceptron (MLP) neural network."); //LayerSizes @@ -56,25 +56,25 @@ LearningApplicationBase<TInputValue,TOutputValue> AddChoice("classifier.ann.f.ident", "Identity function"); AddChoice("classifier.ann.f.sig", "Symmetrical Sigmoid function"); AddChoice("classifier.ann.f.gau", "Gaussian function (Not completely supported)"); - SetParameterString("classifier.ann.f", "sig"); + SetParameterString("classifier.ann.f", "sig", false); SetParameterDescription("classifier.ann.f", "Neuron activation function."); //Alpha AddParameter(ParameterType_Float, "classifier.ann.a", "Alpha parameter of the activation function"); - SetParameterFloat("classifier.ann.a", 1.); + SetParameterFloat("classifier.ann.a",1., false); SetParameterDescription("classifier.ann.a", "Alpha parameter of the activation function (used only with sigmoid and gaussian functions)."); //Beta AddParameter(ParameterType_Float, "classifier.ann.b", "Beta parameter of the activation function"); - SetParameterFloat("classifier.ann.b", 1.); + SetParameterFloat("classifier.ann.b",1., false); SetParameterDescription("classifier.ann.b", "Beta parameter of the activation function (used only with sigmoid and gaussian functions)."); //BackPropDWScale AddParameter(ParameterType_Float, "classifier.ann.bpdw", "Strength of the weight gradient term in the BACKPROP method"); - SetParameterFloat("classifier.ann.bpdw", 0.1); + SetParameterFloat("classifier.ann.bpdw",0.1, false); SetParameterDescription( "classifier.ann.bpdw", "Strength of the weight gradient term in the BACKPROP method. The recommended value is about 0.1."); @@ -82,7 +82,7 @@ LearningApplicationBase<TInputValue,TOutputValue> //BackPropMomentScale AddParameter(ParameterType_Float, "classifier.ann.bpms", "Strength of the momentum term (the difference between weights on the 2 previous iterations)"); - SetParameterFloat("classifier.ann.bpms", 0.1); + SetParameterFloat("classifier.ann.bpms",0.1, false); SetParameterDescription( "classifier.ann.bpms", "Strength of the momentum term (the difference between weights on the 2 previous iterations). " @@ -92,12 +92,12 @@ LearningApplicationBase<TInputValue,TOutputValue> //RegPropDW0 AddParameter(ParameterType_Float, "classifier.ann.rdw", "Initial value Delta_0 of update-values Delta_{ij} in RPROP method"); - SetParameterFloat("classifier.ann.rdw", 0.1); + SetParameterFloat("classifier.ann.rdw",0.1, false); SetParameterDescription("classifier.ann.rdw", "Initial value Delta_0 of update-values Delta_{ij} in RPROP method (default = 0.1)."); //RegPropDWMin AddParameter(ParameterType_Float, "classifier.ann.rdwm", "Update-values lower limit Delta_{min} in RPROP method"); - SetParameterFloat("classifier.ann.rdwm", 1e-7); + SetParameterFloat("classifier.ann.rdwm",1e-7, false); SetParameterDescription( "classifier.ann.rdwm", "Update-values lower limit Delta_{min} in RPROP method. It must be positive (default = 1e-7)."); @@ -107,18 +107,18 @@ LearningApplicationBase<TInputValue,TOutputValue> AddChoice("classifier.ann.term.iter", "Maximum number of iterations"); AddChoice("classifier.ann.term.eps", "Epsilon"); AddChoice("classifier.ann.term.all", "Max. iterations + Epsilon"); - SetParameterString("classifier.ann.term", "all"); + SetParameterString("classifier.ann.term", "all", false); SetParameterDescription("classifier.ann.term", "Termination criteria."); //Epsilon AddParameter(ParameterType_Float, "classifier.ann.eps", "Epsilon value used in the Termination criteria"); - SetParameterFloat("classifier.ann.eps", 0.01); + SetParameterFloat("classifier.ann.eps",0.01, false); SetParameterDescription("classifier.ann.eps", "Epsilon value used in the Termination criteria."); //MaxIter AddParameter(ParameterType_Int, "classifier.ann.iter", "Maximum number of iterations used in the Termination criteria"); - SetParameterInt("classifier.ann.iter", 1000); + SetParameterInt("classifier.ann.iter",1000, false); SetParameterDescription("classifier.ann.iter", "Maximum number of iterations used in the Termination criteria."); } diff --git a/Modules/Applications/AppClassification/include/otbTrainRandomForests.txx b/Modules/Applications/AppClassification/include/otbTrainRandomForests.txx index 669b4562b6..7a507bb8f8 100644 --- a/Modules/Applications/AppClassification/include/otbTrainRandomForests.txx +++ b/Modules/Applications/AppClassification/include/otbTrainRandomForests.txx @@ -34,7 +34,7 @@ LearningApplicationBase<TInputValue,TOutputValue> "See complete documentation here \\url{http://docs.opencv.org/modules/ml/doc/random_trees.html}."); //MaxDepth AddParameter(ParameterType_Int, "classifier.rf.max", "Maximum depth of the tree"); - SetParameterInt("classifier.rf.max", 5); + SetParameterInt("classifier.rf.max",5, false); SetParameterDescription( "classifier.rf.max", "The depth of the tree. A low value will likely underfit and conversely a high value will likely overfit. " @@ -42,14 +42,14 @@ LearningApplicationBase<TInputValue,TOutputValue> //MinSampleCount AddParameter(ParameterType_Int, "classifier.rf.min", "Minimum number of samples in each node"); - SetParameterInt("classifier.rf.min", 10); + SetParameterInt("classifier.rf.min",10, false); SetParameterDescription( "classifier.rf.min", "If the number of samples in a node is smaller than this parameter, " "then the node will not be split. A reasonable value is a small percentage of the total data e.g. 1 percent."); //RegressionAccuracy AddParameter(ParameterType_Float, "classifier.rf.ra", "Termination Criteria for regression tree"); - SetParameterFloat("classifier.rf.ra", 0.); + SetParameterFloat("classifier.rf.ra",0., false); SetParameterDescription("classifier.rf.ra", "If all absolute differences between an estimated value in a node " "and the values of the train samples in this node are smaller than this regression accuracy parameter, " "then the node will not be split."); @@ -61,7 +61,7 @@ LearningApplicationBase<TInputValue,TOutputValue> //MaxNumberOfCategories AddParameter(ParameterType_Int, "classifier.rf.cat", "Cluster possible values of a categorical variable into K <= cat clusters to find a suboptimal split"); - SetParameterInt("classifier.rf.cat", 10); + SetParameterInt("classifier.rf.cat",10, false); SetParameterDescription( "classifier.rf.cat", "Cluster possible values of a categorical variable into K <= cat clusters to find a suboptimal split."); @@ -73,7 +73,7 @@ LearningApplicationBase<TInputValue,TOutputValue> //MaxNumberOfVariables AddParameter(ParameterType_Int, "classifier.rf.var", "Size of the randomly selected subset of features at each tree node"); - SetParameterInt("classifier.rf.var", 0); + SetParameterInt("classifier.rf.var",0, false); SetParameterDescription( "classifier.rf.var", "The size of the subset of features, randomly selected at each tree node, that are used to find the best split(s). " @@ -82,7 +82,7 @@ LearningApplicationBase<TInputValue,TOutputValue> //MaxNumberOfTrees AddParameter(ParameterType_Int, "classifier.rf.nbtrees", "Maximum number of trees in the forest"); - SetParameterInt("classifier.rf.nbtrees", 100); + SetParameterInt("classifier.rf.nbtrees",100, false); SetParameterDescription( "classifier.rf.nbtrees", "The maximum number of trees in the forest. Typically, the more trees you have, the better the accuracy. " @@ -92,7 +92,7 @@ LearningApplicationBase<TInputValue,TOutputValue> //ForestAccuracy AddParameter(ParameterType_Float, "classifier.rf.acc", "Sufficient accuracy (OOB error)"); - SetParameterFloat("classifier.rf.acc", 0.01); + SetParameterFloat("classifier.rf.acc",0.01, false); SetParameterDescription("classifier.rf.acc","Sufficient accuracy (OOB error)."); diff --git a/Modules/Applications/AppClassification/include/otbTrainSVM.txx b/Modules/Applications/AppClassification/include/otbTrainSVM.txx index d36c28dd05..2893b43e4b 100644 --- a/Modules/Applications/AppClassification/include/otbTrainSVM.txx +++ b/Modules/Applications/AppClassification/include/otbTrainSVM.txx @@ -37,35 +37,35 @@ namespace Wrapper { AddChoice("classifier.svm.m.epssvr", "Epsilon Support Vector Regression"); AddChoice("classifier.svm.m.nusvr", "Nu Support Vector Regression"); - SetParameterString("classifier.svm.m", "epssvr"); + SetParameterString("classifier.svm.m", "epssvr", false); } else { AddChoice("classifier.svm.m.csvc", "C support vector classification"); AddChoice("classifier.svm.m.nusvc", "Nu support vector classification"); AddChoice("classifier.svm.m.oneclass", "Distribution estimation (One Class SVM)"); - SetParameterString("classifier.svm.m", "csvc"); + SetParameterString("classifier.svm.m", "csvc", false); } AddParameter(ParameterType_Choice, "classifier.svm.k", "SVM Kernel Type"); AddChoice("classifier.svm.k.linear", "Linear"); AddChoice("classifier.svm.k.rbf", "Gaussian radial basis function"); AddChoice("classifier.svm.k.poly", "Polynomial"); AddChoice("classifier.svm.k.sigmoid", "Sigmoid"); - SetParameterString("classifier.svm.k", "linear"); + SetParameterString("classifier.svm.k", "linear", false); SetParameterDescription("classifier.svm.k", "SVM Kernel Type."); AddParameter(ParameterType_Float, "classifier.svm.c", "Cost parameter C"); - SetParameterFloat("classifier.svm.c", 1.0); + SetParameterFloat("classifier.svm.c",1.0, false); SetParameterDescription( "classifier.svm.c", "SVM models have a cost parameter C (1 by default) to control the trade-off between training errors and forcing rigid margins."); AddParameter(ParameterType_Float, "classifier.svm.nu", "Parameter nu of a SVM optimization problem (NU_SVC / ONE_CLASS)"); - SetParameterFloat("classifier.svm.nu", 0.0); + SetParameterFloat("classifier.svm.nu",0.0, false); SetParameterDescription("classifier.svm.nu", "Parameter nu of a SVM optimization problem."); if (this->m_RegressionFlag) { AddParameter(ParameterType_Float, "classifier.svm.p", "Parameter epsilon of a SVM optimization problem (EPS_SVR)"); - SetParameterFloat("classifier.svm.p", 1.0); + SetParameterFloat("classifier.svm.p",1.0, false); SetParameterDescription("classifier.svm.p", "Parameter epsilon of a SVM optimization problem (EPS_SVR)."); AddParameter(ParameterType_Choice, "classifier.svm.term", "Termination criteria"); @@ -75,22 +75,22 @@ namespace Wrapper AddChoice("classifier.svm.term.all", "Stops when either iteration or epsilon criteria is true"); AddParameter(ParameterType_Float, "classifier.svm.iter", "Maximum iteration"); - SetParameterFloat("classifier.svm.iter", 1000); + SetParameterFloat("classifier.svm.iter",1000, false); SetParameterDescription("classifier.svm.iter", "Maximum number of iterations (corresponds to the termination criteria 'iter')."); AddParameter(ParameterType_Float, "classifier.svm.eps", "Epsilon accuracy threshold"); - SetParameterFloat("classifier.svm.eps", FLT_EPSILON); + SetParameterFloat("classifier.svm.eps",FLT_EPSILON, false); SetParameterDescription("classifier.svm.eps", "Epsilon accuracy (corresponds to the termination criteria 'eps')."); } AddParameter(ParameterType_Float, "classifier.svm.coef0", "Parameter coef0 of a kernel function (POLY / SIGMOID)"); - SetParameterFloat("classifier.svm.coef0", 0.0); + SetParameterFloat("classifier.svm.coef0",0.0, false); SetParameterDescription("classifier.svm.coef0", "Parameter coef0 of a kernel function (POLY / SIGMOID)."); AddParameter(ParameterType_Float, "classifier.svm.gamma", "Parameter gamma of a kernel function (POLY / RBF / SIGMOID)"); - SetParameterFloat("classifier.svm.gamma", 1.0); + SetParameterFloat("classifier.svm.gamma",1.0, false); SetParameterDescription("classifier.svm.gamma", "Parameter gamma of a kernel function (POLY / RBF / SIGMOID)."); AddParameter(ParameterType_Float, "classifier.svm.degree", "Parameter degree of a kernel function (POLY)"); - SetParameterFloat("classifier.svm.degree", 1.0); + SetParameterFloat("classifier.svm.degree",1.0, false); SetParameterDescription("classifier.svm.degree", "Parameter degree of a kernel function (POLY)."); AddParameter(ParameterType_Empty, "classifier.svm.opt", "Parameters optimization"); MandatoryOff("classifier.svm.opt"); @@ -211,15 +211,15 @@ namespace Wrapper SVMClassifier->Save(modelPath); // Update the displayed parameters in the GUI after the training process, for further use of them - SetParameterFloat("classifier.svm.c", static_cast<float> (SVMClassifier->GetOutputC())); - SetParameterFloat("classifier.svm.nu", static_cast<float> (SVMClassifier->GetOutputNu())); + SetParameterFloat("classifier.svm.c",static_cast<float> (SVMClassifier->GetOutputC()), false); + SetParameterFloat("classifier.svm.nu",static_cast<float> (SVMClassifier->GetOutputNu()), false); if (this->m_RegressionFlag) { - SetParameterFloat("classifier.svm.p", static_cast<float> (SVMClassifier->GetOutputP())); + SetParameterFloat("classifier.svm.p",static_cast<float> (SVMClassifier->GetOutputP()), false); } - SetParameterFloat("classifier.svm.coef0", static_cast<float> (SVMClassifier->GetOutputCoef0())); - SetParameterFloat("classifier.svm.gamma", static_cast<float> (SVMClassifier->GetOutputGamma())); - SetParameterFloat("classifier.svm.degree", static_cast<float> (SVMClassifier->GetOutputDegree())); + SetParameterFloat("classifier.svm.coef0",static_cast<float> (SVMClassifier->GetOutputCoef0()), false); + SetParameterFloat("classifier.svm.gamma",static_cast<float> (SVMClassifier->GetOutputGamma()), false); + SetParameterFloat("classifier.svm.degree",static_cast<float> (SVMClassifier->GetOutputDegree()), false); } } //end namespace wrapper diff --git a/Modules/Applications/AppClassification/include/otbTrainSharkRandomForests.txx b/Modules/Applications/AppClassification/include/otbTrainSharkRandomForests.txx index c9b2d56569..cf9705b308 100644 --- a/Modules/Applications/AppClassification/include/otbTrainSharkRandomForests.txx +++ b/Modules/Applications/AppClassification/include/otbTrainSharkRandomForests.txx @@ -38,7 +38,7 @@ LearningApplicationBase<TInputValue,TOutputValue> //MaxNumberOfTrees AddParameter(ParameterType_Int, "classifier.sharkrf.nbtrees", "Maximum number of trees in the forest"); - SetParameterInt("classifier.sharkrf.nbtrees", 100); + SetParameterInt("classifier.sharkrf.nbtrees",100, false); SetParameterDescription( "classifier.sharkrf.nbtrees", "The maximum number of trees in the forest. Typically, the more trees you have, the better the accuracy. " @@ -48,7 +48,7 @@ LearningApplicationBase<TInputValue,TOutputValue> //NodeSize AddParameter(ParameterType_Int, "classifier.sharkrf.nodesize", "Min size of the node for a split"); - SetParameterInt("classifier.sharkrf.nodesize", 25); + SetParameterInt("classifier.sharkrf.nodesize",25, false); SetParameterDescription( "classifier.sharkrf.nodesize", "If the number of samples in a node is smaller than this parameter, " @@ -56,7 +56,7 @@ LearningApplicationBase<TInputValue,TOutputValue> //MTry AddParameter(ParameterType_Int, "classifier.sharkrf.mtry", "Number of features tested at each node"); - SetParameterInt("classifier.sharkrf.mtry", 0); + SetParameterInt("classifier.sharkrf.mtry",0, false); SetParameterDescription( "classifier.sharkrf.mtry", "The number of features (variables) which will be tested at each node in " @@ -66,7 +66,7 @@ LearningApplicationBase<TInputValue,TOutputValue> //OOB Ratio AddParameter(ParameterType_Float, "classifier.sharkrf.oobr", "Out of bound ratio"); - SetParameterFloat("classifier.sharkrf.oobr", 0.66); + SetParameterFloat("classifier.sharkrf.oobr",0.66, false); SetParameterDescription("classifier.sharkrf.oobr", "Set the fraction of the original training dataset to use as the out of bag sample." "A good default value is 0.66. "); diff --git a/Modules/Applications/AppDimensionalityReduction/app/otbDimensionalityReduction.cxx b/Modules/Applications/AppDimensionalityReduction/app/otbDimensionalityReduction.cxx index b3b15d108f..18d951eeda 100644 --- a/Modules/Applications/AppDimensionalityReduction/app/otbDimensionalityReduction.cxx +++ b/Modules/Applications/AppDimensionalityReduction/app/otbDimensionalityReduction.cxx @@ -191,7 +191,7 @@ private: unsigned int nbComp = static_cast<unsigned int> (GetParameterInt("nbcomp")); if (nbComp > nbComponents) { - SetParameterInt("nbcomp", nbComponents); + SetParameterInt("nbcomp",nbComponents, false); otbAppLogINFO( << "number of selected components can't exceed image dimension : "<<nbComponents ); } @@ -201,14 +201,14 @@ private: if (this->GetParameterString("outinv").size()!= 0) { otbAppLogWARNING(<<"This application only provides the forward transform for the MAF method."); - this->SetParameterString("outinv", ""); + this->SetParameterString("outinv", "", false); } this->DisableParameter("outinv"); if (this->GetParameterString("outmatrix").size()!= 0) { otbAppLogWARNING(<<"No transformation matrix available for MAF method."); - this->SetParameterString("outmatrix", ""); + this->SetParameterString("outmatrix", "", false); } this->DisableParameter("outmatrix"); @@ -220,7 +220,7 @@ private: unsigned int nbComp = static_cast<unsigned int> (GetParameterInt("nbcomp")); if ((nbComp != 0) && (nbComp != nbComponents)) { - SetParameterInt("nbcomp", nbComponents); + SetParameterInt("nbcomp",nbComponents, false); otbAppLogINFO( << "all components are kept when using MAF filter method."); } diff --git a/Modules/Applications/AppDomainTransform/app/otbDomainTransform.cxx b/Modules/Applications/AppDomainTransform/app/otbDomainTransform.cxx index 22f2834e01..dbd0d7759d 100644 --- a/Modules/Applications/AppDomainTransform/app/otbDomainTransform.cxx +++ b/Modules/Applications/AppDomainTransform/app/otbDomainTransform.cxx @@ -134,8 +134,8 @@ private: AddChoice("mode.wavelet.form.sym8", "SYMLET8"); //Default value - SetParameterString("mode", "wavelet"); - SetParameterString("mode.wavelet.form", "haar"); + SetParameterString("mode", "wavelet", false); + SetParameterString("mode.wavelet.form", "haar", false); AddParameter(ParameterType_Int,"mode.wavelet.nlevels","Number of decomposition levels"); SetParameterDescription("mode.wavelet.nlevels","Number of decomposition levels"); diff --git a/Modules/Applications/AppFiltering/app/otbSmoothing.cxx b/Modules/Applications/AppFiltering/app/otbSmoothing.cxx index 18cd825f50..14e6be7294 100644 --- a/Modules/Applications/AppFiltering/app/otbSmoothing.cxx +++ b/Modules/Applications/AppFiltering/app/otbSmoothing.cxx @@ -103,7 +103,7 @@ private: SetDefaultParameterInt("type.anidif.nbiter", 10); SetDefaultParameterInt("type.anidif.conductance", 1.); - SetParameterString("type", "anidif"); + SetParameterString("type", "anidif", false); // Doc example parameter settings SetExampleComment("Image smoothing using a mean filter.", 0); diff --git a/Modules/Applications/AppFusion/app/otbBundleToPerfectSensor.cxx b/Modules/Applications/AppFusion/app/otbBundleToPerfectSensor.cxx index 6274196921..48d0c9c0a8 100644 --- a/Modules/Applications/AppFusion/app/otbBundleToPerfectSensor.cxx +++ b/Modules/Applications/AppFusion/app/otbBundleToPerfectSensor.cxx @@ -72,8 +72,8 @@ private: Connect("pansharp.inp","superimpose.inr"); Connect("pansharp.ram","superimpose.ram"); - GetInternalApplication("superimpose")->SetParameterString("interpolator","bco"); - GetInternalApplication("pansharp")->SetParameterString("method","rcs"); + GetInternalApplication("superimpose")->SetParameterString("interpolator","bco", false); + GetInternalApplication("pansharp")->SetParameterString("method","rcs", false); // Doc example parameter settings SetDocExampleParameterValue("inp", "QB_Toulouse_Ortho_PAN.tif"); diff --git a/Modules/Applications/AppHyperspectral/app/otbHyperspectralUnmixing.cxx b/Modules/Applications/AppHyperspectral/app/otbHyperspectralUnmixing.cxx index 750dab500b..403368ec40 100644 --- a/Modules/Applications/AppHyperspectral/app/otbHyperspectralUnmixing.cxx +++ b/Modules/Applications/AppHyperspectral/app/otbHyperspectralUnmixing.cxx @@ -126,7 +126,7 @@ private: AddChoice("ua.mdmdnmf", "MDMDNMF"); SetParameterDescription("ua.mdmdnmf", "Minimum Dispersion Constrained Non Negative Matrix Factorization"); - SetParameterString("ua", "ucls"); + SetParameterString("ua", "ucls", false); // Doc example parameter settings SetDocExampleParameterValue("in", "cupriteSubHsi.tif"); SetDocExampleParameterValue("ie", "cupriteEndmembers.tif"); diff --git a/Modules/Applications/AppHyperspectral/app/otbVertexComponentAnalysis.cxx b/Modules/Applications/AppHyperspectral/app/otbVertexComponentAnalysis.cxx index 8191f40f62..214c77f4e4 100644 --- a/Modules/Applications/AppHyperspectral/app/otbVertexComponentAnalysis.cxx +++ b/Modules/Applications/AppHyperspectral/app/otbVertexComponentAnalysis.cxx @@ -65,7 +65,7 @@ private: AddParameter(ParameterType_Int, "ne", "Number of endmembers"); SetParameterDescription("ne","The number of endmembers to extract from the data cube"); - SetParameterInt("ne", 1); + SetParameterInt("ne",1, false); MandatoryOn("ne"); AddParameter(ParameterType_OutputImage, "outendm", "Output Endmembers"); diff --git a/Modules/Applications/AppImageUtils/app/otbColorMapping.cxx b/Modules/Applications/AppImageUtils/app/otbColorMapping.cxx index 5be5877096..cd1d0c4e89 100644 --- a/Modules/Applications/AppImageUtils/app/otbColorMapping.cxx +++ b/Modules/Applications/AppImageUtils/app/otbColorMapping.cxx @@ -342,11 +342,11 @@ private: AddParameter(ParameterType_Float,"method.continuous.min","Mapping range lower value"); SetParameterDescription("method.continuous.min","Set the lower input value of the mapping range."); - SetParameterFloat("method.continuous.min", 0.); + SetParameterFloat("method.continuous.min",0., false); AddParameter(ParameterType_Float,"method.continuous.max","Mapping range higher value"); SetParameterDescription("method.continuous.max","Set the higher input value of the mapping range."); - SetParameterFloat("method.continuous.max", 255.); + SetParameterFloat("method.continuous.max",255., false); // Optimal LUT AddChoice("method.optimal","Compute an optimized look-up table"); @@ -355,7 +355,7 @@ private: "[color to label] Searching all the colors present in the image to compute a continuous label list"); AddParameter(ParameterType_Int,"method.optimal.background", "Background label"); SetParameterDescription("method.optimal.background","Value of the background label"); - SetParameterInt("method.optimal.background", 0); + SetParameterInt("method.optimal.background",0, false); SetMinimumParameterIntValue("method.optimal.background", 0); SetMaximumParameterIntValue("method.optimal.background", 255); @@ -367,18 +367,18 @@ private: AddParameter(ParameterType_Float, "method.image.nodatavalue", "NoData value"); SetParameterDescription("method.image.nodatavalue","NoData value for each channel of the support image, which will not be handled in the LUT estimation. If NOT checked, ALL the pixel values of the support image will be handled in the LUT estimation."); MandatoryOff("method.image.nodatavalue"); - SetParameterFloat("method.image.nodatavalue", 0); + SetParameterFloat("method.image.nodatavalue",0, false); DisableParameter("method.image.nodatavalue"); AddParameter(ParameterType_Int, "method.image.low", "lower quantile"); SetParameterDescription("method.image.low","lower quantile for image normalization"); MandatoryOff("method.image.low"); - SetParameterInt("method.image.low", 2); + SetParameterInt("method.image.low",2, false); SetMinimumParameterIntValue("method.image.low", 0); SetMaximumParameterIntValue("method.image.low", 100); AddParameter(ParameterType_Int, "method.image.up", "upper quantile"); SetParameterDescription("method.image.up","upper quantile for image normalization"); MandatoryOff("method.image.up"); - SetParameterInt("method.image.up", 2); + SetParameterInt("method.image.up",2, false); SetMinimumParameterIntValue("method.image.up", 0); SetMaximumParameterIntValue("method.image.up", 100); @@ -400,7 +400,7 @@ private: if (GetParameterInt("method")==1 || GetParameterInt("method")==3) { otbAppLogWARNING("Override method : use optimal"); - SetParameterInt("method", 2); + SetParameterInt("method",2, false); } } } diff --git a/Modules/Applications/AppImageUtils/app/otbCompareImages.cxx b/Modules/Applications/AppImageUtils/app/otbCompareImages.cxx index 37210b5790..b7d34b93bb 100644 --- a/Modules/Applications/AppImageUtils/app/otbCompareImages.cxx +++ b/Modules/Applications/AppImageUtils/app/otbCompareImages.cxx @@ -220,10 +220,10 @@ private: otbAppLogINFO( << "PSNR: " << m_CompareFilter->GetPSNR() ); otbAppLogINFO( << "Number of Pixel different: " << m_CompareFilter->GetDiffCount() ); - SetParameterFloat( "mse", m_CompareFilter->GetMSE() ); - SetParameterFloat( "mae", m_CompareFilter->GetMAE() ); - SetParameterFloat( "psnr", m_CompareFilter->GetPSNR() ); - SetParameterFloat( "count", m_CompareFilter->GetDiffCount() ); + SetParameterFloat( "mse",m_CompareFilter->GetMSE() , false); + SetParameterFloat( "mae",m_CompareFilter->GetMAE() , false); + SetParameterFloat( "psnr",m_CompareFilter->GetPSNR() , false); + SetParameterFloat( "count",m_CompareFilter->GetDiffCount() , false); } diff --git a/Modules/Applications/AppImageUtils/app/otbConvert.cxx b/Modules/Applications/AppImageUtils/app/otbConvert.cxx index c5ec7a20bc..085fe5db06 100644 --- a/Modules/Applications/AppImageUtils/app/otbConvert.cxx +++ b/Modules/Applications/AppImageUtils/app/otbConvert.cxx @@ -99,7 +99,7 @@ private: AddChoice("type.none", "None"); AddChoice("type.linear", "Linear"); AddChoice("type.log2", "Log2"); - SetParameterString("type", "none"); + SetParameterString("type", "none", false); AddParameter(ParameterType_Float,"type.linear.gamma","Gamma correction factor"); SetParameterDescription("type.linear.gamma","Gamma correction factor"); diff --git a/Modules/Applications/AppImageUtils/app/otbExtractROI.cxx b/Modules/Applications/AppImageUtils/app/otbExtractROI.cxx index 8a3bc91d20..4983ff4dc1 100644 --- a/Modules/Applications/AppImageUtils/app/otbExtractROI.cxx +++ b/Modules/Applications/AppImageUtils/app/otbExtractROI.cxx @@ -126,8 +126,8 @@ private: if (!HasUserValue("sizex") && !HasUserValue("sizey") ) { - SetParameterInt("sizex", largestRegion.GetSize()[0]); - SetParameterInt("sizey", largestRegion.GetSize()[1]); + SetParameterInt("sizex",largestRegion.GetSize()[0], false); + SetParameterInt("sizey",largestRegion.GetSize()[1], false); } unsigned int nbComponents = inImage->GetNumberOfComponentsPerPixel(); @@ -164,8 +164,8 @@ private: if(!this->CropRegionOfInterest()) { // Put the index of the ROI to origin and try to crop again - SetParameterInt("startx", 0); - SetParameterInt("starty", 0); + SetParameterInt("startx",0, false); + SetParameterInt("starty",0, false); this->CropRegionOfInterest(); } } @@ -209,10 +209,10 @@ private: { if (region.Crop(GetParameterImage("in")->GetLargestPossibleRegion())) { - SetParameterInt("sizex", region.GetSize(0)); - SetParameterInt("sizey", region.GetSize(1)); - SetParameterInt("startx", region.GetIndex(0)); - SetParameterInt("starty", region.GetIndex(1)); + SetParameterInt("sizex",region.GetSize(0), HasUserValue("sizex")); + SetParameterInt("sizey",region.GetSize(1), HasUserValue("sizey")); + SetParameterInt("startx",region.GetIndex(0), HasUserValue("startx")); + SetParameterInt("starty",region.GetIndex(1), HasUserValue("starty")); return true; } } diff --git a/Modules/Applications/AppImageUtils/app/otbManageNoData.cxx b/Modules/Applications/AppImageUtils/app/otbManageNoData.cxx index 03d98cf42b..5611b960aa 100644 --- a/Modules/Applications/AppImageUtils/app/otbManageNoData.cxx +++ b/Modules/Applications/AppImageUtils/app/otbManageNoData.cxx @@ -109,7 +109,7 @@ private: SetParameterDescription("mode.apply.ndval","No Data value used according to the mask image"); SetDefaultParameterFloat("mode.apply.ndval", 0.0); - SetParameterString("mode","buildmask"); + SetParameterString("mode","buildmask", false); AddRAMParameter(); diff --git a/Modules/Applications/AppImageUtils/app/otbPixelValue.cxx b/Modules/Applications/AppImageUtils/app/otbPixelValue.cxx index f616b67886..ed170b21e6 100644 --- a/Modules/Applications/AppImageUtils/app/otbPixelValue.cxx +++ b/Modules/Applications/AppImageUtils/app/otbPixelValue.cxx @@ -147,7 +147,7 @@ private: std::ostringstream oss; oss << extractor->GetOutput()->GetPixel(id)<<std::endl; - SetParameterString("value", oss.str()); + SetParameterString("value", oss.str(), false); //Display image information in the dedicated logger otbAppLogINFO( << oss.str() ); diff --git a/Modules/Applications/AppImageUtils/app/otbQuicklook.cxx b/Modules/Applications/AppImageUtils/app/otbQuicklook.cxx index 7c3677041f..3c6a5e40a9 100644 --- a/Modules/Applications/AppImageUtils/app/otbQuicklook.cxx +++ b/Modules/Applications/AppImageUtils/app/otbQuicklook.cxx @@ -141,8 +141,8 @@ private: if (!HasUserValue("rsx") && !HasUserValue("rsy") ) { - SetParameterInt("rsx", largestRegion.GetSize()[0]); - SetParameterInt("rsy", largestRegion.GetSize()[1]); + SetParameterInt("rsx",largestRegion.GetSize()[0], false); + SetParameterInt("rsy",largestRegion.GetSize()[1], false); } // Put the limit of the index and the size relative the image @@ -163,8 +163,8 @@ private: if(!this->CropRegionOfInterest()) { // Put the index of the ROI to origin and try to crop again - SetParameterInt("rox", 0); - SetParameterInt("roy", 0); + SetParameterInt("rox",0, false); + SetParameterInt("roy",0, false); this->CropRegionOfInterest(); } } @@ -183,10 +183,10 @@ bool CropRegionOfInterest() { if (region.Crop(GetParameterImage("in")->GetLargestPossibleRegion())) { - SetParameterInt("rsx", region.GetSize(0)); - SetParameterInt("rsy", region.GetSize(1)); - SetParameterInt("rox", region.GetIndex(0)); - SetParameterInt("roy", region.GetIndex(1)); + SetParameterInt("rsx",region.GetSize(0), false); + SetParameterInt("rsy",region.GetSize(1), false); + SetParameterInt("rox",region.GetIndex(0), false); + SetParameterInt("roy",region.GetIndex(1), false); return true; } } diff --git a/Modules/Applications/AppImageUtils/app/otbReadImageInfo.cxx b/Modules/Applications/AppImageUtils/app/otbReadImageInfo.cxx index aaa1143fb5..8c78a284ec 100644 --- a/Modules/Applications/AppImageUtils/app/otbReadImageInfo.cxx +++ b/Modules/Applications/AppImageUtils/app/otbReadImageInfo.cxx @@ -262,7 +262,7 @@ private: ImageMetadataInterfaceType::Pointer metadataInterface = ImageMetadataInterfaceFactory::CreateIMI(inImage->GetMetaDataDictionary()); //Get number of bands - SetParameterInt("numberbands", inImage->GetNumberOfComponentsPerPixel()); + SetParameterInt("numberbands",inImage->GetNumberOfComponentsPerPixel(), false); ossOutput << "\tNumber of bands : " << GetParameterInt("numberbands") << std::endl; std::vector<bool> noDataValueAvailable; bool ret = itk::ExposeMetaData<std::vector<bool> >(inImage->GetMetaDataDictionary(),MetaDataKey::NoDataValueAvailable,noDataValueAvailable); @@ -293,26 +293,26 @@ private: ossOutput<<std::endl; //Get image size - SetParameterInt("indexx", inImage->GetLargestPossibleRegion().GetIndex()[0]); - SetParameterInt("indexy", inImage->GetLargestPossibleRegion().GetIndex()[1]); + SetParameterInt("indexx",inImage->GetLargestPossibleRegion().GetIndex()[0], false); + SetParameterInt("indexy",inImage->GetLargestPossibleRegion().GetIndex()[1], false); ossOutput << "\tStart index : [" << GetParameterInt("indexx") << "," << GetParameterInt("indexy") << "]" << std::endl; //Get image size - SetParameterInt("sizex", inImage->GetLargestPossibleRegion().GetSize()[0]); - SetParameterInt("sizey", inImage->GetLargestPossibleRegion().GetSize()[1]); + SetParameterInt("sizex",inImage->GetLargestPossibleRegion().GetSize()[0], false); + SetParameterInt("sizey",inImage->GetLargestPossibleRegion().GetSize()[1], false); ossOutput << "\tSize : [" << GetParameterInt("sizex") << "," << GetParameterInt("sizey") << "]" << std::endl; //Get image origin - SetParameterFloat("originx", inImage->GetOrigin()[0]); - SetParameterFloat("originy", inImage->GetOrigin()[1]); + SetParameterFloat("originx",inImage->GetOrigin()[0], false); + SetParameterFloat("originy",inImage->GetOrigin()[1], false); ossOutput << "\tOrigin : [" << GetParameterFloat("originx") << "," << GetParameterFloat("originy") << "]" << std::endl; //Get image spacing - SetParameterFloat("spacingx", inImage->GetSpacing()[0]); - SetParameterFloat("spacingy", inImage->GetSpacing()[1]); + SetParameterFloat("spacingx",inImage->GetSpacing()[0], false); + SetParameterFloat("spacingy",inImage->GetSpacing()[1], false); ossOutput << "\tSpacing : [" << GetParameterFloat("spacingx") << "," << GetParameterFloat("spacingy") << "]" << std::endl; //Estimate ground spacing @@ -331,14 +331,14 @@ private: approxGroundSpacing = groundSpacing->EvaluateAtIndex(index); //Get image estimated ground spacing (in m) - SetParameterFloat("estimatedgroundspacingx", approxGroundSpacing[0]); - SetParameterFloat("estimatedgroundspacingy", approxGroundSpacing[1]); + SetParameterFloat("estimatedgroundspacingx",approxGroundSpacing[0], false); + SetParameterFloat("estimatedgroundspacingy",approxGroundSpacing[1], false); ossOutput << "\tEstimated ground spacing (in meters): [" << GetParameterFloat("estimatedgroundspacingx") << "," << GetParameterFloat("estimatedgroundspacingy") << "]" << std::endl; ossOutput << std::endl << "Image acquisition information:" << std::endl; - SetParameterString("sensor", metadataInterface->GetSensorID()); + SetParameterString("sensor", metadataInterface->GetSensorID(), false); ossOutput << "\tSensor : "; if (!GetParameterString("sensor").empty()) ossOutput << GetParameterString("sensor"); @@ -348,11 +348,11 @@ private: ossOutput << "\tImage identification number: "; if (metadataInterface->GetImageKeywordlist().HasKey("image_id")) { - SetParameterString("id", metadataInterface->GetImageKeywordlist().GetMetadataByKey("image_id")); + SetParameterString("id", metadataInterface->GetImageKeywordlist().GetMetadataByKey("image_id"), false); ossOutput << GetParameterString("id"); } ossOutput << std::endl; - SetParameterString("projectionref", metadataInterface->GetProjectionRef()); + SetParameterString("projectionref", metadataInterface->GetProjectionRef(), false); if (!GetParameterString("projectionref").empty()) ossOutput << "\tImage projection : " << GetParameterString("projectionref") << std::endl; @@ -376,7 +376,7 @@ private: osstime<<"0"; osstime<<metadataInterface->GetMinute(); osstime<<":00"; - SetParameterString("time", osstime.str()); + SetParameterString("time", osstime.str(), false); ossOutput << "\tAcquisition time : " << GetParameterString("time") << std::endl; } @@ -405,29 +405,29 @@ private: if( !coord2name->GetCountryName().empty() ) { - SetParameterString("country", coord2name->GetCountryName()); + SetParameterString("country", coord2name->GetCountryName(), false); ossOutput << "\tCountry : " << GetParameterString("country") << std::endl; } else - SetParameterString("country", "Not available"); + SetParameterString("country", "Not available", false); if( !coord2name->GetPlaceName().empty() ) { - SetParameterString("town", coord2name->GetPlaceName()); + SetParameterString("town", coord2name->GetPlaceName(), false); ossOutput << "\tTown : " << GetParameterString("town") << std::endl; } else - SetParameterString("town", "Not available"); + SetParameterString("town", "Not available", false); // Retrieve footprint - SetParameterFloat("ullat", ullat); - SetParameterFloat("ullon", ullon); - SetParameterFloat("urlat", urlat); - SetParameterFloat("urlon", urlon); - SetParameterFloat("lrlat", lrlat); - SetParameterFloat("lrlon", lrlon); - SetParameterFloat("lllat", lllat); - SetParameterFloat("lllon", lllon); + SetParameterFloat("ullat",ullat, false); + SetParameterFloat("ullon",ullon, false); + SetParameterFloat("urlat",urlat, false); + SetParameterFloat("urlon",urlon, false); + SetParameterFloat("lrlat",lrlat, false); + SetParameterFloat("lrlon",lrlon, false); + SetParameterFloat("lllat",lllat, false); + SetParameterFloat("lllon",lllon, false); ossOutput << std::endl << "Image footprint coordinates:" << std::endl; ossOutput << "\tUpper left corner (latitude, longitude) = [" << GetParameterFloat("ullat") << "," << GetParameterFloat("ullon") << "]" << std::endl; @@ -439,15 +439,15 @@ private: { } - SetParameterInt("rgb.r", metadataInterface->GetDefaultDisplay()[0]); - SetParameterInt("rgb.g", metadataInterface->GetDefaultDisplay()[1]); - SetParameterInt("rgb.b", metadataInterface->GetDefaultDisplay()[2]); + SetParameterInt("rgb.r",metadataInterface->GetDefaultDisplay()[0], false); + SetParameterInt("rgb.g",metadataInterface->GetDefaultDisplay()[1], false); + SetParameterInt("rgb.b",metadataInterface->GetDefaultDisplay()[2], false); ossOutput << std::endl << "Image default RGB composition:" << std::endl; ossOutput << "\t[R, G, B] = [" << GetParameterInt("rgb.r") << "," << GetParameterInt("rgb.g") << "," << GetParameterInt("rgb.b") << "]" << std::endl; - SetParameterInt("gcp.count", metadataInterface->GetGCPCount()); - SetParameterString("gcp.proj", metadataInterface->GetGCPProjection()); + SetParameterInt("gcp.count",metadataInterface->GetGCPCount(), false); + SetParameterString("gcp.proj", metadataInterface->GetGCPProjection(), false); ossOutput << std::endl << "Ground control points information:" << std::endl; ossOutput << "\tNumber of GCPs = " << GetParameterInt("gcp.count") << std::endl; @@ -476,16 +476,16 @@ private: ossOutput << "\t\tGround coordinates =" << gcp_geocoord.back() << std::endl; } - SetParameterStringList("gcp.ids", gcp_ids); - SetParameterStringList("gcp.imcoord", gcp_imcoord); - SetParameterStringList("gcp.geocoord", gcp_geocoord); - SetParameterStringList("gcp.info", gcp_infos); + SetParameterStringList("gcp.ids", gcp_ids, false); + SetParameterStringList("gcp.imcoord", gcp_imcoord, false); + SetParameterStringList("gcp.geocoord", gcp_geocoord, false); + SetParameterStringList("gcp.info", gcp_infos, false); if ( IsParameterEnabled("keywordlist") ) { std::ostringstream osskeywordlist; osskeywordlist<<metadataInterface->GetImageKeywordlist() << std::endl; - SetParameterString("keyword", osskeywordlist.str()); + SetParameterString("keyword", osskeywordlist.str(), false); ossOutput << std::endl << "Image OSSIM keywordlist (optional):" << std::endl; ossOutput << "\t" << GetParameterString("keyword") << std::endl; diff --git a/Modules/Applications/AppMathParserX/app/otbBandMathX.cxx b/Modules/Applications/AppMathParserX/app/otbBandMathX.cxx index 19ef784627..53884d3afa 100644 --- a/Modules/Applications/AppMathParserX/app/otbBandMathX.cxx +++ b/Modules/Applications/AppMathParserX/app/otbBandMathX.cxx @@ -209,7 +209,7 @@ private: if (useContext) { // only set the first expression, 'ManyExpression' is disabled. - this->SetParameterString("exp",dummyFilter->GetExpression(0)); + this->SetParameterString("exp",dummyFilter->GetExpression(0), false); } } } diff --git a/Modules/Applications/AppOpticalCalibration/app/otbOpticalCalibration.cxx b/Modules/Applications/AppOpticalCalibration/app/otbOpticalCalibration.cxx index 10004ff353..93307da802 100644 --- a/Modules/Applications/AppOpticalCalibration/app/otbOpticalCalibration.cxx +++ b/Modules/Applications/AppOpticalCalibration/app/otbOpticalCalibration.cxx @@ -194,7 +194,7 @@ private: AddChoice("level.toa", "Image to Top Of Atmosphere reflectance"); AddChoice("level.toatoim", "TOA reflectance to Image"); AddChoice("level.toc", "Image to Top Of Canopy reflectance (atmospheric corrections)"); - SetParameterString("level", "toa"); + SetParameterString("level", "toa", false); AddParameter(ParameterType_Empty, "milli", "Convert to milli reflectance"); SetParameterDescription("milli", "Flag to use milli-reflectance instead of reflectance.\n" @@ -424,21 +424,21 @@ private: ossOutput << "Acquisition Minute already set by user: no overload" <<std::endl; else { - SetParameterInt("acqui.minute", lImageMetadataInterface->GetMinute()); + SetParameterInt("acqui.minute",lImageMetadataInterface->GetMinute(), false); } if (HasUserValue("acqui.hour")) ossOutput << "Acquisition Hour already set by user: no overload" <<std::endl; else { - SetParameterInt("acqui.hour", lImageMetadataInterface->GetHour()); + SetParameterInt("acqui.hour",lImageMetadataInterface->GetHour(), false); } if (HasUserValue("acqui.day")) ossOutput << "Acquisition Day already set by user: no overload" <<std::endl; else { - SetParameterInt("acqui.day", lImageMetadataInterface->GetDay()); + SetParameterInt("acqui.day",lImageMetadataInterface->GetDay(), false); if (IsParameterEnabled("acqui.fluxnormcoeff")) DisableParameter("acqui.day"); } @@ -447,7 +447,7 @@ private: ossOutput << "Acquisition Month already set by user: no overload" <<std::endl; else { - SetParameterInt("acqui.month", lImageMetadataInterface->GetMonth()); + SetParameterInt("acqui.month",lImageMetadataInterface->GetMonth(), false); if (IsParameterEnabled("acqui.fluxnormcoeff")) DisableParameter("acqui.month"); } @@ -456,28 +456,28 @@ private: ossOutput << "Acquisition Year already set by user: no overload" <<std::endl; else { - SetParameterInt("acqui.year", lImageMetadataInterface->GetYear()); + SetParameterInt("acqui.year",lImageMetadataInterface->GetYear(), false); } if (HasUserValue("acqui.sun.elev")) ossOutput << "Acquisition Sun Elevation Angle already set by user: no overload" <<std::endl; else - SetParameterFloat("acqui.sun.elev", lImageMetadataInterface->GetSunElevation()); + SetParameterFloat("acqui.sun.elev",lImageMetadataInterface->GetSunElevation(), false); if (HasUserValue("acqui.sun.azim")) ossOutput << "Acquisition Sun Azimuth Angle already set by user: no overload" <<std::endl; else - SetParameterFloat("acqui.sun.azim", lImageMetadataInterface->GetSunAzimuth()); + SetParameterFloat("acqui.sun.azim",lImageMetadataInterface->GetSunAzimuth(), false); if (HasUserValue("acqui.view.elev")) ossOutput << "Acquisition Viewing Elevation Angle already set by user: no overload" <<std::endl; else - SetParameterFloat("acqui.view.elev", lImageMetadataInterface->GetSatElevation()); + SetParameterFloat("acqui.view.elev",lImageMetadataInterface->GetSatElevation(), false); if (HasUserValue("acqui.view.azim")) ossOutput << "Acquisition Viewing Azimuth Angle already set by user: no overload" <<std::endl; else - SetParameterFloat("acqui.view.azim", lImageMetadataInterface->GetSatAzimuth()); + SetParameterFloat("acqui.view.azim",lImageMetadataInterface->GetSatAzimuth(), false); // Set default value so that they are stored somewhere even if // they are overloaded by user values diff --git a/Modules/Applications/AppProjection/app/otbConvertCartoToGeoPoint.cxx b/Modules/Applications/AppProjection/app/otbConvertCartoToGeoPoint.cxx index 718d791680..819b035884 100644 --- a/Modules/Applications/AppProjection/app/otbConvertCartoToGeoPoint.cxx +++ b/Modules/Applications/AppProjection/app/otbConvertCartoToGeoPoint.cxx @@ -117,8 +117,8 @@ private: otbAppLogINFO( << std::setprecision(10) << "Geographic Point (Long, Lat) : (" << geoPoint[0] << ", " << geoPoint[1] << ")" ); - SetParameterFloat( "long", geoPoint[0] ); - SetParameterFloat( "lat", geoPoint[1] ); + SetParameterFloat( "long",geoPoint[0] , false); + SetParameterFloat( "lat",geoPoint[1] , false); } }; diff --git a/Modules/Applications/AppProjection/app/otbConvertSensorToGeoPoint.cxx b/Modules/Applications/AppProjection/app/otbConvertSensorToGeoPoint.cxx index 3b3140b2b1..be3f19a20f 100644 --- a/Modules/Applications/AppProjection/app/otbConvertSensorToGeoPoint.cxx +++ b/Modules/Applications/AppProjection/app/otbConvertSensorToGeoPoint.cxx @@ -125,8 +125,8 @@ private: outputPoint = model->TransformPoint(point); // Set the value computed - SetParameterFloat("output.idx", outputPoint[0]); - SetParameterFloat("output.idy", outputPoint[1]); + SetParameterFloat("output.idx",outputPoint[0], false); + SetParameterFloat("output.idy",outputPoint[1], false); // Set the town and the neaerest city CoordinateToName::Pointer coord2name = CoordinateToName::New(); @@ -134,8 +134,8 @@ private: coord2name->SetLat(outputPoint[1]); coord2name->Evaluate(); - SetParameterString("output.town", coord2name->GetPlaceName()); - SetParameterString("output.country", coord2name->GetCountryName()); + SetParameterString("output.town", coord2name->GetPlaceName(), false); + SetParameterString("output.country", coord2name->GetCountryName(), false); } }; diff --git a/Modules/Applications/AppProjection/app/otbGridBasedImageResampling.cxx b/Modules/Applications/AppProjection/app/otbGridBasedImageResampling.cxx index 5d782b3d17..5a3286c466 100644 --- a/Modules/Applications/AppProjection/app/otbGridBasedImageResampling.cxx +++ b/Modules/Applications/AppProjection/app/otbGridBasedImageResampling.cxx @@ -170,7 +170,7 @@ private: AddParameter(ParameterType_Radius, "interpolator.bco.radius", "Radius for bicubic interpolation"); SetParameterDescription("interpolator.bco.radius","This parameter allows controlling the size of the bicubic interpolation filter. If the target pixel size is higher than the input pixel size, increasing this parameter will reduce aliasing artifacts."); SetDefaultParameterInt("interpolator.bco.radius", 2); - SetParameterString("interpolator","bco"); + SetParameterString("interpolator","bco", false); AddRAMParameter(); diff --git a/Modules/Applications/AppProjection/app/otbObtainUTMZoneFromGeoPoint.cxx b/Modules/Applications/AppProjection/app/otbObtainUTMZoneFromGeoPoint.cxx index e313373460..acfb9028fa 100644 --- a/Modules/Applications/AppProjection/app/otbObtainUTMZoneFromGeoPoint.cxx +++ b/Modules/Applications/AppProjection/app/otbObtainUTMZoneFromGeoPoint.cxx @@ -89,7 +89,7 @@ private: { int utmZone = otb::Utils::GetZoneFromGeoPoint(GetParameterFloat("lon"), GetParameterFloat("lat")); - SetParameterInt("utm", utmZone); + SetParameterInt("utm",utmZone, false); } }; diff --git a/Modules/Applications/AppProjection/app/otbOrthoRectification.cxx b/Modules/Applications/AppProjection/app/otbOrthoRectification.cxx index e94168465d..3d0624f663 100644 --- a/Modules/Applications/AppProjection/app/otbOrthoRectification.cxx +++ b/Modules/Applications/AppProjection/app/otbOrthoRectification.cxx @@ -263,28 +263,28 @@ private: // Fill the Gui with the computed parameters if (!HasUserValue("outputs.sizex")) - SetParameterInt("outputs.sizex", genericRSEstimator->GetOutputSize()[0]); + SetParameterInt("outputs.sizex",genericRSEstimator->GetOutputSize()[0], false); if (!HasUserValue("outputs.sizey")) - SetParameterInt("outputs.sizey", genericRSEstimator->GetOutputSize()[1]); + SetParameterInt("outputs.sizey",genericRSEstimator->GetOutputSize()[1], false); if (!HasUserValue("outputs.spacingx")) - SetParameterFloat("outputs.spacingx", genericRSEstimator->GetOutputSpacing()[0]); + SetParameterFloat("outputs.spacingx",genericRSEstimator->GetOutputSpacing()[0], false); if (!HasUserValue("outputs.spacingy")) - SetParameterFloat("outputs.spacingy", genericRSEstimator->GetOutputSpacing()[1]); + SetParameterFloat("outputs.spacingy",genericRSEstimator->GetOutputSpacing()[1], false); if (!HasUserValue("outputs.ulx")) - SetParameterFloat("outputs.ulx", genericRSEstimator->GetOutputOrigin()[0] - 0.5 * genericRSEstimator->GetOutputSpacing()[0]); + SetParameterFloat("outputs.ulx",genericRSEstimator->GetOutputOrigin()[0] - 0.5 * genericRSEstimator->GetOutputSpacing()[0], false); if (!HasUserValue("outputs.uly")) - SetParameterFloat("outputs.uly", genericRSEstimator->GetOutputOrigin()[1] - 0.5 * genericRSEstimator->GetOutputSpacing()[1]); + SetParameterFloat("outputs.uly",genericRSEstimator->GetOutputOrigin()[1] - 0.5 * genericRSEstimator->GetOutputSpacing()[1], false); if (!HasUserValue("outputs.lrx")) - SetParameterFloat("outputs.lrx", GetParameterFloat("outputs.ulx") + GetParameterFloat("outputs.spacingx") * static_cast<double>(GetParameterInt("outputs.sizex"))); + SetParameterFloat("outputs.lrx",GetParameterFloat("outputs.ulx") + GetParameterFloat("outputs.spacingx") * static_cast<double>(GetParameterInt("outputs.sizex")), false); if (!HasUserValue("outputs.lry")) - SetParameterFloat("outputs.lry", GetParameterFloat("outputs.uly") + GetParameterFloat("outputs.spacingy") * static_cast<double>(GetParameterInt("outputs.sizey"))); + SetParameterFloat("outputs.lry",GetParameterFloat("outputs.uly") + GetParameterFloat("outputs.spacingy") * static_cast<double>(GetParameterInt("outputs.sizey")), false); // Handle the spacing and size field following the mode // chose by the user @@ -325,8 +325,8 @@ private: MandatoryOff("outputs.ortho"); // Update lower right - SetParameterFloat("outputs.lrx", GetParameterFloat("outputs.ulx") + GetParameterFloat("outputs.spacingx") * static_cast<double>(GetParameterInt("outputs.sizex"))); - SetParameterFloat("outputs.lry", GetParameterFloat("outputs.uly") + GetParameterFloat("outputs.spacingy") * static_cast<double>(GetParameterInt("outputs.sizey"))); + SetParameterFloat("outputs.lrx",GetParameterFloat("outputs.ulx") + GetParameterFloat("outputs.spacingx") * static_cast<double>(GetParameterInt("outputs.sizex")), false); + SetParameterFloat("outputs.lry",GetParameterFloat("outputs.uly") + GetParameterFloat("outputs.spacingy") * static_cast<double>(GetParameterInt("outputs.sizey")), false); } break; case Mode_AutomaticSize: @@ -371,16 +371,16 @@ private: genericRSEstimator->Compute(); // Set the processed size relative to this forced spacing - SetParameterInt("outputs.sizex", genericRSEstimator->GetOutputSize()[0]); - SetParameterInt("outputs.sizey", genericRSEstimator->GetOutputSize()[1]); + SetParameterInt("outputs.sizex",genericRSEstimator->GetOutputSize()[0], false); + SetParameterInt("outputs.sizey",genericRSEstimator->GetOutputSize()[1], false); // Reset Origin to default - SetParameterFloat("outputs.ulx", genericRSEstimator->GetOutputOrigin()[0] - 0.5 * genericRSEstimator->GetOutputSpacing()[0]); - SetParameterFloat("outputs.uly", genericRSEstimator->GetOutputOrigin()[1] - 0.5 * genericRSEstimator->GetOutputSpacing()[1]); + SetParameterFloat("outputs.ulx",genericRSEstimator->GetOutputOrigin()[0] - 0.5 * genericRSEstimator->GetOutputSpacing()[0], false); + SetParameterFloat("outputs.uly",genericRSEstimator->GetOutputOrigin()[1] - 0.5 * genericRSEstimator->GetOutputSpacing()[1], false); // Update lower right - SetParameterFloat("outputs.lrx", GetParameterFloat("outputs.ulx") + GetParameterFloat("outputs.spacingx") * static_cast<double>(GetParameterInt("outputs.sizex"))); - SetParameterFloat("outputs.lry", GetParameterFloat("outputs.uly") + GetParameterFloat("outputs.spacingy") * static_cast<double>(GetParameterInt("outputs.sizey"))); + SetParameterFloat("outputs.lrx",GetParameterFloat("outputs.ulx") + GetParameterFloat("outputs.spacingx") * static_cast<double>(GetParameterInt("outputs.sizex")), false); + SetParameterFloat("outputs.lry",GetParameterFloat("outputs.uly") + GetParameterFloat("outputs.spacingy") * static_cast<double>(GetParameterInt("outputs.sizey")), false); } break; case Mode_AutomaticSpacing: @@ -425,16 +425,16 @@ private: genericRSEstimator->Compute(); // Set the processed spacing relative to this forced size - SetParameterFloat("outputs.spacingx", genericRSEstimator->GetOutputSpacing()[0]); - SetParameterFloat("outputs.spacingy", genericRSEstimator->GetOutputSpacing()[1]); + SetParameterFloat("outputs.spacingx",genericRSEstimator->GetOutputSpacing()[0], false); + SetParameterFloat("outputs.spacingy",genericRSEstimator->GetOutputSpacing()[1], false); // Reset Origin to default - SetParameterFloat("outputs.ulx", genericRSEstimator->GetOutputOrigin()[0] - 0.5 * genericRSEstimator->GetOutputSpacing()[0]); - SetParameterFloat("outputs.uly", genericRSEstimator->GetOutputOrigin()[1] - 0.5 * genericRSEstimator->GetOutputSpacing()[1]); + SetParameterFloat("outputs.ulx",genericRSEstimator->GetOutputOrigin()[0] - 0.5 * genericRSEstimator->GetOutputSpacing()[0], false); + SetParameterFloat("outputs.uly",genericRSEstimator->GetOutputOrigin()[1] - 0.5 * genericRSEstimator->GetOutputSpacing()[1], false); // Update lower right - SetParameterFloat("outputs.lrx", GetParameterFloat("outputs.ulx") + GetParameterFloat("outputs.spacingx") * static_cast<double>(GetParameterInt("outputs.sizex"))); - SetParameterFloat("outputs.lry", GetParameterFloat("outputs.uly") + GetParameterFloat("outputs.spacingy") * static_cast<double>(GetParameterInt("outputs.sizey"))); + SetParameterFloat("outputs.lrx",GetParameterFloat("outputs.ulx") + GetParameterFloat("outputs.spacingx") * static_cast<double>(GetParameterInt("outputs.sizex")), false); + SetParameterFloat("outputs.lry",GetParameterFloat("outputs.uly") + GetParameterFloat("outputs.spacingy") * static_cast<double>(GetParameterInt("outputs.sizey")), false); } break; @@ -478,9 +478,9 @@ private: // Set the processed size relative to this forced spacing if (vcl_abs(spacing[0]) > 0.0) - SetParameterInt("outputs.sizex", static_cast<int>(vcl_ceil((GetParameterFloat("outputs.lrx")-GetParameterFloat("outputs.ulx"))/spacing[0]))); + SetParameterInt("outputs.sizex",static_cast<int>(vcl_ceil((GetParameterFloat("outputs.lrx")-GetParameterFloat("outputs.ulx"))/spacing[0])), false); if (vcl_abs(spacing[1]) > 0.0) - SetParameterInt("outputs.sizey", static_cast<int>(vcl_ceil((GetParameterFloat("outputs.lry")-GetParameterFloat("outputs.uly"))/spacing[1]))); + SetParameterInt("outputs.sizey",static_cast<int>(vcl_ceil((GetParameterFloat("outputs.lry")-GetParameterFloat("outputs.uly"))/spacing[1])), false); } break; case Mode_OrthoFit: @@ -530,11 +530,11 @@ private: SetParameterInt("outputs.sizey",size[1]); SetParameterFloat("outputs.spacingx",spacing[0]); SetParameterFloat("outputs.spacingy",spacing[1]); - SetParameterFloat("outputs.ulx", orig[0] - 0.5 * spacing[0]); - SetParameterFloat("outputs.uly", orig[1] - 0.5 * spacing[1]); + SetParameterFloat("outputs.ulx",orig[0] - 0.5 * spacing[0], false); + SetParameterFloat("outputs.uly",orig[1] - 0.5 * spacing[1], false); // Update lower right - SetParameterFloat("outputs.lrx", GetParameterFloat("outputs.ulx") + GetParameterFloat("outputs.spacingx") * static_cast<double>(GetParameterInt("outputs.sizex"))); - SetParameterFloat("outputs.lry", GetParameterFloat("outputs.uly") + GetParameterFloat("outputs.spacingy") * static_cast<double>(GetParameterInt("outputs.sizey"))); + SetParameterFloat("outputs.lrx",GetParameterFloat("outputs.ulx") + GetParameterFloat("outputs.spacingx") * static_cast<double>(GetParameterInt("outputs.sizex")), false); + SetParameterFloat("outputs.lry",GetParameterFloat("outputs.uly") + GetParameterFloat("outputs.spacingy") * static_cast<double>(GetParameterInt("outputs.sizey")), false); } } break; @@ -580,11 +580,11 @@ private: // Use the smallest spacing (more precise grid) double optimalSpacing = std::min( vcl_abs(xgridspacing), vcl_abs(ygridspacing) ); otbAppLogINFO( "Setting grid spacing to " << optimalSpacing ); - SetParameterFloat("opt.gridspacing", optimalSpacing); + SetParameterFloat("opt.gridspacing",optimalSpacing, false); } else // if (m_OutputProjectionRef == otb::GeoInformationConversion::ToWKT(4326)) { - SetParameterFloat("opt.gridspacing", DefaultGridSpacingMeter); + SetParameterFloat("opt.gridspacing",DefaultGridSpacingMeter, false); } // if (m_OutputProjectionRef == otb::GeoInformationConversion::ToWKT(4326)) } // if (!HasUserValue("opt.gridspacing")) } // if (HasValue("io.in")) diff --git a/Modules/Applications/AppProjection/app/otbRigidTransformResample.cxx b/Modules/Applications/AppProjection/app/otbRigidTransformResample.cxx index f7ec69e7ef..c3bd9e3df9 100644 --- a/Modules/Applications/AppProjection/app/otbRigidTransformResample.cxx +++ b/Modules/Applications/AppProjection/app/otbRigidTransformResample.cxx @@ -156,7 +156,7 @@ private: AddParameter(ParameterType_Radius, "interpolator.bco.radius", "Radius for bicubic interpolation"); SetParameterDescription("interpolator.bco.radius","This parameter allows controlling the size of the bicubic interpolation filter. If the target pixel size is higher than the input pixel size, increasing this parameter will reduce aliasing artifacts."); SetDefaultParameterInt("interpolator.bco.radius", 2); - SetParameterString("interpolator","bco"); + SetParameterString("interpolator","bco", false); // RAM available AddRAMParameter("ram"); diff --git a/Modules/Applications/AppProjection/app/otbSuperimpose.cxx b/Modules/Applications/AppProjection/app/otbSuperimpose.cxx index ac37bdc6e7..71cb75003e 100644 --- a/Modules/Applications/AppProjection/app/otbSuperimpose.cxx +++ b/Modules/Applications/AppProjection/app/otbSuperimpose.cxx @@ -159,7 +159,7 @@ private: if(!HasUserValue("mode") && HasValue("inr") && HasValue("inm") && otb::PleiadesPToXSAffineTransformCalculator::CanCompute(GetParameterImage("inr"),GetParameterImage("inm"))) { otbAppLogWARNING("Forcing PHR mode with PHR data. You need to add \"-mode default\" to force the default mode with PHR images."); - SetParameterString("mode","phr"); + SetParameterString("mode","phr", false); } } diff --git a/Modules/Applications/AppSegmentation/app/otbHooverCompareSegmentation.cxx b/Modules/Applications/AppSegmentation/app/otbHooverCompareSegmentation.cxx index d8224dbf51..14fce9949d 100644 --- a/Modules/Applications/AppSegmentation/app/otbHooverCompareSegmentation.cxx +++ b/Modules/Applications/AppSegmentation/app/otbHooverCompareSegmentation.cxx @@ -292,10 +292,10 @@ private: m_InstanceFilter->Update(); - SetParameterFloat("rc", m_InstanceFilter->GetMeanRC()); - SetParameterFloat("rf", m_InstanceFilter->GetMeanRF()); - SetParameterFloat("ra", m_InstanceFilter->GetMeanRA()); - SetParameterFloat("rm", m_InstanceFilter->GetMeanRM()); + SetParameterFloat("rc",m_InstanceFilter->GetMeanRC(), false); + SetParameterFloat("rf",m_InstanceFilter->GetMeanRF(), false); + SetParameterFloat("ra",m_InstanceFilter->GetMeanRA(), false); + SetParameterFloat("rm",m_InstanceFilter->GetMeanRM(), false); } ImageToLabelMapFilterType::Pointer m_GTFilter; diff --git a/Modules/Applications/AppSegmentation/app/otbSegmentation.cxx b/Modules/Applications/AppSegmentation/app/otbSegmentation.cxx index 4234666c49..6454b130e6 100644 --- a/Modules/Applications/AppSegmentation/app/otbSegmentation.cxx +++ b/Modules/Applications/AppSegmentation/app/otbSegmentation.cxx @@ -305,11 +305,11 @@ private: AddParameter(ParameterType_String, "mode.vector.layername", "Layer name"); SetParameterDescription("mode.vector.layername", "Name of the layer in the vector file or database (default is Layer)."); - SetParameterString("mode.vector.layername", "layer"); + SetParameterString("mode.vector.layername", "layer", false); AddParameter(ParameterType_String, "mode.vector.fieldname", "Geometry index field name"); SetParameterDescription("mode.vector.fieldname", "Name of the field holding the geometry index in the output vector file or database."); - SetParameterString("mode.vector.fieldname", "DN"); + SetParameterString("mode.vector.fieldname", "DN", false); AddParameter(ParameterType_Int, "mode.vector.tilesize", "Tiles size"); SetParameterDescription("mode.vector.tilesize", diff --git a/Modules/Applications/AppStereo/app/otbStereoFramework.cxx b/Modules/Applications/AppStereo/app/otbStereoFramework.cxx index 1b18dc5b89..e4c4e030e2 100644 --- a/Modules/Applications/AppStereo/app/otbStereoFramework.cxx +++ b/Modules/Applications/AppStereo/app/otbStereoFramework.cxx @@ -346,7 +346,7 @@ private: SetParameterDescription("input.co","List of index of couples im image list. Couples must be separated by a comma. (index start at 0). for example : 0 1,1 2 will process a first couple composed of the first and the second image in image list, then the first and the third image\n. note that images are handled by pairs." " if left empty couples are created from input index i.e. a first couple will be composed of the first and second image, a second couple with third and fourth image etc. (in this case image list must be even)."); MandatoryOff("input.co"); - SetParameterString("input.co",""); + SetParameterString("input.co","", false); DisableParameter("input.co"); AddParameter(ParameterType_Int, "input.channel", "Image channel used for the block matching"); @@ -363,7 +363,7 @@ private: // // Build the Output Map Projection // for custom map projection MapProjectionParametersHandler::AddMapProjectionParameters(this, "map"); - SetParameterString("map","wgs"); + SetParameterString("map","wgs", false); AddParameter(ParameterType_Float, "output.res","Output resolution"); SetParameterDescription("output.res","Spatial sampling distance of the output elevation : the cell size (in m)"); diff --git a/Modules/Applications/AppVectorDataTranslation/app/otbRasterization.cxx b/Modules/Applications/AppVectorDataTranslation/app/otbRasterization.cxx index 683a46b834..1d3ebf78fa 100644 --- a/Modules/Applications/AppVectorDataTranslation/app/otbRasterization.cxx +++ b/Modules/Applications/AppVectorDataTranslation/app/otbRasterization.cxx @@ -129,7 +129,7 @@ private: AddParameter(ParameterType_String,"mode.attribute.field","The attribute field to burn"); SetParameterDescription("mode.attribute.field","Name of the attribute field to burn"); - SetParameterString("mode.attribute.field","DN"); + SetParameterString("mode.attribute.field","DN", false); AddRAMParameter(); diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h index 26c389002d..90d0a22665 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h @@ -172,10 +172,6 @@ public: * or a value set externally by user */ bool HasValue(std::string paramKey) const; - /* Activate or deactivate the bool parameter - */ - void SetParameterEmpty(std::string paramKey, bool active); - /* Get active flag of parameter with key paramKey */ bool GetParameterEmpty(std::string paramKey); @@ -204,13 +200,6 @@ public: */ /* Set the Parameter value and Update the UserFlag. used by xml parameter */ - void SetParameterInt(std::string parameter, int value, bool hasUserValueFlag); - void SetParameterFloat(std::string parameter, float value, bool hasUserValueFlag); - void SetParameterString(std::string parameter, std::string value, bool hasUserValueFlag); - void SetParameterStringList(std::string parameter, std::vector<std::string> values, bool hasUserValueFlag); - void SetParameterEmpty(std::string parameter, bool value, bool hasUserValueFlag); - - bool IsApplicationReady(); /* Set an integer value * @@ -220,14 +209,48 @@ public: * \li ParameterType_Radius * \li ParameterType_Choice */ - void SetParameterInt(std::string parameter, int value); + void SetParameterInt(std::string parameter, int value, bool hasUserValueFlag = true); /* Set a floating value * * Can be called for types : * \li ParameterType_Float */ - void SetParameterFloat(std::string parameter, float value); + void SetParameterFloat(std::string parameter, float value, bool hasUserValueFlag = true); + + /* Set a string value + * + * Can be called for types : + * \li ParameterType_InputImageListParameter + * \li ParameterType_InputVectorDataListParameter + * \li ParameterType_InputFilenameListParameter + * \li ParameterType_StringList + */ + void SetParameterString(std::string parameter, std::string value, bool hasUserValueFlag = true); + + /* Set a string value + * + * Can be called for types : + * \li ParameterType_String + * \li ParameterType_InputFilename + * \li ParameterType_OutputFilename + * \li ParameterType_Directory + * \li ParameterType_Choice + * \li ParameterType_Float + * \li ParameterType_Int + * \li ParameterType_Radius + * \li ParameterType_InputImageParameter + * \li ParameterType_InputComplexImageParameter + * \li ParameterType_InputVectorDataParameter + * \li ParameterType_OutputImageParameter + * \li ParameterType_OutputVectorDataParameter + */ + void SetParameterStringList(std::string parameter, std::vector<std::string> values, bool hasUserValueFlag = true); + + void SetParameterEmpty(std::string parameter, bool value, bool hasUserValueFlag = true); + + bool IsApplicationReady(); + /* Set an default integer value, must used in the * DoInit when setting a value by default @@ -309,35 +332,6 @@ public: * \li ParameterType_ListView */ void SetListViewSingleSelectionMode(std::string parameter, bool status); - - /* Set a string value - * - * Can be called for types : - * \li ParameterType_String - * \li ParameterType_InputFilename - * \li ParameterType_OutputFilename - * \li ParameterType_Directory - * \li ParameterType_Choice - * \li ParameterType_Float - * \li ParameterType_Int - * \li ParameterType_Radius - * \li ParameterType_InputImageParameter - * \li ParameterType_InputComplexImageParameter - * \li ParameterType_InputVectorDataParameter - * \li ParameterType_OutputImageParameter - * \li ParameterType_OutputVectorDataParameter - */ - void SetParameterString(std::string parameter, std::string value); - - /* Set a string value - * - * Can be called for types : - * \li ParameterType_InputImageListParameter - * \li ParameterType_InputVectorDataListParameter - * \li ParameterType_InputFilenameListParameter - * \li ParameterType_StringList - */ - void SetParameterStringList(std::string parameter, std::vector<std::string> value); /* Set an output image value * diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx index cf17ba6fc9..6a8a8795a4 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx @@ -105,30 +105,185 @@ Parameter* Application::GetParameterByKey(std::string name, bool follow) void Application::SetParameterInt(std::string parameter, int value, bool hasUserValueFlag) { - this->SetParameterInt(parameter, value); + Parameter* param = GetParameterByKey(parameter); + + if (dynamic_cast<IntParameter*>(param)) + { + IntParameter* paramInt = dynamic_cast<IntParameter*>(param); + paramInt->SetValue(value); + } + else if (dynamic_cast<FloatParameter*>(param)) + { + FloatParameter* paramFloat = dynamic_cast<FloatParameter*>(param); + paramFloat->SetValue(static_cast<float>(value)); + } + else if (dynamic_cast<RadiusParameter*>(param)) + { + RadiusParameter* paramRadius = dynamic_cast<RadiusParameter*>(param); + paramRadius->SetValue(static_cast<unsigned int>(value)); + } + else if (dynamic_cast<ChoiceParameter*>(param)) + { + ChoiceParameter* paramChoice = dynamic_cast<ChoiceParameter*>(param); + paramChoice->SetValue(value); + } + this->SetParameterUserValue(parameter, hasUserValueFlag); } void Application::SetParameterFloat(std::string parameter, float value, bool hasUserValueFlag) { - this->SetParameterFloat(parameter, value); + Parameter* param = GetParameterByKey(parameter); + + if (dynamic_cast<FloatParameter*>(param)) + { + FloatParameter* paramFloat = dynamic_cast<FloatParameter*>(param); + paramFloat->SetValue(value); + } + this->SetParameterUserValue(parameter, hasUserValueFlag); } void Application::SetParameterString(std::string parameter, std::string value, bool hasUserValueFlag) { - this->SetParameterString(parameter, value); + Parameter* param = GetParameterByKey(parameter); + + if (dynamic_cast<ChoiceParameter*>(param)) + { + ChoiceParameter* paramDown = dynamic_cast<ChoiceParameter*>(param); + paramDown->SetValue(value); + } + else if (dynamic_cast<ListViewParameter*>(param)) + { + ListViewParameter* paramDown = dynamic_cast<ListViewParameter*>(param); + paramDown->SetValue(value); + } + else if (dynamic_cast<StringParameter*>(param)) + { + StringParameter* paramDown = dynamic_cast<StringParameter*>(param); + paramDown->SetValue(value); + } + else if (dynamic_cast<InputFilenameParameter*>(param)) + { + InputFilenameParameter* paramDown = dynamic_cast<InputFilenameParameter*>(param); + paramDown->SetValue(value); + } + else if (dynamic_cast<OutputFilenameParameter*>(param)) + { + OutputFilenameParameter* paramDown = dynamic_cast<OutputFilenameParameter*>(param); + paramDown->SetValue(value); + } + else if (dynamic_cast<DirectoryParameter*>(param)) + { + DirectoryParameter* paramDown = dynamic_cast<DirectoryParameter*>(param); + paramDown->SetValue(value); + } + else if (dynamic_cast<FloatParameter*>(param)) + { + FloatParameter* paramDown = dynamic_cast<FloatParameter*>(param); + paramDown->SetValue(value); + } + else if (dynamic_cast<RadiusParameter*>(param)) + { + RadiusParameter* paramDown = dynamic_cast<RadiusParameter*>(param); + paramDown->SetValue(value); + } + else if (dynamic_cast<IntParameter*>(param)) + { + IntParameter* paramDown = dynamic_cast<IntParameter*>(param); + paramDown->SetValue(value); + } + else if (dynamic_cast<InputImageParameter*>(param)) + { + InputImageParameter* paramDown = dynamic_cast<InputImageParameter*>(param); + if ( !paramDown->SetFromFileName(value) ) + otbAppLogCRITICAL( <<"Invalid image filename " << value <<"."); + + } + else if (dynamic_cast<ComplexInputImageParameter*>(param)) + { + ComplexInputImageParameter* paramDown = dynamic_cast<ComplexInputImageParameter*>(param); + paramDown->SetFromFileName(value); + } + else if (dynamic_cast<InputVectorDataParameter*>(param)) + { + InputVectorDataParameter* paramDown = dynamic_cast<InputVectorDataParameter*>(param); + if ( !paramDown->SetFromFileName(value) ) + otbAppLogCRITICAL( <<"Invalid vector data filename " << value <<"."); + } + else if (dynamic_cast<OutputImageParameter*>(param)) + { + OutputImageParameter* paramDown = dynamic_cast<OutputImageParameter*>(param); + paramDown->SetFileName(value); + } + else if (dynamic_cast<ComplexOutputImageParameter*>(param)) + { + ComplexOutputImageParameter* paramDown = dynamic_cast<ComplexOutputImageParameter*>(param); + paramDown->SetFileName(value); + } + else if (dynamic_cast<OutputVectorDataParameter*>(param)) + { + OutputVectorDataParameter* paramDown = dynamic_cast<OutputVectorDataParameter*>(param); + paramDown->SetFileName(value); + } + else if (dynamic_cast<RAMParameter*>(param)) + { + RAMParameter* paramDown = dynamic_cast<RAMParameter*>(param); + paramDown->SetValue(value); + } + else if (dynamic_cast<OutputProcessXMLParameter*>(param)) + { + OutputProcessXMLParameter* paramDown = dynamic_cast<OutputProcessXMLParameter*>(param); + paramDown->SetValue(value); + } + else if (dynamic_cast<InputProcessXMLParameter*>(param)) + { + InputProcessXMLParameter* paramDown = dynamic_cast<InputProcessXMLParameter*>(param); + if ( !paramDown->SetFileName(value) ) + otbAppLogCRITICAL( <<"Invalid XML parameter filename " << value <<"."); + } + this->SetParameterUserValue(parameter, hasUserValueFlag); } void Application::SetParameterStringList(std::string parameter, std::vector<std::string> values, bool hasUserValueFlag) { - this->SetParameterStringList(parameter, values); + Parameter* param = GetParameterByKey(parameter); + + if (dynamic_cast<InputImageListParameter*>(param)) + { + InputImageListParameter* paramDown = dynamic_cast<InputImageListParameter*>(param); + if( !paramDown->SetListFromFileName(values) ) + otbAppLogCRITICAL( <<"At least one image filename is invalid."); + } + else if (dynamic_cast<InputVectorDataListParameter*>(param)) + { + InputVectorDataListParameter* paramDown = dynamic_cast<InputVectorDataListParameter*>(param); + if( !paramDown->SetListFromFileName(values) ) + otbAppLogCRITICAL( <<"At least one vector data filename is invalid.."); + } + else if (dynamic_cast<InputFilenameListParameter*>(param)) + { + InputFilenameListParameter* paramDown = dynamic_cast<InputFilenameListParameter*>(param); + if( !paramDown->SetListFromFileName(values) ) + otbAppLogCRITICAL( <<"At least one filename is invalid.."); + } + else if (dynamic_cast<StringListParameter*>(param)) + { + StringListParameter* paramDown = dynamic_cast<StringListParameter*>(param); + paramDown->SetValue(values); + } + else if(dynamic_cast<ListViewParameter *>(param)) + { + ListViewParameter * paramDown = dynamic_cast<ListViewParameter *>(param); + paramDown->SetSelectedNames(values); + } + this->SetParameterUserValue(parameter, hasUserValueFlag); } void Application::SetParameterEmpty(std::string parameter, bool value, bool hasUserValueFlag) { - this->SetParameterEmpty(parameter, value); + GetParameterByKey(parameter)->SetActive(value); this->SetParameterUserValue(parameter, hasUserValueFlag); } @@ -429,11 +584,6 @@ Role Application::GetParameterRole(std::string paramKey) const return GetParameterByKey(paramKey)->GetRole(); } -void Application::SetParameterEmpty(std::string paramKey, bool active) -{ - GetParameterByKey(paramKey)->SetActive(active); -} - bool Application::GetParameterEmpty(std::string paramKey) { return GetParameterByKey(paramKey)->GetActive(); @@ -588,42 +738,6 @@ std::vector<std::string> Application::GetChoiceNames(std::string name) itkExceptionMacro(<< name << " is not a choice parameter"); } -void Application::SetParameterInt(std::string parameter, int value) -{ - Parameter* param = GetParameterByKey(parameter); - - if (dynamic_cast<IntParameter*>(param)) - { - IntParameter* paramInt = dynamic_cast<IntParameter*>(param); - paramInt->SetValue(value); - } - else if (dynamic_cast<FloatParameter*>(param)) - { - FloatParameter* paramFloat = dynamic_cast<FloatParameter*>(param); - paramFloat->SetValue(static_cast<float>(value)); - } - else if (dynamic_cast<RadiusParameter*>(param)) - { - RadiusParameter* paramRadius = dynamic_cast<RadiusParameter*>(param); - paramRadius->SetValue(static_cast<unsigned int>(value)); - } - else if (dynamic_cast<ChoiceParameter*>(param)) - { - ChoiceParameter* paramChoice = dynamic_cast<ChoiceParameter*>(param); - paramChoice->SetValue(value); - } -} - -void Application::SetParameterFloat(std::string parameter, float value) -{ - Parameter* param = GetParameterByKey(parameter); - - if (dynamic_cast<FloatParameter*>(param)) - { - FloatParameter* paramFloat = dynamic_cast<FloatParameter*>(param); - paramFloat->SetValue(value); - } -} void Application::SetDefaultParameterInt(std::string parameter, int value) { @@ -759,140 +873,6 @@ void Application::SetListViewSingleSelectionMode(std::string parameter, bool sta } -void Application::SetParameterString(std::string parameter, std::string value) -{ - Parameter* param = GetParameterByKey(parameter); - - if (dynamic_cast<ChoiceParameter*>(param)) - { - ChoiceParameter* paramDown = dynamic_cast<ChoiceParameter*>(param); - paramDown->SetValue(value); - } - else if (dynamic_cast<ListViewParameter*>(param)) - { - ListViewParameter* paramDown = dynamic_cast<ListViewParameter*>(param); - paramDown->SetValue(value); - } - else if (dynamic_cast<StringParameter*>(param)) - { - StringParameter* paramDown = dynamic_cast<StringParameter*>(param); - paramDown->SetValue(value); - } - else if (dynamic_cast<InputFilenameParameter*>(param)) - { - InputFilenameParameter* paramDown = dynamic_cast<InputFilenameParameter*>(param); - paramDown->SetValue(value); - } - else if (dynamic_cast<OutputFilenameParameter*>(param)) - { - OutputFilenameParameter* paramDown = dynamic_cast<OutputFilenameParameter*>(param); - paramDown->SetValue(value); - } - else if (dynamic_cast<DirectoryParameter*>(param)) - { - DirectoryParameter* paramDown = dynamic_cast<DirectoryParameter*>(param); - paramDown->SetValue(value); - } - else if (dynamic_cast<FloatParameter*>(param)) - { - FloatParameter* paramDown = dynamic_cast<FloatParameter*>(param); - paramDown->SetValue(value); - } - else if (dynamic_cast<RadiusParameter*>(param)) - { - RadiusParameter* paramDown = dynamic_cast<RadiusParameter*>(param); - paramDown->SetValue(value); - } - else if (dynamic_cast<IntParameter*>(param)) - { - IntParameter* paramDown = dynamic_cast<IntParameter*>(param); - paramDown->SetValue(value); - } - else if (dynamic_cast<InputImageParameter*>(param)) - { - InputImageParameter* paramDown = dynamic_cast<InputImageParameter*>(param); - if ( !paramDown->SetFromFileName(value) ) - otbAppLogCRITICAL( <<"Invalid image filename " << value <<"."); - - } - else if (dynamic_cast<ComplexInputImageParameter*>(param)) - { - ComplexInputImageParameter* paramDown = dynamic_cast<ComplexInputImageParameter*>(param); - paramDown->SetFromFileName(value); - } - else if (dynamic_cast<InputVectorDataParameter*>(param)) - { - InputVectorDataParameter* paramDown = dynamic_cast<InputVectorDataParameter*>(param); - if ( !paramDown->SetFromFileName(value) ) - otbAppLogCRITICAL( <<"Invalid vector data filename " << value <<"."); - } - else if (dynamic_cast<OutputImageParameter*>(param)) - { - OutputImageParameter* paramDown = dynamic_cast<OutputImageParameter*>(param); - paramDown->SetFileName(value); - } - else if (dynamic_cast<ComplexOutputImageParameter*>(param)) - { - ComplexOutputImageParameter* paramDown = dynamic_cast<ComplexOutputImageParameter*>(param); - paramDown->SetFileName(value); - } - else if (dynamic_cast<OutputVectorDataParameter*>(param)) - { - OutputVectorDataParameter* paramDown = dynamic_cast<OutputVectorDataParameter*>(param); - paramDown->SetFileName(value); - } - else if (dynamic_cast<RAMParameter*>(param)) - { - RAMParameter* paramDown = dynamic_cast<RAMParameter*>(param); - paramDown->SetValue(value); - } - else if (dynamic_cast<OutputProcessXMLParameter*>(param)) - { - OutputProcessXMLParameter* paramDown = dynamic_cast<OutputProcessXMLParameter*>(param); - paramDown->SetValue(value); - } - else if (dynamic_cast<InputProcessXMLParameter*>(param)) - { - InputProcessXMLParameter* paramDown = dynamic_cast<InputProcessXMLParameter*>(param); - if ( !paramDown->SetFileName(value) ) - otbAppLogCRITICAL( <<"Invalid XML parameter filename " << value <<"."); - } -} - -void Application::SetParameterStringList(std::string parameter, std::vector<std::string> value) -{ - Parameter* param = GetParameterByKey(parameter); - - if (dynamic_cast<InputImageListParameter*>(param)) - { - InputImageListParameter* paramDown = dynamic_cast<InputImageListParameter*>(param); - if( !paramDown->SetListFromFileName(value) ) - otbAppLogCRITICAL( <<"At least one image filename is invalid."); - } - else if (dynamic_cast<InputVectorDataListParameter*>(param)) - { - InputVectorDataListParameter* paramDown = dynamic_cast<InputVectorDataListParameter*>(param); - if( !paramDown->SetListFromFileName(value) ) - otbAppLogCRITICAL( <<"At least one vector data filename is invalid.."); - } - else if (dynamic_cast<InputFilenameListParameter*>(param)) - { - InputFilenameListParameter* paramDown = dynamic_cast<InputFilenameListParameter*>(param); - if( !paramDown->SetListFromFileName(value) ) - otbAppLogCRITICAL( <<"At least one filename is invalid.."); - } - else if (dynamic_cast<StringListParameter*>(param)) - { - StringListParameter* paramDown = dynamic_cast<StringListParameter*>(param); - paramDown->SetValue(value); - } - else if(dynamic_cast<ListViewParameter *>(param)) - { - ListViewParameter * paramDown = dynamic_cast<ListViewParameter *>(param); - paramDown->SetSelectedNames(value); - } -} - void Application::SetParameterOutputImage(std::string parameter, FloatVectorImageType* value) { Parameter* param = GetParameterByKey(parameter); diff --git a/Modules/Wrappers/SWIG/src/otbApplication.i b/Modules/Wrappers/SWIG/src/otbApplication.i index aa93633ba3..d02d01a36d 100644 --- a/Modules/Wrappers/SWIG/src/otbApplication.i +++ b/Modules/Wrappers/SWIG/src/otbApplication.i @@ -181,16 +181,11 @@ public: bool IsApplicationReady(); - void SetParameterInt(std::string parameter, int value); - void SetParameterFloat(std::string parameter, float value); - void SetParameterString(std::string parameter, std::string value); - void SetParameterStringList(std::string parameter, std::vector<std::string> value); - - void SetParameterInt(std::string parameter, int value, bool hasUserValueFlag); - void SetParameterFloat(std::string parameter, float value, bool hasUserValueFlag); - void SetParameterString(std::string parameter, std::string value, bool hasUserValueFlag); - void SetParameterStringList(std::string parameter, std::vector<std::string> values, bool hasUserValueFlag); - void SetParameterEmpty(std::string parameter, bool value, bool hasUserValueFlag); + void SetParameterInt(std::string parameter, int value, bool hasUserValueFlag = true); + void SetParameterFloat(std::string parameter, float value, bool hasUserValueFlag = true); + void SetParameterString(std::string parameter, std::string value, bool hasUserValueFlag = true); + void SetParameterStringList(std::string parameter, std::vector<std::string> values, bool hasUserValueFlag = true); + void SetParameterEmpty(std::string parameter, bool value, bool hasUserValueFlag = true); void SetParameterOutputImagePixelType(std::string parameter, otb::Wrapper::ImagePixelType pixelType); void SetParameterComplexOutputImagePixelType(std::string parameter, otb::Wrapper::ComplexImagePixelType cpixelType); @@ -416,6 +411,7 @@ private: void operator =(const Application&); }; + DECLARE_REF_COUNT_CLASS( Application ) -- GitLab