X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2Ffpa%2FImage%2FDijkstra.h;h=45759cb9c1fa5b9d0cb880dee10068414b2468f0;hb=6468f1fda5fed2788fbaef1a7925c91ecff83d13;hp=1464d3cfd2953d01bfa2c0714437bba3ce42ad12;hpb=9622bd5b833a8845881003228207e0caca59b081;p=FrontAlgorithms.git diff --git a/lib/fpa/Image/Dijkstra.h b/lib/fpa/Image/Dijkstra.h index 1464d3c..45759cb 100644 --- a/lib/fpa/Image/Dijkstra.h +++ b/lib/fpa/Image/Dijkstra.h @@ -1,12 +1,11 @@ #ifndef __FPA__IMAGE__DIJKSTRA__H__ #define __FPA__IMAGE__DIJKSTRA__H__ -#include -#include +#include #include -#include #include #include +#include namespace fpa { @@ -14,45 +13,89 @@ namespace fpa { /** * @param I Input image type + * @param O Output image type */ - template< class I, class C > + template< class I, class O = I > class Dijkstra - : public Algorithm< I, fpa::Base::Dijkstra< typename I::IndexType, C, typename I::PixelType, itk::Functor::IndexLexicographicCompare< I::ImageDimension >, itk::ImageToImageFilter< I, itk::Image< C, I::ImageDimension > > > > + : public Algorithm< I, O, fpa::Base::Dijkstra< typename I::IndexType, typename I::PixelType, typename O::PixelType, I, itk::Functor::IndexLexicographicCompare< I::ImageDimension >, itk::ImageToImageFilter< I, O > > > { public: - // Standard class typdedefs - typedef typename I::IndexType TVertex; - typedef typename I::PixelType TVertexValue; - typedef itk::Image< C, I::ImageDimension > TCostImage; - typedef itk::ImageToImageFilter< I, TCostImage > TBaseFilter; - typedef fpa::Base::Dijkstra< TVertex, C, TVertexValue, itk::Functor::IndexLexicographicCompare< I::ImageDimension >, TBaseFilter > TBaseAlgorithm; - - typedef Dijkstra Self; - typedef Algorithm< I, TBaseAlgorithm > Superclass; - typedef itk::SmartPointer< Self > Pointer; - typedef itk::SmartPointer< const Self > ConstPointer; + typedef fpa::Base::Dijkstra< typename I::IndexType, typename I::PixelType, typename O::PixelType, I, itk::Functor::IndexLexicographicCompare< I::ImageDimension >, itk::ImageToImageFilter< I, O > > TBaseAlgorithm; + + typedef Dijkstra Self; + typedef Algorithm< I, O, TBaseAlgorithm > Superclass; + typedef itk::SmartPointer< Self > Pointer; + typedef itk::SmartPointer< const Self > ConstPointer; + + typedef typename Superclass::TInputImage TInputImage; + typedef typename Superclass::TOutputImage TOutputImage; + typedef typename Superclass::TVertex TVertex; + typedef typename Superclass::TValue TValue; + typedef typename Superclass::TResult TResult; + typedef typename Superclass::TSpace TSpace; + typedef typename Superclass::TMinimumSpanningTree TMinimumSpanningTree; + + typedef typename Superclass::TStartEvent TStartEvent; + typedef typename Superclass::TStartLoopEvent TStartLoopEvent; + typedef typename Superclass::TEndEvent TEndEvent; + typedef typename Superclass::TEndLoopEvent TEndLoopEvent; + typedef typename Superclass::TAliveEvent TAliveEvent; + typedef typename Superclass::TFrontEvent TFrontEvent; + typedef typename Superclass::TFreezeEvent TFreezeEvent; + + typedef typename Superclass::TStartBacktrackingEvent TStartBacktrackingEvent; + typedef typename Superclass::TEndBacktrackingEvent TEndBacktrackingEvent; + typedef typename Superclass::TBacktrackingEvent TBacktrackingEvent; + + typedef fpa::Image::Functors::ImageCostFunction< TInputImage, TResult > TCostFunction; + typedef itk::FunctionBase< TResult, TResult > TConversionFunction; + + protected: + typedef typename Superclass::_TVertices _TVertices; + typedef typename Superclass::_TCollision _TCollision; + typedef typename Superclass::_TCollisionsRow _TCollisionsRow; + typedef typename Superclass::_TCollisions _TCollisions; + typedef typename Superclass::_TNode _TNode; + typedef typename Superclass::_TNodes _TNodes; public: itkNewMacro( Self ); - itkTypeMacro( Dijkstra, fpaBaseDijkstra ); + itkTypeMacro( Dijkstra, Algorithm ); + + itkGetObjectMacro( CostFunction, TCostFunction ); + itkGetObjectMacro( ConversionFunction, TConversionFunction ); + + itkGetConstObjectMacro( CostFunction, TCostFunction ); + itkGetConstObjectMacro( ConversionFunction, TConversionFunction ); + + itkSetObjectMacro( CostFunction, TCostFunction ); + itkSetObjectMacro( ConversionFunction, TConversionFunction ); protected: - Dijkstra( ) - : Superclass( ) - { } - virtual ~Dijkstra( ) - { } + Dijkstra( ); + virtual ~Dijkstra( ); + + virtual TResult _Cost( const TVertex& v, const TVertex& p ) const; + + virtual void _BeforeGenerateData( ); + virtual void _InitResults( ); private: // Purposely not implemented - Dijkstra( const Self& ); - void operator=( const Self& ); + Dijkstra( const Self& other ); + Self& operator=( const Self& other ); + + protected: + typename TCostFunction::Pointer m_CostFunction; + typename TConversionFunction::Pointer m_ConversionFunction; }; } // ecapseman } // ecapseman +#include + #endif // __FPA__IMAGE__DIJKSTRA__H__ // eof - $RCSfile$