1 #include <plugins/Plugins/SimpleImageDijkstraCost.h>
2 #include <cpPlugins/DataObjects/Image.h>
4 #include <fpa/Image/Functors/SimpleDijkstraCost.h>
5 #include <fpa/Image/Functors/SimpleDijkstraCost.hxx>
7 // -------------------------------------------------------------------------
8 fpaPlugins::SimpleImageDijkstraCost::
9 SimpleImageDijkstraCost( )
12 typedef cpPlugins::BaseObjects::DataObject _TData;
13 typedef cpPlugins::DataObjects::Image _TImage;
15 this->_ConfigureInput< _TImage >( "Input", true, false );
16 this->_ConfigureOutput< _TData >( "Output" );
18 std::vector< std::string > choices;
19 choices.push_back( "float" );
20 choices.push_back( "double" );
21 this->m_Parameters.ConfigureAsChoices( "ResultType", choices );
22 this->m_Parameters.ConfigureAsBool( "UseImageSpacing" );
24 this->m_Parameters.SetSelectedChoice( "ResultType", "float" );
25 this->m_Parameters.SetBool( "UseImageSpacing", false );
28 // -------------------------------------------------------------------------
29 fpaPlugins::SimpleImageDijkstraCost::
30 ~SimpleImageDijkstraCost( )
34 // -------------------------------------------------------------------------
35 void fpaPlugins::SimpleImageDijkstraCost::
38 auto o = this->GetInputData( "Input" );
39 cpPlugins_Demangle_ImageScalars_Dims( o, _GD0 );
40 else this->_Error( "Invalid input image." );
43 // -------------------------------------------------------------------------
44 template< class _TImage >
45 void fpaPlugins::SimpleImageDijkstraCost::
46 _GD0( _TImage* image )
48 auto rtype = this->m_Parameters.GetSelectedChoice( "ResultType" );
49 if ( rtype == "float" ) this->_GD1< _TImage, float >( image );
50 else if( rtype == "double" ) this->_GD1< _TImage, double >( image );
53 // -------------------------------------------------------------------------
54 template< class _TImage, class _TOutput >
55 void fpaPlugins::SimpleImageDijkstraCost::
56 _GD1( _TImage* image )
59 fpa::Image::Functors::SimpleDijkstraCost< _TImage, _TOutput >
61 auto out = this->GetOutput( "Output" );
62 auto f = out->GetITK< _TFunctor >( );
65 typename _TFunctor::Pointer ptr_f = _TFunctor::New( );
66 f = ptr_f.GetPointer( );
70 f->SetUseImageSpacing( this->m_Parameters.GetBool( "UseImageSpacing" ) );