Commit c6b384a3 authored by Julien Michel's avatar Julien Michel

MRG

parents 3b391464 f4aaebfa
......@@ -97,25 +97,43 @@ if(SHARK_CONFIG_FILE)
"${SHARK_VERSION_MAJOR}.${SHARK_VERSION_MINOR}.${SHARK_VERSION_PATCH}")
endif()
set(SHARK_USE_OPENMP_matched)
#define SHARK_USE_OPENMP
# Check if Shark was built with OpenMP, CBLAS, DYNLIB, ...
file(STRINGS "${SHARK_INCLUDE_DIR}/shark/Core/Shark.h" SHARK_H_CONTENTS)
string(REGEX MATCH
"#define.SHARK_USE_OPENMP"
SHARK_USE_OPENMP_matched "${SHARK_H_CONTENTS}")
if(SHARK_USE_OPENMP_matched)
if(NOT OTB_USE_OPENMP)
message(WARNING "Shark library is built with OpenMP and you have OTB_USE_OPENMP set to OFF.")
endif()
if(SHARK_H_CONTENTS MATCHES "#define.SHARK_USE_OPENMP")
set(SHARK_USE_OPENMP 1)
else()
set(SHARK_USE_OPENMP 0)
endif()
if(SHARK_H_CONTENTS MATCHES "#define.SHARK_USE_CBLAS")
set(SHARK_USE_CBLAS 1)
else()
set(SHARK_USE_CBLAS 0)
endif()
if(SHARK_H_CONTENTS MATCHES "#define.SHARK_USE_DYNLIB")
set(SHARK_USE_DYNLIB 1)
else()
set(SHARK_USE_DYNLIB 0)
endif()
if(SHARK_USE_CBLAS AND SHARK_USE_DYNLIB)
set(REQUIRED_CBLAS_LIB CBLAS_LIBRARY)
find_library(CBLAS_LIBRARY NAMES cblas)
else()
set(REQUIRED_CBLAS_LIB)
endif()
INCLUDE(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Shark
REQUIRED_VARS SHARK_LIBRARY SHARK_INCLUDE_DIR
REQUIRED_VARS SHARK_LIBRARY SHARK_INCLUDE_DIR ${REQUIRED_CBLAS_LIB}
VERSION_VAR SHARK_VERSION_STRING)
if(SHARK_FOUND)
set(SHARK_INCLUDE_DIRS ${SHARK_INCLUDE_DIR} ${Boost_INCLUDE_DIR} )
set(SHARK_LIBRARIES ${SHARK_LIBRARY} ${Boost_LIBRARIES} )
if(REQUIRED_CBLAS_LIB)
set(SHARK_LIBRARIES ${SHARK_LIBRARIES} ${CBLAS_LIBRARY})
endif()
endif()
......@@ -231,10 +231,6 @@ mark_as_advanced(OTB_USE_DEPRECATED)
option(OTB_USE_OPENMP "Add openmp compiler and linker flags" OFF)
option(OTB_USE_SSE_FLAGS "Enable SIMD optimizations (hardware dependent)." ON)
#-----------------------------------------------------------------------------
# SHOW_ALL_MSG_DEBUG option
option(OTB_SHOW_ALL_MSG_DEBUG "Show all debug messages (very verbose)" OFF)
#mark_as_advanced(OTB_SHOW_ALL_MSG_DEBUG)
include(OTBSetStandardCompilerFlags)
#---------------------------------------------------------------
......
......@@ -95,7 +95,8 @@ def GenerateChoice(app,param,paramlist, count = 0):
return output
def GenerateParameterType(app,param):
if app.GetParameterType(param) == otbApplication.ParameterType_Empty:
if app.GetParameterType(param) == otbApplication.ParameterType_Empty \
or app.GetParameterType(param) == otbApplication.ParameterType_Bool:
return "Boolean"
if app.GetParameterType(param) == otbApplication.ParameterType_Int \
or app.GetParameterType(param) == otbApplication.ParameterType_Radius \
......@@ -346,6 +347,8 @@ def GetApplicationExamplePythonSnippet(app,idx,expand = False, inputpath="",outp
if paramtype == otbApplication.ParameterType_Empty:
app.EnableParameter(param)
output+= "\t" + appname + ".EnableParameter("+EncloseString(param)+")" + linesep
if paramtype == otbApplication.ParameterType_Bool:
output+= "\t" + appname + ".SetParameterString("+EncloseString(param)+","+EncloseString(value)+")" + linesep
if paramtype == otbApplication.ParameterType_Int \
or paramtype == otbApplication.ParameterType_Radius \
or paramtype == otbApplication.ParameterType_RAM:
......
.. _extended-filenames:
Advanced Use
============
This section describes advanced configuration options and tricks.
Environment variables that affects Orfeo ToolBox
------------------------------------------------
The following environment variables are parsed by Orfeo ToolBox. Note
that they only affect default values, and that settings in extended
filenames, applications, monteverdi or custom C++ code might override
those values.
* ``OTB_DEM_DIRECTORY``: Default directory were DEM tiles are stored. It should only contain ```.hgt`` or or georeferenced ``.tif`` files. Empty if not set (no directory set)
* ``OTB_GEOID_FILE``: Default path to the geoid file that will be used to retrieve height of DEM above ellipsoid. Empty if not set (no geoid set)
* ``OTB_MAX_RAM_HINT``: Default maximum memory that OTB should use for processing, in MB. If not set, default value is 128 MB.
* ``OTB_LOGGER_LEVEL``: Default level of logging for OTB. Should be one of ``DEBUG``, ``INFO``, ``WARNING``, ``CRITICAL`` or ``FATAL``, by increasing order of priority. Only messages with a higher priority than the level of logging will be displayed. If not set, default level is ``INFO``.
Extended filenames
================================
------------------
.. _extended-filenames:
Extended filenames is an interesting feature of OTB. With it, you can control
several aspects of the beahvior of the OTB in the OTB-Applications or in our
......@@ -42,7 +59,6 @@ applications from the bash command line.**
Reader options
^^^^^^^^^^^^^^
::
&geom=<path/filename.geom>
......
......@@ -8,7 +8,7 @@ Table of Contents
Installation
OTB-Applications
Monteverdi
ExtendedFilenames
AdvancedUse
Recipes
Applications
FAQ
......@@ -32,10 +32,10 @@ application, changing the algorithm at each iteration.
print "Available applications: "
print str( otbApplication.Registry.GetAvailableApplications() )
# Let's create the application with codename "Smoothing"
# Let's create the application "Smoothing"
app = otbApplication.Registry.CreateApplication("Smoothing")
# We print the keys of all its parameter
# We print the keys of all its parameters
print app.GetParametersKeys()
# First, we set the input image filename
......@@ -47,35 +47,45 @@ application, changing the algorithm at each iteration.
print 'Running with ' + type + ' smoothing type'
# Here we configure the smoothing algorithm
# Now we configure the smoothing algorithm
app.SetParameterString("type", type)
# Set the output filename, using the algorithm to differentiate the outputs
# Set the output filename, using the algorithm type to differentiate the outputs
app.SetParameterString("out", argv[2] + type + ".tif")
# This will execute the application and save the output file
# This will execute the application and save the output to argv[2]
app.ExecuteAndWriteOutput()
If you want to handle the parameters from a Python dictionary, you can use the
functions *SetParameters()* and *GetParameters()*.
.. code-block:: python
params = {"in":"myInput.tif", "type.mean.radius":4}
app.SetParameters(params)
params2 = app.GetParameters()
Numpy array processing
----------------------
Input and output images to any OTB application in the form of numpy array is now possible in OTB python wrapping.
The python wrapping only exposes OTB ApplicationEngine module which allow to access existing C++ applications.
Input and output images to any OTB application in the form of NumPy array is now possible in OTB Python wrapping.
The Python wrapping only exposes OTB Application engine module (called *ApplicationEngine*) which allows to access existing C++ applications.
Due to blissful nature of ApplicationEngine's loading mechanism no specific wrapping is required for each application.
Numpy extension to Python wrapping allows data exchange to application as an array rather than a disk file.
Ofcourse, it is possible to load an image from file and then convert to numpy array or just provide a file as earlier via
NumPy extension to Python wrapping allows data exchange to application as an array rather than a disk file.
Of course, it is possible to load an image from file and then convert it to NumPy
array or just provide a file as explained in the previous section via
Application.SetParameterString(...).
This bridge that completes numpy and OTB makes it easy to plug OTB into any image processing chain via python code that uses
GIS/Image processing tools such as GDAL, GRASS GIS, OSSIM that can deal with numpy.
The bridge between NumPy and OTB makes it easy to plug OTB into any image processing chain via Python code that uses
GIS/Image processing tools such as GDAL, GRASS GIS, OSSIM that can deal with NumPy.
Below code reads an input image using python pillow (PIL) and convert it to numpy array. This numpy array is
used an input to the application via *SetImageFromNumpyArray(...)* method.
The application used in this example is ExtractROI. After extracting
a small area the output image is taken as numpy array with *GetImageFromNumpyArray(...)* method thus avoid wiriting
output to a temporary file.
Below code reads an input image using Python Pillow library (fork of PIL) and convert it to
NumPy array. The NumPy array is used as an input to the application via
*SetImageFromNumpyArray(...)* method. The application used in this example is
ExtractROI. After extracting a small area the output image is taken as NumPy
array with *GetImageFromNumpyArray(...)* method thus avoid writing output to a
temporary file.
::
......@@ -105,7 +115,7 @@ In-memory connection
--------------------
Applications are often use as parts of larger processing
chains. Chaining applications currently requires to write/read back
workflow. Chaining applications currently requires to write/read back
images between applications, resulting in heavy I/O operations and a
significant amount of time dedicated to writing temporary files.
......@@ -118,9 +128,9 @@ images. The last application of the processing chain is responsible
for writing the final result images.
In-memory connection between applications is available both at the C++
API level and using the python bindings.
API level and using the Python bindings.
Here is a Python code sample connecting several applications together:
Here is a Python code sample which connects several applications together:
.. code-block:: python
......@@ -167,7 +177,7 @@ Corner cases
------------
There are a few corner cases to be aware of when using Python wrappers. They are
often limitations, that one day may be solved by future developments. If it
often limitations, that one day may be solved in future versions. If it
happens, this documentation will report the OTB version that fixes the issue.
Calling UpdateParameters()
......@@ -211,30 +221,34 @@ setting the ``field`` parameter:
app.UpdateParameters()
app.SetParameterString("field", "label")
No metadata in Numpy arrays
No metadata in NumPy arrays
^^^^^^^^^^^^^^^^^^^^^^^^^^^
With the Numpy module, it is possible to convert images between OTB and Numpy
arrays. For instance, when converting from OTB to Numpy array:
With the NumPy module, it is possible to convert images between OTB and NumPy
arrays. For instance, when converting from OTB to NumPy array:
* An ``Update()`` of the underlying ``otb::VectorImage`` is requested. Be aware
that the full image is generated.
* The pixel buffer is copied into a ``numpy.array``
As you can see, there is no export of the metadata, such as origin, spacing,
projection WKT. It means that if you want to import back a Numpy array into OTB,
geographic projection. It means that if you want to import back a NumPy array into OTB,
the image won't have any of these metadata. It can be a problem for applications
doing geometry, projections, and also calibration.
Future developments will probably offer a more adapted structure to import and
export images between OTB and Python world.
export images between OTB and the Python world.
Setting of EmptyParameter
^^^^^^^^^^^^^^^^^^^^^^^^^
Setting of boolean parameters
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Most of the parameters are set using functions ``SetParameterXXX()``, except for
one type of parameter: the ``EmptyParameter``. This class was the first
implementation of a boolean. It is now **deprecated**, you should use ``BoolParameter``
instead.
Most of the parameters are set using functions ``SetParameterXXX()``. The boolean
parameters are handled differently (also called Empty parameter). Let's take an example with the application
``ReadImageInfo``:
Let's take an example with the application ``ReadImageInfo`` when it was still
using an ``EmptyParameter`` for parameter ``keywordlist``:
.. code-block:: python
......@@ -247,7 +261,7 @@ If you want the get the state of parameter ``keywordlist``, a boolean, use:
app.IsParameterEnabled("keywordlist")
To set this parameter ON / OFF, use the functions:
To set this parameter ON/OFF, use the functions:
.. code-block:: python
......
......@@ -241,8 +241,6 @@ ReadGeometryFromImage(const std::string& filename, bool checkRpcTag)
if (projection)
{
otbMsgDevMacro(<< "OSSIM plugin projection instantiated ! ");
hasMetaData = projection->saveState(geom_kwl);
otb_kwl.SetKeywordlist(geom_kwl);
}
......@@ -257,7 +255,6 @@ ReadGeometryFromImage(const std::string& filename, bool checkRpcTag)
->open(ossimFilename(filename.c_str())));
if (handler)
{
otbMsgDevMacro(<< "OSSIM Open Image SUCCESS ! ");
// Add ossimPlugins model
ossimProjectionFactoryRegistry::instance()->registerFactory(ossimplugins::ossimPluginProjectionFactory::instance());
......@@ -273,7 +270,6 @@ ReadGeometryFromImage(const std::string& filename, bool checkRpcTag)
// if the handler has found a sensor model, copy the tags found
if (hasMetaData && dynamic_cast<ossimSensorModel const*>(projection))
{
otbMsgDevMacro(<<"OSSIM sensor projection instantiated ! ");
otb_kwl.SetKeywordlist(geom_kwl);
// geom_kwl.print(std::cout);
}
......@@ -317,16 +313,6 @@ ReadGeometryFromImage(const std::string& filename, bool checkRpcTag)
// which uses ossimSensorModelFactory and ossimPluginProjectionFactory internally,
// thus by-passing the need for a valid ossimImageHandler.
if (!hasMetaData)
{
otbMsgDevMacro(<< "OSSIM MetaData not present ! ");
}
else
{
otbMsgDevMacro(<< "OSSIM MetaData present ! ");
//otbMsgDevMacro(<< geom_kwl);
}
return otb_kwl;
}
......@@ -479,7 +465,6 @@ WriteGeometry(const ImageKeywordlist& otb_kwl, const std::string& filename)
if (geom_kwl.getSize() > 0)
{
otbMsgDevMacro(<< "Exporting keywordlist ...");
ossimFilename geomFileName(filename);
geomFileName.setExtension(".geom");
geom_kwl.write(geomFileName.chars());
......
......@@ -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"));
......
......@@ -143,12 +143,12 @@ private:
AddParameter(ParameterType_String, "cri", "Criterion");
SetParameterDescription("cri", "Dempster Shafer criterion (by default (belief+plausibility)/2)");
MandatoryOff("cri");
SetParameterString("cri","((Belief + Plausibility)/2.)", false);
SetParameterString("cri","((Belief + Plausibility)/2.)");
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, false);
SetParameterFloat("wgt",0.5);
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)");
......@@ -157,16 +157,15 @@ 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","", false);
SetParameterString("desclist","");
AddParameter(ParameterType_Int,"maxnbit","Maximum number of iterations");
MandatoryOff("maxnbit");
SetParameterDescription("maxnbit","Maximum number of optimizer iteration (default 200)");
SetParameterInt("maxnbit",200, false);
SetParameterInt("maxnbit",200);
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()
......@@ -148,7 +147,7 @@ protected:
void ComputeImageEnvelope(const std::string &vectorFileName)
{
GetInternalApplication("imgenvelop")->SetParameterString("out", vectorFileName, false);
GetInternalApplication("imgenvelop")->SetParameterString("out", vectorFileName);
GetInternalApplication("imgenvelop")->ExecuteAndWriteOutput();
}
......@@ -187,8 +186,8 @@ protected:
{
std::vector<std::string> fieldList = {fieldName};
GetInternalApplication("polystats")->SetParameterStringList("field", fieldList, false);
GetInternalApplication("polystats")->SetParameterString("out", statisticsFileName, false);
GetInternalApplication("polystats")->SetParameterStringList("field", fieldList);
GetInternalApplication("polystats")->SetParameterString("out", statisticsFileName);
ExecuteInternal("polystats");
}
......@@ -199,17 +198,17 @@ protected:
int NBSamples)
{
/* SampleSelection */
GetInternalApplication("select")->SetParameterString("out", sampleFileName, false);
GetInternalApplication("select")->SetParameterString("out", sampleFileName);
UpdateInternalParameters("select");
GetInternalApplication("select")->SetParameterString("instats", statisticsFileName, false);
GetInternalApplication("select")->SetParameterString("field", fieldName, false);
GetInternalApplication("select")->SetParameterString("instats", statisticsFileName);
GetInternalApplication("select")->SetParameterString("field", fieldName);
GetInternalApplication("select")->SetParameterString("strategy", "constant", false);
GetInternalApplication("select")->SetParameterInt("strategy.constant.nb", NBSamples, false);
GetInternalApplication("select")->SetParameterString("strategy", "constant");
GetInternalApplication("select")->SetParameterInt("strategy.constant.nb", NBSamples);
if( IsParameterEnabled("rand"))
GetInternalApplication("select")->SetParameterInt("rand", GetParameterInt("rand"), false);
GetInternalApplication("select")->SetParameterInt("rand", GetParameterInt("rand"));
// select sample positions
ExecuteInternal("select");
......@@ -217,8 +216,8 @@ protected:
/* SampleExtraction */
UpdateInternalParameters("extraction");
GetInternalApplication("extraction")->SetParameterString("outfield", "prefix", false);
GetInternalApplication("extraction")->SetParameterString("outfield.prefix.name", "value_", false);
GetInternalApplication("extraction")->SetParameterString("outfield", "prefix");
GetInternalApplication("extraction")->SetParameterString("outfield.prefix.name", "value_");
// extract sample descriptors
GetInternalApplication("extraction")->ExecuteAndWriteOutput();
......@@ -229,7 +228,7 @@ protected:
const std::string &modelFileName)
{
std::vector<std::string> extractOutputList = {sampleTrainFileName};
GetInternalApplication("training")->SetParameterStringList("io.vd", extractOutputList, false);
GetInternalApplication("training")->SetParameterStringList("io.vd", extractOutputList);
UpdateInternalParameters("training");
// set field names
......@@ -242,19 +241,19 @@ protected:
oss << i;
selectedNames.push_back( selectPrefix + oss.str() );
}
GetInternalApplication("training")->SetParameterStringList("feat", selectedNames, false);
GetInternalApplication("training")->SetParameterStringList("feat", selectedNames);
GetInternalApplication("training")->SetParameterString("classifier", "sharkkm", false);
GetInternalApplication("training")->SetParameterString("classifier", "sharkkm");
GetInternalApplication("training")->SetParameterInt("classifier.sharkkm.maxiter",
GetParameterInt("maxit"), false);
GetParameterInt("maxit"));
GetInternalApplication("training")->SetParameterInt("classifier.sharkkm.k",
GetParameterInt("nc"), false);
GetParameterInt("nc"));
if( IsParameterEnabled("rand"))
GetInternalApplication("training")->SetParameterInt("rand", GetParameterInt("rand"), false);
GetInternalApplication("training")->SetParameterInt("rand", GetParameterInt("rand"));
GetInternalApplication("training")->GetParameterByKey("v")->SetActive(false);
GetInternalApplication("training")->SetParameterString("io.out", modelFileName, false);
GetInternalApplication("training")->SetParameterString("io.out", modelFileName);
ExecuteInternal( "training" );
otbAppLogINFO("output model : " << GetInternalApplication("training")->GetParameterString("io.out"));
......@@ -264,8 +263,8 @@ protected:
const std::string &imagesStatsFileName)
{
std::vector<std::string> imageFileNameList = {imageFileName};
GetInternalApplication("imgstats")->SetParameterStringList("il", imageFileNameList, false);
GetInternalApplication("imgstats")->SetParameterString("out", imagesStatsFileName, false);
GetInternalApplication("imgstats")->SetParameterStringList("il", imageFileNameList);
GetInternalApplication("imgstats")->SetParameterString("out", imagesStatsFileName);
ExecuteInternal( "imgstats" );
otbAppLogINFO("image statistics file : " << GetInternalApplication("imgstats")->GetParameterString("out"));
......@@ -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();
......@@ -506,7 +505,7 @@ private:
void UpdateKMPolygonClassStatisticsParameters(const std::string &vectorFileName)
{
GetInternalApplication( "polystats" )->SetParameterString( "vec", vectorFileName, false );
GetInternalApplication( "polystats" )->SetParameterString( "vec", vectorFileName);
UpdateInternalParameters( "polystats" );
}
......
......@@ -164,7 +164,7 @@ private:
SetParameterDescription("strategy.all","Take all samples");
// Default strategy : smallest
SetParameterString("strategy","smallest", false);
SetParameterString("strategy","smallest");
AddParameter(ParameterType_Choice, "mim", "Multi-Image Mode");
......
......@@ -82,7 +82,7 @@ private:
AddParameter(ParameterType_String,"cfield","Field containing the predicted class.");
SetParameterDescription("cfield","Field containing the predicted class");
SetParameterString("cfield","predicted", false);
SetParameterString("cfield","predicted");
// Doc example parameter settings
SetDocExampleParameterValue("inshp", "vectorData.shp");
......
......@@ -89,7 +89,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_", false);
SetParameterString("outfield.prefix.name", "value_");
AddChoice("outfield.list","Use the given name list");
SetParameterDescription("outfield.list","Use the given name list");
......
......@@ -200,7 +200,7 @@ private:
SetParameterDescription("strategy.all","Take all samples");
// Default strategy : smallest
SetParameterString("strategy","smallest", false);
SetParameterString("strategy","smallest");
AddParameter(ParameterType_ListView, "field", "Field Name");
SetParameterDescription("field","Name of the field carrying the class name in the input vectors.");
......
......@@ -205,7 +205,7 @@ public:
TrainModel( imageList, fileNames.sampleTrainOutputs, fileNames.sampleValidOutputs );
// cleanup
if( IsParameterEnabled( "cleanup" ) )
if( GetParameterInt( "cleanup" ) )
{
otbAppLogINFO( <<"Final clean-up ..." );
fileNames.clear();
......@@ -217,7 +217,7 @@ private :
void UpdatePolygonClassStatisticsParameters()
{
std::vector<std::string> vectorFileList = GetParameterStringList( "io.vd" );
GetInternalApplication( "polystat" )->SetParameterString( "vec", vectorFileList[0], false );
GetInternalApplication( "polystat" )->SetParameterString( "vec", vectorFileList[0]);
UpdateInternalParameters( "polystat" );
}
......
......@@ -183,7 +183,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 , false );
SetParameterFloat( "sample.vtr" , 0.5);
Superclass::DoInit();
......
......@@ -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"
......