]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Plugins/BasicFilters/MedianImageFilter.cxx
Widget integration (step 4/6)... Testing on windows.
[cpPlugins.git] / lib / cpPlugins / Plugins / BasicFilters / MedianImageFilter.cxx
index 53a9d28c5d9a867e83ede882be432df25c3a34e5..df145b871727f5af048b248a6dff02e86d3f2477 100644 (file)
@@ -15,10 +15,10 @@ MedianImageFilter( )
   this->_MakeOutput< cpPlugins::Interface::Image >( 0 );
 
   using namespace cpPlugins::Interface;
-  this->m_DefaultParameters.Configure(Parameters::Real, "Radius");
-  this->m_DefaultParameters.SetValueAsReal("Radius", 3);
+  this->m_DefaultParameters.Configure( Parameters::Uint, "Radius" );
+
+  this->m_DefaultParameters.SetValueAsUint( "Radius", 3 );
+
   this->m_Parameters = this->m_DefaultParameters;
 }
 
@@ -39,15 +39,9 @@ _GenerateData( )
 
   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 );
 }
@@ -55,7 +49,7 @@ _GenerateData( )
 // -------------------------------------------------------------------------
 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 > >(
@@ -70,25 +64,16 @@ inline std::string cpPlugins::BasicFilters::MedianImageFilter::
 _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.GetValueAsUint( "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
@@ -96,7 +81,7 @@ _RealGD( itk::DataObject* image )
     this->GetOutput< cpPlugins::Interface::Image >( 0 );
   if( out != NULL )
   {
-    out->SetITKImage< O >( filter->GetOutput( ) );
+    out->SetITK< O >( filter->GetOutput( ) );
     return( "" );
   }
   else