]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/DataStructures/Image/MinimumSpanningTree.hxx
...
[FrontAlgorithms.git] / lib / fpa / DataStructures / Image / MinimumSpanningTree.hxx
diff --git a/lib/fpa/DataStructures/Image/MinimumSpanningTree.hxx b/lib/fpa/DataStructures/Image/MinimumSpanningTree.hxx
new file mode 100644 (file)
index 0000000..3cba74c
--- /dev/null
@@ -0,0 +1,75 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__DataStructures__Image__MinimumSpanningTree__hxx__
+#define __fpa__DataStructures__Image__MinimumSpanningTree__hxx__
+
+// -------------------------------------------------------------------------
+template< unsigned int _VDim >
+typename fpa::DataStructures::Image::MinimumSpanningTree< _VDim >::
+TVertex fpa::DataStructures::Image::MinimumSpanningTree< _VDim >::
+GetParent( const TVertex& v ) const
+{
+  return( v + this->GetPixel( v ) );
+}
+
+// -------------------------------------------------------------------------
+template< unsigned int _VDim >
+void fpa::DataStructures::Image::MinimumSpanningTree< _VDim >::
+SetParent( const TVertex& v, const TVertex& p )
+{
+  this->SetPixel( v, p - v );
+}
+
+// -------------------------------------------------------------------------
+template< unsigned int _VDim >
+void fpa::DataStructures::Image::MinimumSpanningTree< _VDim >::
+GetPolyLineParametricPath(
+  typename TPolyLineParametricPath::Pointer& path,
+  const TVertex& a
+  ) const
+{
+  TVertices v = this->GetPath( a );
+  if( path.IsNull( ) )
+    path = TPolyLineParametricPath::New( );
+  path->SetReferenceImage( this );
+  typename TVertices::const_iterator vIt = v.begin( );
+  for( ; vIt != v.end( ); ++vIt )
+    path->AddVertex( *vIt );
+}
+
+// -------------------------------------------------------------------------
+template< unsigned int _VDim >
+void fpa::DataStructures::Image::MinimumSpanningTree< _VDim >::
+GetPolyLineParametricPath(
+  typename TPolyLineParametricPath::Pointer& path,
+  const TVertex& a, const TVertex& b
+  ) const
+{
+  TVertices v = this->GetPath( a, b );
+  if( path.IsNull( ) )
+    path = TPolyLineParametricPath::New( );
+  path->SetReferenceImage( this );
+  typename TVertices::const_iterator vIt = v.begin( );
+  for( ; vIt != v.end( ); ++vIt )
+    path->AddVertex( *vIt );
+}
+
+// -------------------------------------------------------------------------
+template< unsigned int _VDim >
+fpa::DataStructures::Image::MinimumSpanningTree< _VDim >::
+MinimumSpanningTree( )
+  : Superclass( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< unsigned int _VDim >
+fpa::DataStructures::Image::MinimumSpanningTree< _VDim >::
+~MinimumSpanningTree( )
+{
+}
+
+#endif // __fpa__DataStructures__Image__MinimumSpanningTree__hxx__
+// eof - $RCSfile$