From 089dbe00273b36e2e6668b46bdb341df336da3fe Mon Sep 17 00:00:00 2001 From: Thomas Feuvrier <thomas.feuvrier@c-s.fr> Date: Tue, 21 Mar 2006 09:17:08 +0000 Subject: [PATCH] nomsg --- Code/Common/otbComplexMomentImageFunction.h | 122 ---------- Code/Common/otbComplexMomentImageFunction.txx | 137 ----------- Code/Common/otbFlusserImageFunction.h | 130 ---------- Code/Common/otbFlusserImageFunction.txx | 228 ------------------ Code/Common/otbGeometricMomentImageFunction.h | 70 ------ Code/Common/otbHuImageFunction.h | 130 ---------- Code/Common/otbHuImageFunction.txx | 191 --------------- Code/Common/otbRealMomentImageFunction.h | 70 ------ 8 files changed, 1078 deletions(-) delete mode 100644 Code/Common/otbComplexMomentImageFunction.h delete mode 100644 Code/Common/otbComplexMomentImageFunction.txx delete mode 100644 Code/Common/otbFlusserImageFunction.h delete mode 100644 Code/Common/otbFlusserImageFunction.txx delete mode 100644 Code/Common/otbGeometricMomentImageFunction.h delete mode 100644 Code/Common/otbHuImageFunction.h delete mode 100644 Code/Common/otbHuImageFunction.txx delete mode 100644 Code/Common/otbRealMomentImageFunction.h diff --git a/Code/Common/otbComplexMomentImageFunction.h b/Code/Common/otbComplexMomentImageFunction.h deleted file mode 100644 index fd6f5dc85c..0000000000 --- a/Code/Common/otbComplexMomentImageFunction.h +++ /dev/null @@ -1,122 +0,0 @@ -/*========================================================================= - - Programme : OTB (ORFEO ToolBox) - Auteurs : CS - P. Imbo - Language : C++ - Date : 20 mars 2006 - Version : - Role : Complex Geometric Moments Class of iamges - $Id:$ - -=========================================================================*/ -#ifndef _otbComplexMomentImageFunction_h -#define _otbComplexMomentImageFunction_h - -#include "otbGeometricMomentImageFunction.h" - -#include <complex> - -namespace otb -{ - -/** - * \class ComplexMomentImageFunction - * \brief Calculate the complex moment value in the full image. - * - * Calculate the complex moment value over an image. - * The implemented equation is: - * - * \f[ c_{p,q}=\int_{-\infty}^{\infty} \int_{-\infty}^{\infty} (x+iy)^{p} \cdot (x-iy)^{q} \cdot f(x,y) \cdot - dx \cdot dy \f] - * - * With: - * - * - \f$ (x,y) \f$ pixel localization; - * - \f$ f(x,y) \f$ the pixel value over the \f$(x,y) \f$ coordinate. - * - * This class is templated over the input image type and the - * coordinate representation type (e.g. float or double). - * - * \ingroup ImageFunctions - */ -template < class TInput, - class TOutput = std::complex<double >, - class TCoordRep = float > -class ITK_EXPORT ComplexMomentImageFunction : - public GeometricMomentImageFunction<TInput, TOutput,TCoordRep> -{ -public: - /** Standard class typedefs. */ - typedef ComplexMomentImageFunction Self; - typedef GeometricMomentImageFunction<TInput, TOutput,TCoordRep> Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - /** Run-time type information (and related methods). */ - itkTypeMacro(ComplexMomentImageFunction, GeometricMomentImageFunction); - - /** Method for creation through the object factory. */ - itkNewMacro(Self); - - /** InputImageType typedef support. */ - typedef typename Superclass::InputType InputType; - typedef typename Superclass::IndexType IndexType; - typedef typename Superclass::ContinuousIndexType ContinuousIndexType; - typedef typename Superclass::PointType PointType; - - typedef TOutput ComplexType; - - /** Dimension of the underlying image. */ -// itkStaticConstMacro(ImageDimension, unsigned int, -// InputType::ImageDimension); - - /** Evalulate the function at specified index */ - virtual ComplexType EvaluateAtIndex( const IndexType& index ) const; - - /** Evaluate the function at non-integer positions */ - virtual ComplexType Evaluate( const PointType& point ) const - { - IndexType index; - this->ConvertPointToNearestIndex( point, index ); - return this->EvaluateAtIndex( index ); - } - virtual ComplexType EvaluateAtContinuousIndex( - const ContinuousIndexType& cindex ) const - { - IndexType index; - this->ConvertContinuousIndexToNearestIndex( cindex, index ); - return this->EvaluateAtIndex( index ) ; - } - itkSetMacro(P, unsigned int); - itkGetConstReferenceMacro(P, unsigned int); - itkSetMacro(Q, unsigned int); - itkGetConstReferenceMacro(Q, unsigned int); - - /** Get/Set the radius of the neighborhood over which the - statistics are evaluated */ - itkSetMacro( NeighborhoodRadius, int ); - itkGetConstReferenceMacro( NeighborhoodRadius, int ); - -protected: - ComplexMomentImageFunction(); - ~ComplexMomentImageFunction(){}; - void PrintSelf(std::ostream& os, itk::Indent indent) const; - -private: - ComplexMomentImageFunction( const Self& ); //purposely not implemented - void operator=( const Self& ); //purposely not implemented - - unsigned int m_P; - unsigned int m_Q; - int m_NeighborhoodRadius; - -}; - -} // namespace otb - -#ifndef OTB_MANUAL_INSTANTIATION -#include "otbComplexMomentImageFunction.txx" -#endif - -#endif - diff --git a/Code/Common/otbComplexMomentImageFunction.txx b/Code/Common/otbComplexMomentImageFunction.txx deleted file mode 100644 index a2368dee23..0000000000 --- a/Code/Common/otbComplexMomentImageFunction.txx +++ /dev/null @@ -1,137 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile: itkMeanImageFunction.txx,v $ - Language: C++ - Date: $Date: 2004/12/12 22:07:24 $ - Version: $Revision: 1.12 $ - - Copyright (c) Insight Software Consortium. All rights reserved. - See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm 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. - - =========================================================================*/ -#ifndef _otbComplexMomentImageFunction_txx -#define _otbComplexMomentImageFunction_txx - -#include "otbComplexMomentImageFunction.h" -#include "itkImageRegionIterator.h" -#include "itkImage.h" -#include "itkConstNeighborhoodIterator.h" - -#include <complex> -namespace otb -{ - -/** - * Constructor - */ -template < class TInput, class TOutput, class TCoordRep> -ComplexMomentImageFunction<TInput,TOutput,TCoordRep> -::ComplexMomentImageFunction() -{ - m_P = 0; - m_Q = 0; - m_NeighborhoodRadius = -1; -} - -/** - * - */ -template < class TInput, class TOutput, class TCoordRep> -void -ComplexMomentImageFunction<TInput,TOutput,TCoordRep> -::PrintSelf(std::ostream& os, itk::Indent indent) const -{ - this->Superclass::PrintSelf(os,indent); - os << indent << " p indice value : " << m_P << std::endl; - os << indent << " q indice value : " << m_Q << std::endl; - os << indent << " m_NeighborhoodRadius: " << m_NeighborhoodRadius << std::endl; -} - - -template < class TInput, class TOutput, class TCoordRep> -typename ComplexMomentImageFunction<TInput,TOutput,TCoordRep>::ComplexType -ComplexMomentImageFunction<TInput,TOutput,TCoordRep> -::EvaluateAtIndex(const IndexType& index) const -{ - typename InputType::SizeType ImageSize; - ComplexType Sum; - ComplexType ValP; - ComplexType ValQ; - IndexType IndexValue; - IndexType indexPos = index; - typename InputType::SizeType kernelSize; - - if( !this->GetInputImage() ) - { - return std::complex<float>(0.,0.); // A modifier -// return ( NumericTraits<RealType>::max() ); - } - - if ( !this->IsInsideBuffer( index ) ) - { - return std::complex<float>(0.,0.); // A modifier -// return ( NumericTraits<RealType>::max() ); - } -#if 0 - if(m_NeighborhoodRadius<0) - { - ImageSize = this->GetInputImage()->GetBufferedRegion().GetSize(); - indexPos[0] = ImageSize[0] / 2 ; - indexPos[1] = ImageSize[1] / 2; - - kernelSize[0] = indexPos[0]; - kernelSize[1] = indexPos[1]; - } - else - { - kernelSize.Fill( m_NeighborhoodRadius ); - } - - itk::ConstNeighborhoodIterator<InputType> - it(kernelSize, this->GetInputImage(), this->GetInputImage()->GetBufferedRegion()); - - // Set the iterator at the desired location - it.SetLocation(indexPos); - Sum = std::complex<float>(0.0,0.0); - - const unsigned int size = it.Size(); - for (unsigned int i = 0; i < size; ++i) - { - IndexValue = it.GetIndex(i); - ValP = std::complex<float>(1.0,0.0); - ValQ = std::complex<float>(1.0,0.0); - unsigned int p = m_P; - while(p>0) - { - ValP *= std::complex<float>(IndexValue[0], IndexValue[1]); - --p; - } - unsigned int q = m_Q; - while(q>0) - { - ValQ *= std::complex<float>(IndexValue[0], -IndexValue[1]); - --q; - } -// std::cout<< i <<"--> "<< IndexValue << " p:"<<ValP <<" Q: "<<ValQ; - - Sum += ( ValP * ValQ * std::complex<float>(static_cast<float>(it.GetPixel(i)),0.0) ); -// std::cout<< "Val Pixel: " << static_cast<float>(it.GetPixel(i)) <<" Result :" << Sum<<std::endl; - } - -// std::cout<<"Result dans la procedure: " <<Sum <<std::endl; - - return (static_cast<ComplexType>(Sum) ); - -#endif - -} - - -} // namespace otb - -#endif diff --git a/Code/Common/otbFlusserImageFunction.h b/Code/Common/otbFlusserImageFunction.h deleted file mode 100644 index 401911ce46..0000000000 --- a/Code/Common/otbFlusserImageFunction.h +++ /dev/null @@ -1,130 +0,0 @@ -/*========================================================================= - - Programme : OTB (ORFEO ToolBox) - Auteurs : CS - P. Imbo - Language : C++ - Date : 20 mars 2006 - Version : - Role : Flusser's invariant Class of iamges - $Id:$ - -=========================================================================*/ -#ifndef _otbFlusserImageFunction_h -#define _otbFlusserImageFunction_h - -#include "otbRealMomentImageFunction.h" - -#include <complex> - - -namespace otb -{ - -/** - * \class FlusserImageFunction - * \brief Calculate the Flusser's invariant parameters. - * - * Calculate the Flusser's invariant over an image defined as: - * - * - \f$ \psi_{1} = c_{11} \f$ - * - \f$ \psi_{2} = c_{21} c_{12} \f$ - * - \f$ \psi_{3} = Re (c_{20} c_{12}^{2} )\f$ - * - \f$ \psi_{4} = Im (c_{20} c_{12}^{2} )\f$ - * - \f$ \psi_{5} = Re (c_{30} c_{12}^{3} )\f$ - * - \f$ \psi_{6} = Im (c_{30} c_{12}^{3} )\f$ - * - \f$ \psi_{7} = c_{22} \f$ - * - \f$ \psi_{8} = Re (c_{31} c_{12}^{2} )\f$ - * - \f$ \psi_{9} = Im (c_{31} c_{12}^{2} )\f$ - * - \f$ \psi_{10} = Re (c_{40} c_{12}^{4} )\f$ - * - \f$ \psi_{11} = Im (c_{40} c_{12}^{4} )\f$ - * - * With : - * - * \f[ c_{p,q}=\int_{-\infty}^{\infty} \int_{-\infty}^{\infty} (x+iy)^{p} \cdot (x-iy)^{q} \cdot f(x,y) \cdot - dx \cdot dy \f] - * - * And: - * - \f$(x,y)\f$ pixel localization; - * - \f$ f(x,y)\f$ the pixel value over the \f$(x,y)\f$ coordinate. - * - * This class is templated over the input image type and the - * coordinate representation type (e.g. float or double). - * - * \ingroup ImageFunctions - */ - -template < class TInput, - class TOutput = double, - class TCoordRep = float > -class ITK_EXPORT FlusserImageFunction : - public RealMomentImageFunction< TInput, TOutput,TCoordRep > -{ -public: - /** Standard class typedefs. */ - typedef FlusserImageFunction Self; - typedef RealMomentImageFunction< TInput, TOutput,TCoordRep > Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - /** Run-time type information (and related methods). */ - itkTypeMacro(FlusserImageFunction, RealMomentImageFunction); - - /** Method for creation through the object factory. */ - itkNewMacro(Self); - - /** InputImageType typedef support. */ - typedef TInput InputType; - typedef typename Superclass::IndexType IndexType; - typedef typename Superclass::ContinuousIndexType ContinuousIndexType; - typedef typename Superclass::PointType PointType; - - typedef TOutput RealType; - typedef typename std::complex<RealType> ComplexType; - - /** Dimension of the underlying image. */ - itkStaticConstMacro(ImageDimension, unsigned int, - InputType::ImageDimension); - - - /** Evalulate the function at specified index */ - virtual RealType EvaluateAtIndex( const IndexType& index ) const; - - /** Evaluate the function at non-integer positions */ - virtual RealType Evaluate( const PointType& point ) const - { - IndexType index; - this->ConvertPointToNearestIndex( point, index ); - return this->EvaluateAtIndex( index ); - } - virtual RealType EvaluateAtContinuousIndex( - const ContinuousIndexType& cindex ) const - { - IndexType index; - this->ConvertContinuousIndexToNearestIndex( cindex, index ); - return this->EvaluateAtIndex( index ) ; - } - - /** Get/Set the radius of the neighborhood over which the - statistics are evaluated */ - itkSetClampMacro(Number,short,1,11); - itkGetConstReferenceMacro( Number, short ); - -protected: - FlusserImageFunction(); - ~FlusserImageFunction(){}; - void PrintSelf(std::ostream& os, itk::Indent indent) const; - -private: - FlusserImageFunction( const Self& ); //purposely not implemented - void operator=( const Self& ); //purposely not implemented - - short m_Number; -}; - -} // namespace otb - -#ifndef OTB_MANUAL_INSTANTIATION -#include "otbFlusserImageFunction.txx" -#endif - -#endif diff --git a/Code/Common/otbFlusserImageFunction.txx b/Code/Common/otbFlusserImageFunction.txx deleted file mode 100644 index a3c5ca6af7..0000000000 --- a/Code/Common/otbFlusserImageFunction.txx +++ /dev/null @@ -1,228 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile: itkMeanImageFunction.txx,v $ - Language: C++ - Date: $Date: 2004/12/12 22:07:24 $ - Version: $Revision: 1.12 $ - - Copyright (c) Insight Software Consortium. All rights reserved. - See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm 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. - - =========================================================================*/ -#ifndef _otbFlusserImageFunction_txx -#define _otbFlusserImageFunction_txx - -#include "otbFlusserImageFunction.h" -#include "otbComplexMomentImageFunction.h" -#include "itkNumericTraits.h" -#include "itkMacro.h" -#include <complex> - -namespace otb -{ - -/** - * Constructor - */ -template < class TInput, class TOutput, class TCoordRep> -FlusserImageFunction<TInput,TOutput,TCoordRep> -::FlusserImageFunction() -{ - m_Number =-1; -} - -/** - * - */ -template < class TInput, class TOutput, class TCoordRep> -void -FlusserImageFunction<TInput,TOutput,TCoordRep> -::PrintSelf(std::ostream& os, itk::Indent indent) const -{ - this->Superclass::PrintSelf(os,indent); - os << indent << " m_Number : " << m_Number << std::endl; -} - - -template < class TInput, class TOutput, class TCoordRep> -typename FlusserImageFunction<TInput,TOutput,TCoordRep>::RealType -FlusserImageFunction<TInput,TOutput,TCoordRep> -::EvaluateAtIndex(const IndexType& index) const -{ - typename InputType::SizeType ImageSize; - RealType FlusserValue; - ComplexType FlusserValueComplex; - - typedef otb::ComplexMomentImageFunction<InputType,ComplexType> CMType; - typename CMType::Pointer function =CMType::New(); - - if( !this->GetInputImage() ) - { - return ( itk::NumericTraits<RealType>::max() ); - } - - if ( !this->IsInsideBuffer( index ) ) - { - return ( itk::NumericTraits<RealType>::max() ); - } - - assert(m_Number > 0); - assert(m_Number < 12); - - function->SetInputImage( this->GetInputImage() ); - - - switch(m_Number) - { - case 1 : - { - ComplexType C11; - function->SetP(1); - function->SetQ(1); - C11 = function->EvaluateAtIndex( index ); - FlusserValue = C11.real() ; - } - break; - case 2: - { - ComplexType C21; - function->SetP(2); - function->SetQ(1); - C21 = function->EvaluateAtIndex( index ); - FlusserValue = abs( C21 * conj(C21) ) ; - } - break; - case 3: - { - ComplexType C20,C12; - function->SetP(2); - function->SetQ(0); - C20 = function->EvaluateAtIndex( index ); - function->SetP(1); - function->SetQ(2); - C12 = function->EvaluateAtIndex( index ); - FlusserValueComplex = C20 * pow(C12,2); - FlusserValue = FlusserValueComplex.real(); - } - break; - case 4: - { - ComplexType C20,C12; - function->SetP(2); - function->SetQ(0); - C20 = function->EvaluateAtIndex( index ); - function->SetP(1); - function->SetQ(2); - C12 = function->EvaluateAtIndex( index ); - FlusserValueComplex = C20 * pow(C12,2); - FlusserValue = FlusserValueComplex.imag(); - } - break; - case 5: - { - ComplexType C30,C12; - function->SetP(3); - function->SetQ(0); - C30 = function->EvaluateAtIndex( index ); - function->SetP(1); - function->SetQ(2); - C12 = function->EvaluateAtIndex( index ); - - FlusserValueComplex = C30 * pow(C12,3) ; - FlusserValue = FlusserValueComplex.real(); - } - break; - case 6: - { - ComplexType C30,C12; - function->SetP(3); - function->SetQ(0); - C30 = function->EvaluateAtIndex( index ); - function->SetP(1); - function->SetQ(2); - C12 = function->EvaluateAtIndex( index ); - - FlusserValueComplex = C30 * pow(C12,3) ; - FlusserValue = FlusserValueComplex.real(); - } - break; - case 7 : - { - ComplexType C22; - function->SetP(2); - function->SetQ(2); - C22 = function->EvaluateAtIndex( index ); - FlusserValue = C22.real() ; - } - break; - case 8: - { - ComplexType C31,C12; - function->SetP(3); - function->SetQ(1); - C31 = function->EvaluateAtIndex( index ); - function->SetP(1); - function->SetQ(2); - C12 = function->EvaluateAtIndex( index ); - FlusserValueComplex = C31 * pow(C12,2); - FlusserValue = FlusserValueComplex.real(); - } - break; - case 9: - { - ComplexType C31,C12; - function->SetP(3); - function->SetQ(1); - C31 = function->EvaluateAtIndex( index ); - function->SetP(1); - function->SetQ(2); - C12 = function->EvaluateAtIndex( index ); - FlusserValueComplex = C31 * pow(C12,2); - FlusserValue = FlusserValueComplex.imag(); - } - break; - case 10: - { - ComplexType C40,C12; - function->SetP(4); - function->SetQ(0); - C40 = function->EvaluateAtIndex( index ); - function->SetP(1); - function->SetQ(2); - C12 = function->EvaluateAtIndex( index ); - FlusserValueComplex = C40 * pow(C12,4); - FlusserValue = FlusserValueComplex.real(); - } - break; - case 11: - { - ComplexType C40,C12; - function->SetP(4); - function->SetQ(0); - C40 = function->EvaluateAtIndex( index ); - function->SetP(1); - function->SetQ(2); - C12 = function->EvaluateAtIndex( index ); - FlusserValueComplex = C40 * pow(C12,4); - FlusserValue = FlusserValueComplex.imag(); - } - break; - - default: - itkWarningMacro("Hu's invariant parameters are between 1 and 7"); - } - - - return (static_cast<RealType>(FlusserValue) ); - -} - - -} // namespace otb - -#endif diff --git a/Code/Common/otbGeometricMomentImageFunction.h b/Code/Common/otbGeometricMomentImageFunction.h deleted file mode 100644 index 1588a687de..0000000000 --- a/Code/Common/otbGeometricMomentImageFunction.h +++ /dev/null @@ -1,70 +0,0 @@ -/*========================================================================= - - Programme : OTB (ORFEO ToolBox) - Auteurs : CS - P. Imbo - Language : C++ - Date : 17 mars 2006 - Version : - Role : Geometric Moments Class of iamges - $Id$ - -=========================================================================*/ -#ifndef _otbGeometricMomentImageFunction_h -#define _otbGeometricMomentImageFunction_h - -#include "itkImageFunction.h" - - -namespace otb -{ - -/** - * \class GeometricMomentImageFunction - * \brief Virtual class for the Geometric moments for an image function - * - * \ingroup ImageFunctions - */ - -template < class TInput, - class TOutput = float, - class TCoordRep = float > -class ITK_EXPORT GeometricMomentImageFunction : - public itk::ImageFunction<TInput, TOutput,TCoordRep > -{ -public: - /** Standard class typedefs. */ - typedef GeometricMomentImageFunction Self; - typedef itk::ImageFunction< TInput, TOutput,TCoordRep > Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - /** Run-time type information (and related methods). */ - itkTypeMacro(GeometricMomentImageFunction, itk::ImageFunction); - - - /** InputImageType typedef support. */ - typedef typename Superclass::InputType InputType; - typedef typename Superclass::IndexType IndexType; - typedef typename Superclass::ContinuousIndexType ContinuousIndexType; - typedef typename Superclass::PointType PointType; - - typedef TOutput OutputType; - - -protected: - GeometricMomentImageFunction() {}; - ~GeometricMomentImageFunction(){}; - void PrintSelf(std::ostream& os, itk::Indent indent) const - { - Superclass::PrintSelf( os, indent ); - } - -private: - GeometricMomentImageFunction( const Self& ); //purposely not implemented - void operator=( const Self& ); //purposely not implemented -}; - -} // namespace otb - -#endif - diff --git a/Code/Common/otbHuImageFunction.h b/Code/Common/otbHuImageFunction.h deleted file mode 100644 index 50577017d4..0000000000 --- a/Code/Common/otbHuImageFunction.h +++ /dev/null @@ -1,130 +0,0 @@ -/*========================================================================= - - Programme : OTB (ORFEO ToolBox) - Auteurs : CS - P. Imbo - Language : C++ - Date : 20 mars 2006 - Version : - Role : Hu's invariant Class of iamges - $Id:$ - -=========================================================================*/ -#ifndef _otbHuImageFunction_h -#define _otbHuImageFunction_h - -//#include "itkImageFunction.h" -#include "otbRealMomentImageFunction.h" - -#include <complex> - - -namespace otb -{ - -/** - * \class HuImageFunction - * \brief Calculate the Hu's invariant paramete. - * - * Calculate the Hu's invariant over an image defined as: - * - * - \f$ \phi_{1} = c_{11} \f$ - * - \f$ \phi_{2} = c_{20} c_{02} \f$ - * - \f$ \phi_{3} = c_{30} c_{03} \f$ - * - \f$ \phi_{4} = c_{21} c_{12} \f$ - * - \f$ \phi_{5} = Re (c_{30} c_{12}^{3}) \f$ - * - \f$ \phi_{6} = Re (c_{20} c_{12}^{2}) \f$ - * - \f$ \phi_{7} = Im (c_{30} c_{12}^{3}) \f$ - * - * With : - * - * \f[ c_{p,q}=\int_{-\infty}^{\infty} \int_{-\infty}^{\infty} (x+iy)^{p} \cdot (x-iy)^{q} \cdot f(x,y) \cdot - dx \cdot dy \f] - * - * And: - * - \f$(x,y)\f$ pixel localization; - * - \f$ f(x,y)\f$ the pixel value over the \f$(x,y)\f$ coordinate. - * - * This class is templated over the input image type and the - * coordinate representation type (e.g. float or double). - * - * \ingroup ImageFunctions - */ -// public itk::ImageFunction< TInput, TOutput,TCoordRep > - -template < class TInput, - class TOutput = double, - class TCoordRep = float > -class ITK_EXPORT HuImageFunction : - public RealMomentImageFunction< TInput, TOutput,TCoordRep > -{ -public: - /** Standard class typedefs. */ - typedef HuImageFunction Self; - typedef RealMomentImageFunction< TInput, TOutput,TCoordRep > Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - /** Run-time type information (and related methods). */ -// itkTypeMacro(HuImageFunction, itk::ImageFunction); - itkTypeMacro(HuImageFunction, RealMomentImageFunction); - - /** Method for creation through the object factory. */ - itkNewMacro(Self); - - /** InputImageType typedef support. */ - typedef TInput InputType; - typedef typename Superclass::IndexType IndexType; - typedef typename Superclass::ContinuousIndexType ContinuousIndexType; - typedef typename Superclass::PointType PointType; - - typedef TOutput RealType; - typedef typename std::complex<RealType> ComplexType; - - /** Dimension of the underlying image. */ - itkStaticConstMacro(ImageDimension, unsigned int, - InputType::ImageDimension); - - - /** Evalulate the function at specified index */ - virtual RealType EvaluateAtIndex( const IndexType& index ) const; - - /** Evaluate the function at non-integer positions */ - virtual RealType Evaluate( const PointType& point ) const - { - IndexType index; - this->ConvertPointToNearestIndex( point, index ); - return this->EvaluateAtIndex( index ); - } - virtual RealType EvaluateAtContinuousIndex( - const ContinuousIndexType& cindex ) const - { - IndexType index; - this->ConvertContinuousIndexToNearestIndex( cindex, index ); - return this->EvaluateAtIndex( index ) ; - } - - /** Get/Set the radius of the neighborhood over which the - statistics are evaluated */ - itkSetClampMacro(Number,short,1,7); - itkGetConstReferenceMacro( Number, short ); - -protected: - HuImageFunction(); - ~HuImageFunction(){}; - void PrintSelf(std::ostream& os, itk::Indent indent) const; - -private: - HuImageFunction( const Self& ); //purposely not implemented - void operator=( const Self& ); //purposely not implemented - - short m_Number; -}; - -} // namespace otb - -#ifndef OTB_MANUAL_INSTANTIATION -#include "otbHuImageFunction.txx" -#endif - -#endif - diff --git a/Code/Common/otbHuImageFunction.txx b/Code/Common/otbHuImageFunction.txx deleted file mode 100644 index 5847dff282..0000000000 --- a/Code/Common/otbHuImageFunction.txx +++ /dev/null @@ -1,191 +0,0 @@ -/*========================================================================= - - Program: Insight Segmentation & Registration Toolkit - Module: $RCSfile: itkMeanImageFunction.txx,v $ - Language: C++ - Date: $Date: 2004/12/12 22:07:24 $ - Version: $Revision: 1.12 $ - - Copyright (c) Insight Software Consortium. All rights reserved. - See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm 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. - - =========================================================================*/ -#ifndef _otbHuImageFunction_txx -#define _otbHuImageFunction_txx - -#include "otbHuImageFunction.h" -#include "otbComplexMomentImageFunction.h" -#include "itkNumericTraits.h" -#include "itkMacro.h" -#include <complex> - -namespace otb -{ - -/** - * Constructor - */ -template < class TInput, class TOutput, class TCoordRep> -HuImageFunction<TInput,TOutput,TCoordRep> -::HuImageFunction() -{ - m_Number =-1; -} - -/** - * - */ -template < class TInput, class TOutput, class TCoordRep> -void -HuImageFunction<TInput,TOutput,TCoordRep> -::PrintSelf(std::ostream& os, itk::Indent indent) const -{ - this->Superclass::PrintSelf(os,indent); - os << indent << " m_Number : " << m_Number << std::endl; -} - - -template < class TInput, class TOutput, class TCoordRep> -typename HuImageFunction<TInput,TOutput,TCoordRep>::RealType -HuImageFunction<TInput,TOutput,TCoordRep> -::EvaluateAtIndex(const IndexType& index) const -{ - typename InputType::SizeType ImageSize; - RealType HuValue; - ComplexType HuValueComplex; - - typedef otb::ComplexMomentImageFunction<InputType,ComplexType> CMType; - typename CMType::Pointer function =CMType::New(); - - if( !this->GetInputImage() ) - { -// return std::complex<float>(0.,0.); // A modifier - return ( itk::NumericTraits<RealType>::max() ); - } - - if ( !this->IsInsideBuffer( index ) ) - { -// return std::complex<float>(0.,0.); // A modifier - return ( itk::NumericTraits<RealType>::max() ); - } - - assert(m_Number > 0); - assert(m_Number < 8); - - function->SetInputImage( this->GetInputImage() ); - - - switch(m_Number) - { - case 1 : - { - ComplexType C11; - function->SetP(1); - function->SetQ(1); - C11 = function->EvaluateAtIndex( index ); - HuValue = C11.real() ; - } - break; - case 2: - { - ComplexType C20,C02; - function->SetP(2); - function->SetQ(0); - C20 = function->EvaluateAtIndex( index ); -// function->SetP(0); -// function->SetQ(2); -// C02 = function->EvaluateAtIndex( index ); - - HuValue = abs( C20 * conj(C20) ) ; - - } - break; - case 3: - { - ComplexType C30,C03; - function->SetP(3); - function->SetQ(0); - C30 = function->EvaluateAtIndex( index ); -// function->SetP(0); -// function->SetQ(3); -// C03 = function->EvaluateAtIndex( index ); - - HuValue = abs( C30 * conj(C30) ); - } - break; - case 4: - { - ComplexType C21,C12; - function->SetP(2); - function->SetQ(1); - C21 = function->EvaluateAtIndex( index ); -// function->SetP(1); -// function->SetQ(2); -// C12 = function->EvaluateAtIndex( index ); - - HuValue = abs( C21 * conj(C21) ); - } - break; - - case 5: - { - ComplexType C30,C12; - function->SetP(3); - function->SetQ(0); - C30 = function->EvaluateAtIndex( index ); - function->SetP(1); - function->SetQ(2); - C12 = function->EvaluateAtIndex( index ); - - HuValueComplex = C30 * pow(C12,3) ; - HuValue = HuValueComplex.real(); - } - break; - - case 6: - { - ComplexType C20,C12; - function->SetP(2); - function->SetQ(0); - C20 = function->EvaluateAtIndex( index ); - function->SetP(1); - function->SetQ(2); - C12 = function->EvaluateAtIndex( index ); - - HuValueComplex = C20 * pow( C12 ,2 ); - HuValue = HuValueComplex.real(); - } - break; - - case 7: - { - ComplexType C30,C12; - function->SetP(3); - function->SetQ(0); - C30 = function->EvaluateAtIndex( index ); - function->SetP(1); - function->SetQ(2); - C12 = function->EvaluateAtIndex( index ); - - HuValueComplex = C30 * pow( C12 , 3); - HuValue = HuValueComplex.imag(); - } - break; - - default: - itkWarningMacro("Hu's invariant parameters are between 1 and 7"); - } - - - return (static_cast<RealType>(HuValue) ); - -} - - -} // namespace otb - -#endif diff --git a/Code/Common/otbRealMomentImageFunction.h b/Code/Common/otbRealMomentImageFunction.h deleted file mode 100644 index 0e25af090e..0000000000 --- a/Code/Common/otbRealMomentImageFunction.h +++ /dev/null @@ -1,70 +0,0 @@ -/*========================================================================= - - Programme : OTB (ORFEO ToolBox) - Auteurs : CS - P. Imbo - Language : C++ - Date : 17 mars 2006 - Version : - Role : Real Geometric Moments Class of iamges - $Id:$ - -=========================================================================*/ -#ifndef _otbRealMomentImageFunction_h -#define _otbRealMomentImageFunction_h - -#include "otbGeometricMomentImageFunction.h" - - -namespace otb -{ - -/** - * \class RealMomentImageFunction - * \brief Virtual class for the Real moments for an image function - * - * \ingroup ImageFunctions - */ - -template < class TInput, - class TOutput = float, - class TCoordRep = float > -class ITK_EXPORT RealMomentImageFunction : - public GeometricMomentImageFunction<TInput, TOutput,TCoordRep > -{ -public: - /** Standard class typedefs. */ - typedef RealMomentImageFunction Self; - typedef GeometricMomentImageFunction< TInput, TOutput,TCoordRep > Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - /** Run-time type information (and related methods). */ - itkTypeMacro(RealMomentImageFunction, GeometricMomentImageFunction); - - - /** InputImageType typedef support. */ - typedef typename Superclass::InputType InputType; - typedef typename Superclass::IndexType IndexType; - typedef typename Superclass::ContinuousIndexType ContinuousIndexType; - typedef typename Superclass::PointType PointType; - - typedef TOutput OutputType; - - -protected: - RealMomentImageFunction() {}; - ~RealMomentImageFunction(){}; - void PrintSelf(std::ostream& os, itk::Indent indent) const - { - Superclass::PrintSelf( os, indent ); - } - -private: - RealMomentImageFunction( const Self& ); //purposely not implemented - void operator=( const Self& ); //purposely not implemented -}; - -} // namespace otb - -#endif - -- GitLab