]> Creatis software - FrontAlgorithms.git/commitdiff
...
authorLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Tue, 17 Oct 2017 22:18:30 +0000 (17:18 -0500)
committerLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Tue, 17 Oct 2017 22:18:30 +0000 (17:18 -0500)
appli/CTBronchi/FastRandomWalker.cxx
appli/CTBronchi/MoriLabelling.h
lib/fpa/Common/SliceBySliceRandomWalker.hxx

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 )
   {
index f9adb5ce8ea9de58bd51f22a3dcd9b293bd31372..1481d73807cb601cf9808773daf9d337549b44dc 100644 (file)
@@ -91,7 +91,7 @@ namespace CTBronchi
         minMax->SetImage( this->GetInputVesselness( ) );
         minMax->Compute( );
         this->m_MinVesselness =
-          ( 1.0  - ( this->m_VesselnessThreshold / double( 100 ) ) ) *
+          ( this->m_VesselnessThreshold / double( 100 ) ) *
           double( minMax->GetMaximum( ) );
       }
 
index c0bc3ff516e51fe83c2f85239b7ea14cbce3d1f9..3856bca7d697c6ef0c5ed2744fba504c5b1b3a1f 100644 (file)
@@ -6,6 +6,7 @@
 #define __fpa__Common__SliceBySliceRandomWalker__hxx__
 
 #include <vector>
+#include <itkBinaryThresholdImageFilter.h>
 #include <itkExtractImageFilter.h>
 #include <itkImageRegionConstIterator.h>
 #include <itkImageRegionIterator.h>
@@ -197,7 +198,7 @@ _RandomWalker(
     // Create seeds and background
     _TSliceBinaryPtr seeds = _TSliceBinary::New( );
     seeds->CopyInformation( tmp );
-    seeds->SetRequestedRegion( region );
+    seeds->SetBufferedRegion( region );
     seeds->Allocate( );
     seeds->FillBuffer( 0 );
 
@@ -250,10 +251,19 @@ _RandomWalker(
     rw->SetInputLabels( seeds );
     rw->SetEdgeFunction( edge );
 
+    // Extract label
+    typedef itk::BinaryThresholdImageFilter< _TSliceBinary, _TSliceBinary > _TExtract;
+    typename _TExtract::Pointer extract = _TExtract::New( );
+    extract->SetInput( rw->GetOutput( ) );
+    extract->SetInsideValue( 1 );
+    extract->SetOutsideValue( 0 );
+    extract->SetLowerThreshold( 1 );
+    extract->SetUpperThreshold( 1 );
+
     // Keep maximum
     typedef itk::MaximumImageFilter< _TSliceBinary > _TMax;
     typename _TMax::Pointer max = _TMax::New();
-    max->SetInput( 0, rw->GetOutput( ) );
+    max->SetInput( 0, extract->GetOutput( ) );
     max->SetInput( 1, next );
     max->Update( );
     binaryTree[ z + o ] = max->GetOutput( );