]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Image/MinimumSpanningTree.hxx
...
[FrontAlgorithms.git] / lib / fpa / Image / MinimumSpanningTree.hxx
index b99953b28ed029636ab4c3fddca40bf6429038f1..9bd70838ae2066f8a214fbb645eedaeb2edb4dfa 100644 (file)
@@ -1,3 +1,8 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
 #ifndef __fpa__Image__MinimumSpanningTree__hxx__
 #define __fpa__Image__MinimumSpanningTree__hxx__
 
@@ -7,8 +12,7 @@ typename fpa::Image::MinimumSpanningTree< _VDim >::
 TVertex fpa::Image::MinimumSpanningTree< _VDim >::
 GetParent( const TVertex& v ) const
 {
-  TVertex p = v + this->GetPixel( v );
-  return( p );
+  return( v + this->GetPixel( v ) );
 }
 
 // -------------------------------------------------------------------------
@@ -22,25 +26,35 @@ SetParent( const TVertex& v, const TVertex& p )
 // -------------------------------------------------------------------------
 template< unsigned int _VDim >
 void fpa::Image::MinimumSpanningTree< _VDim >::
-GetPath( typename TPath::Pointer& path, const TVertex& a ) const
+GetPolyLineParametricPath(
+  typename TPolyLineParametricPath::Pointer& path,
+  const TVertex& a
+  ) const
 {
-  if( path.GetPointer( ) == NULL )
-    path = TPath::New( );
+  TVertices v = this->GetPath( a );
+  if( path.IsNull( ) )
+    path = TPolyLineParametricPath::New( );
   path->SetReferenceImage( this );
-  this->Superclass::GetPath( path, a );
+  typename TVertices::const_iterator vIt = v.begin( );
+  for( ; vIt != v.end( ); ++vIt )
+    path->AddVertex( *vIt );
 }
 
 // -------------------------------------------------------------------------
 template< unsigned int _VDim >
 void fpa::Image::MinimumSpanningTree< _VDim >::
-GetPath(
-  typename TPath::Pointer& path, const TVertex& a, const TVertex& b
+GetPolyLineParametricPath(
+  typename TPolyLineParametricPath::Pointer& path,
+  const TVertex& a, const TVertex& b
   ) const
 {
-  if( path.GetPointer( ) == NULL )
-    path = TPath::New( );
+  TVertices v = this->GetPath( a, b );
+  if( path.IsNull( ) )
+    path = TPolyLineParametricPath::New( );
   path->SetReferenceImage( this );
-  this->Superclass::GetPath( path, a, b );
+  typename TVertices::const_iterator vIt = v.begin( );
+  for( ; vIt != v.end( ); ++vIt )
+    path->AddVertex( *vIt );
 }
 
 // -------------------------------------------------------------------------