]> Creatis software - FrontAlgorithms.git/blob - lib/fpa/Base/Functors/InvertCostFunction.h
Minor bugs
[FrontAlgorithms.git] / lib / fpa / Base / Functors / InvertCostFunction.h
1 #ifndef __FPA__BASE__FUNCTORS__INVERTCOSTFUNCTION__H__
2 #define __FPA__BASE__FUNCTORS__INVERTCOSTFUNCTION__H__
3
4 #include <itkFunctionBase.h>
5
6 namespace fpa
7 {
8   namespace Base
9   {
10     namespace Functors
11     {
12       /**
13        */
14       template< class C >
15       class InvertCostFunction
16         : public itk::FunctionBase< C, C >
17       {
18       public:
19         /// Type-related and pointers
20         typedef InvertCostFunction              Self;
21         typedef itk::FunctionBase< C, C >       Superclass;
22         typedef itk::SmartPointer< Self >       Pointer;
23         typedef itk::SmartPointer< const Self > ConstPointer;
24
25       public:
26         itkNewMacro( Self );
27         itkTypeMacro( InvertCostFunction, itkFunctionBase );
28
29       public:
30         virtual C Evaluate( const C& input ) const
31           {
32             if( input < C( 0 ) )
33               return( C( -1 ) / ( C( 1 ) + C( input ) ) );
34             else
35               return( C( 1 ) / ( C( 1 ) + C( input ) ) );
36           }
37
38       protected:
39         InvertCostFunction( )
40           : Superclass( )
41           { }
42         virtual ~InvertCostFunction( )
43           { }
44
45       private:
46         // Purposely not implemented
47         InvertCostFunction( const Self& );
48         void operator=( const Self& );
49       };
50
51     } // ecapseman
52
53   } // ecapseman
54
55 } // ecapseman
56
57 #endif // __FPA__BASE__FUNCTORS__INVERTCOSTFUNCTION__H__
58
59 // eof - $RCSfile$