From f0cf5b7e81f482b2098f3c806bf1108794221637 Mon Sep 17 00:00:00 2001
From: Manuel Grizonnet <manuel.grizonnet@orfeo-toolbox.org>
Date: Thu, 29 Sep 2011 14:48:24 +0200
Subject: [PATCH] STYLE:change c casts in c++ casts and few enhancements

---
 Code/Hyperspectral/otbMDMDNMFImageFilter.h   | 43 ++++++++------------
 Code/Hyperspectral/otbMDMDNMFImageFilter.txx |  2 +-
 2 files changed, 19 insertions(+), 26 deletions(-)

diff --git a/Code/Hyperspectral/otbMDMDNMFImageFilter.h b/Code/Hyperspectral/otbMDMDNMFImageFilter.h
index 8852de9132..88e7b6aa37 100644
--- a/Code/Hyperspectral/otbMDMDNMFImageFilter.h
+++ b/Code/Hyperspectral/otbMDMDNMFImageFilter.h
@@ -14,18 +14,10 @@
      PURPOSE.  See the above copyright notices for more information.
 
 =========================================================================*/
-
 #ifndef __otbMDMDNMFImageFilter_h
 #define __otbMDMDNMFImageFilter_h
 
 #include "itkImageToImageFilter.h"
-
-#include "itkConstShapedNeighborhoodIterator.h"
-#include "itkNeighborhoodAlgorithm.h"
-#include "itkImageRegionIterator.h"
-#include "itkListSample.h"
-#include "itkMeanCalculator.h"
-#include "itkCovarianceCalculator.h"
 #include "itkVariableSizeMatrix.h"
 #include "otbVectorImageToMatrixImageFilter.h"
 
@@ -127,10 +119,10 @@ class ITK_EXPORT MDMDNMFImageFilter:
 public:
 
   /** Standard class typedefs. */
-  typedef MDMDNMFImageFilter                                                     Self;
-  typedef itk::ImageToImageFilter< TInputImage, TOutputImage >       Superclass;
-  typedef itk::SmartPointer<Self>                                                         Pointer;
-  typedef itk::SmartPointer<const Self>                                             ConstPointer;
+  typedef MDMDNMFImageFilter                                    Self;
+  typedef itk::ImageToImageFilter< TInputImage, TOutputImage >  Superclass;
+  typedef itk::SmartPointer<Self>                               Pointer;
+  typedef itk::SmartPointer<const Self>                         ConstPointer;
 
   /** Type macro */
   itkNewMacro(Self);
@@ -139,22 +131,22 @@ public:
   itkTypeMacro(MDMDNMFImageFilter, ImageToImageFilter);
 
   /** typedef related to input and output images */
-  typedef TInputImage                                                        InputImageType;
-  typedef typename InputImageType::Pointer              InputPointerType;
-  typedef typename InputImageType::ConstPointer       InputConstPointerType;
-  typedef typename InputImageType::IndexType              InputIndexType;
-  typedef typename InputImageType::SizeType              InputSizeType;
+  typedef TInputImage                            InputImageType;
+  typedef typename InputImageType::Pointer       InputPointerType;
+  typedef typename InputImageType::ConstPointer  InputConstPointerType;
+  typedef typename InputImageType::IndexType     InputIndexType;
+  typedef typename InputImageType::SizeType      InputSizeType;
 
-  typedef TOutputImage                                                  OutputImageType;
-  typedef typename OutputImageType::Pointer              OutputPointerType;
-  typedef typename OutputImageType::IndexType              OutputIndexType;
-  typedef typename OutputImageType::OffsetType       OutputOffsetType;
-  typedef typename OutputImageType::SizeType              OutputSizeType;
-  typedef typename OutputImageType::RegionType       OutputImageRegionType;
+  typedef TOutputImage                           OutputImageType;
+  typedef typename OutputImageType::Pointer      OutputPointerType;
+  typedef typename OutputImageType::IndexType    OutputIndexType;
+  typedef typename OutputImageType::OffsetType   OutputOffsetType;
+  typedef typename OutputImageType::SizeType     OutputSizeType;
+  typedef typename OutputImageType::RegionType   OutputImageRegionType;
 
   /* Matrix type */
-  typedef double PrecisionType;
-  typedef vnl_matrix<PrecisionType> MatrixType;
+  typedef double                                                       PrecisionType;
+  typedef vnl_matrix<PrecisionType>                                    MatrixType;
   typedef typename otb::VectorImageToMatrixImageFilter<InputImageType> VectorImageToMatrixImageFilterType;
  
   /* vector type */
@@ -187,6 +179,7 @@ public:
   
   itkSetMacro(LambdS, double);
   itkGetMacro(LambdS, double);
+
 protected:
   MDMDNMFImageFilter();
   virtual ~MDMDNMFImageFilter() {}
diff --git a/Code/Hyperspectral/otbMDMDNMFImageFilter.txx b/Code/Hyperspectral/otbMDMDNMFImageFilter.txx
index 7907d562b7..94dfcfebd5 100644
--- a/Code/Hyperspectral/otbMDMDNMFImageFilter.txx
+++ b/Code/Hyperspectral/otbMDMDNMFImageFilter.txx
@@ -159,7 +159,7 @@ MDMDNMFImageFilter<TInputImage, TOutputImage>
   //--------------------   Computing f   --------------------------//
   evalf = E1.frobenius_norm() * E1.frobenius_norm()
     - m_LambdS * E2.frobenius_norm() * E2.frobenius_norm()
-    + m_LambdD * (trAtA - (1./ ((double) nbBands) * trE3));
+    + m_LambdD * (trAtA - (1./ (static_cast <double> (nbBands)) * trE3));
   return evalf;
 }
 
-- 
GitLab