From 16a15c115462b2044b4b66a1b97cae3342d63ac2 Mon Sep 17 00:00:00 2001
From: Sebastien Harasse <sebastien.harasse@c-s.fr>
Date: Mon, 30 Apr 2012 18:28:38 +0200
Subject: [PATCH] STYLE: Variable renaming, indenting

---
 Code/BasicFilters/otbMeanShiftImageFilter2.h  | 38 +++++++++--------
 .../BasicFilters/otbMeanShiftImageFilter2.txx | 42 +++++++++----------
 2 files changed, 42 insertions(+), 38 deletions(-)

diff --git a/Code/BasicFilters/otbMeanShiftImageFilter2.h b/Code/BasicFilters/otbMeanShiftImageFilter2.h
index 37ed0f2440..203e1ac494 100644
--- a/Code/BasicFilters/otbMeanShiftImageFilter2.h
+++ b/Code/BasicFilters/otbMeanShiftImageFilter2.h
@@ -44,7 +44,8 @@ public:
   SpatialRangeJointDomainTransform() {}
   ~SpatialRangeJointDomainTransform() {}
 
-  inline typename TOutputJointImage::PixelType operator() (const typename TInputImage::PixelType & inputPixel, const typename TInputImage::IndexType & index)
+  inline typename TOutputJointImage::PixelType operator()
+  (const typename TInputImage::PixelType & inputPixel, const typename TInputImage::IndexType & index)
   {
     typename TOutputJointImage::PixelType jointPixel;
     jointPixel.SetSize(ImageDimension + m_NumberOfComponentsPerPixel);
@@ -60,7 +61,8 @@ public:
     return jointPixel;
   }
 
-  void Initialize(unsigned int _ImageDimension, unsigned int _m_NumberOfComponentsPerPixel, RealType _m_SpatialBandwidth, RealType _m_RangeBandwidth)
+  void Initialize(unsigned int _ImageDimension, unsigned int _m_NumberOfComponentsPerPixel,
+                  RealType _m_SpatialBandwidth, RealType _m_RangeBandwidth)
   {
     ImageDimension = _ImageDimension;
     m_NumberOfComponentsPerPixel = _m_NumberOfComponentsPerPixel;
@@ -78,8 +80,8 @@ private:
   unsigned int ImageDimension;
   unsigned int m_NumberOfComponentsPerPixel;
   unsigned int m_OutputSize;
-  RealType m_SpatialBandwidth;
-  RealType m_RangeBandwidth;
+  RealType     m_SpatialBandwidth;
+  RealType     m_RangeBandwidth;
 };
 
 
@@ -169,15 +171,15 @@ public:
 
   /** Template parameters typedefs */
 
-  typedef TInputImage                           InputImageType;
-  typedef typename InputImageType::Pointer      InputImagePointerType;
-  typedef typename InputImageType::PixelType    InputPixelType;
-  typedef typename InputImageType::IndexType    InputIndexType;
-  typedef typename InputImageType::SizeType     InputSizeType;
+  typedef TInputImage                             InputImageType;
+  typedef typename InputImageType::Pointer        InputImagePointerType;
+  typedef typename InputImageType::PixelType      InputPixelType;
+  typedef typename InputImageType::IndexType      InputIndexType;
+  typedef typename InputImageType::SizeType       InputSizeType;
   typedef typename InputImageType::IndexValueType InputIndexValueType;
-  typedef typename InputImageType::PointType    PointType;
-  typedef typename InputImageType::RegionType   RegionType;
-  typedef typename InputImageType::SizeType     SizeType;
+  typedef typename InputImageType::PointType      PointType;
+  typedef typename InputImageType::RegionType     RegionType;
+  typedef typename InputImageType::SizeType       SizeType;
 
   typedef TOutputImage                          OutputImageType;
   typedef typename OutputImageType::Pointer     OutputImagePointerType;
@@ -195,13 +197,13 @@ public:
   typedef typename OutputSpatialImageType::Pointer                   OutputSpatialImagePointerType;
   typedef typename OutputSpatialImageType::PixelType                 OutputSpatialPixelType;
 
