#include #include #include #include // ------------------------------------------------------------------------- fpaPluginsDijkstraFunctors::SimpleImageDijkstraCost:: SimpleImageDijkstraCost( ) : Superclass( ) { typedef cpPlugins::Pipeline::DataObject _TData; typedef cpInstances::DataObjects::Image _TImage; this->_ConfigureInput< _TImage >( "Input", true, false ); this->_ConfigureOutput< _TData >( "Output" ); std::vector< std::string > choices; choices.push_back( "float" ); choices.push_back( "double" ); this->m_Parameters.ConfigureAsChoices( "ResultType", choices ); this->m_Parameters.SetSelectedChoice( "ResultType", "float" ); this->m_Parameters.ConfigureAsBool( "UseImageSpacing", false ); } // ------------------------------------------------------------------------- fpaPluginsDijkstraFunctors::SimpleImageDijkstraCost:: ~SimpleImageDijkstraCost( ) { } // ------------------------------------------------------------------------- void fpaPluginsDijkstraFunctors::SimpleImageDijkstraCost:: _GenerateData( ) { auto o = this->GetInputData( "Input" ); cpPlugins_Demangle_Image_ScalarPixels_AllDims_1( o, _GD0 ) this->_Error( "Invalid input image." ); } // ------------------------------------------------------------------------- template< class _TImage > void fpaPluginsDijkstraFunctors::SimpleImageDijkstraCost:: _GD0( _TImage* image ) { auto rtype = this->m_Parameters.GetSelectedChoice( "ResultType" ); if ( rtype == "float" ) this->_GD1< _TImage, float >( image ); else if( rtype == "double" ) this->_GD1< _TImage, double >( image ); } // ------------------------------------------------------------------------- template< class _TImage, class _TOutput > void fpaPluginsDijkstraFunctors::SimpleImageDijkstraCost:: _GD1( _TImage* image ) { typedef fpa::Image::Functors::SimpleDijkstraCost< _TImage, _TOutput > _TFunctor; auto out = this->GetOutput( "Output" ); auto f = out->GetITK< _TFunctor >( ); if( f == NULL ) { typename _TFunctor::Pointer ptr_f = _TFunctor::New( ); f = ptr_f.GetPointer( ); out->SetITK( f ); } // fi f->SetUseImageSpacing( this->m_Parameters.GetBool( "UseImageSpacing" ) ); } // eof - $RCSfile$