#include "ThresholdImageGrowFunctionSource.h" #include #include #include #include // ------------------------------------------------------------------------- fpaPlugins::ThresholdImageGrowFunctionSource:: ThresholdImageGrowFunctionSource( ) : Superclass( ) { this->_AddInput( "ReferenceImage" ); this->_AddOutput< GrowFunction >( "Output" ); this->m_Parameters->ConfigureAsReal( "LowerThreshold" ); this->m_Parameters->ConfigureAsReal( "UpperThreshold" ); this->m_Parameters->SetReal( "LowerThreshold", 0 ); this->m_Parameters->SetReal( "UpperThreshold", 1 ); } // ------------------------------------------------------------------------- fpaPlugins::ThresholdImageGrowFunctionSource:: ~ThresholdImageGrowFunctionSource( ) { } // ------------------------------------------------------------------------- std::string fpaPlugins::ThresholdImageGrowFunctionSource:: _GenerateData( ) { auto image = this->GetInputData( "ReferenceImage" ); 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; auto out = this->GetOutputData( "Output" ); auto f = out->GetITK< _F >( ); if( f == NULL ) { typename _F::Pointer ptr_f = _F::New( ); f = ptr_f.GetPointer( ); out->SetITK( f ); } // fi f->SetLowerThreshold( this->m_Parameters->GetReal( "LowerThreshold" ) ); f->SetUpperThreshold( this->m_Parameters->GetReal( "UpperThreshold" ) ); return( "" ); } // eof - $RCSfile$