]> Creatis software - FrontAlgorithms.git/commitdiff
...
authorLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Thu, 30 Nov 2017 23:28:17 +0000 (18:28 -0500)
committerLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Thu, 30 Nov 2017 23:28:17 +0000 (18:28 -0500)
appli/CTBronchi/Process.sh
appli/CTBronchi/Skeleton.cxx
lib/fpa/Filters/Image/ExtractSkeleton.hxx

index 5f4220241880dff433df891707f02219dc832a80..aa98891486317c2f2876e580030999846f69c7d5 100755 (executable)
@@ -2,7 +2,7 @@
 
 ## -- Command line options
 curr_dir=`dirname $0`
-ext="mhd"
+ext="mha"
 vesselness_sigma="0.5"
 vesselness_alpha1="0.5"
 vesselness_alpha2="2"
@@ -122,7 +122,8 @@ fastrw=$base_name"_fastrw.$ext"
 slicerw=$base_name"_slicerw.$ext"
 skeleton_fastrw=$base_name"_fastrw_skeleton.txt"
 skeleton_slicerw=$base_name"_slicerw_skeleton.txt"
-points=$base_name"_points.txt"
+fastrw_points=$base_name"_fastrw_points.txt"
+slicerw_points=$base_name"_slicerw_points.txt"
 
 echo "************************************************"
 (>&2 echo "Processing $input... ")
@@ -182,9 +183,17 @@ if [ ! -f $skeleton_slicerw ] || [ -n "$force" ] ; then
     $curr_dir/fpa_CTBronchi_Skeleton \
         -i $slicerw \
         -o $skeleton_slicerw \
-        -e $points \
+        -e $slicerw_points \
         -p "$seed"
 fi
+
+# if [ ! -f $skeleton_fastrw ] || [ -n "$force" ] ; then
+#     $curr_dir/fpa_CTBronchi_Skeleton \
+#         -i $fastrw \
+#         -o $skeleton_fastrw \
+#         -e $fastrw_points \
+#         -p "$seed"
+# fi
 (>&2 echo "done.")
 echo "done."
 echo "************************************************"
index 41108259e2ba2cd79f44eb25b2f61dc16539ecb9..aa1bd37d0888828ab73ab0658ad871a2f317a394 100644 (file)
@@ -88,12 +88,12 @@ int main( int argc, char* argv[] )
     {
       std::stringstream eStr;
       auto pnts = filter->GetEndPoints( );
-      for( unsigned int i = 0; i < 10; ++i )
+      for( auto pnt: pnts )
       {
         eStr
-          << pnts[ i ][ 0 ] << " "
-          << pnts[ i ][ 1 ] << " "
-          << pnts[ i ][ 2 ] << " " << i % 3 << std::endl;
+          << pnt[ 0 ] << " "
+          << pnt[ 1 ] << " "
+          << pnt[ 2 ] << std::endl;
 
       } // rof
       std::ofstream oStrE( oute.getValue( ).c_str( ) );
index 5904cd45e574d448c287d79742dd583982ddc899..9d2dec047488370b276b26c832039003fcdaa5bd 100644 (file)
@@ -159,6 +159,9 @@ GenerateData( )
 
   } // fi
 
+  std::cout << int( this->GetInput( )->GetPixel( this->m_Seed ) ) << std::endl;
+  std::cout << this->m_DistanceMap->GetOutput( )->GetPixel( this->m_Seed ) << std::endl;
+
   // Compute MST
   typename _TDijkstra::Pointer dijkstra = _TDijkstra::New( );
   dijkstra->SetInput( this->m_DistanceMap->GetOutput( ) );
@@ -175,78 +178,80 @@ GenerateData( )
   this->m_EndPoints = end_points;
 
   // Compute symbolic branches
