X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2Ffpa%2FImage%2FFunctors%2FImageCostFunction.h;fp=lib%2Ffpa%2FImage%2FFunctors%2FImageCostFunction.h;h=0000000000000000000000000000000000000000;hb=9c4035dc18f4e44a92cda3e3c1c6e583c94ef06b;hp=533b64b1ded88e72b6a30e31478304ee9900e1ed;hpb=e832f438861464a8d521464b61be7e31c896adb8;p=FrontAlgorithms.git diff --git a/lib/fpa/Image/Functors/ImageCostFunction.h b/lib/fpa/Image/Functors/ImageCostFunction.h deleted file mode 100644 index 533b64b..0000000 --- a/lib/fpa/Image/Functors/ImageCostFunction.h +++ /dev/null @@ -1,90 +0,0 @@ -#ifndef __FPA__IMAGE__FUNCTORS__IMAGECOSTFUNCTION__H__ -#define __FPA__IMAGE__FUNCTORS__IMAGECOSTFUNCTION__H__ - -#include -#include -#include - -namespace fpa -{ - namespace Image - { - namespace Functors - { - /** - */ - template< class I, class R > - class ImageCostFunction - : public itk::Object - { - public: - /// Type-related and pointers - typedef ImageCostFunction Self; - typedef itk::Object Superclass; - typedef itk::SmartPointer< Self > Pointer; - typedef itk::SmartPointer< const Self > ConstPointer; - - typedef I TInputImage; - typedef R TResult; - typedef typename I::IndexType TIndex; - - public: - itkNewMacro( Self ); - itkTypeMacro( ImageCostFunction, itkObject ); - - itkGetConstObjectMacro( InputImage, I ); - itkSetConstObjectMacro( InputImage, I ); - - public: - virtual R Evaluate( const TIndex& v, const TIndex& p ) const - { - typedef typename I::PixelType _TPixel; - typedef typename itk::NumericTraits< _TPixel > _TTraits; - typedef typename _TTraits::MeasurementVectorType _TVector; - typedef typename _TTraits::ValueType _TValue; - - if( this->m_InputImage.IsNotNull( ) ) - { - _TPixel pix = this->m_InputImage->GetPixel( v ); - if( typeid( _TPixel ) != typeid( _TValue ) ) - { - _TVector* array = reinterpret_cast< _TVector* >( &pix ); - unsigned int n = - this->m_InputImage->GetNumberOfComponentsPerPixel( ); - R sum = R( 0 ); - for( unsigned int i = 0; i < n; ++i ) - sum += R( ( *array )[ i ] ); - return( sum / R( n ) ); - } - else - return( R( *( reinterpret_cast< _TValue* >( &pix ) ) ) ); - } - else - return( std::numeric_limits< R >::max( ) ); - } - - protected: - ImageCostFunction( ) - : Superclass( ) - { } - virtual ~ImageCostFunction( ) - { } - - private: - // Purposely not implemented - ImageCostFunction( const Self& ); - void operator=( const Self& ); - - protected: - typename I::ConstPointer m_InputImage; - }; - - } // ecapseman - - } // ecapseman - -} // ecapseman - -#endif // __FPA__IMAGE__FUNCTORS__IMAGECOSTFUNCTION__H__ - -// eof - $RCSfile$