X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2Ffpa%2FImage%2FMinimumSpanningTree.hxx;h=b99953b28ed029636ab4c3fddca40bf6429038f1;hb=d80032f7c6cb6cdfe9f4d85162112e8c190647d5;hp=48a43cb8190504d74eaf015f2142dbb7bb19e84d;hpb=db33ebb226fd58f493b7db245fc8b807f895ee6e;p=FrontAlgorithms.git diff --git a/lib/fpa/Image/MinimumSpanningTree.hxx b/lib/fpa/Image/MinimumSpanningTree.hxx index 48a43cb..b99953b 100644 --- a/lib/fpa/Image/MinimumSpanningTree.hxx +++ b/lib/fpa/Image/MinimumSpanningTree.hxx @@ -1,41 +1,63 @@ -#ifndef __FPA__IMAGE__MINIMUMSPANNINGTREE__HXX__ -#define __FPA__IMAGE__MINIMUMSPANNINGTREE__HXX__ +#ifndef __fpa__Image__MinimumSpanningTree__hxx__ +#define __fpa__Image__MinimumSpanningTree__hxx__ // ------------------------------------------------------------------------- -template< class V, class N, class C, unsigned int D, unsigned long L > -fpa::Image::MinimumSpanningTree< V, N, C, D, L >:: -MinimumSpanningTree( ) - : Superclass( ) +template< unsigned int _VDim > +typename fpa::Image::MinimumSpanningTree< _VDim >:: +TVertex fpa::Image::MinimumSpanningTree< _VDim >:: +GetParent( const TVertex& v ) const { + TVertex p = v + this->GetPixel( v ); + return( p ); } // ------------------------------------------------------------------------- -template< class V, class N, class C, unsigned int D, unsigned long L > -fpa::Image::MinimumSpanningTree< V, N, C, D, L >:: -~MinimumSpanningTree( ) +template< unsigned int _VDim > +void fpa::Image::MinimumSpanningTree< _VDim >:: +SetParent( const TVertex& v, const TVertex& p ) +{ + this->SetPixel( v, p - v ); +} + +// ------------------------------------------------------------------------- +template< unsigned int _VDim > +void fpa::Image::MinimumSpanningTree< _VDim >:: +GetPath( typename TPath::Pointer& path, const TVertex& a ) const { + if( path.GetPointer( ) == NULL ) + path = TPath::New( ); + path->SetReferenceImage( this ); + this->Superclass::GetPath( path, a ); } // ------------------------------------------------------------------------- -template< class V, class N, class C, unsigned int D, unsigned long L > -long fpa::Image::MinimumSpanningTree< V, N, C, D, L >:: -_FrontId( const V& v ) const +template< unsigned int _VDim > +void fpa::Image::MinimumSpanningTree< _VDim >:: +GetPath( + typename TPath::Pointer& path, const TVertex& a, const TVertex& b + ) const { - return( this->GetPixel( v ).FrontId ); + if( path.GetPointer( ) == NULL ) + path = TPath::New( ); + path->SetReferenceImage( this ); + this->Superclass::GetPath( path, a, b ); } // ------------------------------------------------------------------------- -template< class V, class N, class C, unsigned int D, unsigned long L > -V fpa::Image::MinimumSpanningTree< V, N, C, D, L >:: -_Parent( const V& v ) const +template< unsigned int _VDim > +fpa::Image::MinimumSpanningTree< _VDim >:: +MinimumSpanningTree( ) + : Superclass( ) +{ +} + +// ------------------------------------------------------------------------- +template< unsigned int _VDim > +fpa::Image::MinimumSpanningTree< _VDim >:: +~MinimumSpanningTree( ) { - _TNode n = this->GetPixel( v ); - if( n.Label == L ) - return( n.Parent ); - else - return( v ); } -#endif // __FPA__IMAGE__MINIMUMSPANNINGTREE__HXX__ +#endif // __fpa__Image__MinimumSpanningTree__hxx__ // eof - $RCSfile$