Skip to content
Snippets Groups Projects
Commit 9d1e0f60 authored by Marina Bertolino's avatar Marina Bertolino
Browse files

ENH: add const at std::string parameters in KMeans class

parent edb3438b
No related branches found
No related tags found
No related merge requests found
......@@ -98,9 +98,9 @@ public:
* \param sampleFileName samples select output filename
* \param sampleExtractFileName samples extract filename
*/
void SelectAndExtractSamples(std::string statisticsFileName,
std::string fieldName,
std::string sampleFileName,
void SelectAndExtractSamples(const std::string &statisticsFileName,
const std::string &fieldName,
const std::string &sampleFileName,
int NBSamples);
/**
......@@ -110,16 +110,16 @@ public:
* \param modelFileName model filename
*/
void TrainKMModel(FloatVectorImageType *image,
std::string sampleTrainFileName,
std::string modelFileName);
const std::string &sampleTrainFileName,
const std::string &modelFileName);
/**
* Compute image second order statistics
* \param imageFileName input image filename
* \param imagesStatsFileName image statistics
*/
void ComputeImageStatistics(std::string imageFileName,
std::string imagesStatsFileName);
void ComputeImageStatistics(const std::string &imageFileName,
const std::string &imagesStatsFileName);
/**
* Performs a classification of the input image according to a model file
......@@ -135,7 +135,7 @@ public:
* \param modelFileName model filename
* \param nbClasses number of class
*/
void CreateOutMeansFile(FloatVectorImageType *image, std::string modelFileName,
void CreateOutMeansFile(FloatVectorImageType *image, const std::string &modelFileName,
unsigned int nbClasses);
/**
......@@ -147,7 +147,7 @@ public:
class KMeansFileNamesHandler
{
public :
void CreateTemporaryFileNames(std::string outPath)
void CreateTemporaryFileNames(const std::string &outPath)
{
tmpVectorFile = outPath + "_imgEnvelope.shp";
polyStatOutput = outPath + "_polyStats.xml";
......@@ -172,7 +172,7 @@ public:
std::string imgStatOutput;
private:
bool RemoveFile(std::string &filePath)
bool RemoveFile(const std::string &filePath)
{
bool res = true;
if( itksys::SystemTools::FileExists( filePath.c_str() ) )
......
......@@ -178,9 +178,9 @@ void ClassKMeansBase::ComputePolygonStatistics(const std::string &statisticsFile
ExecuteInternal("polystats");
}
void ClassKMeansBase::SelectAndExtractSamples(std::string statisticsFileName,
std::string fieldName,
std::string sampleFileName,
void ClassKMeansBase::SelectAndExtractSamples(const std::string &statisticsFileName,
const std::string &fieldName,
const std::string &sampleFileName,
int NBSamples)
{
/* SampleSelection */
......@@ -210,8 +210,8 @@ void ClassKMeansBase::SelectAndExtractSamples(std::string statisticsFileName,
}
void ClassKMeansBase::TrainKMModel(FloatVectorImageType *image,
std::string sampleTrainFileName,
std::string modelFileName)
const std::string &sampleTrainFileName,
const std::string &modelFileName)
{
std::vector<std::string> extractOutputList = {sampleTrainFileName};
GetInternalApplication("training")->SetParameterStringList("io.vd", extractOutputList, false);
......@@ -245,8 +245,8 @@ void ClassKMeansBase::TrainKMModel(FloatVectorImageType *image,
otbAppLogINFO("output model : " << GetInternalApplication("training")->GetParameterString("io.out"));
}
void ClassKMeansBase::ComputeImageStatistics(std::string imageFileName,
std::string imagesStatsFileName)
void ClassKMeansBase::ComputeImageStatistics(const std::string &imageFileName,
const std::string &imagesStatsFileName)
{
std::vector<std::string> imageFileNameList = {imageFileName};
GetInternalApplication("imgstats")->SetParameterStringList("il", imageFileNameList, false);
......@@ -263,7 +263,7 @@ void ClassKMeansBase::KMeansClassif()
}
void ClassKMeansBase::CreateOutMeansFile(FloatVectorImageType *image,
std::string modelFileName,
const std::string &modelFileName,
unsigned int nbClasses)
{
if (IsParameterEnabled("outmeans"))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment