1 #include <Plugins/InvertCost.h>
2 #include <cpInstances/Image.h>
4 #include <fpa/Base/Functors/Inverse.h>
6 // -------------------------------------------------------------------------
7 fpaPlugins::InvertCost::
11 typedef cpPlugins::BaseObjects::DataObject _TData;
12 this->_ConfigureOutput< _TData >( "Output" );
14 std::vector< std::string > choices;
15 choices.push_back( "float" );
16 choices.push_back( "double" );
17 this->m_Parameters.ConfigureAsChoices( "ResultType", choices );
18 this->m_Parameters.ConfigureAsReal( "NegativeValue", -1 );
19 this->m_Parameters.SetSelectedChoice( "ResultType", "float" );
22 // -------------------------------------------------------------------------
23 fpaPlugins::InvertCost::
28 // -------------------------------------------------------------------------
29 void fpaPlugins::InvertCost::
32 auto rtype = this->m_Parameters.GetSelectedChoice( "ResultType" );
33 if ( rtype == "float" ) this->_GD0< float >( );
34 else if( rtype == "double" ) this->_GD0< double >( );
37 // -------------------------------------------------------------------------
38 template< class _TOutput >
39 void fpaPlugins::InvertCost::
42 typedef fpa::Base::Functors::Inverse< _TOutput, _TOutput > _TFunctor;
44 auto out = this->GetOutput( "Output" );
45 auto f = out->GetITK< _TFunctor >( );
48 typename _TFunctor::Pointer ptr_f = _TFunctor::New( );
49 f = ptr_f.GetPointer( );
53 f->SetNegativeValue( this->m_Parameters.GetReal( "NegativeValue" ) );