From 9f521be3822731610599c97e34a4e0b8d00ed745 Mon Sep 17 00:00:00 2001
From: ctraizet <cedric.traizet@c-s.fr>
Date: Tue, 19 Mar 2019 11:58:25 +0100
Subject: [PATCH] STYLE: run clange format

---
 .../app/otbZonalStatistics.cxx                | 40 +++++++++----------
 .../app/otbContrastEnhancement.cxx            | 28 ++++++-------
 .../AppImageUtils/app/otbColorMapping.cxx     |  8 ++--
 .../app/otbHooverCompareSegmentation.cxx      |  8 ++--
 .../include/otbDotProductImageFilter.h        | 24 +++++------
 .../otbProjectiveProjectionImageFilter.h      |  9 ++---
 .../include/otbISRAUnmixingImageFilter.h      | 10 ++---
 .../include/otbNCLSUnmixingImageFilter.h      |  6 +--
 .../otbUnConstrainedLeastSquareImageFilter.h  | 11 +++--
 9 files changed, 63 insertions(+), 81 deletions(-)

diff --git a/Modules/Applications/AppClassification/app/otbZonalStatistics.cxx b/Modules/Applications/AppClassification/app/otbZonalStatistics.cxx
index 1697e13bde..7d78276c47 100644
--- a/Modules/Applications/AppClassification/app/otbZonalStatistics.cxx
+++ b/Modules/Applications/AppClassification/app/otbZonalStatistics.cxx
@@ -79,7 +79,7 @@ public:
   typedef itk::BinaryThresholdImageFilter<LabelImageType,
                                           LabelImageType>                   ThresholdFilterType;
 
-  template<class TInput, class TOutput>
+  template <class TInput, class TOutput>
   struct EncoderFunctorType
   {
     StatsFilterType::LabelPopulationMapType* m_CountMap;
@@ -93,17 +93,17 @@ public:
     static constexpr size_t m_NbStatsPerBand{4};
     static constexpr size_t m_NbGlobalStats{1};
 
-    size_t OutputSize(const std::array<size_t,1> & ) const
+    size_t OutputSize(const std::array<size_t, 1>&) const
     {
       return m_NbInputComponents*m_NbStatsPerBand+m_NbGlobalStats;
     }
 
     size_t OutputSize() const
     {
-      return m_NbInputComponents*m_NbStatsPerBand+m_NbGlobalStats;
+      return m_NbInputComponents * m_NbStatsPerBand + m_NbGlobalStats;
     }
 
-    TOutput operator()(TInput const &pix)
+    TOutput operator()(TInput const& pix)
     {
       TOutput outPix(OutputSize());
       outPix.Fill(m_OutBvValue);
@@ -135,11 +135,8 @@ public:
       else return false;
     }
   };
-  typedef otb::FunctorImageFilter<EncoderFunctorType<
-                                          LabelValueType,
-                                          FloatVectorImageType::PixelType 
-                                            >> EncoderFilterType;
-  
+  typedef otb::FunctorImageFilter<EncoderFunctorType<LabelValueType, FloatVectorImageType::PixelType>> EncoderFilterType;
+
   /** Standard macro */
   itkNewMacro(Self);
   itkTypeMacro(ZonalStatistics, Application);
@@ -414,19 +411,18 @@ public:
       m_EncoderFilter->SetInput(m_RasterizeFilter->GetOutput());
       }
 
