diff --git a/Code/FeatureExtraction/otbImageFunctionAdapter.h b/Code/FeatureExtraction/otbImageFunctionAdapter.h deleted file mode 100644 index e66a57bda16d77b24d45b036b0ae6f954c7c5aa6..0000000000000000000000000000000000000000 --- a/Code/FeatureExtraction/otbImageFunctionAdapter.h +++ /dev/null @@ -1,493 +0,0 @@ -/*========================================================================= - - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt 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 __otbImageFunctionAdapter_h -#define __otbImageFunctionAdapter_h - -#include "itkImageFunction.h" -#include "itkNumericTraits.h" - -#include "otbFourierMellinDescriptorsImageFunction.h" -#include "otbRealMomentsImageFunction.h" -#include "otbComplexMomentsImageFunction.h" -#include "otbFlusserMomentsImageFunction.h" -#include "otbHuMomentsImageFunction.h" -#include "otbRadiometricMomentsImageFunction.h" -#include "otbLocalHistogramImageFunction.h" - -#include <complex> - -namespace otb -{ - - -template< class TInputImage, class TInternalImageFunctionType, class TCoordRep = double > -class ITK_EXPORT ImageFunctionAdapterBase : - public itk::ImageFunction< TInputImage, - itk::VariableLengthVector< - ITK_TYPENAME itk::NumericTraits<typename TInputImage::PixelType> - ::RealType >, - TCoordRep > -{ - public: - // Standard class typedefs. // - typedef ImageFunctionAdapterBase Self; - typedef itk::ImageFunction< TInputImage, - itk::VariableLengthVector< - ITK_TYPENAME itk::NumericTraits<typename TInputImage::PixelType> - ::RealType >, - TCoordRep > Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - // Run-time type information (and related methods). // - itkTypeMacro(ImageFunctionAdapterBase, ImageFunction); - - // Method for creation through the object factory. // - itkNewMacro(Self); - - // InputImageType typedef support. // - typedef TInputImage InputImageType; - typedef typename Superclass::IndexType IndexType; - typedef typename Superclass::ContinuousIndexType ContinuousIndexType; - typedef typename Superclass::PointType PointType; - typedef typename Superclass::OutputType OutputType; - typedef typename OutputType::ValueType OutputValueType; - - // Template Partial Specialization Specific typedef // - typedef TInternalImageFunctionType InternalImageFunctionType; - typedef typename InternalImageFunctionType::Pointer InternalImageFunctionPointerType; - - // Dimension of the underlying image. // - itkStaticConstMacro(ImageDimension, unsigned int, - InputImageType::ImageDimension); - - // Evalulate the function at specified index // - virtual OutputType EvaluateAtIndex(const IndexType& index) const - { - OutputType result; - - result.SetSize(1); - - result[0] = 0.0; - - return result; - }; - - // Evaluate the function at non-integer positions // - virtual OutputType Evaluate(const PointType& point) const - { - IndexType index; - this->ConvertPointToNearestIndex(point, index); - return this->EvaluateAtIndex(index); - } - virtual OutputType EvaluateAtContinuousIndex( - const ContinuousIndexType& cindex) const - { - IndexType index; - this->ConvertContinuousIndexToNearestIndex(cindex, index); - return this->EvaluateAtIndex(index); - } - - // Get/Set the internal image function // - InternalImageFunctionPointerType GetImageFunction() const - { - return m_ImageFunction; - } - -protected: - ImageFunctionAdapterBase() - { - m_ImageFunction = InternalImageFunctionType::New(); - } - - virtual ~ImageFunctionAdapterBase() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const - { - Superclass::PrintSelf(os, indent); - os << indent << "Internal Image Function: " << m_ImageFunction << std::endl; - } - -private: - ImageFunctionAdapterBase(const Self &); //purposely not implemented - void operator =(const Self&); //purposely not implemented - - // Internal Image Function // - InternalImageFunctionPointerType m_ImageFunction; -}; - - -// ----- Template Partial Specialization ----- // - -//Dummy -template< class TInputImage, class TInternalImageFunctionType, class TCoordRep = double > -class ITK_EXPORT ImageFunctionAdapter : - public otb::ImageFunctionAdapterBase< TInputImage, - TInternalImageFunctionType, - TCoordRep > -{ -public: - typedef ImageFunctionAdapter Self; - typedef ImageFunctionAdapterBase< TInputImage, - TInternalImageFunctionType, - TCoordRep > Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - itkTypeMacro(ImageFunctionAdapter, ImageFunction); - itkNewMacro(Self); - typedef typename Superclass::IndexType IndexType; - typedef typename Superclass::ContinuousIndexType ContinuousIndexType; - typedef typename Superclass::OutputType OutputType; - typedef typename Superclass::InternalImageFunctionType InternalImageFunctionType; - - virtual OutputType EvaluateAtIndex(const IndexType& index) const; - -protected: - ImageFunctionAdapter() {} - virtual ~ImageFunctionAdapter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; - -private: - ImageFunctionAdapter(const Self &); //purposely not implemented - void operator =(const Self&); //purposely not implemented -}; - - -//FourierMellinDescriptors -template< class TInputImage, class TCoordRep > -class ITK_EXPORT ImageFunctionAdapter< TInputImage, - otb::FourierMellinDescriptorsImageFunction<TInputImage, TCoordRep>, - TCoordRep > : - public otb::ImageFunctionAdapterBase< TInputImage, - FourierMellinDescriptorsImageFunction< - TInputImage, - TCoordRep >, - TCoordRep > -{ -public: - // Standard class typedefs. // - typedef ImageFunctionAdapter Self; - typedef ImageFunctionAdapterBase< TInputImage, - FourierMellinDescriptorsImageFunction< - TInputImage, - TCoordRep >, - TCoordRep > Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - // Run-time type information (and related methods). // - itkTypeMacro(ImageFunctionAdapter, ImageFunction); - // Method for creation through the object factory. // - itkNewMacro(Self); - // Usefull typedefs // - typedef typename Superclass::IndexType IndexType; - typedef typename Superclass::ContinuousIndexType ContinuousIndexType; - typedef typename Superclass::OutputType OutputType; - // Template Partial Specialization Specific typedef // - typedef typename Superclass::InternalImageFunctionType InternalImageFunctionType; - - // Evalulate the function at specified index // - virtual OutputType EvaluateAtIndex(const IndexType& index) const; - -protected: - ImageFunctionAdapter() {} - virtual ~ImageFunctionAdapter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; - -private: - ImageFunctionAdapter(const Self &); //purposely not implemented - void operator =(const Self&); //purposely not implemented -}; - -//RealMoments -template< class TInputImage, class TCoordRep > -class ITK_EXPORT ImageFunctionAdapter< TInputImage, - otb::RealMomentsImageFunction<TInputImage, TCoordRep>, - TCoordRep > : - public otb::ImageFunctionAdapterBase< TInputImage, - RealMomentsImageFunction< - TInputImage, - TCoordRep >, - TCoordRep > -{ -public: - // Standard class typedefs. // - typedef ImageFunctionAdapter Self; - typedef ImageFunctionAdapterBase< TInputImage, - RealMomentsImageFunction< - TInputImage, - TCoordRep >, - TCoordRep > Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - // Run-time type information (and related methods). // - itkTypeMacro(ImageFunctionAdapter, ImageFunction); - // Method for creation through the object factory. // - itkNewMacro(Self); - // Usefull typedefs // - typedef typename Superclass::IndexType IndexType; - typedef typename Superclass::ContinuousIndexType ContinuousIndexType; - typedef typename Superclass::OutputType OutputType; - // Template Partial Specialization Specific typedef // - typedef typename Superclass::InternalImageFunctionType InternalImageFunctionType; - - // Evalulate the function at specified index // - virtual OutputType EvaluateAtIndex(const IndexType& index) const; - -protected: - ImageFunctionAdapter() {} - virtual ~ImageFunctionAdapter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; - -private: - ImageFunctionAdapter(const Self &); //purposely not implemented - void operator =(const Self&); //purposely not implemented -}; - -//ComplexMoments -template< class TInputImage, class TCoordRep > -class ITK_EXPORT ImageFunctionAdapter< TInputImage, - otb::ComplexMomentsImageFunction< TInputImage, TCoordRep>, - TCoordRep > : - public otb::ImageFunctionAdapterBase< TInputImage, - ComplexMomentsImageFunction< - TInputImage, - TCoordRep >, - TCoordRep > -{ -public: - // Standard class typedefs. // - typedef ImageFunctionAdapter Self; - typedef ImageFunctionAdapterBase< TInputImage, - ComplexMomentsImageFunction< - TInputImage, - TCoordRep >, - TCoordRep > Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - // Run-time type information (and related methods). // - itkTypeMacro(ImageFunctionAdapter, ImageFunction); - // Method for creation through the object factory. // - itkNewMacro(Self); - // Usefull typedefs // - typedef typename Superclass::IndexType IndexType; - typedef typename Superclass::ContinuousIndexType ContinuousIndexType; - typedef typename Superclass::OutputType OutputType; - // Template Partial Specialization Specific typedef // - typedef typename Superclass::InternalImageFunctionType InternalImageFunctionType; - - // Evalulate the function at specified index // - virtual OutputType EvaluateAtIndex(const IndexType& index) const; - -protected: - ImageFunctionAdapter() {} - virtual ~ImageFunctionAdapter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; - -private: - ImageFunctionAdapter(const Self &); //purposely not implemented - void operator =(const Self&); //purposely not implemented -}; - -//FlusserMoments -template< class TInputImage, class TCoordRep > -class ITK_EXPORT ImageFunctionAdapter< TInputImage, - otb::FlusserMomentsImageFunction< TInputImage, TCoordRep>, - TCoordRep > : - public otb::ImageFunctionAdapterBase< TInputImage, - FlusserMomentsImageFunction< - TInputImage, - TCoordRep >, - TCoordRep > -{ -public: - // Standard class typedefs. // - typedef ImageFunctionAdapter Self; - typedef ImageFunctionAdapterBase< TInputImage, - FlusserMomentsImageFunction< - TInputImage, - TCoordRep >, - TCoordRep > Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - // Run-time type information (and related methods). // - itkTypeMacro(ImageFunctionAdapter, ImageFunction); - // Method for creation through the object factory. // - itkNewMacro(Self); - // Usefull typedefs // - typedef typename Superclass::IndexType IndexType; - typedef typename Superclass::ContinuousIndexType ContinuousIndexType; - typedef typename Superclass::OutputType OutputType; - // Template Partial Specialization Specific typedef // - typedef typename Superclass::InternalImageFunctionType InternalImageFunctionType; - - // Evalulate the function at specified index // - virtual OutputType EvaluateAtIndex(const IndexType& index) const; - -protected: - ImageFunctionAdapter() {}; - virtual ~ImageFunctionAdapter() {}; - void PrintSelf(std::ostream& os, itk::Indent indent) const; - -private: - ImageFunctionAdapter(const Self &); //purposely not implemented - void operator =(const Self&); //purposely not implemented -}; - -//HuMoments -template< class TInputImage, class TCoordRep > -class ITK_EXPORT ImageFunctionAdapter< TInputImage, - otb::HuMomentsImageFunction< TInputImage, TCoordRep>, - TCoordRep > : - public otb::ImageFunctionAdapterBase< TInputImage, - HuMomentsImageFunction< - TInputImage, - TCoordRep >, - TCoordRep > -{ -public: - // Standard class typedefs. // - typedef ImageFunctionAdapter Self; - typedef ImageFunctionAdapterBase< TInputImage, - HuMomentsImageFunction< - TInputImage, - TCoordRep >, - TCoordRep > Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - // Run-time type information (and related methods). // - itkTypeMacro(ImageFunctionAdapter, ImageFunction); - // Method for creation through the object factory. // - itkNewMacro(Self); - // Usefull typedefs // - typedef typename Superclass::IndexType IndexType; - typedef typename Superclass::ContinuousIndexType ContinuousIndexType; - typedef typename Superclass::OutputType OutputType; - // Template Partial Specialization Specific typedef // - typedef typename Superclass::InternalImageFunctionType InternalImageFunctionType; - - // Evalulate the function at specified index // - virtual OutputType EvaluateAtIndex(const IndexType& index) const; - -protected: - ImageFunctionAdapter() {} - virtual ~ImageFunctionAdapter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; - -private: - ImageFunctionAdapter(const Self &); //purposely not implemented - void operator =(const Self&); //purposely not implemented -}; - -//RadiometricMoments -template< class TInputImage, class TCoordRep > -class ITK_EXPORT ImageFunctionAdapter< TInputImage, - otb::RadiometricMomentsImageFunction< TInputImage, TCoordRep>, - TCoordRep > : - public otb::ImageFunctionAdapterBase< TInputImage, - RadiometricMomentsImageFunction< - TInputImage, - TCoordRep >, - TCoordRep > -{ -public: - // Standard class typedefs. // - typedef ImageFunctionAdapter Self; - typedef ImageFunctionAdapterBase< TInputImage, - RadiometricMomentsImageFunction< - TInputImage, - TCoordRep >, - TCoordRep > Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - // Run-time type information (and related methods). // - itkTypeMacro(ImageFunctionAdapter, ImageFunction); - // Method for creation through the object factory. // - itkNewMacro(Self); - // Usefull typedefs // - typedef typename Superclass::IndexType IndexType; - typedef typename Superclass::ContinuousIndexType ContinuousIndexType; - typedef typename Superclass::OutputType OutputType; - // Template Partial Specialization Specific typedef // - typedef typename Superclass::InternalImageFunctionType InternalImageFunctionType; - - // Evalulate the function at specified index // - virtual OutputType EvaluateAtIndex(const IndexType& index) const; - -protected: - ImageFunctionAdapter() {} - virtual ~ImageFunctionAdapter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; - -private: - ImageFunctionAdapter(const Self &); //purposely not implemented - void operator =(const Self&); //purposely not implemented -}; - - -//LocalHistogram -template< class TInputImage, class TCoordRep > -class ITK_EXPORT ImageFunctionAdapter< TInputImage, - otb::LocalHistogramImageFunction< TInputImage, TCoordRep>, - TCoordRep > : - public otb::ImageFunctionAdapterBase< TInputImage, - LocalHistogramImageFunction< - TInputImage, - TCoordRep >, - TCoordRep > -{ -public: - // Standard class typedefs. // - typedef ImageFunctionAdapter Self; - typedef ImageFunctionAdapterBase< TInputImage, - LocalHistogramImageFunction< - TInputImage, - TCoordRep >, - TCoordRep > Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - // Run-time type information (and related methods). - itkTypeMacro(ImageFunctionAdapter, ImageFunction); - // Method for creation through the object factory. - itkNewMacro(Self); - // Usefull typedefs // - typedef typename Superclass::IndexType IndexType; - typedef typename Superclass::ContinuousIndexType ContinuousIndexType; - typedef typename Superclass::OutputType OutputType; - // Template Partial Specialization Specific typedef - typedef typename Superclass::InternalImageFunctionType InternalImageFunctionType; - - // Evalulate the function at specified index // - virtual OutputType EvaluateAtIndex(const IndexType& index) const; - -protected: - ImageFunctionAdapter() {} - virtual ~ImageFunctionAdapter() {} - void PrintSelf(std::ostream& os, itk::Indent indent) const; - -private: - ImageFunctionAdapter(const Self &); //purposely not implemented - void operator =(const Self&); //purposely not implemented -}; - - -} // end namespace otb - -#ifndef OTB_MANUAL_INSTANTIATION -#include "otbImageFunctionAdapter.txx" -#endif - -#endif diff --git a/Code/FeatureExtraction/otbImageFunctionAdapter.txx b/Code/FeatureExtraction/otbImageFunctionAdapter.txx deleted file mode 100644 index 1b55cd7edae2bcd4648d89ef836bf314b1f00181..0000000000000000000000000000000000000000 --- a/Code/FeatureExtraction/otbImageFunctionAdapter.txx +++ /dev/null @@ -1,342 +0,0 @@ -/*========================================================================= - - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt 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 __otbImageFunctionAdapter_txx -#define __otbImageFunctionAdapter_txx - -#include "otbImageFunctionAdapter.h" - -namespace otb -{ -/** ----- Template Partial Specialization ----- **/ -// Dummy -template <class TInputImage, class TInternalImageFunctionType, class TCoordRep> -typename ImageFunctionAdapter<TInputImage, TInternalImageFunctionType, TCoordRep >::OutputType -ImageFunctionAdapter <TInputImage, TInternalImageFunctionType, TCoordRep > -::EvaluateAtIndex(const IndexType& index) const -{ - OutputType result; - result.SetSize(1); - result[0] = 0.0; - return result; -} -template <class TInputImage, class TInternalImageFunctionType, class TCoordRep > -void -ImageFunctionAdapter <TInputImage, TInternalImageFunctionType, TCoordRep > -::PrintSelf(std::ostream& os, itk::Indent indent) const -{ - Superclass::PrintSelf(os, indent); -} - - -// Fourier-Mellin Descriptors -template <class TInputImage, class TCoordRep> -typename ImageFunctionAdapter<TInputImage, - FourierMellinDescriptorsImageFunction< TInputImage, TCoordRep >, - TCoordRep >::OutputType -ImageFunctionAdapter<TInputImage, - FourierMellinDescriptorsImageFunction< TInputImage, TCoordRep >, - TCoordRep > -::EvaluateAtIndex(const IndexType& index) const -{ - unsigned int p, q, rsltIdx = 0; - OutputType result; - - p = this->GetImageFunction()->GetPmax(); - q = this->GetImageFunction()->GetQmax(); - - result.SetSize((p+1)*(q+1)); - - typename InternalImageFunctionType::OutputType tmpResult; - this->GetImageFunction()->SetInputImage(this->GetInputImage()); - tmpResult = this->GetImageFunction()->EvaluateAtIndex(index); - - for (unsigned int i=0; i<=p; i++) - { - for (unsigned int j=0; j<=q; j++) - { - result[rsltIdx] = tmpResult.at(i).at(j); - rsltIdx ++; - } - } - - return result; -} - -template <class TInputImage, class TCoordRep> -void -ImageFunctionAdapter<TInputImage, - FourierMellinDescriptorsImageFunction< TInputImage, TCoordRep >, - TCoordRep > -::PrintSelf(std::ostream& os, itk::Indent indent) const -{ - Superclass::PrintSelf(os, indent); -} - - -// Real Moments -template <class TInputImage, class TCoordRep> -typename ImageFunctionAdapter<TInputImage, - RealMomentsImageFunction< TInputImage, TCoordRep >, - TCoordRep >::OutputType -ImageFunctionAdapter<TInputImage, - RealMomentsImageFunction< TInputImage, TCoordRep >, - TCoordRep > -::EvaluateAtIndex(const IndexType& index) const -{ - unsigned int p, q, rsltIdx = 0; - OutputType result; - - p = this->GetImageFunction()->GetPmax(); - q = this->GetImageFunction()->GetQmax(); - - result.SetSize((p+1)*(q+1)); - - typename InternalImageFunctionType::OutputType tmpResult; - this->GetImageFunction()->SetInputImage(this->GetInputImage()); - tmpResult = this->GetImageFunction()->EvaluateAtIndex(index); - - for (unsigned int i=0; i<=p; i++) - { - for (unsigned int j=0; j<=q; j++) - { - result[rsltIdx] = tmpResult.at(i).at(j); - rsltIdx ++; - } - } - - return result; -} - -template <class TInputImage, class TCoordRep> -void -ImageFunctionAdapter<TInputImage, - RealMomentsImageFunction< TInputImage, TCoordRep >, - TCoordRep > -::PrintSelf(std::ostream& os, itk::Indent indent) const -{ - Superclass::PrintSelf(os, indent); -} - - -//Complex Moments -template <class TInputImage, class TCoordRep> -typename ImageFunctionAdapter<TInputImage, - ComplexMomentsImageFunction< TInputImage, TCoordRep >, - TCoordRep >::OutputType -ImageFunctionAdapter<TInputImage, - ComplexMomentsImageFunction< TInputImage, TCoordRep >, - TCoordRep > -::EvaluateAtIndex(const IndexType& index) const -{ - unsigned int p, q, rsltIdx = 0; - OutputType result; - - p = this->GetImageFunction()->GetPmax(); - q = this->GetImageFunction()->GetQmax(); - - result.SetSize((p+1)*(q+1)*2); - - typename InternalImageFunctionType::OutputType tmpResult; - this->GetImageFunction()->SetInputImage(this->GetInputImage()); - tmpResult = this->GetImageFunction()->EvaluateAtIndex(index); - - for (unsigned int i=0; i<=p; i++) - { - for (unsigned int j=0; j<=q; j++) - { - result[rsltIdx] = tmpResult.at(i).at(j).real(); - rsltIdx ++; - result[rsltIdx] = tmpResult.at(i).at(j).imag(); - rsltIdx ++; - } - } - - return result; -} - -template <class TInputImage, class TCoordRep> -void -ImageFunctionAdapter<TInputImage, - ComplexMomentsImageFunction< TInputImage, TCoordRep >, - TCoordRep > -::PrintSelf(std::ostream& os, itk::Indent indent) const -{ - Superclass::PrintSelf(os, indent); -} - - -//Flusser Moments -template <class TInputImage, class TCoordRep> -typename ImageFunctionAdapter<TInputImage, - FlusserMomentsImageFunction< TInputImage, TCoordRep >, - TCoordRep >::OutputType -ImageFunctionAdapter<TInputImage, - FlusserMomentsImageFunction< TInputImage, TCoordRep >, - TCoordRep > -::EvaluateAtIndex(const IndexType& index) const -{ - unsigned int rsltIdx = 0; - OutputType result; - - result.SetSize(11); - - typename InternalImageFunctionType::OutputType tmpResult; - this->GetImageFunction()->SetInputImage(this->GetInputImage()); - tmpResult = this->GetImageFunction()->EvaluateAtIndex(index); - - for (unsigned int i=0; i<11; i++) - { - result[rsltIdx] = tmpResult[i]; - rsltIdx ++; - } - - return result; -} - -template <class TInputImage, class TCoordRep> -void -ImageFunctionAdapter<TInputImage, - FlusserMomentsImageFunction<TInputImage, TCoordRep >, - TCoordRep > -::PrintSelf(std::ostream& os, itk::Indent indent) const -{ - Superclass::PrintSelf(os, indent); -} - - -//Hu Moments -template <class TInputImage, class TCoordRep> -typename ImageFunctionAdapter<TInputImage, - HuMomentsImageFunction< TInputImage, TCoordRep >, - TCoordRep >::OutputType -ImageFunctionAdapter<TInputImage, - HuMomentsImageFunction< TInputImage, TCoordRep >, - TCoordRep > -::EvaluateAtIndex(const IndexType& index) const -{ - unsigned int rsltIdx = 0; - OutputType result; - - result.SetSize(7); - - typename InternalImageFunctionType::OutputType tmpResult; - this->GetImageFunction()->SetInputImage(this->GetInputImage()); - tmpResult = this->GetImageFunction()->EvaluateAtIndex(index); - - for (unsigned int i=0; i<7; i++) - { - result[rsltIdx] = tmpResult[i]; - rsltIdx ++; - } - - return result; -} - -template <class TInputImage, class TCoordRep> -void -ImageFunctionAdapter<TInputImage, - HuMomentsImageFunction< TInputImage, TCoordRep >, - TCoordRep > -::PrintSelf(std::ostream& os, itk::Indent indent) const -{ - Superclass::PrintSelf(os, indent); -} - - -//Radiometric Moments -template <class TInputImage, class TCoordRep> -typename ImageFunctionAdapter<TInputImage, - RadiometricMomentsImageFunction< TInputImage, TCoordRep >, - TCoordRep >::OutputType -ImageFunctionAdapter<TInputImage, - RadiometricMomentsImageFunction< TInputImage, TCoordRep >, - TCoordRep > -::EvaluateAtIndex(const IndexType& index) const -{ - unsigned int rsltIdx = 0; - OutputType result; - - result.SetSize(4); - - typename InternalImageFunctionType::OutputType tmpResult; - this->GetImageFunction()->SetInputImage(this->GetInputImage()); - tmpResult = this->GetImageFunction()->EvaluateAtIndex(index); - - for (unsigned int i=0; i<4; i++) - { - result[rsltIdx] = tmpResult[i]; - rsltIdx ++; - } - - return result; -} - -template <class TInputImage, class TCoordRep> -void -ImageFunctionAdapter<TInputImage, - RadiometricMomentsImageFunction< TInputImage, TCoordRep >, - TCoordRep > -::PrintSelf(std::ostream& os, itk::Indent indent) const -{ - Superclass::PrintSelf(os, indent); -} - - -//Local Histogramm -template <class TInputImage, class TCoordRep> -typename ImageFunctionAdapter<TInputImage, - LocalHistogramImageFunction< TInputImage, TCoordRep >, - TCoordRep >::OutputType -ImageFunctionAdapter<TInputImage, - LocalHistogramImageFunction< TInputImage, TCoordRep >, - TCoordRep > -::EvaluateAtIndex(const IndexType& index) const -{ - unsigned int nbBins, rsltIdx = 0; - OutputType result; - - nbBins = this->GetImageFunction()->GetNumberOfHistogramBins(); - - result.SetSize(nbBins); - - typename InternalImageFunctionType::OutputType tmpResult; - this->GetImageFunction()->SetInputImage(this->GetInputImage()); - tmpResult = this->GetImageFunction()->EvaluateAtIndex(index); - - for (unsigned int i=0; i<nbBins; i++) - { - result[rsltIdx] = tmpResult->GetFrequency(i); - rsltIdx ++; - } - - return result; -} - -template <class TInputImage, class TCoordRep> -void -ImageFunctionAdapter<TInputImage, - LocalHistogramImageFunction< TInputImage, TCoordRep >, - TCoordRep > -::PrintSelf(std::ostream& os, itk::Indent indent) const -{ - Superclass::PrintSelf(os, indent); -} - -} // end namespace otb - -#endif diff --git a/Code/FeatureExtraction/otbMetaImageFunction.txx b/Code/FeatureExtraction/otbMetaImageFunction.txx index 94239e2ba64cb89374e04f27b979c9bb0bd048ff..197c08faba0ad2597994febd79468023035b69db 100644 --- a/Code/FeatureExtraction/otbMetaImageFunction.txx +++ b/Code/FeatureExtraction/otbMetaImageFunction.txx @@ -19,7 +19,7 @@ #define __otbMetaImageFunction_txx #include "otbMetaImageFunction.h" -#include "otbImageFunctionAdapter.h" +#include "otbImageFunctionAdaptor.h" #include <algorithm> diff --git a/Testing/Code/FeatureExtraction/otbMetaImageFunction.cxx b/Testing/Code/FeatureExtraction/otbMetaImageFunction.cxx index fb5441ee64dcf4bc8085443f7e35c3dc8a9e2d12..633b4882b7d3ae2c319b78367d111a32586cf6fe 100644 --- a/Testing/Code/FeatureExtraction/otbMetaImageFunction.cxx +++ b/Testing/Code/FeatureExtraction/otbMetaImageFunction.cxx @@ -23,7 +23,7 @@ #include "otbImage.h" #include "otbImageFileReader.h" #include "otbFlusserMomentsImageFunction.h" -#include "otbImageFunctionAdapter.h" +#include "otbImageFunctionAdaptor.h" typedef unsigned short InputPixelType; const unsigned int Dimension = 2; @@ -31,7 +31,7 @@ const unsigned int Dimension = 2; typedef otb::Image<InputPixelType, Dimension> InputImageType; typedef otb::ImageFileReader<InputImageType> ReaderType; typedef otb::FlusserMomentsImageFunction<InputImageType> FlusserFunctionType; -typedef otb::ImageFunctionAdapter<InputImageType,FlusserFunctionType> FunctionType; +typedef otb::ImageFunctionAdaptor<FlusserFunctionType> FunctionType; typedef otb::MetaImageFunction< itk::NumericTraits<InputPixelType>::RealType,double> MetaImageFunctionType; @@ -61,9 +61,9 @@ int otbMetaImageFunction(int argc, char * argv[]) function2->SetInputImage(reader->GetOutput()); function3->SetInputImage(reader->GetOutput()); - function1->GetImageFunction()->SetNeighborhoodRadius(3); - function2->GetImageFunction()->SetNeighborhoodRadius(5); - function3->GetImageFunction()->SetNeighborhoodRadius(7); + function1->GetInternalImageFunction()->SetNeighborhoodRadius(3); + function2->GetInternalImageFunction()->SetNeighborhoodRadius(5); + function3->GetInternalImageFunction()->SetNeighborhoodRadius(7); std::ofstream outputStream(argv[2]);