]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Plugins/BasicFilters/OtsuThresholdImageFilter.cxx
...
[cpPlugins.git] / lib / cpPlugins / Plugins / BasicFilters / OtsuThresholdImageFilter.cxx
index 0c4852bfd0107a35132403fcea796aec2484d4dc..6ce525a784bd5900da47e4b7440039cb1985e7af 100644 (file)
@@ -8,7 +8,7 @@ cpPlugins::BasicFilters::OtsuThresholdImageFilter::
 OtsuThresholdImageFilter( )
   : Superclass( )
 {
-  this->_AddInput( "Input", true );
+  this->_AddInput( "Input" );
   this->_AddOutput< cpPlugins::Interface::Image >( "Output" );
 
   this->m_Parameters->ConfigureAsUint( "NumberOfHistogramBins" );
@@ -30,10 +30,7 @@ cpPlugins::BasicFilters::OtsuThresholdImageFilter::
 std::string cpPlugins::BasicFilters::OtsuThresholdImageFilter::
 _GenerateData( )
 {
-  auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" );
-  if( image == NULL )
-    return( "OtsuThresholdImageFilter: No input image." );
-
+  auto image = this->GetInputData( "Input" );
   itk::DataObject* itk_image = NULL;
   std::string r = "";
   cpPlugins_Image_Demangle_AllScalarTypes( 2, image, itk_image, r, _GD0 );
@@ -77,14 +74,9 @@ _RealGD( itk::DataObject* image )
   filter->Update( );
 
   // Connect output
-  auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" );
-  if( out != NULL )
-  {
-    out->SetITK< O >( filter->GetOutput( ) );
-    return( "" );
-  }
-  else
-    return( "OtsuThresholdImageFilter: output not correctly created." );
+  auto out = this->GetOutputData( "Output" );
+  out->SetITK( filter->GetOutput( ) );
+  return( "" );
 }
 
 // eof - $RCSfile$