1 #include "ThresholdImageGrowFunctionSource.h"
3 #include <cpPlugins/Interface/BaseProcessObjects.h>
4 #include <cpPlugins/Interface/Image.h>
5 #include <fpaPlugins/GrowFunction.h>
6 #include <fpa/Image/Functors/RegionGrowThresholdFunction.h>
8 // -------------------------------------------------------------------------
9 fpaPlugins::ThresholdImageGrowFunctionSource::
10 ThresholdImageGrowFunctionSource( )
13 this->_AddInput( "ReferenceImage" );
14 this->_AddOutput< GrowFunction >( "Output" );
16 this->m_Parameters->ConfigureAsReal( "LowerThreshold" );
17 this->m_Parameters->ConfigureAsReal( "UpperThreshold" );
19 this->m_Parameters->SetReal( "LowerThreshold", 0 );
20 this->m_Parameters->SetReal( "UpperThreshold", 0 );
23 // -------------------------------------------------------------------------
24 fpaPlugins::ThresholdImageGrowFunctionSource::
25 ~ThresholdImageGrowFunctionSource( )
29 // -------------------------------------------------------------------------
30 std::string fpaPlugins::ThresholdImageGrowFunctionSource::
34 this->GetInputData< cpPlugins::Interface::Image >( "ReferenceImage" );
35 itk::DataObject* itk_image = NULL;
37 cpPlugins_Image_Demangle_AllScalarTypes( 2, image, itk_image, r, _GD0 );
38 else cpPlugins_Image_Demangle_AllScalarTypes( 3, image, itk_image, r, _GD0 );
39 else r = "fpaPlugins::ThresholdImageGrowFunctionSource: no valid reference image.";
44 // -------------------------------------------------------------------------
46 std::string fpaPlugins::ThresholdImageGrowFunctionSource::
47 _GD0( itk::DataObject* data )
49 typedef fpa::Image::Functors::RegionGrowThresholdFunction< I > _F;
51 auto out = this->GetOutputData< GrowFunction >( "Output" );
52 auto f = out->GetITK< _F >( );
55 typename _F::Pointer ptr_f = _F::New( );
56 f = ptr_f.GetPointer( );
60 f->SetLowerThreshold( this->m_Parameters->GetReal( "LowerThreshold" ) );
61 f->SetUpperThreshold( this->m_Parameters->GetReal( "UpperThreshold" ) );