+#include "ThresholdImageGrowFunctionSource.h"
+
+#include <cpPlugins/Interface/BaseProcessObjects.h>
+#include <cpPlugins/Interface/Image.h>
+#include <fpaPlugins/GrowFunction.h>
+#include <fpa/Image/Functors/RegionGrowThresholdFunction.h>
+
+// -------------------------------------------------------------------------
+fpaPlugins::ThresholdImageGrowFunctionSource::
+ThresholdImageGrowFunctionSource( )
+ : Superclass( )
+{
+ this->_AddInput( "ReferenceImage" );
+ this->_MakeOutput< GrowFunction >( "Output" );
+
+ this->m_Parameters->ConfigureAsReal( "LowerThreshold" );
+ this->m_Parameters->ConfigureAsReal( "UpperThreshold" );
+
+ this->m_Parameters->SetReal( "LowerThreshold", 0 );
+ this->m_Parameters->SetReal( "UpperThreshold", 0 );
+}
+
+// -------------------------------------------------------------------------
+fpaPlugins::ThresholdImageGrowFunctionSource::
+~ThresholdImageGrowFunctionSource( )
+{
+}
+
+// -------------------------------------------------------------------------
+std::string fpaPlugins::ThresholdImageGrowFunctionSource::
+_GenerateData( )
+{
+ cpPlugins::Interface::Image* image =
+ this->GetInput< cpPlugins::Interface::Image >( "ReferenceImage" );
+ if( image == NULL )
+ return( "fpaPlugins::ThresholdImageGrowFunctionSource: No input reference image." );
+
+ itk::DataObject* itk_image = NULL;
+ std::string r = "";
+ cpPlugins_Image_Demangle_AllScalarTypes( 2, image, itk_image, r, _GD0 );
+ else cpPlugins_Image_Demangle_AllScalarTypes( 3, image, itk_image, r, _GD0 );
+ else r = "fpaPlugins::ThresholdImageGrowFunctionSource: no valid reference image.";
+
+ return( r );
+}
+
+// -------------------------------------------------------------------------
+template< class I >
+std::string fpaPlugins::ThresholdImageGrowFunctionSource::
+_GD0( itk::DataObject* data )
+{
+ typedef fpa::Image::Functors::RegionGrowThresholdFunction< I > _F;
+ typename _F::Pointer functor = _F::New( );
+
+ // Connect output
+ GrowFunction* out = this->GetOutput< GrowFunction >( "Output" );
+ if( out != NULL )
+ {
+ out->SetITK< _F >( functor );
+ return( "" );
+ }
+ else
+ return( "fpaPlugins::ThresholdImageGrowFunctionSource: output not correctly created." );
+}
+
+// eof - $RCSfile$