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->_AddOutput< cpPlugins::Interface::Image >( "Output" );
- using namespace cpPlugins::Interface;
- this->m_DefaultParameters.Configure( Parameters::Uint, "Radius" );
-
- this->m_DefaultParameters.SetValueAsUint( "Radius", 3 );
-
- this->m_Parameters = this->m_DefaultParameters;
+ this->m_Parameters->ConfigureAsUint( "Radius" );
+ this->m_Parameters->SetUint( "Radius", 3 );
}
// -------------------------------------------------------------------------
std::string cpPlugins::BasicFilters::MedianImageFilter::
_GenerateData( )
{
- cpPlugins::Interface::Image* image =
- this->GetInput< cpPlugins::Interface::Image >( 0 );
+ auto image = this->GetInputData< 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 > >(
// Get parameters
_RT rad_val;
- rad_val.Fill( this->m_Parameters.GetValueAsUint( "Radius" ) );
+ 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->Update( );
// Connect output
- cpPlugins::Interface::Image* out =
- this->GetOutput< cpPlugins::Interface::Image >( 0 );
+ auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" );
if( out != NULL )
{
- out->SetITKImage< O >( filter->GetOutput( ) );
+ out->SetITK< O >( filter->GetOutput( ) );
return( "" );
}
else