Commit 34601b25 authored by Cyrille Valladeau's avatar Cyrille Valladeau

ENH: use otb::Application::AddRAMParameter everywhere

parent fe56b332
......@@ -95,9 +95,8 @@ private:
SetParameterDescription("in2","Image which describe scene after perturbations.");
AddParameter(ParameterType_OutputImage, "out", "Change Map");
SetParameterDescription("out","Image of detected changes.");
AddParameter(ParameterType_RAM, "ram", "Available RAM");
SetDefaultParameterInt("ram", 256);
MandatoryOff("ram");
AddRAMParameter();
// Doc example parameter settings
SetDocExampleParameterValue("in1", "Spot5-Gloucester-before.tif");
......
......@@ -89,9 +89,7 @@ private:
SetParameterDescription( "out", "Output image containing class labels");
SetParameterOutputImagePixelType( "out", ImagePixelType_uint8);
AddParameter(ParameterType_RAM, "ram", "Available RAM");
SetDefaultParameterInt("ram", 256);
MandatoryOff("ram");
AddRAMParameter();
// Doc example parameter settings
SetDocExampleParameterValue("in", "QB_1_ortho.tif");
......
......@@ -186,9 +186,9 @@ private:
SetParameterDescription("in", "Input image to classify.");
AddParameter(ParameterType_OutputImage, "out", "Output Image");
SetParameterDescription("out", "Output image containing the class indexes.");
AddParameter(ParameterType_RAM, "ram", "Available RAM");
SetDefaultParameterInt("ram", 256);
MandatoryOff("ram");
AddRAMParameter();
AddParameter(ParameterType_InputImage, "vm", "Validity Mask");
SetParameterDescription("vm", "Validity mask. Only non-zero pixels will be used to estimate KMeans modes.");
MandatoryOff("vm");
......
......@@ -141,9 +141,7 @@ private:
SetParameterDescription("iv", "Maximum initial neuron weight");
MandatoryOff("iv");
AddParameter(ParameterType_RAM, "ram", "Available RAM");
SetDefaultParameterInt("ram", 256);
MandatoryOff("ram");
AddRAMParameter();
// TODO : replace StreamingLines by RAM param ?
// Default parameters
......
......@@ -213,10 +213,8 @@ private:
SetParameterDescription( "vmut", "Upper threshold to obtain a validity mask." );
MandatoryOff("vmut");
AddParameter(ParameterType_RAM, "ram", "Available RAM");
SetDefaultParameterInt("ram", 256);
MandatoryOff("ram");
AddRAMParameter();
// Doc example parameter settings
SetDocExampleParameterValue("ref", "StereoFixed.png");
SetDocExampleParameterValue("sec", "StereoMoving.png");
......
......@@ -87,9 +87,7 @@ private:
SetParameterDescription("out", "The output image.");
// Optional parameters
AddParameter(ParameterType_RAM, "ram", "Available RAM");
SetDefaultParameterInt("ram", 256);
MandatoryOff("ram");
AddRAMParameter();
AddParameter(ParameterType_Int, "r", "Radius");
SetParameterDescription("r", "Radius (in pixels) of the metric computation window (default is 3).");
......
......@@ -77,11 +77,9 @@ private:
SetParameterDescription("lms"," Spacing of the deformation field. Default is 10 times the PAN image spacing.");
AddParameter(ParameterType_OutputImage, "out", "Output image");
SetParameterDescription("out"," Output image.");
AddParameter(ParameterType_RAM, "ram", "Available RAM");
SetDefaultParameterInt("ram", 256);
AddRAMParameter();
MandatoryOff("lms");
MandatoryOff("ram");
// Doc example parameter settings
SetDocExampleParameterValue("inp", "QB_Toulouse_Ortho_PAN.tif");
......
......@@ -166,9 +166,7 @@ SetParameterDescription("grid.type.def","A deformation grid contains at each gri
SetDefaultParameterInt("interpolator.bco.radius", 2);
SetParameterString("interpolator","bco");
// RAM available
AddRAMParameter();
MandatoryOff("ram");
}
void DoUpdateParameters()
......
......@@ -34,8 +34,6 @@
#include "otbMacro.h"
#include "otbWrapperRAMParameter.h"
namespace otb
{
......@@ -182,10 +180,8 @@ private:
MandatoryOff("opt.rpc");
// RAM available
AddParameter(ParameterType_RAM, "opt.ram", "Available memory for processing (in MB)");
AddRAMParameter("opt.ram");
SetParameterDescription("opt.ram","This allows to set the maximum amount of RAM available for processing. As the writing task is time consuming, it is better to write large pieces of data, which can be achieved by increasing this parameter (pay attention to your system capabilities)");
SetDefaultParameterInt("opt.ram", 256);
MandatoryOff("opt.ram");
// Deformation Field Spacing
AddParameter(ParameterType_Float, "opt.gridspacing", "Resampling grid spacing");
......
......@@ -80,11 +80,9 @@ private:
AddParameter(ParameterType_OutputImage, "out", "Output image");
SetParameterDescription("out","Output reprojected image.");
AddParameter(ParameterType_RAM, "ram", "Available RAM");
SetDefaultParameterInt("ram", 256);
AddRAMParameter();
MandatoryOff("lms");
MandatoryOff("ram");
// Doc example parameter settings
SetDocExampleParameterValue("inr", "QB_Toulouse_Ortho_PAN.tif");
......
......@@ -100,9 +100,7 @@ private:
AddParameter(ParameterType_OutputImage, "out", "Output Image");
SetParameterDescription("out", "Radiometric indices output image");
AddParameter(ParameterType_RAM, "ram", "Available RAM");
SetDefaultParameterInt("ram", 256);
MandatoryOff("ram");
AddRAMParameter();
AddParameter(ParameterType_Group, "channels", "Channels selection");
SetParameterDescription("channels", "Channels selection");
......
......@@ -95,9 +95,7 @@ private:
AddParameter(ParameterType_OutputImage, "out", "Output");
SetParameterDescription("out","Output calibrated image filename");
AddParameter(ParameterType_RAM, "ram", "Available RAM");
SetDefaultParameterInt("ram", 256);
MandatoryOff("ram");
AddRAMParameter();
AddParameter(ParameterType_Choice, "level", "Calibration Level");
AddChoice("level.toa", "TOA : Top Of Atmosphere");
......
......@@ -64,9 +64,7 @@ private:
AddParameter(ParameterType_ComplexOutputImage, "out", "Output Image");
SetParameterDescription("out", "Output calibrated complex image");
AddParameter(ParameterType_RAM, "ram", "Available RAM");
SetDefaultParameterInt("ram", 256);
MandatoryOff("ram");
AddRAMParameter();
AddParameter(ParameterType_Empty, "noise", "Disable Noise");
SetParameterDescription("noise", "Flag to disable noise");
......
......@@ -116,9 +116,7 @@ private:
SetParameterDescription( "spy", "OutputSpacing[1] (useless if support image is given)" );
MandatoryOff("spy");
AddParameter(ParameterType_RAM, "ram", "Available RAM");
SetDefaultParameterInt("ram", 256);
MandatoryOff("ram");
AddRAMParameter();
SetDocExampleParameterValue("in","qb_RoadExtract_classification.shp");
SetDocExampleParameterValue("out", "rasterImage.tif");
......
......@@ -72,10 +72,6 @@ private:
MandatoryOff("lout");
MandatoryOff("cbout");
// AddParameter(ParameterType_RAM, "ram", "Available RAM");
// SetDefaultParameterInt("ram", 256);
// MandatoryOff("ram");
AddParameter(ParameterType_Int, "spatialr", "Spatial radius");
SetParameterDescription( "spatialr", "Spatial radius defining neighborhood." );
AddParameter(ParameterType_Float, "ranger", "Range radius");
......
......@@ -69,9 +69,7 @@ private:
AddParameter(ParameterType_OutputImage, "out", "Output Image");
SetParameterDescription("out","Output image.");
AddParameter(ParameterType_RAM, "ram", "Available RAM");
SetDefaultParameterInt("ram", 256);
MandatoryOff("ram");
AddRAMParameter();
AddParameter(ParameterType_String, "exp", "Expression");
SetParameterDescription("exp",
......
......@@ -424,10 +424,9 @@ private:
SetParameterDescription("in", "Input image filename");
AddParameter(ParameterType_OutputImage, "out", "Output Image");
SetParameterDescription("out","Output image filename");
AddParameter(ParameterType_RAM, "ram", "Available RAM");
SetDefaultParameterInt("ram", 256);
MandatoryOff("ram");
AddRAMParameter();
// --- OPERATION --- : Label to color / Color to label
AddParameter(ParameterType_Choice, "op", "Operation");
SetParameterDescription("op","Selection of the operation to execute (default is : label to color).");
......
......@@ -79,9 +79,7 @@ private:
AddParameter(ParameterType_OutputImage, "out", "Output Image");
SetParameterDescription("out", "The concatenated output image");
AddParameter(ParameterType_RAM, "ram", "Available RAM");
SetDefaultParameterInt("ram", 256);
MandatoryOff("ram");
AddRAMParameter();
// Doc example parameter settings
SetDocExampleParameterValue("il", "GomaAvant.png GomaApres.png");
......
......@@ -104,9 +104,7 @@ private:
AddParameter(ParameterType_OutputImage, "out", "Output Image");
SetParameterDescription("out", "Output image");
AddParameter(ParameterType_RAM, "ram", "Available RAM");
SetDefaultParameterInt("ram", 256);
MandatoryOff("ram");
AddRAMParameter();
// Doc example parameter settings
SetDocExampleParameterValue("in", "QB_Toulouse_Ortho_XS.tif");
......
......@@ -66,9 +66,7 @@ private:
AddParameter(ParameterType_OutputImage, "out", "Output Image");
SetParameterDescription("out", "Output image.");
AddParameter(ParameterType_RAM, "ram", "Available RAM");
SetDefaultParameterInt("ram", 256);
MandatoryOff("ram");
AddRAMParameter();
AddParameter(ParameterType_Int, "startx", "Start X");
SetParameterDescription("startx", "ROI start x position.");
......
......@@ -79,9 +79,7 @@ private:
AddParameter(ParameterType_Filename, "out", "Output Image");
SetParameterDescription("out","will be used to get the prefix and the extension of the images to write");
AddParameter(ParameterType_RAM, "ram", "Available RAM");
SetDefaultParameterInt("ram", 256);
MandatoryOff("ram");
AddRAMParameter();
AddParameter(ParameterType_Int, "level", "Number Of Levels");
SetDefaultParameterInt("level", 1);
......
......@@ -66,7 +66,6 @@ private:
SetParameterDescription( "out" , "The rescaled image filename." );
AddRAMParameter();
MandatoryOff("ram");
AddParameter(ParameterType_Float, "outmin", "Output min value");
AddParameter(ParameterType_Float, "outmax", "Output max value");
......
......@@ -71,9 +71,7 @@ private:
AddParameter(ParameterType_OutputImage, "out", "Output Image");
SetParameterDescription("out", "Output smoothed image.");
AddParameter(ParameterType_RAM, "ram", "Available RAM");
SetDefaultParameterInt("ram", 256);
MandatoryOff("ram");
AddRAMParameter();
AddParameter(ParameterType_Choice, "type", "Smoothing Type");
SetParameterDescription("type", "Smoothing kernel to apply");
......
......@@ -68,9 +68,7 @@ private:
SetParameterDescription("out",
"Output filename that will be used to get the prefix and the extension of the output images to write");
AddParameter(ParameterType_RAM, "ram", "Available RAM");
SetDefaultParameterInt("ram", 256);
MandatoryOff("ram");
AddRAMParameter();
// Doc example parameter settings
SetDocExampleParameterValue("in", "VegetationIndex.hd");
......
......@@ -1087,24 +1087,28 @@ void Application::AddRAMParameter(std::string paramKey, std::string paramName, u
{
GetParameterList()->AddParameter(ParameterType_RAM, paramKey, paramName);
SetDefaultParameterInt(paramKey, defaultValue);
MandatoryOff(paramKey);
}
void Application::AddRAMParameter()
// paramKey default value = ram
void Application::AddRAMParameter(std::string paramKey)
{
// Get the RAM Parameter from the configuration file
if (otb::ConfigurationFile::GetInstance()->IsValid() )
{
AddRAMParameter("ram",
"Available RAM",
AddRAMParameter(paramKey,
"Available RAM (Mb)",
otb::ConfigurationFile::GetInstance()->GetAvailableRAMInMBytes());
}
else
{
// TODO check this
AddRAMParameter("ram",
"Available RAM",
AddRAMParameter(paramKey,
"Available RAM (Mb)",
128);
}
MandatoryOff(paramKey);
SetParameterDescription(paramKey, "Available memory for processing (in MB)");
}
std::vector< std::pair<std::string, std::string> >
......
......@@ -612,7 +612,7 @@ protected:
void AddRAMParameter(std::string paramKey, std::string paramName, unsigned int defaultValue);
/** Add a parameterRAM method with no parameter*/
void AddRAMParameter();
void AddRAMParameter(std::string paramKey="ram");
/** Remove the items added to the ListWidget */
void ClearChoices(std::string key);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment