MedianImageFilter( )
: Superclass( )
{
- this->m_ClassName = "cpPlugins::BasicFilters::MedianImageFilter";
- this->m_ClassCategory = "ImageToImageFilter";
- this->SetNumberOfInputs( 1 );
- this->SetNumberOfOutputs( 1 );
- this->_MakeOutput< cpPlugins::Interface::Image >( 0 );
+ this->_AddInput( "Input" );
+ this->_MakeOutput< cpPlugins::Interface::Image >( "Output" );
- using namespace cpPlugins::Interface;
- this->m_DefaultParameters.Configure(Parameters::Real, "Radius");
-
- this->m_DefaultParameters.SetValueAsReal("Radius", 3);
-
- this->m_Parameters = this->m_DefaultParameters;
+ this->m_Parameters->ConfigureAsUint( "Radius" );
+ this->m_Parameters->SetUint( "Radius", 3 );
}
// -------------------------------------------------------------------------
_GenerateData( )
{
cpPlugins::Interface::Image* image =
- this->GetInput< cpPlugins::Interface::Image >( 0 );
+ this->GetInput< cpPlugins::Interface::Image >( "Input" );
if( image == NULL )
return( "MedianImageFilter: No input image." );
itk::DataObject* itk_image = NULL;
std::string r = "";
- cpPlugins_Image_Input_Demangle_Dimension_AllScalarTypes(
- 2, image, itk_image, r, _DemangleOutput
- );
- else cpPlugins_Image_Input_Demangle_Dimension_AllScalarTypes(
- 3, image, itk_image, r, _DemangleOutput
- );
- else cpPlugins_Image_Input_Demangle_Dimension_AllScalarTypes(
- 4, image, itk_image, r, _DemangleOutput
- );
+ cpPlugins_Image_Demangle_AllScalarTypes( 2, image, itk_image, r, _GD0 );
+ else cpPlugins_Image_Demangle_AllScalarTypes( 3, image, itk_image, r, _GD0 );
+ else cpPlugins_Image_Demangle_AllScalarTypes( 4, image, itk_image, r, _GD0 );
else r = "MedianImageFilter: Input image type not supported.";
return( r );
}
// -------------------------------------------------------------------------
template< class I >
std::string cpPlugins::BasicFilters::MedianImageFilter::
-_DemangleOutput( itk::DataObject* image )
+_GD0( itk::DataObject* image )
{
return(
this->_RealGD< I, itk::Image< unsigned char, I::ImageDimension > >(
_RealGD( itk::DataObject* image )
{
typedef itk::MedianImageFilter< I, O > _F;
- typedef typename O::PixelType _OP;
+ typedef typename _F::RadiusType _RT;
// Get parameters
-
- _OP rad_val = _OP(this->m_Parameters.GetValueAsReal("Radius"));
-
+ _RT rad_val;
+ rad_val.Fill( this->m_Parameters->GetUint( "Radius" ) );
// Configure filter
- _F* filter = dynamic_cast< _F* >( this->m_RealProcessObject.GetPointer( ) );
- if( filter == NULL )
- {
- this->m_RealProcessObject = _F::New( );
- filter = dynamic_cast< _F* >( this->m_RealProcessObject.GetPointer( ) );
-
- } // fi
+ _F* filter = this->_CreateITK< _F >( );
filter->SetInput( dynamic_cast< I* >( image ) );
-
- filter->SetRadius(rad_val);
-
+ filter->SetRadius( rad_val );
filter->Update( );
// Connect output
cpPlugins::Interface::Image* out =
- this->GetOutput< cpPlugins::Interface::Image >( 0 );
+ this->GetOutput< cpPlugins::Interface::Image >( "Output" );
if( out != NULL )
{
- out->SetITKImage< O >( filter->GetOutput( ) );
+ out->SetITK< O >( filter->GetOutput( ) );
return( "" );
}
else