#include "VertexCost.h" #include #include #include // ------------------------------------------------------------------------- void fpaPlugins_ImageFunctors::VertexCost:: Instantiate( itk::LightObject* filter ) { auto itk_filter = dynamic_cast< itk::ProcessObject* >( filter ); if( itk_filter != NULL ) { auto inputs = itk_filter->GetInputs( ); if( inputs.size( ) > 0 ) { cpPlugins_Demangle_Image_ScalarPixels_AllDims_2( inputs[ 0 ].GetPointer( ), _GD0, itk_filter ) this->_Error( "Invalid input data." ); } else this->_Error( "Not enough inputs." ); } else this->_Error( "Invalid instantiation filter." ); } // ------------------------------------------------------------------------- fpaPlugins_ImageFunctors::VertexCost:: VertexCost( ) : Superclass( ) { this->_ConfigureOutput< cpPlugins::Pipeline::DataObject >( "Functor" ); this->m_Parameters.ConfigureAsBool( "UseImageSpacing", false ); this->GetOutput( "Functor" )->SetITK( this ); } // ------------------------------------------------------------------------- fpaPlugins_ImageFunctors::VertexCost:: ~VertexCost( ) { } // ------------------------------------------------------------------------- void fpaPlugins_ImageFunctors::VertexCost:: _GenerateData( ) { } // ------------------------------------------------------------------------- template< class _TInput > void fpaPlugins_ImageFunctors::VertexCost:: _GD0( _TInput* input, itk::ProcessObject* filter ) { auto outputs = filter->GetOutputs( ); if( outputs.size( ) > 0 ) { cpPlugins_Demangle_Image_ScalarPixels_3( outputs[ 0 ].GetPointer( ), _GD1, _TInput::ImageDimension, input, filter ) this->_Error( "Invalid output data." ); } else this->_Error( "Not enough outputs." ); } // ------------------------------------------------------------------------- template< class _TInput, class _TOutput > void fpaPlugins_ImageFunctors::VertexCost:: _GD1( _TOutput* output, _TInput* input, itk::ProcessObject* filter ) { typedef typename _TInput::PixelType _TIValue; typedef typename _TOutput::PixelType _TOValue; typedef fpa::Image::Functors::VertexCost< _TInput, _TOValue > _TFunctor; auto f = dynamic_cast< _TFunctor* >( this->m_Functor.GetPointer( ) ); if( f == NULL ) { typename _TFunctor::Pointer ptr_f = _TFunctor::New( ); f = ptr_f.GetPointer( ); this->m_Functor = f; } // fi f->SetUseImageSpacing( this->m_Parameters.GetReal( "UseImageSpacing" ) ); } // eof - $RCSfile$