Commit baeffe2d authored by Ludovic Hussonnois's avatar Ludovic Hussonnois

STYLE: Change include order add ignore some warning for shark.

parent 4f8f6e36
...@@ -18,14 +18,16 @@ ...@@ -18,14 +18,16 @@
#ifndef otbSharkUtils_h #ifndef otbSharkUtils_h
#define otbSharkUtils_h #define otbSharkUtils_h
#include "otb_shark.h" #ifdef OTB_USE_SHARK
#include "itkMacro.h" #include "itkMacro.h"
#if defined(__GNUC__) || defined(__clang__) #if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif #endif
#include <shark/Data/Dataset.h> #include "otb_shark.h"
#include "shark/Data/Dataset.h"
#if defined(__GNUC__) || defined(__clang__) #if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif #endif
...@@ -120,6 +122,7 @@ template <class T> void ListSampleToSharkVector(const T * listSample, std::vecto ...@@ -120,6 +122,7 @@ template <class T> void ListSampleToSharkVector(const T * listSample, std::vecto
} }
} }
#endif //OTB_USE_SHARK
#endif #endif
...@@ -18,8 +18,6 @@ ...@@ -18,8 +18,6 @@
#ifndef otbSharkRandomForestsMachineLearningModel_h #ifndef otbSharkRandomForestsMachineLearningModel_h
#define otbSharkRandomForestsMachineLearningModel_h #define otbSharkRandomForestsMachineLearningModel_h
#include "otb_shark.h"
#include "itkLightObject.h" #include "itkLightObject.h"
#include "otbMachineLearningModel.h" #include "otbMachineLearningModel.h"
...@@ -33,6 +31,7 @@ ...@@ -33,6 +31,7 @@
#pragma GCC diagnostic ignored "-Wcast-align" #pragma GCC diagnostic ignored "-Wcast-align"
#pragma GCC diagnostic ignored "-Wunknown-pragmas" #pragma GCC diagnostic ignored "-Wunknown-pragmas"
#endif #endif
#include "otb_shark.h"
#include "shark/Algorithms/Trainers/RFTrainer.h" #include "shark/Algorithms/Trainers/RFTrainer.h"
#if defined(__GNUC__) || defined(__clang__) #if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
......
...@@ -17,6 +17,7 @@ otb_module(OTBUnsupervised ...@@ -17,6 +17,7 @@ otb_module(OTBUnsupervised
OTBImageBase OTBImageBase
OTBLearningBase OTBLearningBase
OTBSupervised OTBSupervised
OTBShark
DESCRIPTION DESCRIPTION
"${DOCUMENTATION}" "${DOCUMENTATION}"
......
...@@ -51,15 +51,15 @@ void generateSamples(unsigned int num_classes, unsigned int num_samples, ...@@ -51,15 +51,15 @@ void generateSamples(unsigned int num_classes, unsigned int num_samples,
LocalInputListSampleType * samples, LocalInputListSampleType * samples,
LocalTargetListSampleType * labels) LocalTargetListSampleType * labels)
{ {
std::default_random_engine generator; std::default_random_engine randomEngine;
std::uniform_int_distribution<int> label_distribution(1,num_classes); std::uniform_int_distribution<int> label_distribution(1,num_classes);
std::uniform_int_distribution<int> feat_distribution(0,256); std::uniform_int_distribution<int> feat_distribution(0,256);
for(size_t scount=0; scount<num_samples; ++scount) for(size_t scount=0; scount<num_samples; ++scount)
{ {
LabeledPixelType label = label_distribution(generator); LabeledPixelType label = label_distribution(randomEngine);
LocalInputSampleType sample(num_features); LocalInputSampleType sample(num_features);
for(unsigned int i=0; i<num_features; ++i) for(unsigned int i=0; i<num_features; ++i)
sample[i]= feat_distribution(generator); sample[i]= feat_distribution(randomEngine);
samples->SetMeasurementVectorSize(num_features); samples->SetMeasurementVectorSize(num_features);
samples->PushBack(sample); samples->PushBack(sample);
labels->PushBack(label); labels->PushBack(label);
......
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include <iostream> #include <iostream>
#include <otbConfigure.h> #include <otbConfigure.h>
......
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "otbTestMain.h" #include "otbTestMain.h"
void RegisterTests() void RegisterTests()
{ {
......
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