]> Creatis software - FrontAlgorithms.git/blob - plugins/Plugins/InvertCostFunctor.cxx
779541dd5e5c7dda53e45c6c85cd5f7537be41d7
[FrontAlgorithms.git] / plugins / Plugins / InvertCostFunctor.cxx
1 #include "InvertCostFunctor.h"
2
3 #include <fpa/Base/Functors/InvertCost.h>
4 #include <fpa/Base/Functors/InvertCost.hxx>
5
6 // -------------------------------------------------------------------------
7 fpaPlugins::InvertCostFunctor::
8 InvertCostFunctor( )
9   : Superclass( )
10 {
11   this->_ConfigureOutput< cpPlugins::BaseObjects::DataObject >( "Output" );
12   std::vector< std::string > choices;
13   choices.push_back( "float" );
14   choices.push_back( "double" );
15   this->m_Parameters.ConfigureAsChoices( "ResultType", choices );
16   this->m_Parameters.SetSelectedChoice( "ResultType", "float" );
17 }
18
19 // -------------------------------------------------------------------------
20 fpaPlugins::InvertCostFunctor::
21 ~InvertCostFunctor( )
22 {
23 }
24
25 // -------------------------------------------------------------------------
26 void fpaPlugins::InvertCostFunctor::
27 _GenerateData( )
28 {
29   auto rtype = this->m_Parameters.GetSelectedChoice( "ResultType" );
30   if     ( rtype == "float"  ) this->_GD0< float >( );
31   else if( rtype == "double" ) this->_GD0< double >( );
32 }
33
34 // -------------------------------------------------------------------------
35 template< class _TResult >
36 void fpaPlugins::InvertCostFunctor::
37 _GD0( )
38 {
39   typedef fpa::Base::Functors::InvertCost< _TResult > _TFunctor;
40   auto out = this->GetOutput( "Output" );
41   auto f = out->GetITK< _TFunctor >( );
42   if( f == NULL )
43   {
44     typename _TFunctor::Pointer ptr_f = _TFunctor::New( );
45     f = ptr_f.GetPointer( );
46     out->SetITK( f );
47
48   } // fi
49 }
50
51 // eof - $RCSfile$