-  typedef TKernel                                     KernelType;
+  typedef TKernel KernelType;
 
   itkStaticConstMacro(ImageDimension, unsigned int, InputImageType::ImageDimension);
 
-  typedef itk::VariableLengthVector<RealType>         RealVector;
+  typedef itk::VariableLengthVector<RealType>                        RealVector;
   typedef otb::VectorImage<RealType, InputImageType::ImageDimension> RealVectorImageType;
-  typedef otb::Image<unsigned short, InputImageType::ImageDimension>  ModeTableImageType;
+  typedef otb::Image<unsigned short, InputImageType::ImageDimension> ModeTableImageType;
 
   /** Setters / Getters */
   itkSetMacro(SpatialBandwidth, RealType);
@@ -276,7 +278,9 @@ protected:
   /** PrintSelf method */
   virtual void PrintSelf(std::ostream& os, itk::Indent indent) const;
 
-  virtual void CalculateMeanShiftVector(typename RealVectorImageType::Pointer inputImagePtr, RealVector jointPixel, const OutputRegionType& outputRegion, RealVector & meanShiftVector);
+  virtual void CalculateMeanShiftVector(typename RealVectorImageType::Pointer inputImagePtr,
+                                        RealVector jointPixel, const OutputRegionType& outputRegion,
+                                        RealVector & meanShiftVector);
 
 private:
   MeanShiftImageFilter2(const Self &); //purposely not implemented
@@ -313,7 +317,7 @@ private:
    * 2 : pixel is in the path of the currently processed pixel and a mode will
    *     be assigned to it
    */
-  typename ModeTableImageType::Pointer m_modeTable;
+  typename ModeTableImageType::Pointer m_ModeTable;
 
   /** Boolean to enable mode search optimization */
   bool m_ModeSearchOptimization;
diff --git a/Code/BasicFilters/otbMeanShiftImageFilter2.txx b/Code/BasicFilters/otbMeanShiftImageFilter2.txx
index 175ac0c961..14a2905def 100644
--- a/Code/BasicFilters/otbMeanShiftImageFilter2.txx
+++ b/Code/BasicFilters/otbMeanShiftImageFilter2.txx
@@ -347,10 +347,10 @@ MeanShiftImageFilter2<TInputImage, TOutputImage, TKernel, TNorm, TOutputMetricIm
     // 0 : no mode has been found yet
     // 1 : a mode has been assigned to this pixel
     // 2 : a mode will be assigned to this pixel
-    m_modeTable = ModeTableImageType::New();
-    m_modeTable->SetRegions(inputPtr->GetRequestedRegion());
-    m_modeTable->Allocate();
-    m_modeTable->FillBuffer(0);
+    m_ModeTable = ModeTableImageType::New();
+    m_ModeTable->SetRegions(inputPtr->GetRequestedRegion());
+    m_ModeTable->Allocate();
+    m_ModeTable->FillBuffer(0);
     }
 
 }
@@ -481,25 +481,25 @@ MeanShiftImageFilter2<TInputImage, TOutputImage, TKernel, TNorm, TOutputMetricIm
   this->AllocateOutputs();
 
   // Retrieve output images pointers
-  typename OutputSpatialImageType::Pointer spatialOutput = this->GetSpatialOutput();
-  typename OutputImageType::Pointer rangeOutput = this->GetRangeOutput();
-  typename OutputMetricImageType::Pointer metricOutput = this->GetMetricOutput();
+  typename OutputSpatialImageType::Pointer   spatialOutput = this->GetSpatialOutput();
+  typename OutputImageType::Pointer          rangeOutput = this->GetRangeOutput();
+  typename OutputMetricImageType::Pointer    metricOutput = this->GetMetricOutput();
   typename OutputIterationImageType::Pointer iterationOutput = this->GetIterationOutput();
 
   // Get input image pointer
   typename InputImageType::ConstPointer input = this->GetInput();
 
   // defines input and output iterators