-    m_EncoderFilter->GetModifiableFunctor().m_CountMap = &m_CountMap;
-    m_EncoderFilter->GetModifiableFunctor().m_MeanMap = &m_MeanMap;
-    m_EncoderFilter->GetModifiableFunctor().m_StdMap = &m_StdMap;
-    m_EncoderFilter->GetModifiableFunctor().m_MinMap = &m_MinMap;
-    m_EncoderFilter->GetModifiableFunctor().m_MaxMap = &m_MaxMap;
-    m_EncoderFilter->GetModifiableFunctor().m_NbInputComponents = m_InputImage->GetNumberOfComponentsPerPixel();
-    m_EncoderFilter->GetModifiableFunctor().m_InNoData = m_IntNoData;
-    m_EncoderFilter->GetModifiableFunctor().m_OutBvValue = m_OutBvValue;
-    
-    otbAppLogINFO("Output raster image will have " << 
-                  (m_EncoderFilter->GetFunctor()).OutputSize() << " bands\n");
-    AddProcess(m_EncoderFilter, "Encode output raster image");
-    SetParameterOutputImage("out.raster.filename", m_EncoderFilter->GetOutput());
+      m_EncoderFilter->GetModifiableFunctor().m_CountMap          = &m_CountMap;
+      m_EncoderFilter->GetModifiableFunctor().m_MeanMap           = &m_MeanMap;
+      m_EncoderFilter->GetModifiableFunctor().m_StdMap            = &m_StdMap;
+      m_EncoderFilter->GetModifiableFunctor().m_MinMap            = &m_MinMap;
+      m_EncoderFilter->GetModifiableFunctor().m_MaxMap            = &m_MaxMap;
+      m_EncoderFilter->GetModifiableFunctor().m_NbInputComponents = m_InputImage->GetNumberOfComponentsPerPixel();
+      m_EncoderFilter->GetModifiableFunctor().m_InNoData          = m_IntNoData;
+      m_EncoderFilter->GetModifiableFunctor().m_OutBvValue        = m_OutBvValue;
+
+      otbAppLogINFO("Output raster image will have " << (m_EncoderFilter->GetFunctor()).OutputSize() << " bands\n");
+      AddProcess(m_EncoderFilter, "Encode output raster image");
+      SetParameterOutputImage("out.raster.filename", m_EncoderFilter->GetOutput());
   }
 
   void WriteXMLStatsFile()
diff --git a/Modules/Applications/AppFiltering/app/otbContrastEnhancement.cxx b/Modules/Applications/AppFiltering/app/otbContrastEnhancement.cxx
index 4a1bc5880b..bbb8f2757b 100644
--- a/Modules/Applications/AppFiltering/app/otbContrastEnhancement.cxx
+++ b/Modules/Applications/AppFiltering/app/otbContrastEnhancement.cxx
@@ -46,25 +46,23 @@ namespace Wrapper
 namespace Functor
 {
 
-template<class TInput, class TOutput>
+template <class TInput, class TOutput>
 class LuminanceOperator
 {
 public:
   LuminanceOperator() = default;
-  
-  size_t OutputSize(const std::array<size_t,1> &) const
+
+  size_t OutputSize(const std::array<size_t, 1>&) const
   {
     return 1;
   }
   virtual ~LuminanceOperator() = default;
 
- TOutput operator() (  TInput  input )
-  { 
-  TOutput out(1);  
-  out[0] = m_LumCoef[0] * input[m_Rgb[0]] + 
-           m_LumCoef[1] * input[m_Rgb[1]] + 
-           m_LumCoef[2] * input[m_Rgb[2]] ;
-  return out;
+  TOutput operator()(TInput input)
+  {
+    TOutput out(1);
+    out[0] = m_LumCoef[0] * input[m_Rgb[0]] + m_LumCoef[1] * input[m_Rgb[1]] + m_LumCoef[2] * input[m_Rgb[2]];
+    return out;
   } // end operator ()
 
 
@@ -86,7 +84,7 @@ private:
   std::vector<float> m_LumCoef;
 }; // end of functor class LuminanceOperator
 
-}  // namespace functor
+} // namespace functor
 
 class ContrastEnhancement : public Application
 {
@@ -127,9 +125,7 @@ public:
   typedef otb::StreamingStatisticsImageFilter < FloatImageType >
           StatsFilterType;
 
-  typedef otb::FunctorImageFilter < Functor::LuminanceOperator
-    <FloatVectorImageType::PixelType, FloatVectorImageType::PixelType> > 
-          LuminanceFunctorType;
+  typedef otb::FunctorImageFilter<Functor::LuminanceOperator<FloatVectorImageType::PixelType, FloatVectorImageType::PixelType>> LuminanceFunctorType;
 
   typedef itk::StreamingImageFilter < LutType , LutType > 
           StreamingImageFilterType;
@@ -705,8 +701,8 @@ private:
       lumCoef[i] /= sum;
       }
     m_LuminanceFunctor =  LuminanceFunctorType::New() ;
