#include #include #include // ------------------------------------------------------------------------- fpaPluginsImageAlgorithms::FastMarching:: FastMarching( ) : Superclass( ) { typedef cpPlugins::Pipeline::DataObject _TData; typedef cpInstances::DataObjects::Image _TMST; this->_ConfigureInput< _TData >( "VertexFunction", false, false ); this->_ConfigureInput< _TData >( "ConversionFunction", false, false ); this->_ConfigureOutput< _TMST >( "MST" ); 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" ); } // ------------------------------------------------------------------------- fpaPluginsImageAlgorithms::FastMarching:: ~FastMarching( ) { } // ------------------------------------------------------------------------- void fpaPluginsImageAlgorithms::FastMarching:: _GenerateData( ) { auto o = this->GetInputData( "Input" ); cpPlugins_Demangle_Image_ScalarPixels_AllDims_1( o, _GD0 ) this->_Error( "Invalid input image." ); } // ------------------------------------------------------------------------- template< class _TImage > void fpaPluginsImageAlgorithms::FastMarching:: _GD0( _TImage* image ) { typedef itk::Image< float, _TImage::ImageDimension > _TFloat; typedef itk::Image< double, _TImage::ImageDimension > _TDouble; auto rtype = this->m_Parameters.GetSelectedChoice( "ResultType" ); if ( rtype == "float" ) this->_GD1< _TImage, _TFloat >( image ); else if( rtype == "double" ) this->_GD1< _TImage, _TDouble >( image ); } // ------------------------------------------------------------------------- template< class _TInputImage, class _TOutputImage > void fpaPluginsImageAlgorithms::FastMarching:: _GD1( _TInputImage* image ) { typedef fpa::Image::FastMarching< _TInputImage, _TOutputImage > _TFilter; typedef typename _TFilter::TConversionFunction _TConversionFunction; typedef typename _TFilter::TVertexFunction _TVertexFunction; auto filter = this->_CreateITK< _TFilter >( ); std::vector< typename _TInputImage::IndexType > seeds; this->_ConfigureFilter( filter, image, seeds ); filter->ClearSeeds( ); for( auto seed : seeds ) filter->AddSeed( seed, ( typename _TOutputImage::PixelType )( 0 ) ); filter->Update( ); this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) ); /* TODO auto filter = this->_CreateITK< _TFilter >( ); this->_ConfigureFilter( filter, image ); auto cost = this->GetInputData< _TCost >( "Cost" ); auto conv = this->GetInputData< _TCostConversion >( "CostConversion" ); if( cost != NULL ) filter->SetCostFunction( cost ); if( conv != NULL ) filter->SetCostConversionFunction( conv ); filter->Update( ); this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) ); this->GetOutput( "MST" )->SetITK( filter->GetMinimumSpanningTree( ) ); */ } // eof - $RCSfile$