]> Creatis software - FrontAlgorithms.git/commitdiff
...
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Tue, 16 Feb 2016 02:20:11 +0000 (21:20 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Tue, 16 Feb 2016 02:20:11 +0000 (21:20 -0500)
lib/fpa/Base/ExtractBranchesFromMinimumSpanningTree.h
lib/fpa/Base/ExtractBranchesFromMinimumSpanningTree.hxx
lib/fpa/Base/MinimumSpanningTree.hxx

index 985d339f5b851a7ca2f4592d774a16f23a70232f..183a7fa2774e5e1dcb6886574b65a69c0f32a0c8 100644 (file)
@@ -4,6 +4,7 @@
 #include <set>
 #include <fpa/Base/MatrixValuesContainer.h>
 #include <itkProcessObject.h>
+#include <itkPolyLineParametricPath.h>
 
 namespace fpa
 {
@@ -24,10 +25,8 @@ namespace fpa
       typedef T                          TMinimumSpanningTree;
       typedef typename T::TVertex        TVertex;
       typedef typename T::TVertexCompare TVertexCompare;
-      typedef std::vector< TVertex >     TPath;
-      typedef
-      fpa::Base::MatrixValuesContainer< TVertex, TPath, TVertexCompare >
-      TBranches;
+      typedef itk::PolyLineParametricPath< TVertex::Dimension >  TPath;
+      typedef fpa::Base::MatrixValuesContainer< TVertex, typename TPath::Pointer, TVertexCompare > TBranches;
 
       typedef std::set< TVertex, TVertexCompare > TEndPoints;
 
index f8793c9c5936f3a2c0259b7b9585a71ab6537e8e..9dd96ed08afffc0e4dd18f70b28d43c068bf5fbd 100644 (file)
@@ -93,32 +93,28 @@ template< class T >
 void fpa::Base::ExtractBranchesFromMinimumSpanningTree< T >::
 GenerateData( )
 {
-  const T* tree = this->GetInput( );
-  TBranches* branches = this->GetOutput( );
+  auto tree = this->GetInput( );
+  auto branches = this->GetOutput( );
 
   // Find bifurcations
-  TEndPoints all_points, marks;
+  TEndPoints bifurcations, marks;
   auto e0It = this->m_EndPoints.begin( );
   for( ; e0It != this->m_EndPoints.end( ); ++e0It )
   {
-    all_points.insert( *e0It );
     auto e1It = e0It;
     e1It++;
     for( ; e1It != this->m_EndPoints.end( ); ++e1It )
     {
-      all_points.insert( *e0It );
       auto path = tree->GetPath( *e0It, *e1It );
+      std::cout << "path" << std::endl;
       auto pIt = path.begin( );
       for( ; pIt != path.end( ); ++pIt )
       {
-        if( *pIt == *e0It || *pIt == *e1It )
-          continue;
-
         if( marks.find( *pIt ) == marks.end( ) )
           marks.insert( *pIt );
         else
-          all_points.insert( *pIt );
-        
+          bifurcations.insert( *pIt );
+
       } // rof
 
     } // rof
@@ -126,7 +122,7 @@ GenerateData( )
   } // rof
 
   // Construct branches
-  std::cout << all_points.size( ) << std::endl;
+  std::cout << bifurcations.size( ) << std::endl;
 }
 
 #endif // __FPA__BASE__EXTRACTBRANCHESFROMMINIMUMSPANNINGTREE__HXX__
index 9d0939ddf74b2e469c4416c103f1f6445ee96214..6bf9be2e365b51e974a15c1fc6af5f3aa974c0c1 100644 (file)
@@ -238,9 +238,6 @@ _Path( std::vector< V >& path, const V& a ) const
 
     } while( dIt->first != dIt->second.first && dIt != this->Get( ).end( ) );
 
-    if( dIt != this->Get( ).end( ) )
-      path.push_back( dIt->first );
-
   } // fi
 }