1 #include "InvertCostFunction.h"
3 #include <cpPlugins/Image.h>
4 #include <fpa/Base/Functors/InvertCostFunction.h>
6 // -------------------------------------------------------------------------
7 fpaPlugins::InvertCostFunction::
11 this->_AddOutput< cpPlugins::DataObject >( "Output" );
13 this->m_Parameters.ConfigureAsReal( "Alpha" );
14 this->m_Parameters.ConfigureAsReal( "Beta" );
16 std::vector< std::string > choices;
17 choices.push_back( "float" );
18 choices.push_back( "double" );
19 this->m_Parameters.ConfigureAsChoices( "ScalarType", choices );
21 this->m_Parameters.SetReal( "Alpha", 1 );
22 this->m_Parameters.SetReal( "Beta", 1 );
23 this->m_Parameters.SetSelectedChoice( "ScalarType", "float" );
26 // -------------------------------------------------------------------------
27 fpaPlugins::InvertCostFunction::
28 ~InvertCostFunction( )
32 // -------------------------------------------------------------------------
33 std::string fpaPlugins::InvertCostFunction::
36 auto choice = this->m_Parameters.GetSelectedChoice( "ScalarType" );
37 if ( choice == "float" ) return( this->_GD0< float >( ) );
38 else if( choice == "double" ) return( this->_GD0< double >( ) );
40 return( "fpaPlugins::InvertCostFunction: invalid scalar type." );
43 // -------------------------------------------------------------------------
44 template< class _TScalar >
45 std::string fpaPlugins::InvertCostFunction::
48 typedef fpa::Base::Functors::InvertCostFunction< _TScalar > _TFunctor;
49 auto out = this->GetOutputData( "Output" );
50 auto f = out->GetITK< _TFunctor >( );
53 typename _TFunctor::Pointer ptr_f = _TFunctor::New( );
54 f = ptr_f.GetPointer( );
58 f->SetAlpha( this->m_Parameters.GetReal( "Alpha" ) );
59 f->SetBeta( this->m_Parameters.GetReal( "Beta" ) );