-  typedef itk::ImageRegionIterator<OutputImageType> OutputIteratorType;
-  typedef itk::ImageRegionIterator<OutputSpatialImageType> OutputSpatialIteratorType;
-  typedef itk::ImageRegionIterator<OutputMetricImageType> OutputMetricIteratorType;
-  typedef itk::ImageRegionConstIteratorWithIndex<InputImageType> InputIteratorWithIndexType;
-  typedef itk::ImageRegionIterator<OutputIterationImageType> OutputIterationIteratorType;
+  typedef itk::ImageRegionIterator<OutputImageType>               OutputIteratorType;
+  typedef itk::ImageRegionIterator<OutputSpatialImageType>        OutputSpatialIteratorType;
+  typedef itk::ImageRegionIterator<OutputMetricImageType>         OutputMetricIteratorType;
+  typedef itk::ImageRegionConstIteratorWithIndex<InputImageType>  InputIteratorWithIndexType;
+  typedef itk::ImageRegionIterator<OutputIterationImageType>      OutputIterationIteratorType;
 
 
-  typename OutputImageType::PixelType rangePixel;
-  typename OutputSpatialImageType::PixelType spatialPixel;
-  typename OutputMetricImageType::PixelType metricPixel;
+  typename OutputImageType::PixelType          rangePixel;
+  typename OutputSpatialImageType::PixelType   spatialPixel;
+  typename OutputMetricImageType::PixelType    metricPixel;
   typename OutputIterationImageType::PixelType iterationPixel;
 
   InputIndexType index;
@@ -583,7 +583,7 @@ MeanShiftImageFilter2<TInputImage, TOutputImage, TKernel, TNorm, TOutputMetricIm
         // but not 2 (pixel in current search path), and pixel has actually moved
         // from its initial position, and pixel candidate is inside the output
         // region, then perform optimization tasks
-        if (m_modeTable->GetPixel(modeCandidate) != 2 && modeCandidate != currentIndex && outputRegionForThread.IsInside(modeCandidate))
+        if (m_ModeTable->GetPixel(modeCandidate) != 2 && modeCandidate != currentIndex && outputRegionForThread.IsInside(modeCandidate))
           {
           // Obtain the data point to see if it close to jointPixel
           RealVector candidatePixel;
@@ -600,12 +600,12 @@ MeanShiftImageFilter2<TInputImage, TOutputImage, TKernel, TNorm, TOutputMetricIm
             {
             // If no mode has been associated to the candidate pixel then
             // associate it to the upcoming mode
-            if( m_modeTable->GetPixel(modeCandidate) == 0)
+            if( m_ModeTable->GetPixel(modeCandidate) == 0)
               {
               // Add the candidate to the list of pixels that will be assigned the
               // finally calculated mode value
               pointList[pointCount++] = modeCandidate;
-              m_modeTable->SetPixel(modeCandidate, 2);
+              m_ModeTable->SetPixel(modeCandidate, 2);
               } else // == 1
               {
               // The candidate pixel has already been assigned to a mode
@@ -616,7 +616,7 @@ MeanShiftImageFilter2<TInputImage, TOutputImage, TKernel, TNorm, TOutputMetricIm
                 jointPixel[ImageDimension + comp] = rangePixel[comp] / m_RangeBandwidth;
                 }
               // Update the mode table because pixel will be assigned just now
-              m_modeTable->SetPixel(currentIndex, 2);
+              m_ModeTable->SetPixel(currentIndex, 2);
               // bypass further calculation
               numBreaks++;
               break;
@@ -673,13 +673,13 @@ MeanShiftImageFilter2<TInputImage, TOutputImage, TKernel, TNorm, TOutputMetricIm
     if (m_ModeSearchOptimization)
       {
       // Update the mode table now that the current pixel has been assigned
-      m_modeTable->SetPixel(currentIndex, 1);
+      m_ModeTable->SetPixel(currentIndex, 1);
 
       // Also assign all points in the list to the same mode
       for (unsigned int i = 0; i < pointCount; i++)
         {
         rangeOutput->SetPixel(pointList[i], rangePixel);
-        m_modeTable->SetPixel(pointList[i], 1);
+        m_ModeTable->SetPixel(pointList[i], 1);
         }
       }
 
-- 
GitLab