1 #include "RegionGrowThresholdFunction.h"
3 #include <cpPlugins/Image.h>
4 #include <fpa/Image/Functors/RegionGrowThresholdFunction.h>
6 // -------------------------------------------------------------------------
7 fpaPlugins::RegionGrowThresholdFunction::
8 RegionGrowThresholdFunction( )
11 this->_AddInput( "ReferenceImage" );
12 this->_AddOutput< cpPlugins::DataObject >( "Output" );
14 this->m_Parameters.ConfigureAsReal( "LowerThreshold" );
15 this->m_Parameters.ConfigureAsReal( "UpperThreshold" );
17 this->m_Parameters.SetReal( "LowerThreshold", 0 );
18 this->m_Parameters.SetReal( "UpperThreshold", 1 );
21 // -------------------------------------------------------------------------
22 fpaPlugins::RegionGrowThresholdFunction::
23 ~RegionGrowThresholdFunction( )
27 // -------------------------------------------------------------------------
28 void fpaPlugins::RegionGrowThresholdFunction::
31 auto image = this->GetInputData< itk::DataObject >( "ReferenceImage" );
32 cpPlugins_Image_Demangle_Pixel_AllScalars ( _GD0, image, 2 );
33 else cpPlugins_Image_Demangle_Pixel_AllScalars( _GD0, image, 3 );
34 else this->_Error( "No valid input image." );
37 // -------------------------------------------------------------------------
38 template< class _TImage >
39 void fpaPlugins::RegionGrowThresholdFunction::
40 _GD0( _TImage* image )
43 fpa::Image::Functors::RegionGrowThresholdFunction< _TImage >
46 auto out = this->GetOutput( "Output" );
47 auto f = out->GetITK< _TFunctor >( );
50 typename _TFunctor::Pointer ptr_f = _TFunctor::New( );
51 f = ptr_f.GetPointer( );
55 f->SetLowerThreshold( this->m_Parameters.GetReal( "LowerThreshold" ) );
56 f->SetUpperThreshold( this->m_Parameters.GetReal( "UpperThreshold" ) );