OtsuThresholdImageFilter( )
: Superclass( )
{
- this->SetNumberOfInputs( 1 );
- this->SetNumberOfOutputs( 1 );
- this->_MakeOutput< cpPlugins::Interface::Image >( 0 );
+ this->_AddInput( "Input" );
+ this->_AddOutput< cpPlugins::Interface::Image >( "Output" );
- this->m_Parameters->ConfigureAsUint( "NumberOfHistogramBins", 100 );
- this->m_Parameters->ConfigureAsUint( "InsideValue", 255 );
- this->m_Parameters->ConfigureAsUint( "OutsideValue", 0 );
+ this->m_Parameters->ConfigureAsUint( "NumberOfHistogramBins" );
+ this->m_Parameters->ConfigureAsUint( "InsideValue" );
+ this->m_Parameters->ConfigureAsUint( "OutsideValue" );
+
+ this->m_Parameters->SetUint( "NumberOfHistogramBins", 100 );
+ this->m_Parameters->SetUint( "InsideValue", 255 );
+ this->m_Parameters->SetUint( "OutsideValue", 0 );
}
// -------------------------------------------------------------------------
_GenerateData( )
{
cpPlugins::Interface::Image* image =
- this->GetInput< cpPlugins::Interface::Image >( 0 );
+ this->GetInput< cpPlugins::Interface::Image >( "Input" );
if( image == NULL )
return( "OtsuThresholdImageFilter: No input image." );
_F* filter = this->_CreateITK< _F >( );
filter->SetInput( dynamic_cast< I* >( image ) );
filter->SetNumberOfHistogramBins( bins );
- filter->SetInsideValue( in_val );
- filter->SetOutsideValue( out_val );
+ filter->SetInsideValue( out_val ); // WARNING: these are inverted
+ filter->SetOutsideValue( in_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->SetITK< O >( filter->GetOutput( ) );