]> Creatis software - cpPlugins.git/commitdiff
...
authorLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Tue, 8 Nov 2016 16:07:36 +0000 (11:07 -0500)
committerLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Tue, 8 Nov 2016 16:07:36 +0000 (11:07 -0500)
plugins/CMakeLists.txt
plugins/ImageGenericFilters/GaussianBlurImageFilter.cxx [deleted file]
plugins/ImageGenericFilters/GaussianBlurImageFilter.h [deleted file]
plugins/ImageGenericFilters/ImageGenericFilters.i
plugins/ImageGradientFilters/ImageGradientFilters.i
plugins/ImageGradientFilters/SmoothingRecursiveGaussianImageFilter.cxx [new file with mode: 0644]
plugins/ImageGradientFilters/SmoothingRecursiveGaussianImageFilter.h [new file with mode: 0644]

index fbe5996c7ac3a254505b3423b0180942c6f7f1bc..1a97df67c7ac23a8051ee12b3e9a8ac59c3a7b6a 100644 (file)
@@ -52,6 +52,10 @@ TARGET_LINK_LIBRARIES(
   cpPluginsImageSliceFilters
   cpPluginsImageGenericFilters
   )
+TARGET_LINK_LIBRARIES(
+  cpPluginsImageGradientFilters
+  cpPluginsImageGenericFilters
+  )
 IF(ParabolicMorphology_LOADED)
   TARGET_LINK_LIBRARIES(
     cpPluginsImageParaMorphologyFilters
diff --git a/plugins/ImageGenericFilters/GaussianBlurImageFilter.cxx b/plugins/ImageGenericFilters/GaussianBlurImageFilter.cxx
deleted file mode 100644 (file)
index 10415cd..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-#include <ImageGenericFilters/GaussianBlurImageFilter.h>
-#include <cpPlugins/DataObjects/Image.h>
-#include <cpPlugins/DataObjects/Image_Demanglers.h>
-
-#include <itkImage.h>
-#include <itkGaussianBlurImageFunction.h>
-
-// -------------------------------------------------------------------------
-cpPluginsImageGenericFilters::GaussianBlurImageFilter::
-GaussianBlurImageFilter( )
-  : Superclass( )
-{
-  typedef cpPlugins::DataObjects::Image _TImage;
-  this->_ConfigureInput< _TImage >( "Input", true, false );
-  this->_ConfigureOutput< _TImage >( "Output" );
-
-  this->m_Parameters.ConfigureAsReal( "MaximumError", 1e-3 );
-  this->m_Parameters.ConfigureAsReal( "Sigma", 1 );
-  this->m_Parameters.ConfigureAsUint( "MaximumKernelWidth", 32 );
-  this->m_Parameters.ConfigureAsRealTypesChoices( "OutputResolution" );
-}
-
-// -------------------------------------------------------------------------
-cpPluginsImageGenericFilters::GaussianBlurImageFilter::
-~GaussianBlurImageFilter( )
-{
-}
-
-// -------------------------------------------------------------------------
-void cpPluginsImageGenericFilters::GaussianBlurImageFilter::
-_GenerateData( )
-{
-  auto o = this->GetInputData( "Input" );
-  cpPlugins_Demangle_Image_ScalarPixels_AllDims_1( o, _GD0 )
-    this->_Error( "Invalid input image." );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInput >
-void cpPluginsImageGenericFilters::GaussianBlurImageFilter::
-_GD0( _TInput* input )
-{
-  std::string t = this->m_Parameters.GetSelectedChoice( "OutputResolution" );
-#ifdef cpPlugins_CONFIG_REAL_TYPES_float
-  if( t == "float" ) this->_GD1< _TInput, float >( input );
-#endif // cpPlugins_CONFIG_REAL_TYPES_float
-#ifdef cpPlugins_CONFIG_REAL_TYPES_double
-  if( t == "double" ) this->_GD1< _TInput, double >( input );
-#endif // cpPlugins_CONFIG_REAL_TYPES_double
-}
-
-// -------------------------------------------------------------------------
-template< class _TInput, class _TOutputPixel >
-void cpPluginsImageGenericFilters::GaussianBlurImageFilter::
-_GD1( _TInput* input )
-{
-  /* TODO
-     typedef itk::GaussianBlurImageFunction< _TInput, _TOutputPixel > _TFunction;
-     typedef itk::Image< _TOutputPixel, _TInput::ImageDimension > _TOutput;
-     typedef itk::UnaryFunctorImageFilter< _TInput, _TOutput, _TFunction > _TFilter;
-
-     auto filter = this->_CreateITK< _TFilter >( );
-     filter->SetInput( input );
-
-     typename _TFunction::ErrorArrayType e;
-     e.Fill( this->m_Parameters.GetReal( "MaximumError" ) );
-     filter->GetFunctor( ).SetMaximumError( e );
-     filter->GetFunctor( ).SetSigma( this->m_Parameters.GetReal( "Sigma" ) );
-     filter->GetFunctor( ).SetMaximumKernelWidth(
-     this->m_Parameters.GetUint( "MaximumKernelWidth" )
-     );
-     filter->Update( );
-     this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
-  */
-}
-
-// eof - $RCSfile$
diff --git a/plugins/ImageGenericFilters/GaussianBlurImageFilter.h b/plugins/ImageGenericFilters/GaussianBlurImageFilter.h
deleted file mode 100644 (file)
index 9faef0a..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef __cpPluginsImageGenericFilters__GaussianBlurImageFilter__h__
-#define __cpPluginsImageGenericFilters__GaussianBlurImageFilter__h__
-
-#include <cpPluginsImageGenericFilters_Export.h>
-#include <cpPlugins/BaseObjects/ProcessObject.h>
-
-namespace cpPluginsImageGenericFilters
-{
-  /**
-   */
-  class cpPluginsImageGenericFilters_EXPORT GaussianBlurImageFilter
-    : public cpPlugins::BaseObjects::ProcessObject
-  {
-    cpPluginsObject(
-      GaussianBlurImageFilter,
-      cpPlugins::BaseObjects::ProcessObject,
-      ImageFilters
-      );
-
-  protected:
-    template< class _TInput >
-    inline void _GD0( _TInput* input );
-
-    template< class _TInput, class _TOutputPixel >
-    inline void _GD1( _TInput* input );
-  };
-
-} // ecapseman
-
-#endif // __cpPluginsImageGenericFilters__GaussianBlurImageFilter__h__
-
-// eof - $RCSfile$
index 1deff6b0d2768940b3d0ba50e697eec8537bf639..d76a6f984ef1500b043ec0dca531d586119ebb0c 100644 (file)
@@ -1,12 +1,14 @@
 header #define ITK_MANUAL_INSTANTIATION
 
 define functions=NeighborhoodOperatorImageFunction;GaussianBlurImageFunction
+define in_scalars=#scalar_pixels#
+define out_scalars=#scalar_pixels#
 
 tinclude itkRegionOfInterestImageFilter:h|hxx
 tinclude itkRescaleIntensityImageFilter:h|hxx
 tinclude itkMinimumMaximumImageCalculator:h|hxx
 tinclude itkExtractImageFilter:h|hxx
-* tinclude itk#functions#:h|hxx
+tinclude itkCastImageFilter:h|hxx
 
 cinclude itk#color_pixels#.h
 cinclude itkImageAlgorithm.hxx
@@ -20,6 +22,6 @@ instances itk::RescaleIntensityImageFilter< itk::Image< #scalar_pixels#, #proces
 
 instances itk::MinimumMaximumImageCalculator< itk::Image< #scalar_pixels#, #process_dims# > >
 
-* instances itk::#functions#< itk::Image< #scalar_pixels#, #process_dims# >, #real_types# >
+instances itk::CastImageFilter< itk::Image< #in_scalars#, #process_dims# >, itk::Image< #out_scalars#, #process_dims# > >
 
 ** eof - $RCSfile$
index 95bff3ac158ea2f1fdd3a70866c14a47882eaac4..903e20998f99a3f307cb2ecb8e99d8ba3b534e1d 100644 (file)
@@ -5,6 +5,7 @@ define all_funcs=GradientImageFunctionBase;#funcs#
 define itk_filters=RecursiveGaussianImageFilter;GradientRecursiveGaussianImageFilter
 
 tinclude itk#itk_filters#:h|hxx
+tinclude itkSmoothingRecursiveGaussianImageFilter:h|hxx
 tinclude cpExtensions/Algorithms/#all_funcs#:h|hxx
 tinclude cpExtensions/Algorithms/ImageFunctionFilter:h|hxx
 tinclude cpExtensions/Algorithms/MultiScaleGaussianImageFilter:h|hxx
@@ -27,4 +28,6 @@ instances cpExtensions::Algorithms::ImageFunctionFilter< itk::Image< itk::Covari
 
 instances cpExtensions::Algorithms::MultiScaleGaussianImageFilter< itk::Image< #scalar_pixels#, #process_dims# >, itk::Image< itk::CovariantVector< #real_types#, #process_dims# >, #process_dims# > >
 
+instances itk::SmoothingRecursiveGaussianImageFilter< itk::Image< #scalar_pixels#, #process_dims# >, itk::Image< #real_types#, #process_dims# > >
+
 ** eof - $RCSfile$
diff --git a/plugins/ImageGradientFilters/SmoothingRecursiveGaussianImageFilter.cxx b/plugins/ImageGradientFilters/SmoothingRecursiveGaussianImageFilter.cxx
new file mode 100644 (file)
index 0000000..28944bc
--- /dev/null
@@ -0,0 +1,81 @@
+#include <ImageGradientFilters/SmoothingRecursiveGaussianImageFilter.h>
+#include <cpPlugins/DataObjects/Image.h>
+#include <cpPlugins/DataObjects/Image_Demanglers.h>
+
+#include <itkSmoothingRecursiveGaussianImageFilter.h>
+
+// -------------------------------------------------------------------------
+cpPluginsImageGradientFilters::SmoothingRecursiveGaussianImageFilter::
+SmoothingRecursiveGaussianImageFilter( )
+  : Superclass( )
+{
+  typedef cpPlugins::DataObjects::Image _TImage;
+
+  this->_ConfigureInput< _TImage >( "Input", true, false );
+  this->_ConfigureOutput< _TImage >( "Output" );
+
+  this->m_Parameters.ConfigureAsRealList( "SigmaArray" );
+  this->m_Parameters.ConfigureAsRealTypesChoices( "OutputResolution" );
+}
+
+// -------------------------------------------------------------------------
+cpPluginsImageGradientFilters::SmoothingRecursiveGaussianImageFilter::
+~SmoothingRecursiveGaussianImageFilter( )
+{
+}
+
+// -------------------------------------------------------------------------
+void cpPluginsImageGradientFilters::SmoothingRecursiveGaussianImageFilter::
+_GenerateData( )
+{
+  auto o = this->GetInputData( "Input" );
+  cpPlugins_Demangle_Image_ScalarPixels_AllDims_1( o, _GD0 )
+    this->_Error( "Invalid input image." );
+}
+
+// -------------------------------------------------------------------------
+template< class _TImage >
+void cpPluginsImageGradientFilters::SmoothingRecursiveGaussianImageFilter::
+_GD0( _TImage* image )
+{
+  auto choice = this->m_Parameters.GetSelectedChoice( "OutputResolution" );
+#ifdef cpPlugins_CONFIG_REAL_TYPES_float
+  if( choice == "float" ) this->_GD1< _TImage, float >( image );
+#endif // cpPlugins_CONFIG_REAL_TYPES_float
+#ifdef cpPlugins_CONFIG_REAL_TYPES_double
+  if( choice == "double" ) this->_GD1< _TImage, double >( image );
+#endif // cpPlugins_CONFIG_REAL_TYPES_double
+}
+
+// -------------------------------------------------------------------------
+template< class _TInput, class _TOutputPixel >
+void cpPluginsImageGradientFilters::SmoothingRecursiveGaussianImageFilter::
+_GD1( _TInput* image )
+{
+  typedef itk::Image< _TOutputPixel, _TInput::ImageDimension > _TOutput;
+  typedef
+    itk::SmoothingRecursiveGaussianImageFilter< _TInput, _TOutput >
+    _TFilter;
+  typedef typename _TFilter::SigmaArrayType _TSigmas;
+
+  auto param_sigmas = this->m_Parameters.GetRealList( "SigmaArray" );
+  unsigned int dim =
+    ( param_sigmas.size( ) < _TInput::ImageDimension )? 
+    param_sigmas.size( ):
+    _TInput::ImageDimension;
+  _TSigmas sigmas;
+  sigmas.Fill( param_sigmas[ dim - 1 ] );
+  for( unsigned d = 0; d < dim; ++d )
+    sigmas[ d ] = param_sigmas[ d ];
+
+  // Configure filter
+  _TFilter* filter = this->_CreateITK< _TFilter >( );
+  filter->SetInput( image );
+  filter->SetSigmaArray( sigmas );
+  filter->Update( );
+
+  // Connect output
+  this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
+}
+
+// eof - $RCSfile$
diff --git a/plugins/ImageGradientFilters/SmoothingRecursiveGaussianImageFilter.h b/plugins/ImageGradientFilters/SmoothingRecursiveGaussianImageFilter.h
new file mode 100644 (file)
index 0000000..526b80c
--- /dev/null
@@ -0,0 +1,32 @@
+#ifndef __cpPluginsImageGradientFilters__SmoothingRecursiveGaussianImageFilter__h__
+#define __cpPluginsImageGradientFilters__SmoothingRecursiveGaussianImageFilter__h__
+
+#include <cpPluginsImageGradientFilters_Export.h>
+#include <cpPlugins/BaseObjects/ProcessObject.h>
+
+namespace cpPluginsImageGradientFilters
+{
+  /**
+   */
+  class cpPluginsImageGradientFilters_EXPORT SmoothingRecursiveGaussianImageFilter
+    : public cpPlugins::BaseObjects::ProcessObject
+  {
+    cpPluginsObject(
+      SmoothingRecursiveGaussianImageFilter,
+      cpPlugins::BaseObjects::ProcessObject,
+      ImageGradientFilters
+      );
+
+  protected:
+    template< class _TInput >
+    inline void _GD0( _TInput* image );
+
+    template< class _TInput, class _TOutputPixel >
+    inline void _GD1( _TInput* image );
+  };
+
+} // ecapseman
+
+#endif // __cpPluginsImageGradientFilters__SmoothingRecursiveGaussianImageFilter__h__
+
+// eof - $RCSfile$