]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Plugins/BasicFilters/OtsuThresholdImageFilter.cxx
...
[cpPlugins.git] / lib / cpPlugins / Plugins / BasicFilters / OtsuThresholdImageFilter.cxx
index 6bc538e7efa635de4ca9b99bdeecb816f7bf237b..dd2bd1ca346960af8ded4c3af10a0d8a02705d5f 100644 (file)
@@ -9,11 +9,15 @@ OtsuThresholdImageFilter( )
   : Superclass( )
 {
   this->_AddInput( "Input" );
-  this->_MakeOutput< cpPlugins::Interface::Image >( "Output" );
+  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 );
 }
 
 // -------------------------------------------------------------------------
@@ -27,7 +31,7 @@ std::string cpPlugins::BasicFilters::OtsuThresholdImageFilter::
 _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." );
 
@@ -69,8 +73,8 @@ _RealGD( itk::DataObject* 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