]> Creatis software - FrontAlgorithms.git/blob - plugins/DijkstraFunctors/SimpleImageDijkstraCost.cxx
a053e86b22699175f0c308cfc86414a5f5066b02
[FrontAlgorithms.git] / plugins / DijkstraFunctors / SimpleImageDijkstraCost.cxx
1 #include <DijkstraFunctors/SimpleImageDijkstraCost.h>
2 #include <cpInstances/DataObjects/Image.h>
3
4 #include <itkImage.h>
5
6 // TODO: #include <fpa/Image/Functors/SimpleDijkstraCost.h>
7
8 // -------------------------------------------------------------------------
9 fpaPluginsDijkstraFunctors::SimpleImageDijkstraCost::
10 SimpleImageDijkstraCost( )
11   : Superclass( )
12 {
13   typedef cpPlugins::Pipeline::DataObject _TData;
14   typedef cpInstances::DataObjects::Image _TImage;
15
16   this->_ConfigureInput< _TImage >( "Input", true, false );
17   this->_ConfigureOutput< _TData >( "Output" );
18
19   std::vector< std::string > choices;
20   choices.push_back( "float" );
21   choices.push_back( "double" );
22   this->m_Parameters.ConfigureAsChoices( "ResultType", choices );
23   this->m_Parameters.SetSelectedChoice( "ResultType", "float" );
24   this->m_Parameters.ConfigureAsBool( "UseImageSpacing", false );
25 }
26
27 // -------------------------------------------------------------------------
28 fpaPluginsDijkstraFunctors::SimpleImageDijkstraCost::
29 ~SimpleImageDijkstraCost( )
30 {
31 }
32
33 // -------------------------------------------------------------------------
34 void fpaPluginsDijkstraFunctors::SimpleImageDijkstraCost::
35 _GenerateData( )
36 {
37   auto o = this->GetInputData( "Input" );
38   cpPlugins_Demangle_Image_ScalarPixels_AllDims_1( o, _GD0 )
39     this->_Error( "Invalid input image." );
40 }
41
42 // -------------------------------------------------------------------------
43 template< class _TImage >
44 void fpaPluginsDijkstraFunctors::SimpleImageDijkstraCost::
45 _GD0( _TImage* image )
46 {
47   auto rtype = this->m_Parameters.GetSelectedChoice( "ResultType" );
48   if     ( rtype == "float"  ) this->_GD1< _TImage, float >( image );
49   else if( rtype == "double" ) this->_GD1< _TImage, double >( image );
50 }
51
52 // -------------------------------------------------------------------------
53 template< class _TImage, class _TOutput >
54 void fpaPluginsDijkstraFunctors::SimpleImageDijkstraCost::
55 _GD1( _TImage* image )
56 {
57   /* TODO
58      typedef
59      fpa::Image::Functors::SimpleDijkstraCost< _TImage, _TOutput >
60      _TFunctor;
61      auto out = this->GetOutput( "Output" );
62      auto f = out->GetITK< _TFunctor >( );
63      if( f == NULL )
64      {
65      typename _TFunctor::Pointer ptr_f = _TFunctor::New( );
66      f = ptr_f.GetPointer( );
67      out->SetITK( f );
68
69      } // fi
70      f->SetUseImageSpacing( this->m_Parameters.GetBool( "UseImageSpacing" ) );
71   */
72 }
73
74 // eof - $RCSfile$