diff --git a/Code/BasicFilters/otbMaximumAutocorrelationFactorImageFilter.h b/Code/BasicFilters/otbMaximumAutocorrelationFactorImageFilter.h index 7f44c076bf44d10cf10006cfd18832f64f0084d9..bf42c9489507eadc5c68a5a03ccd3d8415e63f17 100644 --- a/Code/BasicFilters/otbMaximumAutocorrelationFactorImageFilter.h +++ b/Code/BasicFilters/otbMaximumAutocorrelationFactorImageFilter.h @@ -33,28 +33,28 @@ namespace otb /** \class MaximumAutocorrelationFactorImageFilter * \brief This filter implements the Maximum Autocorrelation Factor - * + * * This filter implements the Maximum Autocorrelation Factor, based * on the following work: - * + * * A. A. Nielsen, "Kernel maximum autocorrelation factor and minimum * noise fraction transformations," IEEE Transactions on Image * Processing, vol. 20, no. 3, pp. 612-624, (2011) - * + * * Maximum Autocorrelation Factor can be considered as a spatial * extension of the PCA, in which new variates try to maximize * auto-correlation between neighboring pixels instead of * variance. Though the inverse transform can be computed, this filter * only provides the forward transform for now. - * + * * The GetV() method allows to retrieve the linear combinations used * to generate new variates, and the GetAutoCorrelation() method * allows to retrieve the auto-correlation associated to each variate. - * + * * This filter has been implemented from the Matlab code kindly made * available by the authors here: * http://www2.imm.dtu.dk/~aa/software.html - * + * * this filter have been validated by comparing the output image to * the output produced by the Matlab code, and the reference image * for testing has been generated from the Matlab code using Octave. @@ -63,8 +63,8 @@ namespace otb * \sa otbPCAImageFilter */ template <class TInputImage, class TOutputImage> -class ITK_EXPORT MaximumAutocorrelationFactorImageFilter - : public itk::ImageToImageFilter<TInputImage,TOutputImage> +class ITK_EXPORT MaximumAutocorrelationFactorImageFilter + : public itk::ImageToImageFilter<TInputImage, TOutputImage> { public: /** Standard class typedefs. */ @@ -93,10 +93,10 @@ public: typedef typename OutputImageType::RegionType OutputImageRegionType; typedef typename OutputImageType::PixelType OutputImagePixelType; typedef typename InputImageType::InternalPixelType InputInternalPixelType; - typedef typename + typedef typename itk::NumericTraits<InputInternalPixelType>::RealType InternalPixelType; - typedef VectorImage<InternalPixelType,2> InternalImageType; + typedef VectorImage<InternalPixelType, 2> InternalImageType; /** Internal filters types */ @@ -112,28 +112,28 @@ public: typedef vnl_matrix<RealType> VnlMatrixType; /** Get the linear correlation used to compute Maf */ - itkGetMacro(V,VnlMatrixType); + itkGetMacro(V, VnlMatrixType); /** Get the auto-correlation associated with each Maf */ - itkGetMacro(AutoCorrelation,VnlVectorType); + itkGetMacro(AutoCorrelation, VnlVectorType); /** Get the covariance estimator for image (use for progress * reporting purposes) */ - itkGetObjectMacro(CovarianceEstimator,CovarianceEstimatorType); + itkGetObjectMacro(CovarianceEstimator, CovarianceEstimatorType); /** Get the covariance estimator for horizontal autocorrelation (use * for progress reporting purposes) */ - itkGetObjectMacro(CovarianceEstimatorH,CovarianceEstimatorType); + itkGetObjectMacro(CovarianceEstimatorH, CovarianceEstimatorType); /** Get the covariance estimator for vertical autocorrelation (use * for progress reporting purposes) */ - itkGetObjectMacro(CovarianceEstimatorV,CovarianceEstimatorType); + itkGetObjectMacro(CovarianceEstimatorV, CovarianceEstimatorType); protected: MaximumAutocorrelationFactorImageFilter(); virtual ~MaximumAutocorrelationFactorImageFilter() {} - virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,int threadId); + virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, int threadId); virtual void GenerateOutputInformation(); diff --git a/Code/BasicFilters/otbMaximumAutocorrelationFactorImageFilter.txx b/Code/BasicFilters/otbMaximumAutocorrelationFactorImageFilter.txx index 1dab724077bbee6a23939cc04f30beccb39145b5..fb7b068c769f64e3f9fff82c9377476595695c93 100644 --- a/Code/BasicFilters/otbMaximumAutocorrelationFactorImageFilter.txx +++ b/Code/BasicFilters/otbMaximumAutocorrelationFactorImageFilter.txx @@ -32,7 +32,7 @@ namespace otb { template <class TInputImage, class TOutputImage> -MaximumAutocorrelationFactorImageFilter<TInputImage,TOutputImage> +MaximumAutocorrelationFactorImageFilter<TInputImage, TOutputImage> ::MaximumAutocorrelationFactorImageFilter() { m_CovarianceEstimator = CovarianceEstimatorType::New(); @@ -42,7 +42,7 @@ MaximumAutocorrelationFactorImageFilter<TInputImage,TOutputImage> template <class TInputImage, class TOutputImage> void -MaximumAutocorrelationFactorImageFilter<TInputImage,TOutputImage> +MaximumAutocorrelationFactorImageFilter<TInputImage, TOutputImage> ::GenerateOutputInformation() { // Call superclass implementation @@ -56,8 +56,8 @@ MaximumAutocorrelationFactorImageFilter<TInputImage,TOutputImage> unsigned int nbComp = inputPtr->GetNumberOfComponentsPerPixel(); // Compute Dh and Dv - typedef otb::MultiChannelExtractROI<typename InputImageType::InternalPixelType,RealType> ExtractFilterType; - typedef itk::SubtractImageFilter<InternalImageType,InternalImageType,InternalImageType> DifferenceFilterType; + typedef otb::MultiChannelExtractROI<typename InputImageType::InternalPixelType, RealType> ExtractFilterType; + typedef itk::SubtractImageFilter<InternalImageType, InternalImageType, InternalImageType> DifferenceFilterType; InputImageRegionType largestInputRegion = inputPtr->GetLargestPossibleRegion(); InputImageRegionType referenceRegion; @@ -120,37 +120,37 @@ MaximumAutocorrelationFactorImageFilter<TInputImage,TOutputImage> m_CovarianceEstimator->Update(); VnlMatrixType sigma = m_CovarianceEstimator->GetCovariance().GetVnlMatrix(); - m_Mean = VnlVectorType(nbComp,0); + m_Mean = VnlVectorType(nbComp, 0); - for(unsigned int i = 0; i<nbComp;++i) + for(unsigned int i = 0; i<nbComp; ++i) { m_Mean[i] = m_CovarianceEstimator->GetMean()[i]; } - vnl_generalized_eigensystem ges(sigmad,sigma); + vnl_generalized_eigensystem ges(sigmad, sigma); VnlMatrixType d = ges.D; m_V = ges.V; - m_AutoCorrelation = VnlVectorType(nbComp,1.); + m_AutoCorrelation = VnlVectorType(nbComp, 1.); m_AutoCorrelation -= 0.5 *d.get_diagonal(); - VnlMatrixType invstderr = VnlMatrixType(nbComp,nbComp,0); + VnlMatrixType invstderr = VnlMatrixType(nbComp, nbComp, 0); invstderr.set_diagonal(sigma.get_diagonal()); invstderr = invstderr.apply(&vcl_sqrt); invstderr = invstderr.apply(&InverseValue); - VnlMatrixType invstderrmaf = VnlMatrixType(nbComp,nbComp,0); + VnlMatrixType invstderrmaf = VnlMatrixType(nbComp, nbComp, 0); invstderrmaf.set_diagonal((m_V.transpose() * sigma * m_V).get_diagonal()); invstderrmaf = invstderrmaf.apply(&vcl_sqrt); invstderrmaf = invstderrmaf.apply(&InverseValue); VnlMatrixType aux1 = invstderr * sigma * m_V * invstderrmaf; - VnlMatrixType sign = VnlMatrixType(nbComp,nbComp,0); + VnlMatrixType sign = VnlMatrixType(nbComp, nbComp, 0); - VnlVectorType aux2 = VnlVectorType(nbComp,0); + VnlVectorType aux2 = VnlVectorType(nbComp, 0); - for(unsigned int i = 0; i < nbComp;++i) + for(unsigned int i = 0; i < nbComp; ++i) { aux2=aux2 + aux1.get_row(i); } @@ -165,7 +165,7 @@ MaximumAutocorrelationFactorImageFilter<TInputImage,TOutputImage> template <class TInputImage, class TOutputImage> void -MaximumAutocorrelationFactorImageFilter<TInputImage,TOutputImage> +MaximumAutocorrelationFactorImageFilter<TInputImage, TOutputImage> ::ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, int threadId) { // Retrieve input images pointers @@ -176,7 +176,7 @@ MaximumAutocorrelationFactorImageFilter<TInputImage,TOutputImage> typedef itk::ImageRegionConstIterator<InputImageType> ConstIteratorType; typedef itk::ImageRegionIterator<OutputImageType> IteratorType; - IteratorType outIt(outputPtr,outputRegionForThread); + IteratorType outIt(outputPtr, outputRegionForThread); ConstIteratorType inIt(inputPtr, outputRegionForThread); inIt.GoToBegin(); @@ -190,10 +190,10 @@ MaximumAutocorrelationFactorImageFilter<TInputImage,TOutputImage> while(!inIt.IsAtEnd() && !outIt.IsAtEnd()) { - VnlVectorType x(outNbComp,0); - VnlVectorType maf(outNbComp,0); + VnlVectorType x(outNbComp, 0); + VnlVectorType maf(outNbComp, 0); - for(unsigned int i = 0; i < outNbComp;++i) + for(unsigned int i = 0; i < outNbComp; ++i) { x[i] = inIt.Get()[i]; } diff --git a/Code/ChangeDetection/otbMultivariateAlterationDetectorImageFilter.h b/Code/ChangeDetection/otbMultivariateAlterationDetectorImageFilter.h index 0454de56b3a5ad0c69a0badcd85d057e15cdd81d..e3db436fd5f22dd7860bdf8415d27d2b94b821e0 100644 --- a/Code/ChangeDetection/otbMultivariateAlterationDetectorImageFilter.h +++ b/Code/ChangeDetection/otbMultivariateAlterationDetectorImageFilter.h @@ -31,41 +31,41 @@ namespace otb /** \class MultivariateAlterationDetectorImageFilter * \brief This filter implements the Multivariate Alteration Detector - * + * * This filter implements the Multivariate Alteration Detector, based * on the following work: - * + * * A. A. Nielsen and K. Conradsen, "Multivariate alteration detection * (mad) in multispectral, bi-temporal image data: a new approach to * change detection studies," Remote Sens. Environ., vol. 64, * pp. 1-19, (1998) - * + * * Multivariate Alteration Detector takes two images as inputs and * produce a set of N change maps as a VectorImage (where N is the * maximum of number of bands in first and second image) with the * following properties: - * + * * - Change maps are differences of a pair of linear combinations of * bands from image 1 and bands from image 2 chosen to maximize the * correlation. * - Each change map is orthogonal to the others. - * + * * This is a statistical method which can handle different modalities * and even differents bands and number of bands between images. - * + * * If numbers of bands in image 1 and 2 are equal, then change maps * are sorted by increasing correlation. If number of bands is * different, the change maps are sorted by decreasing correlation. - * + * * The GetV1() and GetV2() methods allow to retrieve the linear * combinations used to generate the Mad change maps as a vnl_matrix of * double, and the GetRho() method allows to retrieve the correlation * associated to each Mad change maps as a vnl_vector. - * + * * This filter has been implemented from the Matlab code kindly made * available by the authors here: * http://www2.imm.dtu.dk/~aa/software.html - * + * * Both cases (same and different number of bands) have been validated * by comparing the output image to the output produced by the Matlab * code, and the reference images for testing have been generated from @@ -74,8 +74,8 @@ namespace otb * \ingroup Streamed, Multithreaded */ template <class TInputImage, class TOutputImage> -class ITK_EXPORT MultivariateAlterationDetectorImageFilter - : public itk::ImageToImageFilter<TInputImage,TOutputImage> +class ITK_EXPORT MultivariateAlterationDetectorImageFilter + : public itk::ImageToImageFilter<TInputImage, TOutputImage> { public: /** Standard class typedefs. */ @@ -104,7 +104,7 @@ public: /** Internal filters types */ typedef StreamingStatisticsVectorImageFilter<InputImageType> CovarianceEstimatorType; typedef typename CovarianceEstimatorType::Pointer CovarianceEstimatorPointer; - typedef otb::ConcatenateVectorImageFilter<InputImageType,InputImageType,InputImageType> ConcatenateImageFilterType; + typedef otb::ConcatenateVectorImageFilter<InputImageType, InputImageType, InputImageType> ConcatenateImageFilterType; typedef typename ConcatenateImageFilterType::Pointer ConcatenateImageFilterPointer; typedef typename CovarianceEstimatorType::MatrixObjectType MatrixObjectType; @@ -120,18 +120,18 @@ public: /** Get the linear combinations of bands of image 1 associated to * multivariate alteration detector. This is a square matrix of * size nbBand of image 1. */ - itkGetMacro(V1,VnlMatrixType); + itkGetMacro(V1, VnlMatrixType); /** Get the linear combinations of bands of image 2 associated to * multivariate alteration detector. This is a square matrix of * size nbBand of image 2. */ - itkGetMacro(V2,VnlMatrixType); + itkGetMacro(V2, VnlMatrixType); /** Get the correlation coefficient associated with each mad.*/ - itkGetMacro(Rho,VnlVectorType); + itkGetMacro(Rho, VnlVectorType); /** Get the covariance estimator (for progress reporting purposes) */ - itkGetObjectMacro(CovarianceEstimator,CovarianceEstimatorType); + itkGetObjectMacro(CovarianceEstimator, CovarianceEstimatorType); /** Connect one of the operands for pixel-wise addition */ void SetInput1(const TInputImage * image1); @@ -147,7 +147,7 @@ protected: MultivariateAlterationDetectorImageFilter(); virtual ~MultivariateAlterationDetectorImageFilter() {} - virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,int threadId); + virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, int threadId); virtual void GenerateOutputInformation(); diff --git a/Code/ChangeDetection/otbMultivariateAlterationDetectorImageFilter.txx b/Code/ChangeDetection/otbMultivariateAlterationDetectorImageFilter.txx index 4bd15242185ef5e29ef70468a6ca19bfac17f33d..7c06d5905e27a1d4d7211d34b3bf74640850b28d 100644 --- a/Code/ChangeDetection/otbMultivariateAlterationDetectorImageFilter.txx +++ b/Code/ChangeDetection/otbMultivariateAlterationDetectorImageFilter.txx @@ -30,7 +30,7 @@ namespace otb { template <class TInputImage, class TOutputImage> -MultivariateAlterationDetectorImageFilter<TInputImage,TOutputImage> +MultivariateAlterationDetectorImageFilter<TInputImage, TOutputImage> ::MultivariateAlterationDetectorImageFilter() { this->SetNumberOfRequiredInputs(2); @@ -39,7 +39,7 @@ MultivariateAlterationDetectorImageFilter<TInputImage,TOutputImage> template <class TInputImage, class TOutputImage> void -MultivariateAlterationDetectorImageFilter<TInputImage,TOutputImage> +MultivariateAlterationDetectorImageFilter<TInputImage, TOutputImage> ::SetInput1(const TInputImage * image1) { // Process object is not const-correct so the const casting is required. @@ -47,9 +47,9 @@ MultivariateAlterationDetectorImageFilter<TInputImage,TOutputImage> } template <class TInputImage, class TOutputImage> -const typename MultivariateAlterationDetectorImageFilter<TInputImage,TOutputImage> +const typename MultivariateAlterationDetectorImageFilter<TInputImage, TOutputImage> ::InputImageType * -MultivariateAlterationDetectorImageFilter<TInputImage,TOutputImage> +MultivariateAlterationDetectorImageFilter<TInputImage, TOutputImage> ::GetInput1() { if (this->GetNumberOfInputs() < 1) @@ -61,7 +61,7 @@ MultivariateAlterationDetectorImageFilter<TInputImage,TOutputImage> template <class TInputImage, class TOutputImage> void -MultivariateAlterationDetectorImageFilter<TInputImage,TOutputImage> +MultivariateAlterationDetectorImageFilter<TInputImage, TOutputImage> ::SetInput2(const TInputImage * image2) { // Process object is not const-correct so the const casting is required. @@ -69,9 +69,9 @@ MultivariateAlterationDetectorImageFilter<TInputImage,TOutputImage> } template <class TInputImage, class TOutputImage> -const typename MultivariateAlterationDetectorImageFilter<TInputImage,TOutputImage> +const typename MultivariateAlterationDetectorImageFilter<TInputImage, TOutputImage> ::InputImageType * -MultivariateAlterationDetectorImageFilter<TInputImage,TOutputImage> +MultivariateAlterationDetectorImageFilter<TInputImage, TOutputImage> ::GetInput2() { if (this->GetNumberOfInputs() < 2) @@ -84,7 +84,7 @@ MultivariateAlterationDetectorImageFilter<TInputImage,TOutputImage> template <class TInputImage, class TOutputImage> void -MultivariateAlterationDetectorImageFilter<TInputImage,TOutputImage> +MultivariateAlterationDetectorImageFilter<TInputImage, TOutputImage> ::GenerateOutputInformation() { // Call superclass implementation @@ -98,7 +98,7 @@ MultivariateAlterationDetectorImageFilter<TInputImage,TOutputImage> // Get the number of components for each image unsigned int nbComp1 = input1Ptr->GetNumberOfComponentsPerPixel(); unsigned int nbComp2 = input2Ptr->GetNumberOfComponentsPerPixel(); - unsigned int outNbComp = std::max(nbComp1,nbComp2); + unsigned int outNbComp = std::max(nbComp1, nbComp2); outputPtr->SetNumberOfComponentsPerPixel(outNbComp); @@ -120,21 +120,21 @@ MultivariateAlterationDetectorImageFilter<TInputImage,TOutputImage> m_MeanValues = m_CovarianceEstimator->GetMean(); // Extract sub-matrices of the covariance matrix - VnlMatrixType s11 = m_CovarianceMatrix.GetVnlMatrix().extract(nbComp1,nbComp1); - VnlMatrixType s22 = m_CovarianceMatrix.GetVnlMatrix().extract(nbComp2,nbComp2,nbComp1,nbComp1); - VnlMatrixType s12 = m_CovarianceMatrix.GetVnlMatrix().extract(nbComp1,nbComp2,0,nbComp1); + VnlMatrixType s11 = m_CovarianceMatrix.GetVnlMatrix().extract(nbComp1, nbComp1); + VnlMatrixType s22 = m_CovarianceMatrix.GetVnlMatrix().extract(nbComp2, nbComp2, nbComp1, nbComp1); + VnlMatrixType s12 = m_CovarianceMatrix.GetVnlMatrix().extract(nbComp1, nbComp2, 0, nbComp1); VnlMatrixType s21 = s12.transpose(); // Extract means - m_Mean1 = VnlVectorType(nbComp1,0); - m_Mean2 = VnlVectorType(nbComp2,0); + m_Mean1 = VnlVectorType(nbComp1, 0); + m_Mean2 = VnlVectorType(nbComp2, 0); - for(unsigned int i = 0; i<nbComp1;++i) + for(unsigned int i = 0; i<nbComp1; ++i) { m_Mean1[i] = m_MeanValues[i]; } - for(unsigned int i = 0; i<nbComp2;++i) + for(unsigned int i = 0; i<nbComp2; ++i) { m_Mean2[i] = m_MeanValues[nbComp1+i]; } @@ -148,7 +148,7 @@ MultivariateAlterationDetectorImageFilter<TInputImage,TOutputImage> // Build the generalized eigensystem VnlMatrixType s12s22is21 = s12 * invs22 *s21; - vnl_generalized_eigensystem ges(s12s22is21,s11); + vnl_generalized_eigensystem ges(s12s22is21, s11); m_V1 = ges.V; @@ -165,13 +165,13 @@ MultivariateAlterationDetectorImageFilter<TInputImage,TOutputImage> invstderr1.fill(0); invstderr1.set_diagonal(diag1); - VnlMatrixType sign1 = VnlMatrixType(nbComp1,nbComp1,0); + VnlMatrixType sign1 = VnlMatrixType(nbComp1, nbComp1, 0); VnlMatrixType aux4 = invstderr1 * s11 * m_V1; - VnlVectorType aux5 = VnlVectorType(nbComp1,0); + VnlVectorType aux5 = VnlVectorType(nbComp1, 0); - for(unsigned int i = 0; i < nbComp1;++i) + for(unsigned int i = 0; i < nbComp1; ++i) { aux5=aux5 + aux4.get_row(i); } @@ -188,40 +188,40 @@ MultivariateAlterationDetectorImageFilter<TInputImage,TOutputImage> VnlVectorType aux2 = aux1.get_diagonal(); aux2 = aux2.apply(&vcl_sqrt); aux2 = aux2.apply(&InverseValue); - VnlMatrixType aux3 = VnlMatrixType(aux2.size(),aux2.size(),0); + VnlMatrixType aux3 = VnlMatrixType(aux2.size(), aux2.size(), 0); aux3.fill(0); aux3.set_diagonal(aux2); m_V2 = m_V2 * aux3; } else { - VnlMatrixType sl(nbComp1+nbComp2,nbComp1+nbComp2,0); - VnlMatrixType sr(nbComp1+nbComp2,nbComp1+nbComp2,0); + VnlMatrixType sl(nbComp1+nbComp2, nbComp1+nbComp2, 0); + VnlMatrixType sr(nbComp1+nbComp2, nbComp1+nbComp2, 0); - sl.update(s12,0,nbComp1); - sl.update(s21,nbComp1,0); - sr.update(s11,0,0); - sr.update(s22,nbComp1,nbComp1); + sl.update(s12, 0, nbComp1); + sl.update(s21, nbComp1, 0); + sr.update(s11, 0, 0); + sr.update(s22, nbComp1, nbComp1); - vnl_generalized_eigensystem ges(sl,sr); + vnl_generalized_eigensystem ges(sl, sr); VnlMatrixType V = ges.V; V.fliplr(); - m_V1 = V.extract(nbComp1,nbComp1); - m_V2 = V.extract(nbComp2,nbComp2,nbComp1,0); + m_V1 = V.extract(nbComp1, nbComp1); + m_V2 = V.extract(nbComp2, nbComp2, nbComp1, 0); - m_Rho = ges.D.get_diagonal().flip().extract(std::max(nbComp1,nbComp2),0); + m_Rho = ges.D.get_diagonal().flip().extract(std::max(nbComp1, nbComp2), 0); //Scale v1 to get a unit variance VnlMatrixType aux1 = m_V1.transpose() * (s11 * m_V1); VnlVectorType aux2 = aux1.get_diagonal(); aux2 = aux2.apply(&vcl_sqrt); - aux2 = aux2.apply(&InverseValue); + aux2 = aux2.apply(&InverseValue); - VnlMatrixType aux3 = VnlMatrixType(aux2.size(),aux2.size(),0); + VnlMatrixType aux3 = VnlMatrixType(aux2.size(), aux2.size(), 0); aux3.set_diagonal(aux2); m_V1 = m_V1 * aux3; @@ -231,13 +231,13 @@ MultivariateAlterationDetectorImageFilter<TInputImage,TOutputImage> invstderr1.fill(0); invstderr1.set_diagonal(diag1); - VnlMatrixType sign1 = VnlMatrixType(nbComp1,nbComp1,0); + VnlMatrixType sign1 = VnlMatrixType(nbComp1, nbComp1, 0); VnlMatrixType aux4 = invstderr1 * s11 * m_V1; - VnlVectorType aux5 = VnlVectorType(nbComp1,0); + VnlVectorType aux5 = VnlVectorType(nbComp1, 0); - for(unsigned int i = 0; i < nbComp1;++i) + for(unsigned int i = 0; i < nbComp1; ++i) { aux5=aux5 + aux4.get_row(i); } @@ -252,12 +252,12 @@ MultivariateAlterationDetectorImageFilter<TInputImage,TOutputImage> aux2 = aux1.get_diagonal(); aux2 = aux2.apply(&vcl_sqrt); aux2 = aux2.apply(&InverseValue); - aux3 = VnlMatrixType(aux2.size(),aux2.size(),0); + aux3 = VnlMatrixType(aux2.size(), aux2.size(), 0); aux3.fill(0); aux3.set_diagonal(aux2); m_V2 = m_V2 * aux3; - VnlMatrixType sign2 = VnlMatrixType(nbComp2,nbComp2,0); + VnlMatrixType sign2 = VnlMatrixType(nbComp2, nbComp2, 0); aux5 = (m_V1.transpose() * s12 * m_V2).transpose().get_diagonal(); sign2.set_diagonal(aux5); @@ -268,7 +268,7 @@ MultivariateAlterationDetectorImageFilter<TInputImage,TOutputImage> template <class TInputImage, class TOutputImage> void -MultivariateAlterationDetectorImageFilter<TInputImage,TOutputImage> +MultivariateAlterationDetectorImageFilter<TInputImage, TOutputImage> ::ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, int threadId) { // Retrieve input images pointers @@ -280,7 +280,7 @@ MultivariateAlterationDetectorImageFilter<TInputImage,TOutputImage> typedef itk::ImageRegionConstIterator<InputImageType> ConstIteratorType; typedef itk::ImageRegionIterator<OutputImageType> IteratorType; - IteratorType outIt(outputPtr,outputRegionForThread); + IteratorType outIt(outputPtr, outputRegionForThread); ConstIteratorType inIt1(input1Ptr, outputRegionForThread); ConstIteratorType inIt2(input2Ptr, outputRegionForThread); @@ -298,18 +298,18 @@ MultivariateAlterationDetectorImageFilter<TInputImage,TOutputImage> while(!inIt1.IsAtEnd() && !inIt2.IsAtEnd() && !outIt.IsAtEnd()) { - VnlVectorType x1(nbComp1,0); - VnlVectorType x1bis(outNbComp,0); - VnlVectorType x2(nbComp2,0); - VnlVectorType x2bis(outNbComp,0); - VnlVectorType mad(outNbComp,0); + VnlVectorType x1(nbComp1, 0); + VnlVectorType x1bis(outNbComp, 0); + VnlVectorType x2(nbComp2, 0); + VnlVectorType x2bis(outNbComp, 0); + VnlVectorType mad(outNbComp, 0); - for(unsigned int i = 0; i < nbComp1;++i) + for(unsigned int i = 0; i < nbComp1; ++i) { x1[i] = inIt1.Get()[i]; } - for(unsigned int i = 0; i < nbComp2;++i) + for(unsigned int i = 0; i < nbComp2; ++i) { x2[i] = inIt2.Get()[i]; } @@ -317,12 +317,12 @@ MultivariateAlterationDetectorImageFilter<TInputImage,TOutputImage> VnlVectorType first = (x1-m_Mean1)*m_V1; VnlVectorType second = (x2-m_Mean2)*m_V2; - for(unsigned int i = 0; i < nbComp1;++i) + for(unsigned int i = 0; i < nbComp1; ++i) { x1bis[i] = first[i]; } - for(unsigned int i = 0; i < nbComp2;++i) + for(unsigned int i = 0; i < nbComp2; ++i) { x2bis[i] = second[i]; } @@ -344,7 +344,7 @@ MultivariateAlterationDetectorImageFilter<TInputImage,TOutputImage> { outPixel[i]=mad[outNbComp - i - 1]; - if(i < outNbComp - std::min(nbComp1,nbComp2)) + if(i < outNbComp - std::min(nbComp1, nbComp2)) { outPixel[i]*=vcl_sqrt(2.); } diff --git a/Testing/Code/BasicFilters/otbMaximumAutocorrelationFactorImageFilter.cxx b/Testing/Code/BasicFilters/otbMaximumAutocorrelationFactorImageFilter.cxx index c8b598f4b4b2d13cf25d70a251ede6d4d63c9329..e41cbbeb89214645b70e85a0a160f2743fe3c9f6 100644 --- a/Testing/Code/BasicFilters/otbMaximumAutocorrelationFactorImageFilter.cxx +++ b/Testing/Code/BasicFilters/otbMaximumAutocorrelationFactorImageFilter.cxx @@ -20,11 +20,11 @@ #include "otbStreamingImageFileWriter.h" #include "otbMaximumAutocorrelationFactorImageFilter.h" -typedef otb::VectorImage<unsigned short,2> ImageType; -typedef otb::VectorImage<double,2> OutputImageType; +typedef otb::VectorImage<unsigned short, 2> ImageType; +typedef otb::VectorImage<double, 2> OutputImageType; typedef otb::ImageFileReader<ImageType> ReaderType; typedef otb::StreamingImageFileWriter<OutputImageType> WriterType; -typedef otb::MaximumAutocorrelationFactorImageFilter<ImageType,OutputImageType> MADFilterType; +typedef otb::MaximumAutocorrelationFactorImageFilter<ImageType, OutputImageType> MADFilterType; int otbMaximumAutocorrelationFactorImageFilterNew(int argc, char* argv[]) { diff --git a/Testing/Code/ChangeDetection/otbMultivariateAlterationDetectorImageFilter.cxx b/Testing/Code/ChangeDetection/otbMultivariateAlterationDetectorImageFilter.cxx index cfb8700f6c7d6af3ad680a5ac4085976ce575c66..c0eb11240475a92e6a470b4e95435074db9f9281 100644 --- a/Testing/Code/ChangeDetection/otbMultivariateAlterationDetectorImageFilter.cxx +++ b/Testing/Code/ChangeDetection/otbMultivariateAlterationDetectorImageFilter.cxx @@ -20,11 +20,11 @@ #include "otbImageFileWriter.h" #include "otbMultivariateAlterationDetectorImageFilter.h" -typedef otb::VectorImage<unsigned short,2> ImageType; -typedef otb::VectorImage<double,2> OutputImageType; +typedef otb::VectorImage<unsigned short, 2> ImageType; +typedef otb::VectorImage<double, 2> OutputImageType; typedef otb::ImageFileReader<ImageType> ReaderType; typedef otb::ImageFileWriter<OutputImageType> WriterType; -typedef otb::MultivariateAlterationDetectorImageFilter<ImageType,OutputImageType> MADFilterType; +typedef otb::MultivariateAlterationDetectorImageFilter<ImageType, OutputImageType> MADFilterType; int otbMultivariateAlterationDetectorImageFilterNew(int argc, char* argv[])