]> Creatis software - FrontAlgorithms.git/commitdiff
...
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Wed, 20 Jan 2016 22:15:10 +0000 (17:15 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Wed, 20 Jan 2016 22:15:10 +0000 (17:15 -0500)
lib/fpa/Image/Functors/RegionGrowThresholdFunction.h
lib/fpaPlugins/AllPixelsImageGrowFunctionSource.cxx
lib/fpaPlugins/ImageDijkstra.cxx
lib/fpaPlugins/ImageRegionGrow.cxx
lib/fpaPlugins/ThresholdImageGrowFunctionSource.cxx

index f43ad2c453ceabaad18e9cc9cff7314b6531a3d2..55a5d53b7fc63b53f88b59a8442b5b38e109607e 100644 (file)
@@ -45,6 +45,7 @@ namespace fpa
         virtual bool Evaluate( const TIndex& idx ) const
           {
             const I* img = this->GetSpace( );
+
             if( img != NULL )
             {
               TPixel v = img->GetPixel( idx );
index f70ee79cfd218cb87ea583148ebae9627ffebfb1..9d3b41c1e039abf30ea856ff2aa86e28014ad113 100644 (file)
@@ -11,7 +11,7 @@ AllPixelsImageGrowFunctionSource( )
   : Superclass( )
 {
   this->_AddInput( "ReferenceImage" );
-  this->_MakeOutput< GrowFunction >( "Output" );
+  this->_AddOutput< GrowFunction >( "Output" );
 }
 
 // -------------------------------------------------------------------------
index 0f88d8e379d4612a42c0e2028aaff32c23c43714..75d9bebf094d02283bab7c8f08d23ccd263eddde 100644 (file)
@@ -11,7 +11,7 @@ ImageDijkstra( )
 {
   this->_AddInput( "Input" );
   this->_AddInput( "Seeds" );
-  this->_MakeOutput< cpPlugins::Interface::Image >( "Output" );
+  this->_AddOutput< cpPlugins::Interface::Image >( "Output" );
 
   this->m_Parameters->ConfigureAsBool( "VisualDebug" );
   this->m_Parameters->ConfigureAsBool( "StopAtOneFront" );
index 0780fe028c1b604ca7494f4157494e11ec396ace..21bb43cd902af905b65aa394e0b5e96b7090ef85 100644 (file)
@@ -2,9 +2,16 @@
 
 #include <cpPlugins/Interface/Image.h>
 #include <cpPlugins/Interface/PointList.h>
+
+#include <fpaPlugins/GrowFunction.h>
+
 #include <fpa/Image/RegionGrow.h>
 #include <fpa/Image/Functors/RegionGrowAllBelongsFunction.h>
-#include <fpaPlugins/GrowFunction.h>
+#include <fpa/VTK/Image2DObserver.h>
+#include <fpa/VTK/Image3DObserver.h>
+
+#include <vtkRenderWindow.h>
+#include <vtkRenderWindowInteractor.h>
 
 // -------------------------------------------------------------------------
 fpaPlugins::ImageRegionGrow::
@@ -14,7 +21,7 @@ ImageRegionGrow( )
   this->_AddInput( "Input" );
   this->_AddInput( "GrowFunction" );
   this->_AddInput( "Seeds" );
-  this->_MakeOutput< cpPlugins::Interface::Image >( "Output" );
+  this->_AddOutput< cpPlugins::Interface::Image >( "Output" );
 
   this->m_Parameters->ConfigureAsBool( "VisualDebug" );
   this->m_Parameters->ConfigureAsBool( "StopAtOneFront" );
@@ -108,9 +115,36 @@ _GD0( itk::DataObject* data )
   } // rof
 
   // Connect visual debugger
-  /* TODO
-     this->m_Parameters->ConfigureAsBool( "VisualDebug", false );
-   */
+  if(
+    this->m_Parameters->GetBool( "VisualDebug" ) &&
+    this->m_Interactors.size( ) > 0
+    )
+  {
+    if( I::ImageDimension == 2 )
+    {
+      typedef
+        fpa::VTK::Image2DObserver< _TFilter, vtkRenderWindow >
+        _TDebugger;
+
+      for(
+        auto iIt = this->m_Interactors.begin( );
+        iIt != this->m_Interactors.end( );
+        ++iIt
+        )
+      {
+        typename _TDebugger::Pointer debugger = _TDebugger::New( );
+        debugger->SetRenderWindow( ( *iIt )->GetRenderWindow( ) );
+        debugger->SetRenderPercentage( 0.01 );
+        filter->AddObserver( itk::AnyEvent( ), debugger );
+
+      } // rof
+      filter->ThrowEventsOn( );
+    }
+    else if( I::ImageDimension == 3 )
+    {
+    } // fi
+
+  } // fi
 
   // Go!!!
   filter->Update( );
index 8ea176ee7f5577f92acbdd309c87cf1d802d3260..99bac98e9db274f313a8ccb71744f3928c7a39de 100644 (file)
@@ -11,7 +11,7 @@ ThresholdImageGrowFunctionSource( )
   : Superclass( )
 {
   this->_AddInput( "ReferenceImage" );
-  this->_MakeOutput< GrowFunction >( "Output" );
+  this->_AddOutput< GrowFunction >( "Output" );
 
   this->m_Parameters->ConfigureAsReal( "LowerThreshold" );
   this->m_Parameters->ConfigureAsReal( "UpperThreshold" );
@@ -50,13 +50,15 @@ std::string fpaPlugins::ThresholdImageGrowFunctionSource::
 _GD0( itk::DataObject* data )
 {
   typedef fpa::Image::Functors::RegionGrowThresholdFunction< I > _F;
-  typename _F::Pointer functor = _F::New( );
+  typename _F::Pointer f = _F::New( );
+  f->SetLowerThreshold( this->m_Parameters->GetReal( "LowerThreshold" ) );
+  f->SetUpperThreshold( this->m_Parameters->GetReal( "UpperThreshold" ) );
 
   // Connect output
   GrowFunction* out = this->GetOutput< GrowFunction >( "Output" );
   if( out != NULL )
   {
-    out->SetITK< _F >( functor );
+    out->SetITK< _F >( f );
     return( "" );
   }
   else