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