#include "ImageRegionGrow.h" #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( ) { } // ------------------------------------------------------------------------- void fpaPlugins::ImageRegionGrow:: _GenerateData( ) { auto image = this->GetInputData< itk::DataObject >( "Input" ); cpPlugins_Image_Demangle_Pixel_AllScalars ( _GD0, image, 2 ); else cpPlugins_Image_Demangle_Pixel_AllScalars( _GD0, image, 3 ); else this->_Error( "No valid input image." ); } // ------------------------------------------------------------------------- template< class _TImage > void fpaPlugins::ImageRegionGrow:: _GD0( _TImage* image ) { typedef unsigned short _TPixel; typedef itk::Image< _TPixel, _TImage::ImageDimension > _TOutImage; typedef fpa::Image::RegionGrow< _TImage, _TOutImage > _TFilter; typedef typename _TFilter::TGrowingFunction _TGrowFunctor; typedef typename _TFilter::TResult _TResult; // Create filter _TFilter* filter = this->_ConfigureFilter< _TFilter >( ); typename _TGrowFunctor::Pointer functor; auto wrap_functor = this->GetInput( "GrowFunctor" ); if( wrap_functor != NULL ) functor = wrap_functor->GetITK< _TGrowFunctor >( ); if( functor.IsNull( ) ) filter->SetGrowingFunction( functor ); filter->SetInsideValue( _TResult( this->m_Parameters.GetUint( "InsideValue" ) ) ); filter->SetOutsideValue( _TResult( this->m_Parameters.GetUint( "OutsideValue" ) ) ); // Go!!! this->_ExecuteFilter( filter ); } // eof - $RCSfile$