]> Creatis software - FrontAlgorithms.git/blobdiff - appli/examples/example_ImageAlgorithmDijkstra_03.cxx
More tests
[FrontAlgorithms.git] / appli / examples / example_ImageAlgorithmDijkstra_03.cxx
index 3b354baf3b1dfcc2728596a24a0bceddbbc705cc..b3c04eb033305d165caf2f62a0e98e05427ca5cb 100644 (file)
@@ -54,6 +54,9 @@ public:
   typedef Superclass::InputImageType TImage;
   typedef std::deque< TVertex >      TVertices;
 
+  typedef Superclass::TEndEvent          TEndEvent;
+  typedef Superclass::TBacktrackingEvent TBacktrackingEvent;
+
 protected:
   typedef std::pair< TCost, TVertex >     _TCandidate;
   typedef std::multimap< TCost, TVertex > _TCandidates;
@@ -119,6 +122,8 @@ protected:
       if( this->m_Candidates.size( ) == 0 )
         return;
 
+      this->InvokeEvent( TEndEvent( ) );
+
       const TImage* input = this->GetInput( );
       TImage::SpacingType spacing = input->GetSpacing( );
 
@@ -137,7 +142,7 @@ protected:
       // are near thin branches
       _TCandidates::const_reverse_iterator cIt =
         this->m_Candidates.rbegin( );
-      for( int leo = 0; leo < 1 && cIt != this->m_Candidates.rend( ); ++cIt )
+      for( int backId = 0; backId < 100 && cIt != this->m_Candidates.rend( ); ++cIt )
       {
         // If pixel hasn't been visited, continue
         TVertex v = cIt->second;
@@ -170,8 +175,8 @@ protected:
 
         if( marks->GetPixel( max_vertex ) != _TMark( 0 ) )
           continue;
-        leo++;
-        std::cout << "Leaf: " << leo << " " << max_value << " " << max_vertex << std::endl;
+        backId++;
+        std::cout << "Leaf: " << backId << " " << max_value << " " << max_vertex << std::endl;
 
         bool start = true;
         do
@@ -210,6 +215,7 @@ protected:
             start = false;
           */
           // Next vertex in current path
+          this->InvokeEvent( TBacktrackingEvent( max_vertex, backId ) );
           max_vertex = this->_Parent( max_vertex );
 
         } while( max_vertex != this->_Parent( max_vertex ) );
@@ -221,14 +227,14 @@ protected:
         } // rof
       */
 
-      itk::ImageFileWriter< _TMarkImage >::Pointer w =
-        itk::ImageFileWriter< _TMarkImage >::New( );
-      w->SetInput( marks );
-      w->SetFileName( "marks.mhd" );
-      w->Update( );
-
       /*
-
+        itk::ImageFileWriter< _TMarkImage >::Pointer w =
+        itk::ImageFileWriter< _TMarkImage >::New( );
+        w->SetInput( marks );
+        w->SetFileName( "marks.mhd" );
+        w->Update( );
+        
+        
         this->m_Axes = vtkSmartPointer< vtkPolyData >::New( );
         vtkSmartPointer< vtkPoints > points =
         vtkSmartPointer< vtkPoints >::New( );
@@ -237,8 +243,8 @@ protected:
 
         {
 
-        leo++;
-        std::cout << "Leaf: " << leo << " " << cIt->first << " " << vIt << std::endl;
+        backId++;
+        std::cout << "Leaf: " << backId << " " << cIt->first << " " << vIt << std::endl;
         bool start = true;
         do
         {