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