]> Creatis software - FrontAlgorithms.git/blobdiff - appli/CTBronchi/FastRandomWalker.cxx
...
[FrontAlgorithms.git] / appli / CTBronchi / FastRandomWalker.cxx
index 7342562f3f80ce58c6460867bcdd8d762f9ff0f8..1d3354550b882fa02f0939b5eb1020a24990aa63 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <string>
 #include <tclap/CmdLine.h>
+#include <itkBinaryThresholdImageFilter.h>
 #include <itkImage.h>
 #include <fpa/Filters/Image/RandomWalker.h>
 #include <fpa/Functors/Dijkstra/Image/Gaussian.h>
@@ -77,8 +78,19 @@ int main( int argc, char* argv[] )
     double t = CTBronchi::MeasureTime( filter );
     std::cout << "FastRandomWalk executed in " << t << " s" << std::endl;
 
+    // Extract label
+    typedef itk::BinaryThresholdImageFilter< TLabels, TLabels > _TExtract;
+    typename _TExtract::Pointer extract = _TExtract::New( );
+    extract->SetInput( filter->GetOutputLabels( ) );
+    extract->SetInsideValue( 1 );
+    extract->SetOutsideValue( 0 );
+    extract->SetLowerThreshold( 1 );
+    extract->SetUpperThreshold( 1 );
+    t = CTBronchi::MeasureTime( extract );
+    std::cout << "Extract labels executed in " << t << " s" << std::endl;
+
     // Write result
-    CTBronchi::WriteImage( filter->GetOutputLabels( ), out.getValue( ) );
+    CTBronchi::WriteImage( extract->GetOutput( ), out.getValue( ) );
   }
   catch( std::exception& err )
   {