Commit d2458cd0 authored by Guillaume Pasero's avatar Guillaume Pasero

ENH: replace Empty by Bool parameter in Applications

parent 66b32a13
......@@ -92,7 +92,7 @@ private:
SetParameterDescription("ip.radius", "The radius of the ball shaped structuring element (expressed in pixels). By default, 'ip.radius = 1 pixel'.");
SetDefaultParameterInt("ip.radius", 1.0);
AddParameter(ParameterType_Empty, "ip.suvbool", "Multiple majority: Undecided(X)/Original");
AddParameter(ParameterType_Bool, "ip.suvbool", "Multiple majority: Undecided(X)/Original");
SetParameterDescription("ip.suvbool", "Pixels with more than 1 majority class are marked as Undecided if this parameter is checked (true), or keep their Original labels otherwise (false). Please note that the Undecided value must be different from existing labels in the input labeled image. By default, 'ip.suvbool = false'.");
AddParameter(ParameterType_Int, "ip.nodatalabel", "Label for the NoData class");
......@@ -103,7 +103,7 @@ private:
SetParameterDescription("ip.undecidedlabel", "Label for the Undecided class. By default, 'ip.undecidedlabel = 0'.");
SetDefaultParameterInt("ip.undecidedlabel", 0.0);
AddParameter(ParameterType_Empty, "ip.onlyisolatedpixels", "Process isolated pixels only");
AddParameter(ParameterType_Bool, "ip.onlyisolatedpixels", "Process isolated pixels only");
SetParameterDescription("ip.onlyisolatedpixels", "Only pixels whose label is unique in the neighbordhood will be processed. By default, 'ip.onlyisolatedpixels = false'.");
AddParameter(ParameterType_Int, "ip.isolatedthreshold", "Threshold for isolated pixels");
......@@ -153,7 +153,7 @@ private:
m_NeighMajVotingFilter->SetLabelForUndecidedPixels(GetParameterInt("ip.undecidedlabel"));
// Set to Undecided label if NOT unique Majority Voting
if (IsParameterEnabled("ip.suvbool"))
if (GetParameterInt("ip.suvbool"))
{
m_NeighMajVotingFilter->SetKeepOriginalLabelBool(false);
}
......@@ -164,7 +164,7 @@ private:
}
// Process isolated pixels only
if (IsParameterEnabled("ip.onlyisolatedpixels"))
if (GetParameterInt("ip.onlyisolatedpixels"))
{
m_NeighMajVotingFilter->SetOnlyIsolatedPixels(true);
m_NeighMajVotingFilter->SetIsolatedThreshold(GetParameterInt("ip.isolatedthreshold"));
......
......@@ -164,9 +164,8 @@ private:
SetParameterDescription("maxnbit","Maximum number of optimizer iteration (default 200)");
SetParameterInt("maxnbit",200, false);
AddParameter(ParameterType_Empty,"optobs","Optimizer Observer");
AddParameter(ParameterType_Bool,"optobs","Optimizer Observer");
SetParameterDescription("optobs","Activate the optimizer observer");
MandatoryOff("optobs");
AddParameter(ParameterType_OutputFilename,"out","Output filename");
SetParameterDescription("out","Output model file name (xml file) contains the optimal model to perform information fusion.");
......@@ -405,7 +404,7 @@ private:
// Create the Command observer and register it with the optimizer.
CommandIterationUpdate::Pointer observer = CommandIterationUpdate::New();
if (IsParameterEnabled("optobs"))
if (GetParameterInt("optobs"))
{
m_Optimizer->AddObserver(itk::IterationEvent(), observer);
}
......
......@@ -59,11 +59,10 @@ protected:
InitKMClassification();
// init at the end cleanup
AddParameter( ParameterType_Empty, "cleanup", "Temporary files cleaning" );
EnableParameter( "cleanup" );
AddParameter( ParameterType_Bool, "cleanup", "Temporary files cleaning" );
SetParameterDescription( "cleanup",
"If activated, the application will try to clean all temporary files it created" );
MandatoryOff( "cleanup" );
SetParameterInt("cleanup", 1);
}
void InitKMSampling()
......@@ -497,7 +496,7 @@ private:
Superclass::CreateOutMeansFile(GetParameterImage("in"), fileNames.modelFile, GetParameterInt("nc"));
// Remove all tempory files
if( IsParameterEnabled( "cleanup" ) )
if( GetParameterInt( "cleanup" ) )
{
otbAppLogINFO( <<"Final clean-up ..." );
fileNames.clear();
......
......@@ -205,7 +205,7 @@ public:
TrainModel( imageList, fileNames.sampleTrainOutputs, fileNames.sampleValidOutputs );
// cleanup
if( IsParameterEnabled( "cleanup" ) )
if( GetParameterInt( "cleanup" ) )
{
otbAppLogINFO( <<"Final clean-up ..." );
fileNames.clear();
......
......@@ -112,7 +112,7 @@ protected:
contingencyTableCalculator->Compute(performanceLabeledListSample->Begin(),
performanceLabeledListSample->End(),predictedListSample->Begin(), predictedListSample->End());
if(IsParameterEnabled("v"))
if(GetParameterInt("v"))
{
otbAppLogINFO( "Training performances:" );
otbAppLogINFO(<<"Contingency table: reference labels (rows) vs. produced labels (cols)\n"
......
......@@ -130,7 +130,7 @@ private:
SetParameterDescription("feat","List of field names in the input vector data used as features for training. "
"Put the same field names as the TrainVectorClassifier application.");
AddParameter(ParameterType_Empty, "confmap", "Confidence map");
AddParameter(ParameterType_Bool, "confmap", "Confidence map");
SetParameterDescription( "confmap", "Confidence map of the produced classification. "
"The confidence index depends on the model : \n"
" - LibSVM : difference between the two highest probabilities "
......@@ -145,7 +145,6 @@ private:
" * RandomForest : Confidence (proportion of votes for the majority class). "
"Margin (normalized difference of the votes of the 2 majority classes) is not available for now.\n"
" * SVM : distance to margin (only works for 2-class models).\n");
MandatoryOff("confmap");
AddParameter(ParameterType_OutputFilename, "out", "Output vector data file containing class labels");
SetParameterDescription("out","Output vector data file storing sample values (OGR format)."
......@@ -271,10 +270,10 @@ private:
ConfidenceListSampleType::Pointer quality;
bool computeConfidenceMap(IsParameterEnabled("confmap") && m_Model->HasConfidenceIndex()
bool computeConfidenceMap(GetParameterInt("confmap") && m_Model->HasConfidenceIndex()
&& !m_Model->GetRegressionMode());
if (!m_Model->HasConfidenceIndex() && IsParameterEnabled("confmap"))
if (!m_Model->HasConfidenceIndex() && GetParameterInt("confmap"))
{
otbAppLogWARNING("Confidence map requested but the classifier doesn't support it!");
}
......
......@@ -90,13 +90,13 @@ LearningApplicationBase<TInputValue,TOutputValue>
"is equal to cv_folds.");
//Use1seRule
AddParameter(ParameterType_Empty, "classifier.dt.r", "Set Use1seRule flag to false");
AddParameter(ParameterType_Bool, "classifier.dt.r", "Set Use1seRule flag to false");
SetParameterDescription("classifier.dt.r",
"If true, then a pruning will be harsher. This will make a tree more compact and more "
"resistant to the training data noise but a bit less accurate.");
//TruncatePrunedTree
AddParameter(ParameterType_Empty, "classifier.dt.t", "Set TruncatePrunedTree flag to false");
AddParameter(ParameterType_Bool, "classifier.dt.t", "Set TruncatePrunedTree flag to false");
SetParameterDescription("classifier.dt.t",
"If true, then pruned branches are physically removed from the tree.");
......@@ -121,11 +121,11 @@ LearningApplicationBase<TInputValue,TOutputValue>
classifier->SetRegressionAccuracy(GetParameterFloat("classifier.dt.ra"));
classifier->SetMaxCategories(GetParameterInt("classifier.dt.cat"));
classifier->SetCVFolds(GetParameterInt("classifier.dt.f"));
if (IsParameterEnabled("classifier.dt.r"))
if (GetParameterInt("classifier.dt.r"))
{
classifier->SetUse1seRule(false);
}
if (IsParameterEnabled("classifier.dt.t"))
if (GetParameterInt("classifier.dt.t"))
{
classifier->SetTruncatePrunedTree(false);
}
......
......@@ -39,11 +39,10 @@ void TrainImagesBase::InitIO()
SetParameterDescription( "io.vd", "A list of vector data to select the training samples." );
MandatoryOn( "io.vd" );
AddParameter( ParameterType_Empty, "cleanup", "Temporary files cleaning" );
EnableParameter( "cleanup" );
AddParameter( ParameterType_Bool, "cleanup", "Temporary files cleaning" );
SetParameterDescription( "cleanup",
"If activated, the application will try to clean all temporary files it created" );
MandatoryOff( "cleanup" );
SetParameterInt( "cleanup", 1);
}
void TrainImagesBase::InitSampling()
......
......@@ -105,11 +105,10 @@ namespace Wrapper
"the smoother the decision.");
// It seems that it miss a nu parameter for the nu-SVM use.
AddParameter(ParameterType_Empty, "classifier.libsvm.opt", "Parameters optimization");
MandatoryOff("classifier.libsvm.opt");
AddParameter(ParameterType_Bool, "classifier.libsvm.opt", "Parameters optimization");
SetParameterDescription("classifier.libsvm.opt", "SVM parameters optimization flag.");
AddParameter(ParameterType_Empty, "classifier.libsvm.prob", "Probability estimation");
MandatoryOff("classifier.libsvm.prob");
AddParameter(ParameterType_Bool, "classifier.libsvm.prob", "Probability estimation");
SetParameterDescription("classifier.libsvm.prob", "Probability estimation flag.");
if (this->m_RegressionFlag)
......@@ -137,14 +136,8 @@ namespace Wrapper
libSVMClassifier->SetTargetListSample(trainingLabeledListSample);
//SVM Option
//TODO : Add other options ?
if (IsParameterEnabled("classifier.libsvm.opt"))
{
libSVMClassifier->SetParameterOptimization(true);
}
if (IsParameterEnabled("classifier.libsvm.prob"))
{
libSVMClassifier->SetDoProbabilityEstimates(true);
}
libSVMClassifier->SetParameterOptimization(GetParameterInt("classifier.libsvm.opt"));
libSVMClassifier->SetDoProbabilityEstimates(GetParameterInt("classifier.libsvm.prob"));
libSVMClassifier->SetNu(GetParameterFloat("classifier.libsvm.nu"));
libSVMClassifier->SetC(GetParameterFloat("classifier.libsvm.c"));
......
......@@ -112,9 +112,8 @@ namespace Wrapper
SetParameterFloat("classifier.svm.degree",1.0, false);
SetParameterDescription("classifier.svm.degree",
"Parameter degree of a kernel function (POLY).");
AddParameter(ParameterType_Empty, "classifier.svm.opt",
AddParameter(ParameterType_Bool, "classifier.svm.opt",
"Parameters optimization");
MandatoryOff("classifier.svm.opt");
SetParameterDescription("classifier.svm.opt", "SVM parameters optimization flag.\n"
"-If set to True, then the optimal SVM parameters will be estimated. "
"Parameters are considered optimal by OpenCV when the cross-validation estimate of "
......@@ -229,10 +228,7 @@ namespace Wrapper
SVMClassifier->SetCoef0(GetParameterFloat("classifier.svm.coef0"));
SVMClassifier->SetGamma(GetParameterFloat("classifier.svm.gamma"));
SVMClassifier->SetDegree(GetParameterFloat("classifier.svm.degree"));
if (IsParameterEnabled("classifier.svm.opt"))
{
SVMClassifier->SetParameterOptimization(true);
}
SVMClassifier->SetParameterOptimization(GetParameterInt("classifier.svm.opt"));
SVMClassifier->Train();
SVMClassifier->Save(modelPath);
......
......@@ -91,10 +91,9 @@ void TrainVectorBase::DoInit()
"The contingency table is output when we unsupervised algorithms is used otherwise the confusion matrix is output." );
MandatoryOff( "io.confmatout" );
AddParameter(ParameterType_Empty, "v", "Verbose mode");
EnableParameter("v");
AddParameter(ParameterType_Bool, "v", "Verbose mode");
SetParameterDescription("v", "Verbose mode, display the contingency table result.");
MandatoryOff("v");
SetParameterInt("v", 1);
// Doc example parameter settings
SetDocExampleParameterValue( "io.vd", "vectorData.shp" );
......
......@@ -135,10 +135,8 @@ private:
SetMinimumParameterFloatValue("threshold",0.0);
SetDefaultParameterFloat("threshold",0.6);
AddParameter(ParameterType_Empty,"backmatching","Use back-matching to filter matches.");
AddParameter(ParameterType_Bool,"backmatching","Use back-matching to filter matches.");
SetParameterDescription("backmatching","If set to true, matches should be consistent in both ways.");
MandatoryOff("backmatching");
DisableParameter("backmatching");
AddParameter(ParameterType_Choice,"mode","Keypoints search mode");
......@@ -177,10 +175,10 @@ private:
SetParameterDescription("precision","Estimated precision of the colocalisation function in pixels");
SetDefaultParameterFloat("precision",0.);
AddParameter(ParameterType_Empty,"mfilter","Filter points according to geographical or sensor based colocalisation");
AddParameter(ParameterType_Bool,"mfilter","Filter points according to geographical or sensor based colocalisation");
SetParameterDescription("mfilter","If enabled, this option allows one to filter matches according to colocalisation from sensor or geographical information, using the given tolerancy expressed in pixels");
AddParameter(ParameterType_Empty,"2wgs84","If enabled, points from second image will be exported in WGS84");
AddParameter(ParameterType_Bool,"2wgs84","If enabled, points from second image will be exported in WGS84");
// Elevation
ElevationParametersHandler::AddElevationParameters(this, "elev");
......@@ -251,7 +249,7 @@ private:
matchingFilter->SetInput1(surf1->GetOutput());
matchingFilter->SetInput2(surf2->GetOutput());
matchingFilter->SetDistanceThreshold(GetParameterFloat("threshold"));
matchingFilter->SetUseBackMatching(IsParameterEnabled("backmatching"));
matchingFilter->SetUseBackMatching(GetParameterInt("backmatching"));
}
try
......@@ -276,7 +274,7 @@ private:
bool filtered = false;
if(IsParameterEnabled("mfilter"))
if(GetParameterInt("mfilter"))
{
pprime1 = rsTransform->TransformPoint(point1);
error = vcl_sqrt((point2[0]-pprime1[0])*(point2[0]-pprime1[0])+(point2[1]-pprime1[1])*(point2[1]-pprime1[1]));
......@@ -289,7 +287,7 @@ private:
if(!filtered)
{
if(IsParameterEnabled("2wgs84"))
if(GetParameterInt("2wgs84"))
{
pprime2 = rsTransform2ToWGS84->TransformPoint(point2);
......
......@@ -164,9 +164,8 @@ private:
MandatoryOff("nbcomp");
SetMinimumParameterIntValue("nbcomp", 0);
AddParameter(ParameterType_Empty, "normalize", "Normalize.");
AddParameter(ParameterType_Bool, "normalize", "Normalize.");
SetParameterDescription("normalize", "center AND reduce data before Dimensionality reduction.");
MandatoryOff("normalize");
AddParameter(ParameterType_OutputFilename, "outmatrix", "Transformation matrix output (text format)");
SetParameterDescription("outmatrix", "Filename to store the transformation matrix (csv format)");
......@@ -237,7 +236,7 @@ private:
// Get Parameters
int nbComp = GetParameterInt("nbcomp");
bool normalize = IsParameterEnabled("normalize");
bool normalize = GetParameterInt("normalize");
bool rescale = IsParameterEnabled("rescale");
bool invTransform = HasValue("outinv") && IsParameterEnabled("outinv");
......
......@@ -134,7 +134,7 @@ private:
AddChoice("mode.fft", "FFT transform");
SetParameterDescription("mode.fft", "FFT transform");
AddParameter(ParameterType_Empty, "mode.fft.shift", "Shift fft transform");
AddParameter(ParameterType_Bool, "mode.fft.shift", "Shift fft transform");
SetParameterDescription("mode.fft.shift", "Shift transform of fft filter");
AddChoice("mode.wavelet", "Wavelet");
......@@ -263,7 +263,7 @@ private:
else
{
// fft ttransform
bool shift = IsParameterEnabled( "mode.fft.shift");
bool shift = GetParameterInt( "mode.fft.shift");
typedef otb::Image< std::complex<OutputPixelType> > ComplexOutputImageType;
if (dir == 0 )
......
......@@ -85,11 +85,10 @@ private:
// Elevation
ElevationParametersHandler::AddElevationParameters(this, "elev");
AddParameter(ParameterType_Empty, "norescale", "No rescaling in [0, 255]");
AddParameter(ParameterType_Bool, "norescale", "No rescaling in [0, 255]");
SetParameterDescription("norescale",
"By default, the input image amplitude is rescaled between [0,255]."
" Turn on this parameter to skip rescaling");
MandatoryOff("norescale");
AddRAMParameter();
......@@ -132,7 +131,7 @@ private:
= ShiftScaleImageFilterType::New();
// Default behavior is to do the rescaling
if ( !IsParameterEnabled("norescale") )
if ( !GetParameterInt("norescale") )
{
stats->SetInput(amplitudeConverter->GetOutput());
stats->GetStreamer()->SetAutomaticAdaptativeStreaming(GetParameterInt("ram"));
......
......@@ -229,7 +229,7 @@ private:
SetParameterDescription("minmax.auto" , "Minimum and maximum value will "
"be computed on the image (nodata value won't be taken "
"into account) . Each band will have a minimum and a maximum.");
AddParameter(ParameterType_Empty, "minmax.auto.global", "Global");
AddParameter(ParameterType_Bool, "minmax.auto.global", "Global");
SetParameterDescription("minmax.auto.global" , "Automatic"
"Min/max computation will result in the same minimum and maximum for "
"all the bands.");
......@@ -488,7 +488,7 @@ private:
if ( m_MinMaxMode == "auto" )
{
oss << "automatic";
if ( IsParameterEnabled( "minmax.auto.global" ) )
if ( GetParameterInt( "minmax.auto.global" ) )
{
oss << " and global";
}
......@@ -584,7 +584,7 @@ private:
statFilter->Update();
min = statFilter->GetMinimum();
max = statFilter->GetMaximum();
if ( IsParameterEnabled("minmax.auto.global") )
if ( GetParameterInt("minmax.auto.global") )
{
float temp(min[0]);
for ( unsigned int i = 1 ; i < min.GetSize() ; i++ )
......@@ -602,7 +602,7 @@ private:
}
std::ostringstream oss;
oss<<"Minimum and maximum are for each channel : ";
if ( IsParameterEnabled("minmax.auto.global") ||
if ( GetParameterInt("minmax.auto.global") ||
m_MinMaxMode == "manuel" )
{
oss<<std::endl<<min[0]<<" and "<<max[0];
......
......@@ -79,10 +79,8 @@ private:
AddParameter(ParameterType_OutputImage, "out", "Output Image");
SetParameterDescription("out", "Output image");
AddParameter(ParameterType_Empty,"usenan", "Consider NaN as no-data");
AddParameter(ParameterType_Bool,"usenan", "Consider NaN as no-data");
SetParameterDescription("usenan","If active, the application will consider NaN as no-data values as well");
MandatoryOff("usenan");
DisableParameter("usenan");
AddParameter(ParameterType_Choice,"mode","No-data handling mode");
SetParameterDescription("mode","Allows choosing between different no-data handling options");
......@@ -138,12 +136,12 @@ private:
m_Filter = FilterType::New();
m_Filter->SetInsideValue(this->GetParameterFloat("mode.buildmask.inv"));
m_Filter->SetOutsideValue(this->GetParameterFloat("mode.buildmask.outv"));
m_Filter->SetNaNIsNoData(IsParameterEnabled("usenan"));
m_Filter->SetNaNIsNoData(GetParameterInt("usenan"));
m_Filter->SetInput(inputPtr);
m_ChangeNoDataFilter = ChangeNoDataFilterType::New();
m_ChangeNoDataFilter->SetInput(inputPtr);
m_ChangeNoDataFilter->SetNaNIsNoData(IsParameterEnabled("usenan"));
m_ChangeNoDataFilter->SetNaNIsNoData(GetParameterInt("usenan"));
std::vector<double> newNoData(inputPtr->GetNumberOfComponentsPerPixel(),GetParameterFloat("mode.changevalue.newv"));
......
......@@ -96,12 +96,11 @@ private:
SetParameterDescription( "vfactor", "Variance factor use in smoothing. It is multiplied by the subsampling factor of each level in the pyramid (default is 0.6).");
// Boolean Fast scheme
AddParameter(ParameterType_Empty, "fast", "Use Fast Scheme");
AddParameter(ParameterType_Bool, "fast", "Use Fast Scheme");
std::ostringstream desc;
desc<<"If used, this option allows one to speed-up computation by iteratively"
<<" subsampling previous level of pyramid instead of processing the full input.";
SetParameterDescription("fast", desc.str());
MandatoryOff("fast");
// Doc example parameter settings
SetDocExampleParameterValue("in", "QB_Toulouse_Ortho_XS.tif");
......@@ -132,7 +131,7 @@ private:
unsigned int shrinkFactor = GetParameterInt("sfactor");
double varianceFactor = GetParameterFloat("vfactor");
bool fastScheme = IsParameterEnabled("fast");
bool fastScheme = GetParameterInt("fast");
// Get the input image
FloatVectorImageType::Pointer inImage = GetParameterImage("in");
......
......@@ -199,16 +199,13 @@ private:
AddChoice("level.toc", "Image to Top Of Canopy reflectance (atmospheric corrections)");
SetParameterString("level", "toa", false);
AddParameter(ParameterType_Empty, "milli", "Convert to milli reflectance");
AddParameter(ParameterType_Bool, "milli", "Convert to milli reflectance");
SetParameterDescription("milli", "Flag to use milli-reflectance instead of reflectance.\n"
"This allows saving the image with integer pixel type (in the range [0, 1000] instead of floating point in the range [0, 1]. In order to do that, use this option and set the output pixel type (-out filename double for example)");
DisableParameter("milli");
MandatoryOff("milli");
AddParameter(ParameterType_Empty, "clamp", "Clamp of reflectivity values between [0, 1]");
AddParameter(ParameterType_Bool, "clamp", "Clamp of reflectivity values between [0, 1]");
SetParameterDescription("clamp", "Clamping in the range [0, 1]. It can be useful to preserve area with specular reflectance.");
EnableParameter("clamp");
MandatoryOff("clamp");
SetParameterInt("clamp",1);
//Acquisition parameters
AddParameter(ParameterType_Group,"acqui","Acquisition parameters");
......@@ -751,12 +748,12 @@ private:
m_ImageToRadianceFilter->SetInput(inImage);
m_RadianceToReflectanceFilter->SetInput(m_ImageToRadianceFilter->GetOutput());
if (IsParameterEnabled("clamp"))
if (GetParameterInt("clamp"))
{
GetLogger()->Info("Clamp values between [0, 100]\n");
}
m_RadianceToReflectanceFilter->SetUseClamp(IsParameterEnabled("clamp"));
m_RadianceToReflectanceFilter->SetUseClamp(GetParameterInt("clamp"));
m_RadianceToReflectanceFilter->UpdateOutputInformation();
m_ScaleFilter->SetInput(m_RadianceToReflectanceFilter->GetOutput());
}
......@@ -894,7 +891,7 @@ private:
}
//Rescale the surface reflectance in milli-reflectance
if (!IsParameterEnabled("clamp"))
if (!GetParameterInt("clamp"))
{
if (!adjComputation)
m_ScaleFilter->SetInput(m_ReflectanceToSurfaceReflectanceFilter->GetOutput());
......@@ -920,7 +917,7 @@ private:
// Output Image
double scale = 1.;
if (IsParameterEnabled("milli"))
if (GetParameterInt("milli"))
{
GetLogger()->Info("Use milli-reflectance\n");
if ( (GetParameterInt("level") == Level_IM_TOA) || (GetParameterInt("level") == Level_TOC) )
......
......@@ -177,13 +177,13 @@ private:
MandatoryOff("outputs.lry");
MandatoryOff("outputs.ortho");
AddParameter(ParameterType_Empty,"outputs.isotropic","Force isotropic spacing by default");
AddParameter(ParameterType_Bool,"outputs.isotropic","Force isotropic spacing by default");
std::ostringstream isotropOss;
isotropOss << "Default spacing (pixel size) values are estimated from the sensor modeling of the image. It can therefore result in a non-isotropic spacing. ";
isotropOss << "This option allows you to force default values to be isotropic (in this case, the minimum of spacing in both direction is applied. ";
isotropOss << "Values overridden by user are not affected by this option.";
SetParameterDescription("outputs.isotropic", isotropOss.str());
EnableParameter("outputs.isotropic");
SetParameterInt("outputs.isotropic", 1);
AddParameter(ParameterType_Float, "outputs.default", "Default pixel value");
SetParameterDescription("outputs.default","Default value to write when outside of input image.");
......@@ -259,7 +259,7 @@ private:
typedef otb::ImageToGenericRSOutputParameters<FloatVectorImageType> OutputParametersEstimatorType;
OutputParametersEstimatorType::Pointer genericRSEstimator = OutputParametersEstimatorType::New();
if(IsParameterEnabled("outputs.isotropic"))
if(GetParameterInt("outputs.isotropic"))
{
genericRSEstimator->EstimateIsotropicSpacingOn();
}
......
......@@ -68,9 +68,8 @@ private:
AddRAMParameter();
AddParameter(ParameterType_Empty, "noise", "Disable Noise");
AddParameter(ParameterType_Bool, "noise", "Disable Noise");
SetParameterDescription("noise", "Flag to disable noise. For 5.2.0 release, the noise values are only read by TerraSARX product.");
MandatoryOff("noise");
AddParameter(ParameterType_Choice, "lut", "Lookup table sigma /gamma/ beta/ DN.");
SetParameterDescription("lut", "Lookup table values are not available with all SAR products. Products that provide lookup table with metadata are: Sentinel1, Radarsat2.");
......@@ -104,17 +103,8 @@ private:
// Set the filer input
m_CalibrationFilter = CalibrationFilterType::New();
m_CalibrationFilter->SetInput(floatComplexImage);
if (IsParameterEnabled("noise"))
{
m_CalibrationFilter->SetEnableNoise(false);
}
short lut = 0;
lut = GetParameterInt("lut");
m_CalibrationFilter->SetLookupSelected(lut);
m_CalibrationFilter->SetEnableNoise( !bool(GetParameterInt("noise")) );
m_CalibrationFilter->SetLookupSelected(GetParameterInt("lut"));
// Set the output image
SetParameterOutputImage("out", m_CalibrationFilter->GetOutput());
......
......@@ -139,7 +139,7 @@ private:
void RemoveFile(std::string tile)
{
// Cleanup
if(IsParameterEnabled("cleanup"))
if(GetParameterInt("cleanup"))
{
// Try to remove the geom file if existing
std::string geomfile = tile.substr(0,tile.size() - itksys::SystemTools::GetFilenameExtension(tile.c_str()).size()).append(".geom");
......@@ -302,10 +302,9 @@ private:
MandatoryOff("tmpdir");
DisableParameter("tmpdir");
AddParameter(ParameterType_Empty,"cleanup","Temporary files cleaning");
EnableParameter("cleanup");
AddParameter(ParameterType_Bool,"cleanup","Temporary files cleaning");
SetParameterDescription("cleanup","If activated, the application will try to remove all temporary files it created.");
MandatoryOff("cleanup");
SetParameterInt("cleanup",1);
// Doc example parameter settings
SetDocExampleParameterValue("in","smooth.tif");
......@@ -724,7 +723,7 @@ private:
// Release input files
m_FinalReader = ITK_NULLPTR;
if(IsParameterEnabled("cleanup"))
if(GetParameterInt("cleanup"))
{
otbAppLogINFO(<<"Final clean-up ...");
......
......@@ -120,11 +120,10 @@ private:
"The output raster image",
"It corresponds to the output of the small region merging step.");
AddParameter( ParameterType_Empty, "cleanup", "Temporary files cleaning" );
EnableParameter( "cleanup" );
AddParameter( ParameterType_Bool, "cleanup", "Temporary files cleaning" );
SetParameterDescription( "cleanup",
"If activated, the application will try to clean all temporary files it created" );
MandatoryOff( "cleanup" );
SetParameterInt("cleanup",1);
// Setup RAM
ShareParameter("ram","smoothing.ram");
......
......@@ -159,10 +159,8 @@ private:
SetMinimumParameterFloatValue("rangeramp", 0);
MandatoryOff("rangeramp");
AddParameter(ParameterType_Empty, "modesearch", "Mode search.");
AddParameter(ParameterType_Bool, "modesearch", "Mode search.");
SetParameterDescription("modesearch", "If activated pixel iterative convergence is stopped if the path crosses an already converged pixel. Be careful, with this option, the result will slightly depend on thread number and the results will not be stable (see [4] for more details).");
DisableParameter("modesearch");
// Doc example parameter settings
SetDocExampleParameterValue("in", "maur_rgb.png");
......@@ -192,7 +190,7 @@ private:
m_Filter->SetThreshold(GetParameterFloat("thres"));
m_Filter->SetMaxIterationNumber(GetParameterInt("maxiter"));
m_Filter->SetRangeBandwidthRamp(GetParameterFloat("rangeramp"));
m_Filter->SetModeSearch(IsParameterEnabled("modesearch"));
m_Filter->SetModeSearch(GetParameterInt("modesearch"));
//Compute the margin used to ensure exact results (tile wise smoothing)
//This margin is valid for the default uniform kernel used by the
......@@ -211,7 +209,7 @@ private:
{
SetParameterOutputImage("foutpos", m_Filter->GetSpatialOutput());
}
if(!IsParameterEnabled("modesearch"))
if(!GetParameterInt("modesearch"))
{
otbAppLogINFO(<<"Mode Search is disabled." << std::endl);
}
......
......@@ -282,17 +282,13 @@ private:
SetParameterDescription("mode.vector.inmask", "Only pixels whose mask value is strictly positive will be segmented.");
MandatoryOff("mode.vector.inmask");
AddParameter(ParameterType_Empty, "mode.vector.neighbor", "8-neighbor connectivity");
AddParameter(ParameterType_Bool, "mode.vector.neighbor", "8-neighbor connectivity");
SetParameterDescription("mode.vector.neighbor",
"Activate 8-Neighborhood connectivity (default is 4).");
MandatoryOff("mode.vector.neighbor");
DisableParameter("mode.vector.neighbor");
AddParameter(ParameterType_Empty,"mode.vector.stitch","Stitch polygons");
AddParameter(ParameterType_Bool,"mode.vector.stitch","Stitch polygons");
SetParameterDescription("mode.vector.stitch", "Scan polygons on each side of tiles and stitch polygons which connect by more than one pixel.");
MandatoryOff("mode.vector.stitch");
EnableParameter("mode.vector.stitch");
SetParameterInt("mode.vector.stitch",1);
AddParameter(ParameterType_Int, "mode.vector.minsize", "Minimum object size");
SetParameterDescription("mode.vector.minsize",
......@@ -365,7 +361,7 @@ private:
// Retrieve tile size parameter
const unsigned int tileSize = static_cast<unsigned int> (this->GetParameterInt("mode.vector.tilesize"));
// Retrieve the 8-connected option
bool use8connected = IsParameterEnabled("mode.vector.neighbor");
bool use8connected = GetParameterInt("mode.vector.neighbor");
// Retrieve min object size parameter
const unsigned int minSize = static_cast<unsigned int> (this->GetParameterInt("mode.vector.minsize"));
......@@ -673,7 +669,7 @@ private:
ogrDS->SyncToDisk();
// Stitching mode
if (IsParameterEnabled("mode.vector.stitch"))
if (GetParameterInt("mode.vector.stitch"))
{
otbAppLogINFO(<<"Segmentation done, stiching polygons ...");
......
......@@ -202,7 +202,7 @@ private:
DisableParameter("io.outmask");
MandatoryOff("io.outmask");
AddParameter(ParameterType_Empty,"io.outmetric","Flag to output optimal "
AddParameter(ParameterType_Bool,"io.outmetric","Flag to output optimal "
"metric values as well");
SetParameterDescription("io.outmetric","If enabled, the output image will "
"have a third component with metric optimal values");
......@@ -847,7 +847,7 @@ private:
m_OutputImageList->PushBack(hdispImage);
m_OutputImageList->PushBack(vdispImage);
if(IsParameterEnabled("io.outmetric"))
if(GetParameterInt("io.outmetric"))
{
m_OutputImageList->PushBack(metricImage);
}
......
......@@ -525,20 +525,16 @@ private:
AddParameter(ParameterType_Group,"postproc","Postprocessing parameters");
SetParameterDescription("postproc","This group of parameters allow use optional filters.");
AddParameter(ParameterType_Empty,"postproc.bij","Use bijection consistency"