-  typedef std::map< TIndex, TIndex, typename TIndex::LexicographicCompare > _TTags;
-  _TTags tags, branches;
-  typename std::vector< TIndex >::const_iterator eIt = end_points.begin( );
-  for( ; eIt != end_points.end( ); ++eIt )
-  {
-    // Tag path
-    TIndex it = *eIt;
-    TIndex p = mst->GetParent( it );
-    typename _TTags::iterator bIt = tags.end( );
-    while( it != p && bIt == tags.end( ) )
-    {
-      typename _TTags::iterator tIt = tags.find( it );
-      if( tIt != tags.end( ) )
-      {
-        // Ok, a bifurcation point has been found
-        // branch1: tIt->second <-> it (ok)
-        branches[ tIt->second ] = it;
-
-        // branch2: *eit <-> it (ok)
-        branches[ *eIt ] = it;
-
-        // branch3: it <-> until next bifurcation
-        bIt = tIt;
-      }
-      else
-        tags[ it ] = *eIt;
-      it = p;
-      p = mst->GetParent( it );
-
-    } // elihw
-    if( bIt != tags.end( ) )
-    {
-      TIndex pTag = bIt->second;
-      TIndex nTag = bIt->first;
-      it = bIt->first;
-      p = it;
-      while( tags[ it ] == pTag )
-      {
-        tags[ it ] = nTag;
-        p = it;
-        it = mst->GetParent( it );
-
-      } // elihw
-      tags[ it ] = nTag;
-      branches[ bIt->first ] = p;
-    }
-    else
-    {
-      tags[ it ] = *eIt;
-      branches[ *eIt ] = it;
-
-    } // fi
-
-  } // rof
-
-  // Fill full branches
-  typedef typename _TMST::TVertices _TVertices;
-  typedef typename TSkeleton::TPath _TPath;
-
-  TSkeleton* sk = this->GetOutput( );
-  typename _TTags::const_iterator bIt = branches.begin( );
-  for( ; bIt != branches.end( ); ++bIt )
-  {
-    _TVertices v = mst->GetAxis( bIt->first, bIt->second );
-    typename _TPath::Pointer path = _TPath::New( );
-    path->SetReferenceImage( this->GetInput( ) );
-    typename _TVertices::const_reverse_iterator vIt = v.rbegin( );
-    for( ; vIt != v.rend( ); ++vIt )
-      path->AddVertex( *vIt );
-    sk->AddBranch( path );
-
-  } // rof
+  /* TODO
+     typedef std::map< TIndex, TIndex, typename TIndex::LexicographicCompare > _TTags;
+     _TTags tags, branches;
+     typename std::vector< TIndex >::const_iterator eIt = end_points.begin( );
+     for( ; eIt != end_points.end( ); ++eIt )
+     {
+     // Tag path
+     TIndex it = *eIt;
+     TIndex p = mst->GetParent( it );
+     typename _TTags::iterator bIt = tags.end( );
+     while( it != p && bIt == tags.end( ) )
+     {
+     typename _TTags::iterator tIt = tags.find( it );
+     if( tIt != tags.end( ) )
+     {
+     // Ok, a bifurcation point has been found
+     // branch1: tIt->second <-> it (ok)
+     branches[ tIt->second ] = it;
+
+     // branch2: *eit <-> it (ok)
+     branches[ *eIt ] = it;
+
+     // branch3: it <-> until next bifurcation
+     bIt = tIt;
+     }
+     else
+     tags[ it ] = *eIt;
+     it = p;
+     p = mst->GetParent( it );
+
+     } // elihw
+     if( bIt != tags.end( ) )
+     {
+     TIndex pTag = bIt->second;
+     TIndex nTag = bIt->first;
+     it = bIt->first;
+     p = it;
+     while( tags[ it ] == pTag )
+     {
+     tags[ it ] = nTag;
+     p = it;
+     it = mst->GetParent( it );
+
+     } // elihw
+     tags[ it ] = nTag;
+     branches[ bIt->first ] = p;
+     }
+     else
+     {
+     tags[ it ] = *eIt;
+     branches[ *eIt ] = it;
+
+     } // fi
+
+     } // rof
+
+     // Fill full branches
+     typedef typename _TMST::TVertices _TVertices;
+     typedef typename TSkeleton::TPath _TPath;
+
+     TSkeleton* sk = this->GetOutput( );
+     typename _TTags::const_iterator bIt = branches.begin( );
+     for( ; bIt != branches.end( ); ++bIt )
+     {
+     _TVertices v = mst->GetAxis( bIt->first, bIt->second );
+     typename _TPath::Pointer path = _TPath::New( );
+     path->SetReferenceImage( this->GetInput( ) );
+     typename _TVertices::const_reverse_iterator vIt = v.rbegin( );
+     for( ; vIt != v.rend( ); ++vIt )
+     path->AddVertex( *vIt );
+     sk->AddBranch( path );
+
+     } // rof
+  */
 }
 
 // -------------------------------------------------------------------------