]> Creatis software - FrontAlgorithms.git/commitdiff
...
authorLeonardo Flórez-Valencia <leonardo.florez@gmail.com>
Fri, 14 Jul 2017 04:39:15 +0000 (23:39 -0500)
committerLeonardo Flórez-Valencia <leonardo.florez@gmail.com>
Fri, 14 Jul 2017 04:39:15 +0000 (23:39 -0500)
lib/fpa/Base/Dijkstra.hxx
lib/fpa/Base/MinimumSpanningTree.hxx
lib/fpa/Base/SeedsInterface.h
lib/fpa/Base/SeedsInterface.hxx
lib/fpa/Image/Algorithm.hxx
lib/fpa/Image/MinimumSpanningTree.h
lib/fpa/Image/MinimumSpanningTree.hxx [new file with mode: 0644]

index 85380aa8a127de82828aadaf25c3111a459b4aeb..9de7912d2597427ed381279679432b659115f72a 100644 (file)
@@ -61,7 +61,7 @@ _AfterGenerateData( )
   mst->ClearSeeds( );
   mst->SetCollisions( this->m_Collisions );
 
-  TSeeds seeds = this->GetSeeds( );
+  const TSeeds& seeds = this->GetSeeds( );
   typename TSeeds::const_iterator sIt = seeds.begin( );
   for( ; sIt != seeds.end( ); ++sIt )
   {
index 6004aaa183efea0514cc2839fea585a009fadfa6..00e4159c98c489c6140d9e58572815c646449123 100644 (file)
@@ -124,6 +124,7 @@ typename fpa::Base::MinimumSpanningTree< _TVertex, _Superclass >::
 TVertices fpa::Base::MinimumSpanningTree< _TVertex, _Superclass >::
 GetPath( const _TVertex& a, const _TVertex& b ) const
 {
+#error no hace bien el backtracking!
   static const unsigned long _inf =
     std::numeric_limits< unsigned long >::max( );
 
index 41debde26ae73c812224358b3c864ca825b699d8..61860cc5fd66570b868ca351795248b1e736bfe3 100644 (file)
@@ -71,6 +71,7 @@ namespace fpa
       typedef std::set< TNode, TNodeCompare > TNodes;
 
     public:
+      TSeeds& GetSeeds( );
       const TSeeds& GetSeeds( ) const;
 
       virtual void AddSeed( const TVertex& seed );
index 5dd666ee53fbf5a719373ea0f27088f22ce569b2..5bfd16a45d8da329bcf6c377eb71f176ed03a50d 100644 (file)
@@ -6,6 +6,17 @@
 #ifndef __fpa__Base__SeedsInterface__hxx__
 #define __fpa__Base__SeedsInterface__hxx__
 
+// -------------------------------------------------------------------------
+template< class _TVertex, class _TPoint, class _TInputValue, class _TOutputValue, class _TFrontId, class _TCompare >
+typename
+fpa::Base::SeedsInterface< _TVertex, _TPoint, _TInputValue, _TOutputValue, _TFrontId, _TCompare >::
+TSeeds&
+fpa::Base::SeedsInterface< _TVertex, _TPoint, _TInputValue, _TOutputValue, _TFrontId, _TCompare >::
+GetSeeds( )
+{
+  return( this->m_Seeds );
+}
+
 // -------------------------------------------------------------------------
 template< class _TVertex, class _TPoint, class _TInputValue, class _TOutputValue, class _TFrontId, class _TCompare >
 const typename
index ba3497f738629f57f09e381616353650b44eb9ac..0fce0d597c85d14e51aa516b883ee351a6b87df1 100644 (file)
@@ -64,7 +64,7 @@ _UnifySeeds( )
 {
   const TInputImage* input = this->GetInput( );
   typename TInputImage::RegionType region = input->GetRequestedRegion( );
-  TSeeds seeds = this->GetSeeds( );
+  TSeeds& seeds = this->GetSeeds( );
   TNodes nodes;
 
   typename TSeeds::iterator sIt = seeds.begin( );
index 46d2231fc5dab68cf84246bce0f65582a4800395..22f7904f5b28549cbf5c619076ee06ffdfe69c50 100644 (file)
@@ -44,30 +44,21 @@ namespace fpa
         );
 
     public:
-      virtual TVertex GetParent( const TVertex& v ) const override
-        {
-          return( v + this->GetPixel( v ) );
-        }
-      virtual void SetParent( const TVertex& v, const TVertex& p ) override
-        {
-          this->SetPixel( v, p - v );
-        }
-
-      void GetPath(
+      virtual TVertex GetParent( const TVertex& v ) const override;
+      virtual void SetParent( const TVertex& v, const TVertex& p ) override;
+
+      void GetPolyLineParametricPath(
         typename TPolyLineParametricPath::Pointer& path,
         const TVertex& a
         ) const;
-      void GetPath(
+      void GetPolyLineParametricPath(
         typename TPolyLineParametricPath::Pointer& path,
         const TVertex& a, const TVertex& b
         ) const;
 
     protected:
-      MinimumSpanningTree( )
-        : Superclass( )
-        { }
-      virtual ~MinimumSpanningTree( )
-        { }
+      MinimumSpanningTree( );
+      virtual ~MinimumSpanningTree( );
 
     private:
       MinimumSpanningTree( const Self& other );
diff --git a/lib/fpa/Image/MinimumSpanningTree.hxx b/lib/fpa/Image/MinimumSpanningTree.hxx
new file mode 100644 (file)
index 0000000..b6161ee
--- /dev/null
@@ -0,0 +1,75 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#ifndef __fpa__Image__MinimumSpanningTree__hxx__
+#define __fpa__Image__MinimumSpanningTree__hxx__
+
+// -------------------------------------------------------------------------
+template< unsigned int _VDim >
+typename fpa::Image::MinimumSpanningTree< _VDim >::
+TVertex fpa::Image::MinimumSpanningTree< _VDim >::
+GetParent( const TVertex& v ) const
+{
+  return( v + this->GetPixel( v ) );
+}
+
+// -------------------------------------------------------------------------
+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 >::
+GetPolyLineParametricPath(
+  typename TPolyLineParametricPath::Pointer& path,
+  const TVertex& a
+  ) const
+{
+  TVertices v = this->GetPath( a );
+  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::Image::MinimumSpanningTree< _VDim >::
+GetPolyLineParametricPath(
+  typename TPolyLineParametricPath::Pointer& path,
+  const TVertex& a, const TVertex& b
+  ) const
+{
+  TVertices v = this->GetPath( a, b );
+  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::Image::MinimumSpanningTree< _VDim >::
+MinimumSpanningTree( )
+  : Superclass( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< unsigned int _VDim >
+fpa::Image::MinimumSpanningTree< _VDim >::
+~MinimumSpanningTree( )
+{
+}
+
+#endif // __fpa__Image__MinimumSpanningTree__hxx__
+
+// eof - $RCSfile$