]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Image/MinimumSpanningTree.hxx
...
[FrontAlgorithms.git] / lib / fpa / Image / MinimumSpanningTree.hxx
index 48a43cb8190504d74eaf015f2142dbb7bb19e84d..b99953b28ed029636ab4c3fddca40bf6429038f1 100644 (file)
@@ -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$