]> Creatis software - FrontAlgorithms.git/commitdiff
...
authorLeonardo Flórez-Valencia <leonardo.florez@gmail.com>
Mon, 7 Nov 2016 23:35:53 +0000 (18:35 -0500)
committerLeonardo Flórez-Valencia <leonardo.florez@gmail.com>
Mon, 7 Nov 2016 23:35:53 +0000 (18:35 -0500)
lib/fpa/Image/SkeletonFilter.hxx

index 010c6945391c518eedd08a3fade1dca64723cd14..2e98935f43e2eeb9998ebddb7262aeaa7f834147 100644 (file)
@@ -108,7 +108,6 @@ GenerateData( )
 
   // 2. Detect end-points
   this->_EndPoints( dmap, cmap, mst, ep->Get( ) );
-  std::cout << "endpoints" << std::endl;
 
   // 3. Build skeleton and keep track of bifurcations
   this->_Skeleton( dmap, cmap, mst, ep->Get( ), bi->Get( ), sk );
@@ -152,8 +151,9 @@ _EndPoints(
   for( ; !dIt.IsAtEnd( ) && !cIt.IsAtEnd( ); ++dIt, ++cIt )
   {
     double d = double( dIt.Get( ) );
-    if( d > double( 0 ) )
+    if( d >= double( 0 ) )
     {
+      d += double( 1e-5 );
       double v = double( cIt.Get( ) ) / ( d * d );
       queue.insert( _TQueueValue( v, dIt.GetIndex( ) ) );
 
@@ -163,7 +163,6 @@ _EndPoints(
 
   // BFS from maximum queue
   auto region = dmap->GetRequestedRegion( );
-  double init_v = queue.begin( )->first;
   while( queue.size( ) > 0 )
   {
     // Get node
@@ -171,15 +170,11 @@ _EndPoints(
     auto n = *nIt;
     queue.erase( nIt );
 
+    // Mark it and update end-points
     unsigned char m = marks->GetPixel( n.second );
     if( m != 0 )
       continue;
-
-    std::cout << queue.size( ) << std::endl;
-
-    // Mark it and update end-points
-    m |= 0x01;
-    marks->SetPixel( n.second, m );
+    marks->SetPixel( n.second, 1 );
     end_points.insert( n.second );
 
     // Mark path
@@ -197,8 +192,8 @@ _EndPoints(
       for( unsigned int d = 0; d < TMarks::ImageDimension; ++d )
       {
         long off = long( std::ceil( r / double( spac[ d ] ) ) );
-        if( off == 0 )
-          off = 1;
+        if( off < 3 )
+          off = 3;
         i0[ d ] = idx[ d ] - off;
         i1[ d ] = idx[ d ] + off;
 
@@ -224,8 +219,7 @@ _EndPoints(
         TIndex w = mIt.GetIndex( );
         typename _TCostMap::PointType p;
         marks->TransformIndexToPhysicalPoint( w, p );
-        if( cnt.EuclideanDistanceTo( p ) <= r )
-          mIt.Set( mIt.Get( ) | 0x02 );
+        mIt.Set( 1 );
 
       } // rof