-    m_LuminanceFunctor->GetModifiableFunctor().SetRgb( rgb );
-    m_LuminanceFunctor->GetModifiableFunctor().SetLumCoef( lumCoef );
+    m_LuminanceFunctor->GetModifiableFunctor().SetRgb(rgb);
+    m_LuminanceFunctor->GetModifiableFunctor().SetLumCoef(lumCoef);
     m_LuminanceFunctor->SetInput( inImage );
     m_LuminanceFunctor->UpdateOutputInformation();
   }
diff --git a/Modules/Applications/AppImageUtils/app/otbColorMapping.cxx b/Modules/Applications/AppImageUtils/app/otbColorMapping.cxx
index b34512b1cc..e2078b324c 100644
--- a/Modules/Applications/AppImageUtils/app/otbColorMapping.cxx
+++ b/Modules/Applications/AppImageUtils/app/otbColorMapping.cxx
@@ -92,8 +92,8 @@ public:
   {
     m_OutputSize = nb;
   }
-  
-  size_t OutputSize(const std::array<size_t,1> & ) const
+
+  size_t OutputSize(const std::array<size_t, 1>&) const
   {
     return m_OutputSize;
   }
@@ -224,9 +224,7 @@ public:
     StreamingStatisticsMapFromLabelImageFilterType;
 
   // Inverse mapper for color->label operation
-  typedef otb::FunctorImageFilter
-    <Functor::VectorMapping
-      <RGBPixelType, LabelVectorType> >               ColorToLabelFilterType;
+  typedef otb::FunctorImageFilter<Functor::VectorMapping<RGBPixelType, LabelVectorType>> ColorToLabelFilterType;
 
   // Streaming the input image for color->label operation
   typedef RGBImageType::RegionType                    RegionType;
diff --git a/Modules/Applications/AppSegmentation/app/otbHooverCompareSegmentation.cxx b/Modules/Applications/AppSegmentation/app/otbHooverCompareSegmentation.cxx
index 8f39edc15f..dcc25d7101 100644
--- a/Modules/Applications/AppSegmentation/app/otbHooverCompareSegmentation.cxx
+++ b/Modules/Applications/AppSegmentation/app/otbHooverCompareSegmentation.cxx
@@ -43,11 +43,11 @@ public:
 
   typedef std::vector<TOutput> ColorListType;
 
-  size_t OutputSize(const std::array<size_t,1> &) const
+  size_t OutputSize(const std::array<size_t, 1>&) const
   {
     return 3;
   }
