]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Base/ExtractBranchesFromMinimumSpanningTree.hxx
...
[FrontAlgorithms.git] / lib / fpa / Base / ExtractBranchesFromMinimumSpanningTree.hxx
index 9dd96ed08afffc0e4dd18f70b28d43c068bf5fbd..5a7433f6bea67718c8bfd4e4b3d73e460ee7ded7 100644 (file)
@@ -22,11 +22,11 @@ SetInput( const T* tree )
 // -------------------------------------------------------------------------
 template< class T >
 typename fpa::Base::ExtractBranchesFromMinimumSpanningTree< T >::
-TBranches* fpa::Base::ExtractBranchesFromMinimumSpanningTree< T >::
+TPath* fpa::Base::ExtractBranchesFromMinimumSpanningTree< T >::
 GetOutput( )
 {
   return(
-    itkDynamicCastInDebugMode< TBranches* >( this->GetPrimaryOutput( ) )
+    itkDynamicCastInDebugMode< TPath* >( this->GetPrimaryOutput( ) )
     );
 }
 
@@ -76,7 +76,7 @@ ExtractBranchesFromMinimumSpanningTree( )
 {
   this->itk::ProcessObject::SetNumberOfRequiredInputs( 1 );
 
-  typename TBranches::Pointer out = TBranches::New( );
+  typename TPath::Pointer out = TPath::New( );
   this->itk::ProcessObject::SetNumberOfRequiredOutputs( 1 );
   this->itk::ProcessObject::SetNthOutput( 0, out.GetPointer( ) );
 }
@@ -94,35 +94,45 @@ void fpa::Base::ExtractBranchesFromMinimumSpanningTree< T >::
 GenerateData( )
 {
   auto tree = this->GetInput( );
-  auto branches = this->GetOutput( );
+  auto path = this->GetOutput( );
+
+  // TODO: this is just a temporary code
+  auto v0 = *( this->m_EndPoints.begin( ) );
+  auto v1 = *( this->m_EndPoints.rbegin( ) );
+  auto lst = tree->GetPath( v0, v1 );
+  path->Initialize( );
+  for( auto i = lst.begin( ); i != lst.end( ); ++i )
+    path->AddVertex( *i );
 
   // Find bifurcations
-  TEndPoints bifurcations, marks;
-  auto e0It = this->m_EndPoints.begin( );
-  for( ; e0It != this->m_EndPoints.end( ); ++e0It )
-  {
-    auto e1It = e0It;
-    e1It++;
-    for( ; e1It != this->m_EndPoints.end( ); ++e1It )
-    {
-      auto path = tree->GetPath( *e0It, *e1It );
-      std::cout << "path" << std::endl;
-      auto pIt = path.begin( );
-      for( ; pIt != path.end( ); ++pIt )
-      {
-        if( marks.find( *pIt ) == marks.end( ) )
-          marks.insert( *pIt );
-        else
-          bifurcations.insert( *pIt );
-
-      } // rof
-
-    } // rof
-
-  } // rof
-
-  // Construct branches
-  std::cout << bifurcations.size( ) << std::endl;
+  /* TODO: this should be the final code
+     TEndPoints bifurcations, marks;
+     auto e0It = this->m_EndPoints.begin( );
+     for( ; e0It != this->m_EndPoints.end( ); ++e0It )
+     {
+     auto e1It = e0It;
+     e1It++;
+     for( ; e1It != this->m_EndPoints.end( ); ++e1It )
+     {
+     auto path = tree->GetPath( *e0It, *e1It );
+     std::cout << "path" << std::endl;
+     auto pIt = path.begin( );
+     for( ; pIt != path.end( ); ++pIt )
+     {
+     if( marks.find( *pIt ) == marks.end( ) )
+     marks.insert( *pIt );
+     else
+     bifurcations.insert( *pIt );
+
+     } // rof
+
+     } // rof
+
+     } // rof
+
+     // Construct branches
+     std::cout << bifurcations.size( ) << std::endl;
+  */
 }
 
 #endif // __FPA__BASE__EXTRACTBRANCHESFROMMINIMUMSPANNINGTREE__HXX__