#include "ImageRegionGrow.h" #include #include #include #include #include #include #include // ------------------------------------------------------------------------- fpaPlugins::ImageRegionGrow:: ImageRegionGrow( ) : Superclass( ) { this->_AddInput( "GrowFunctor", false ); this->m_Parameters.ConfigureAsUint( "InsideValue" ); this->m_Parameters.ConfigureAsUint( "OutsideValue" ); this->m_Parameters.SetUint( "InsideValue", 1 ); this->m_Parameters.SetUint( "OutsideValue", 0 ); } // ------------------------------------------------------------------------- fpaPlugins::ImageRegionGrow:: ~ImageRegionGrow( ) { } // ------------------------------------------------------------------------- std::string fpaPlugins::ImageRegionGrow:: _GenerateData( ) { auto image = this->GetInputData( "Input" )->GetITK< itk::DataObject >( ); std::string cpPlugin_Image_Demangle_Pixel_AllScalars( r, _GD0, image, 2 ); if( r != "" ) cpPlugin_Image_Demangle_Pixel_AllScalars( r, _GD0, image, 3 ); return( r ); } // ------------------------------------------------------------------------- template< class _TImage > std::string fpaPlugins::ImageRegionGrow:: _GD0( _TImage* image ) { typedef fpa::Image::RegionGrow< _TImage, _TImage > _TFilter; typedef typename _TFilter::TGrowingFunction _TGrowFunctor; typedef typename _TFilter::TResult _TResult; if( image == NULL ) return( "fpaPlugins::ImageRegionGrow: Invalid image type." ); // Get functor (if any) typename _TGrowFunctor::Pointer functor; auto wrap_functor = this->GetInputData( "GrowFunctor" ); if( wrap_functor != NULL ) functor = wrap_functor->GetITK< _TGrowFunctor >( ); if( functor.IsNull( ) ) functor = fpa::Image::Functors::RegionGrowAllBelongsFunction< _TImage >::New( ); // Create filter _TFilter* filter = this->_ConfigureFilter< _TFilter >( ); filter->SetGrowingFunction( functor ); filter->SetInsideValue( _TResult( this->m_Parameters.GetUint( "InsideValue" ) ) ); filter->SetOutsideValue( _TResult( this->m_Parameters.GetUint( "OutsideValue" ) ) ); // Go!!! this->_ExecuteFilter( filter ); // Connect remaining output this->GetOutputData( "Output" )->SetITK( filter->GetOutput( ) ); return( "" ); } // eof - $RCSfile$