From 6468f1fda5fed2788fbaef1a7925c91ecff83d13 Mon Sep 17 00:00:00 2001 From: Leonardo Florez-Valencia Date: Wed, 20 Jan 2016 17:15:10 -0500 Subject: [PATCH] ... --- .../Functors/RegionGrowThresholdFunction.h | 1 + .../AllPixelsImageGrowFunctionSource.cxx | 2 +- lib/fpaPlugins/ImageDijkstra.cxx | 2 +- lib/fpaPlugins/ImageRegionGrow.cxx | 44 ++++++++++++++++--- .../ThresholdImageGrowFunctionSource.cxx | 8 ++-- 5 files changed, 47 insertions(+), 10 deletions(-) diff --git a/lib/fpa/Image/Functors/RegionGrowThresholdFunction.h b/lib/fpa/Image/Functors/RegionGrowThresholdFunction.h index f43ad2c..55a5d53 100644 --- a/lib/fpa/Image/Functors/RegionGrowThresholdFunction.h +++ b/lib/fpa/Image/Functors/RegionGrowThresholdFunction.h @@ -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 ); diff --git a/lib/fpaPlugins/AllPixelsImageGrowFunctionSource.cxx b/lib/fpaPlugins/AllPixelsImageGrowFunctionSource.cxx index f70ee79..9d3b41c 100644 --- a/lib/fpaPlugins/AllPixelsImageGrowFunctionSource.cxx +++ b/lib/fpaPlugins/AllPixelsImageGrowFunctionSource.cxx @@ -11,7 +11,7 @@ AllPixelsImageGrowFunctionSource( ) : Superclass( ) { this->_AddInput( "ReferenceImage" ); - this->_MakeOutput< GrowFunction >( "Output" ); + this->_AddOutput< GrowFunction >( "Output" ); } // ------------------------------------------------------------------------- diff --git a/lib/fpaPlugins/ImageDijkstra.cxx b/lib/fpaPlugins/ImageDijkstra.cxx index 0f88d8e..75d9beb 100644 --- a/lib/fpaPlugins/ImageDijkstra.cxx +++ b/lib/fpaPlugins/ImageDijkstra.cxx @@ -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" ); diff --git a/lib/fpaPlugins/ImageRegionGrow.cxx b/lib/fpaPlugins/ImageRegionGrow.cxx index 0780fe0..21bb43c 100644 --- a/lib/fpaPlugins/ImageRegionGrow.cxx +++ b/lib/fpaPlugins/ImageRegionGrow.cxx @@ -2,9 +2,16 @@ #include #include + +#include + #include #include -#include +#include +#include + +#include +#include // ------------------------------------------------------------------------- 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( ); diff --git a/lib/fpaPlugins/ThresholdImageGrowFunctionSource.cxx b/lib/fpaPlugins/ThresholdImageGrowFunctionSource.cxx index 8ea176e..99bac98 100644 --- a/lib/fpaPlugins/ThresholdImageGrowFunctionSource.cxx +++ b/lib/fpaPlugins/ThresholdImageGrowFunctionSource.cxx @@ -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 -- 2.47.1