1 #include <Plugins/SimpleImageDijkstraCost.h>
2 #include <cpPlugins/DataObjects/Image.h>
3 #include <cpPlugins/DataObjects/Image_Demanglers.h>
6 #include <fpa/Image/Functors/SimpleDijkstraCost.h>
8 // -------------------------------------------------------------------------
9 fpaPlugins::SimpleImageDijkstraCost::
10 SimpleImageDijkstraCost( )
13 typedef cpPlugins::BaseObjects::DataObject _TData;
14 typedef cpPlugins::DataObjects::Image _TImage;
16 this->_ConfigureInput< _TImage >( "Input", true, false );
17 this->_ConfigureOutput< _TData >( "Output" );
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 );
27 // -------------------------------------------------------------------------
28 fpaPlugins::SimpleImageDijkstraCost::
29 ~SimpleImageDijkstraCost( )
33 // -------------------------------------------------------------------------
34 void fpaPlugins::SimpleImageDijkstraCost::
37 auto o = this->GetInputData( "Input" );
38 cpPlugins_Demangle_Image_ScalarPixels_AllDims_1( o, _GD0 )
39 this->_Error( "Invalid input image." );
42 // -------------------------------------------------------------------------
43 template< class _TImage >
44 void fpaPlugins::SimpleImageDijkstraCost::
45 _GD0( _TImage* image )
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 );
52 // -------------------------------------------------------------------------
53 template< class _TImage, class _TOutput >
54 void fpaPlugins::SimpleImageDijkstraCost::
55 _GD1( _TImage* image )
58 fpa::Image::Functors::SimpleDijkstraCost< _TImage, _TOutput >
60 auto out = this->GetOutput( "Output" );
61 auto f = out->GetITK< _TFunctor >( );
64 typename _TFunctor::Pointer ptr_f = _TFunctor::New( );
65 f = ptr_f.GetPointer( );
69 f->SetUseImageSpacing( this->m_Parameters.GetBool( "UseImageSpacing" ) );