-  
+
   void AddColor(const TOutput& color)
   {
     m_ScoreColors.push_back(color);
@@ -124,9 +124,7 @@ public:
   typedef otb::HooverInstanceFilter<LabelMapType>   InstanceFilterType;
   typedef otb::LabelMapToAttributeImageFilter
       <LabelMapType, FloatVectorImageType>          AttributeImageFilterType;
-  typedef otb::FunctorImageFilter
-      <Functor::HooverColorMapping
-        <FloatPixelType, Int16PixelType> >          HooverColorFilterType;
+  typedef otb::FunctorImageFilter<Functor::HooverColorMapping<FloatPixelType, Int16PixelType>> HooverColorFilterType;
 
 private:
   void DoInit() override
diff --git a/Modules/Core/Functor/include/otbDotProductImageFilter.h b/Modules/Core/Functor/include/otbDotProductImageFilter.h
index 471787a8fd..57af72b6e9 100644
--- a/Modules/Core/Functor/include/otbDotProductImageFilter.h
+++ b/Modules/Core/Functor/include/otbDotProductImageFilter.h
@@ -27,7 +27,8 @@
 namespace otb
 {
 
-namespace Functor {
+namespace Functor
+{
 
 /** \class DotProductFunctor
  *
@@ -35,14 +36,14 @@ namespace Functor {
  *
  * \ingroup OTBCommon
  */
-template<class TInput, class TOutput>
+template <class TInput, class TOutput>
 class DotProductFunctor
 {
 public:
-  typedef TInput     InputType;
-  typedef TOutput    OutputType;
+  typedef TInput  InputType;
+  typedef TOutput OutputType;
 
-  DotProductFunctor() = default;
+  DotProductFunctor()          = default;
   virtual ~DotProductFunctor() = default;
 
   const InputType& GetVector()
@@ -55,14 +56,14 @@ public:
     m_Vector = m;
   }
 
-  OutputType operator ()(const InputType& in)
+  OutputType operator()(const InputType& in)
   {
     assert(in.Size() == m.Size());
     OutputType result = 0;
-    for(unsigned int i = 0; i < in.Size(); ++i)
-      {
+    for (unsigned int i = 0; i < in.Size(); ++i)
+    {
       result += in[i] * m_Vector[i];
-      }
+    }
     return result;
   }
 
@@ -79,15 +80,14 @@ private:
  * with respect to the specified vector
  *
  * \sa otb::Functor::DotProductFunctor
- * 
+ *
  * \ingroup Streamed
  * \ingroup Threaded
  *
  * \ingroup OTBFunctor
  */
 template <typename TInputImage, typename TOutputImage>
-using DotProductImageFilter = FunctorImageFilter<
-    Functor::DotProductFunctor<typename TInputImage::PixelType, typename TOutputImage::PixelType> >;
+using DotProductImageFilter = FunctorImageFilter<Functor::DotProductFunctor<typename TInputImage::PixelType, typename TOutputImage::PixelType>>;
 
 } // namespace otb
 #endif
diff --git a/Modules/Filtering/Projection/include/otbProjectiveProjectionImageFilter.h b/Modules/Filtering/Projection/include/otbProjectiveProjectionImageFilter.h
index 8eeaf539b2..8734cbfc6a 100644
--- a/Modules/Filtering/Projection/include/otbProjectiveProjectionImageFilter.h
+++ b/Modules/Filtering/Projection/include/otbProjectiveProjectionImageFilter.h
@@ -48,13 +48,13 @@ public:
   ProjectiveProjectionFunctor() : m_OutputSize(0) {}
   virtual ~ProjectiveProjectionFunctor() {}
 
-  size_t OutputSize(const std::array<size_t,1> & nbBands) const;
+  size_t OutputSize(const std::array<size_t, 1>& nbBands) const;
 
   const InputType& GetProjectionDirection();
 
   void SetProjectionDirection(const InputType& p);
 
-  OutputType operator ()(const InputType& in);
+  OutputType operator()(const InputType& in);
 
 private:
   unsigned int   m_OutputSize;
@@ -72,9 +72,8 @@ private:
  * \ingroup OTBProjection
  */
 template <typename TInputImage, typename TOutputImage, typename TPrecision>
-using ProjectiveProjectionImageFilter = FunctorImageFilter<
-        Functor::ProjectiveProjectionFunctor<typename TInputImage::PixelType,
-          typename TOutputImage::PixelType, TPrecision> >;
+using ProjectiveProjectionImageFilter =
+    FunctorImageFilter<Functor::ProjectiveProjectionFunctor<typename TInputImage::PixelType, typename TOutputImage::PixelType, TPrecision>>;
 
 } // end namespace otb
 
diff --git a/Modules/Hyperspectral/Unmixing/include/otbISRAUnmixingImageFilter.h b/Modules/Hyperspectral/Unmixing/include/otbISRAUnmixingImageFilter.h
index 3306472785..9ab74bfde3 100644
--- a/Modules/Hyperspectral/Unmixing/include/otbISRAUnmixingImageFilter.h
+++ b/Modules/Hyperspectral/Unmixing/include/otbISRAUnmixingImageFilter.h
@@ -36,7 +36,7 @@ namespace Functor {
  * \brief Perform fully constrained least squares on a pixel
  *
  * \sa ISRAUnmixingImageFilter
- * 
+ *
  * \ingroup OTBUnmixing
  */
 template<class TInput, class TOutput, class TPrecision>
@@ -53,9 +53,9 @@ public:
   typedef vnl_matrix<PrecisionType> MatrixType;
 
   ISRAUnmixingFunctor();
-  virtual ~ISRAUnmixingFunctor() =default;
+  virtual ~ISRAUnmixingFunctor() = default;
 
-  size_t OutputSize(const std::array<size_t,1> & nbBands) const;
+  size_t OutputSize(const std::array<size_t, 1>& nbBands) const;
 
   void SetEndmembersMatrix(const MatrixType& U);
   const MatrixType& GetEndmembersMatrix(void) const;
@@ -116,9 +116,7 @@ private:
  * \ingroup OTBUnmixing
  */
 template <typename TInputImage, typename TOutputImage, typename TPrecision>
-using ISRAUnmixingImageFilter = FunctorImageFilter<
-        Functor::ISRAUnmixingFunctor<typename TInputImage::PixelType,
-          typename TOutputImage::PixelType, TPrecision> >;
+using ISRAUnmixingImageFilter = FunctorImageFilter<Functor::ISRAUnmixingFunctor<typename TInputImage::PixelType, typename TOutputImage::PixelType, TPrecision>>;
 
 } // end namespace otb
 
diff --git a/Modules/Hyperspectral/Unmixing/include/otbNCLSUnmixingImageFilter.h b/Modules/Hyperspectral/Unmixing/include/otbNCLSUnmixingImageFilter.h
index 28afc9d914..aa3ef08ce4 100644
--- a/Modules/Hyperspectral/Unmixing/include/otbNCLSUnmixingImageFilter.h
+++ b/Modules/Hyperspectral/Unmixing/include/otbNCLSUnmixingImageFilter.h
@@ -56,7 +56,7 @@ public:
   NCLSUnmixingFunctor();
   virtual ~NCLSUnmixingFunctor() = default;
 
-  size_t OutputSize(const std::array<size_t,1> & nbBands) const;
+  size_t OutputSize(const std::array<size_t, 1>& nbBands) const;
 
   void SetEndmembersMatrix(const MatrixType& U);
   const MatrixType& GetEndmembersMatrix(void) const;
@@ -119,9 +119,7 @@ private:
  * \ingroup OTBUnmixing
  */
 template <typename TInputImage, typename TOutputImage, typename TPrecision>
-using NCLSUnmixingImageFilter = FunctorImageFilter<
-        Functor::NCLSUnmixingFunctor<typename TInputImage::PixelType,
-          typename TOutputImage::PixelType, TPrecision> >;
+using NCLSUnmixingImageFilter = FunctorImageFilter<Functor::NCLSUnmixingFunctor<typename TInputImage::PixelType, typename TOutputImage::PixelType, TPrecision>>;
 
 } // end namespace otb
 
diff --git a/Modules/Hyperspectral/Unmixing/include/otbUnConstrainedLeastSquareImageFilter.h b/Modules/Hyperspectral/Unmixing/include/otbUnConstrainedLeastSquareImageFilter.h
index 82d541808c..ae57d18a5b 100644
--- a/Modules/Hyperspectral/Unmixing/include/otbUnConstrainedLeastSquareImageFilter.h
+++ b/Modules/Hyperspectral/Unmixing/include/otbUnConstrainedLeastSquareImageFilter.h
@@ -50,14 +50,14 @@ public:
   typedef vnl_vector<PrecisionType> VectorType;
   typedef vnl_matrix<PrecisionType> MatrixType;
 
-  UnConstrainedLeastSquareFunctor() : m_OutputSize(0) {};
+  UnConstrainedLeastSquareFunctor() : m_OutputSize(0){};
   virtual ~UnConstrainedLeastSquareFunctor() = default;
 
-  size_t OutputSize(const std::array<size_t,1> & nbBands) const;
+  size_t OutputSize(const std::array<size_t, 1>& nbBands) const;
 
   void SetMatrix(const MatrixType& m);
 
-  OutputType operator ()(const InputType& in) const;
+  OutputType operator()(const InputType& in) const;
 
 private:
 
@@ -92,9 +92,8 @@ private:
  * \ingroup OTBUnmixing
  */
 template <typename TInputImage, typename TOutputImage, typename TPrecision>
-using UnConstrainedLeastSquareImageFilter = FunctorImageFilter<
-        Functor::UnConstrainedLeastSquareFunctor<typename TInputImage::PixelType,
-          typename TOutputImage::PixelType, TPrecision> >;
+using UnConstrainedLeastSquareImageFilter =
+    FunctorImageFilter<Functor::UnConstrainedLeastSquareFunctor<typename TInputImage::PixelType, typename TOutputImage::PixelType, TPrecision>>;
 
 } // end namespace otb
 
-- 
GitLab