]> Creatis software - cpPlugins.git/commitdiff
Coding style improved.
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Wed, 30 Sep 2015 23:13:18 +0000 (18:13 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Wed, 30 Sep 2015 23:13:18 +0000 (18:13 -0500)
lib/cpPlugins/Plugins/BasicFilters/BinaryThresholdImageFilter.cxx
lib/cpPlugins/Plugins/BasicFilters/BinaryThresholdImageFilter.h
lib/cpPlugins/Plugins/BasicFilters/MedianImageFilter.cxx
lib/cpPlugins/Plugins/BasicFilters/MedianImageFilter.h

index d3d541e8527652d7bafebc8623b9c42ea650e246..ea7c965184579ad6a01033ce59d1f29d36c2dbac 100644 (file)
@@ -15,25 +15,16 @@ BinaryThresholdImageFilter( )
   this->_MakeOutput< cpPlugins::Interface::Image >( 0 );
 
   using namespace cpPlugins::Interface;
-  this->m_DefaultParameters.Configure(Parameters::Real, "LowerThresholdValue");
-  this->m_DefaultParameters.Configure(Parameters::Real, "UpperThresholdValue");
-  this->m_DefaultParameters.Configure(Parameters::Real, "InsideValue");
-  this->m_DefaultParameters.Configure(Parameters::Real, "OutsideValue");
+  this->m_DefaultParameters.Configure( Parameters::Real, "LowerThresholdValue" );
+  this->m_DefaultParameters.Configure( Parameters::Real, "UpperThresholdValue" );
+  this->m_DefaultParameters.Configure( Parameters::Real, "InsideValue" );
+  this->m_DefaultParameters.Configure( Parameters::Real, "OutsideValue" );
 
-  this->m_DefaultParameters.SetValueAsReal("LowerThresholdValue", 100);
-  this->m_DefaultParameters.SetValueAsReal("UpperThresholdValue",500);
-  this->m_DefaultParameters.SetValueAsReal("InsideValue", 255);
-  this->m_DefaultParameters.SetValueAsReal("OutsideValue", 0);
+  this->m_DefaultParameters.SetValueAsReal( "LowerThresholdValue", 100 );
+  this->m_DefaultParameters.SetValueAsReal( "UpperThresholdValue", 500 );
+  this->m_DefaultParameters.SetValueAsReal( "InsideValue", 255 );
+  this->m_DefaultParameters.SetValueAsReal( "OutsideValue", 0 );
 
-  //this->m_DefaultParameters.Configure(
-
-  //  Parameters::Uint, "NumberOfHistogramBins"
-  //  );
-  //this->m_DefaultParameters.Configure( Parameters::Real, "InsideValue" );
-  //this->m_DefaultParameters.Configure( Parameters::Real, "OutsideValue" );
-  //this->m_DefaultParameters.SetValueAsUint( "NumberOfHistogramBins", 100 );
-  //this->m_DefaultParameters.SetValueAsReal( "InsideValue", 255 );
-  //this->m_DefaultParameters.SetValueAsReal( "OutsideValue", 0 );
   this->m_Parameters = this->m_DefaultParameters;
 }
 
@@ -85,13 +76,14 @@ inline std::string cpPlugins::BasicFilters::BinaryThresholdImageFilter::
 _RealGD( itk::DataObject* image )
 {
   typedef itk::BinaryThresholdImageFilter< I, O > _F;
+  typedef typename I::PixelType _IP;
   typedef typename O::PixelType _OP;
 
   // Get parameters
   //unsigned int bins =
   //  this->m_Parameters.GetValueAsUint( "NumberOfHistogramBins" );
-  _OP lower_val = _OP(this->m_Parameters.GetValueAsReal("LowerValue"));
-  _OP upper_val = _OP(this->m_Parameters.GetValueAsReal("UpperValue"));
+  _IP lower_val = _IP( this->m_Parameters.GetValueAsReal( "LowerValue" ) );
+  _IP upper_val = _IP( this->m_Parameters.GetValueAsReal( "UpperValue" ) );
   _OP in_val = _OP( this->m_Parameters.GetValueAsReal( "InsideValue" ) );
   _OP out_val = _OP( this->m_Parameters.GetValueAsReal( "OutsideValue" ) );
 
@@ -104,9 +96,8 @@ _RealGD( itk::DataObject* image )
 
   } // fi
   filter->SetInput( dynamic_cast< I* >( image ) );
-  //filter->SetNumberOfHistogramBins( bins );
-  filter->SetLowerThreshold(lower_val);
-  filter->SetUpperThreshold(upper_val);
+  filter->SetLowerThreshold( lower_val );
+  filter->SetUpperThreshold( upper_val );
   filter->SetInsideValue( in_val );
   filter->SetOutsideValue( out_val );
   filter->Update( );
index b41015102473d38b54cad4e3add0c1adf4f093ad..74a970f49d56100a4101c14d7dae37f0773329cf 100644 (file)
@@ -14,14 +14,17 @@ namespace cpPlugins
       : public cpPlugins::Interface::ImageToImageFilter
     {
     public:
-      typedef BinaryThresholdImageFilter                 Self;
+      typedef BinaryThresholdImageFilter               Self;
       typedef cpPlugins::Interface::ImageToImageFilter Superclass;
       typedef itk::SmartPointer< Self >                Pointer;
       typedef itk::SmartPointer< const Self >          ConstPointer;
 
     public:
       itkNewMacro( Self );
-      itkTypeMacro( BinaryThresholdImageFilter, cpPluginsInterfaceImageToImageFilter );
+      itkTypeMacro(
+        BinaryThresholdImageFilter,
+        cpPluginsInterfaceImageToImageFilter
+        );
 
     protected:
       BinaryThresholdImageFilter( );
index 53a9d28c5d9a867e83ede882be432df25c3a34e5..d806506352ac0a058055739e00b5ac84cc2d9ca4 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;
 }
 
@@ -70,12 +70,11 @@ 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( ) );
@@ -86,9 +85,8 @@ _RealGD( itk::DataObject* image )
 
   } // fi
   filter->SetInput( dynamic_cast< I* >( image ) );
-  
-  filter->SetRadius(rad_val);
+  filter->SetRadius( rad_val );
+
   filter->Update( );
 
   // Connect output
index a4d4679c29378ca2bb7a06d614108b376b167e29..8b3cbf7538ccf872b1af90233d1de71924581d06 100644 (file)
@@ -14,14 +14,17 @@ namespace cpPlugins
       : public cpPlugins::Interface::ImageToImageFilter
     {
     public:
-      typedef MedianImageFilter                 Self;
+      typedef MedianImageFilter                        Self;
       typedef cpPlugins::Interface::ImageToImageFilter Superclass;
       typedef itk::SmartPointer< Self >                Pointer;
       typedef itk::SmartPointer< const Self >          ConstPointer;
 
     public:
       itkNewMacro( Self );
-      itkTypeMacro( MedianImageFilter, cpPluginsInterfaceImageToImageFilter );
+      itkTypeMacro(
+        MedianImageFilter,
+        cpPluginsInterfaceImageToImageFilter
+        );
 
     protected:
       MedianImageFilter( );