]> Creatis software - cpPlugins.git/commitdiff
...
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Mon, 31 Oct 2016 14:41:16 +0000 (09:41 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Mon, 31 Oct 2016 14:41:16 +0000 (09:41 -0500)
13 files changed:
lib/cpExtensions/Algorithms/CPRImageFilter.h [new file with mode: 0644]
lib/cpExtensions/Algorithms/CPRImageFilter.hxx [new file with mode: 0644]
lib/cpExtensions/Algorithms/IsoImageSlicer.h
plugins/AnisotropicDiffusion/AnisotropicDiffusion.i [new file with mode: 0644]
plugins/AnisotropicDiffusion/CurvatureAnisotropicDiffusionImageFilter.cxx
plugins/AnisotropicDiffusion/CurvatureAnisotropicDiffusionImageFilter.h
plugins/CMakeLists.txt
plugins/ImageBooleanFilters/ImageBooleanFilters.i
plugins/ImageBooleanFilters/NotImageFilter.cxx [new file with mode: 0644]
plugins/ImageBooleanFilters/NotImageFilter.h [new file with mode: 0644]
plugins/ImageDistanceMaps/SignedMaurerDistanceMapImageFilter.cxx
plugins/ImageDistanceMaps/SignedMaurerDistanceMapImageFilter.h
plugins/ImageSliceFilters/ImageSliceFilters.i [new file with mode: 0644]

diff --git a/lib/cpExtensions/Algorithms/CPRImageFilter.h b/lib/cpExtensions/Algorithms/CPRImageFilter.h
new file mode 100644 (file)
index 0000000..9161260
--- /dev/null
@@ -0,0 +1,68 @@
+#ifndef __cpExtensions__Algorithms__CPRImageFilter__h__
+#define __cpExtensions__Algorithms__CPRImageFilter__h__
+
+#include <itkImageToImageFilter.h>
+#include <cpExtensions/Algorithms/IsoImageSlicer.h>
+
+namespace cpExtensions
+{
+  namespace Algorithms
+  {
+    /**
+     */
+    template< class _TImage, class _TCurve >
+    class CPRImageFilter
+      : public itk::ImageToImageFilter< _TImage, _TImage >
+    {
+    public:
+      typedef CPRImageFilter                              Self;
+      typedef itk::ImageToImageFilter< _TImage, _TImage > Superclass;
+      typedef itk::SmartPointer< Self >                   Pointer;
+      typedef itk::SmartPointer< const Self >             ConstPointer;
+
+      typedef _TImage TImage;
+      typedef _TCurve TCurve;
+      typedef typename TCurve::TScalar TScalar;
+
+      typedef IsoImageSlicer< TImage, TScalar > TSlicer;
+      typedef typename TSlicer::TInterpolateFunction TInterpolateFunction;
+
+    public:
+      itkNewMacro( Self );
+      itkTypeMacro( CPRImageFilter, itk::ImageToImageFilter );
+
+      itkGetConstMacro( SliceRadius, double );
+      itkGetObjectMacro( Interpolator, TInterpolateFunction );
+
+      itkSetMacro( SliceRadius, double );
+      itkSetObjectMacro( Interpolator, TInterpolateFunction );
+
+    public:
+      _TCurve* GetCurve( );
+      const _TCurve* GetCurve( ) const;
+      void SetCurve( _TCurve* curve );
+
+    protected:
+      CPRImageFilter( );
+      virtual ~CPRImageFilter( );
+
+      virtual void GenerateOutputInformation( ) cpExtensions_OVERRIDE;
+      virtual void GenerateInputRequestedRegion( ) cpExtensions_OVERRIDE;
+      virtual void GenerateData( ) cpExtensions_OVERRIDE;
+
+    protected:
+      double m_SliceRadius;
+      typename TInterpolateFunction::Pointer m_Interpolator;
+    };
+
+  } // ecapseman
+
+} // ecapseman
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#  include <cpExtensions/Algorithms/CPRImageFilter.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+
+#endif // __cpExtensions__Algorithms__CPRImageFilter__h__
+
+// eof - $RCSfile$
diff --git a/lib/cpExtensions/Algorithms/CPRImageFilter.hxx b/lib/cpExtensions/Algorithms/CPRImageFilter.hxx
new file mode 100644 (file)
index 0000000..a29c656
--- /dev/null
@@ -0,0 +1,79 @@
+#ifndef __cpExtensions__Algorithms__CPRImageFilter__hxx__
+#define __cpExtensions__Algorithms__CPRImageFilter__hxx__
+
+// -------------------------------------------------------------------------
+template< class _TImage, class _TCurve >
+_TCurve* cpExtensions::Algorithms::CPRImageFilter< _TImage, _TCurve >::
+GetCurve( )
+{
+  return(
+    dynamic_cast< _TCurve* >( this->itk::ProcessObject::GetInput( 1 ) )
+    );
+}
+
+// -------------------------------------------------------------------------
+template< class _TImage, class _TCurve >
+const _TCurve* cpExtensions::Algorithms::CPRImageFilter< _TImage, _TCurve >::
+GetCurve( ) const
+{
+  return(
+    dynamic_cast< const _TCurve* >( this->itk::ProcessObject::GetInput( 1 ) )
+    );
+}
+
+// -------------------------------------------------------------------------
+template< class _TImage, class _TCurve >
+void cpExtensions::Algorithms::CPRImageFilter< _TImage, _TCurve >::
+SetCurve( _TCurve* curve )
+{
+  this->itk::ProcessObject::SetInput( 1, curve );
+}
+
+// -------------------------------------------------------------------------
+template< class _TImage, class _TCurve >
+cpExtensions::Algorithms::CPRImageFilter< _TImage, _TCurve >::
+CPRImageFilter( )
+  : Superclass( ),
+    m_SliceRadius( 0 )
+{
+  this->Superclass::SetNumberOfRequiredInputs( 2 );
+}
+
+// -------------------------------------------------------------------------
+template< class _TImage, class _TCurve >
+cpExtensions::Algorithms::CPRImageFilter< _TImage, _TCurve >::
+~CPRImageFilter( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TImage, class _TCurve >
+void cpExtensions::Algorithms::CPRImageFilter< _TImage, _TCurve >::
+GenerateOutputInformation( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TImage, class _TCurve >
+void cpExtensions::Algorithms::CPRImageFilter< _TImage, _TCurve >::
+GenerateInputRequestedRegion( )
+{
+  TImage* input = const_cast< TImage* >( this->GetInput( ) );
+  if( input != NULL )
+    input->SetRequestedRegionToLargestPossibleRegion( );
+}
+
+// -------------------------------------------------------------------------
+template< class _TImage, class _TCurve >
+void cpExtensions::Algorithms::CPRImageFilter< _TImage, _TCurve >::
+GenerateData( )
+{
+  /* TODO
+     double m_SliceRadius
+     typename TInterpolateFunction::Pointer m_Interpolator
+  */
+}
+
+#endif // __cpExtensions__Algorithms__CPRImageFilter__hxx__
+
+// eof - $RCSfile$
index dad9c7a485b9ca6ba5414852fb80b3f6cea59f70..919043022b208d86348d5795d69ce8a5be8319ef 100644 (file)
@@ -177,7 +177,7 @@ namespace cpExtensions
 } // ecapseman
 
 #ifndef ITK_MANUAL_INSTANTIATION
-#include <cpExtensions/Algorithms/IsoImageSlicer.hxx>
+#  include <cpExtensions/Algorithms/IsoImageSlicer.hxx>
 #endif // ITK_MANUAL_INSTANTIATION
 
 #endif // __CPEXTENSIONS__ALGORITHMS__ISOIMAGESLICER__H__
diff --git a/plugins/AnisotropicDiffusion/AnisotropicDiffusion.i b/plugins/AnisotropicDiffusion/AnisotropicDiffusion.i
new file mode 100644 (file)
index 0000000..95d1fce
--- /dev/null
@@ -0,0 +1,8 @@
+
+tinclude itkAnisotropicDiffusionImageFilter:h|hxx
+tinclude itkCurvatureNDAnisotropicDiffusionFunction:h|hxx
+
+instances itk::AnisotropicDiffusionImageFilter< itk::Image< #scalar_pixels#, #process_dims# >, itk::Image< #real_types#, #process_dims# > >
+instances itk::CurvatureNDAnisotropicDiffusionFunction< itk::Image< #real_types#, #process_dims# > >
+
+** eof - $RCSfile$
index d2f2aea8fbf6e0d84370c7f7e824abb8f8bb2576..d8ce6597ae2ef6ecc992458377955caf9e07af0a 100644 (file)
@@ -3,31 +3,28 @@
 #include <cpPlugins/DataObjects/Image_Demanglers.h>
 
 #include <itkCurvatureAnisotropicDiffusionImageFilter.h>
-/* TODO
-   #include <itkCurvatureNDAnisotropicDiffusionFunction.hxx>
-   #include <itkFiniteDifferenceFunction.hxx>
-   #include <itkNeighborhoodInnerProduct.hxx>
-   #include <itkNeighborhoodOperator.hxx>
-   #include <itkFiniteDifferenceImageFilter.hxx>
-   #include <itkAnisotropicDiffusionImageFilter.hxx>
-   #include <itkDenseFiniteDifferenceImageFilter.hxx>
-   #include <itkNeighborhoodAlgorithm.hxx>
-   #include <itkDerivativeOperator.hxx>
-   #include <itkScalarAnisotropicDiffusionFunction.hxx>
-*/
 
 // -------------------------------------------------------------------------
 cpPluginsAnisotropicDiffusion::CurvatureAnisotropicDiffusionImageFilter::
 CurvatureAnisotropicDiffusionImageFilter( )
   : Superclass( )
 {
-  this->_ConfigureInput< cpPlugins::DataObjects::Image >( "Input", true, false );
-  this->_ConfigureOutput< cpPlugins::DataObjects::Image >( "Output" );
+  typedef cpPlugins::DataObjects::Image _TImage;
+  this->_ConfigureInput< _TImage >( "Input", true, false );
+  this->_ConfigureOutput< _TImage >( "Output" );
 
   this->m_Parameters.ConfigureAsUint( "NumberOfIterations" );
   this->m_Parameters.ConfigureAsBool( "UseImageSpacing" );
   this->m_Parameters.ConfigureAsReal( "ConductanceParameter" );
   this->m_Parameters.ConfigureAsReal( "TimeStep" );
+  std::vector< std::string > choices;
+#ifdef cpPlugins_CONFIG_REAL_TYPES_float
+  choices.push_back( "float" );
+#endif // cpPlugins_CONFIG_REAL_TYPES_float
+#ifdef cpPlugins_CONFIG_REAL_TYPES_double
+  choices.push_back( "double" );
+#endif // cpPlugins_CONFIG_REAL_TYPES_double
+  this->m_Parameters.ConfigureAsChoices( "OutputResolution", choices );
 
   this->m_Parameters.SetUint( "NumberOfIterations", 5 );
   this->m_Parameters.SetBool( "UseImageSpacing", false );
@@ -46,7 +43,7 @@ void cpPluginsAnisotropicDiffusion::CurvatureAnisotropicDiffusionImageFilter::
 _GenerateData( )
 {
   auto o = this->GetInputData( "Input" );
-  cpPlugins_Demangle_Image_ScalarPixels_VisualDims_1( o, _GD0 )
+  cpPlugins_Demangle_Image_ScalarPixels_AllDims_1( o, _GD0 )
     this->_Error( "No valid input image." );
 }
 
@@ -55,7 +52,25 @@ template< class _TImage >
 void cpPluginsAnisotropicDiffusion::CurvatureAnisotropicDiffusionImageFilter::
 _GD0( _TImage* image )
 {
-  typedef itk::CurvatureAnisotropicDiffusionImageFilter< _TImage, _TImage > _TFilter;
+  std::string out_res =
+    this->m_Parameters.GetSelectedChoice( "OutputResolution" );
+#ifdef cpPlugins_CONFIG_REAL_TYPES_float
+  if( out_res == "float" ) this->_GD1< _TImage, float >( image );
+#endif // cpPlugins_CONFIG_REAL_TYPES_float
+#ifdef cpPlugins_CONFIG_REAL_TYPES_double
+  if( out_res == "double" ) this->_GD1< _TImage, double >( image );
+#endif // cpPlugins_CONFIG_REAL_TYPES_double
+}
+
+// -------------------------------------------------------------------------
+template< class _TImage, class _TScalar >
+void cpPluginsAnisotropicDiffusion::CurvatureAnisotropicDiffusionImageFilter::
+_GD1( _TImage* image )
+{
+  typedef itk::Image< _TScalar, _TImage::ImageDimension > _TOutImage;
+  typedef
+    itk::CurvatureAnisotropicDiffusionImageFilter< _TImage, _TOutImage >
+    _TFilter;
 
   // Configure filter
   _TFilter* filter = this->_CreateITK< _TFilter >( );
index fb92cd141ee7d9d9b535de708e2d1a55b4a98193..1271688a44f2ffa558fe54c5095cb718db2ceedd 100644 (file)
@@ -20,6 +20,9 @@ namespace cpPluginsAnisotropicDiffusion
   protected:
     template< class _TImage >
     inline void _GD0( _TImage* image );
+
+    template< class _TImage, class _TScalar >
+    inline void _GD1( _TImage* image );
   };
 
 } // ecapseman
index e112573285df252377a8d31da86035a001ae845c..fccbecad7e1faa0a5fd8935fddc701b24dfc8a24 100644 (file)
@@ -12,6 +12,7 @@ SET(
   ImageGenericFilters
   ImageGradientFilters
   ImageMeshFilters
+  ImageSliceFilters
   ImageSources
   ImageThresholdFilters
   IO
index 4fc6e7a6394cbee69a1a28d0f26f604014cc52a1..c185fbd003e600b175f9147ac74628a8ef92b5dc 100644 (file)
@@ -1,12 +1,15 @@
 header #define ITK_MANUAL_INSTANTIATION
 
-define filters=And;Or;Xor
+define filters=And;Or;Xor;Not
 define functors=AND;OR;XOR
 define all_ints=#int_types#;unsigned #int_types#
 
 tinclude itkBinaryFunctorImageFilter:h|hxx
+tinclude itkUnaryFunctorImageFilter:h|hxx
 cinclude itk#filters#ImageFilter.h
 
 instances itk::BinaryFunctorImageFilter< itk::Image< #all_ints#, #process_dims# >, itk::Image< #all_ints#, #process_dims# >, itk::Image< #all_ints#, #process_dims# >, itk::Functor::#functors#< #all_ints#, #all_ints#, #all_ints# > >
 
+instances itk::UnaryFunctorImageFilter< itk::Image< #all_ints#, #process_dims# >, itk::Image< #all_ints#, #process_dims# >, itk::Functor::NOT< #all_ints#, #all_ints# > >
+
 ** eof - $RCSfile$
diff --git a/plugins/ImageBooleanFilters/NotImageFilter.cxx b/plugins/ImageBooleanFilters/NotImageFilter.cxx
new file mode 100644 (file)
index 0000000..149dc24
--- /dev/null
@@ -0,0 +1,49 @@
+#include <ImageBooleanFilters/NotImageFilter.h>
+#include <cpPlugins/DataObjects/Image.h>
+#include <cpPlugins/DataObjects/Image_Demanglers.h>
+
+#include <itkNotImageFilter.h>
+
+// -------------------------------------------------------------------------
+cpPluginsImageBooleanFilters::NotImageFilter::
+NotImageFilter( )
+  : Superclass( )
+{
+  typedef cpPlugins::DataObjects::Image _TImage;
+
+  this->_ConfigureInput< _TImage >( "Input", true, false );
+  this->_ConfigureOutput< _TImage >( "Output" );
+}
+
+// -------------------------------------------------------------------------
+cpPluginsImageBooleanFilters::NotImageFilter::
+~NotImageFilter( )
+{
+}
+
+// -------------------------------------------------------------------------
+void cpPluginsImageBooleanFilters::NotImageFilter::
+_GenerateData( )
+{
+  auto o = this->GetInputData( "Input" );
+  cpPlugins_Demangle_Image_IntPixels_AllDims_1( o, _GD0 )
+    this->_Error( "Invalid input image." );
+}
+
+// -------------------------------------------------------------------------
+template< class _TImage >
+void cpPluginsImageBooleanFilters::NotImageFilter::
+_GD0( _TImage* image )
+{
+  typedef itk::NotImageFilter< _TImage, _TImage > _TFilter;
+
+  // Configure filter
+  auto filter = this->_CreateITK< _TFilter >( );
+  filter->SetInput( image );
+  filter->Update( );
+
+  // Connect output
+  this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
+}
+
+// eof - $RCSfile$
diff --git a/plugins/ImageBooleanFilters/NotImageFilter.h b/plugins/ImageBooleanFilters/NotImageFilter.h
new file mode 100644 (file)
index 0000000..020d380
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef __cpPluginsImageBooleanFilters__NotImageFilter__h__
+#define __cpPluginsImageBooleanFilters__NotImageFilter__h__
+
+#include <cpPluginsImageBooleanFilters_Export.h>
+#include <cpPlugins/BaseObjects/ProcessObject.h>
+
+namespace cpPluginsImageBooleanFilters
+{
+  /**
+   */
+  class cpPluginsImageBooleanFilters_EXPORT NotImageFilter
+    : public cpPlugins::BaseObjects::ProcessObject
+  {
+    cpPluginsObject(
+      NotImageFilter,
+      cpPlugins::BaseObjects::ProcessObject,
+      ImageBooleanFilters
+      );
+
+  protected:
+    template< class _TImage >
+    inline void _GD0( _TImage* image1 );
+  };
+
+} // ecapseman
+
+#endif // __cpPluginsImageBooleanFilters__NotImageFilter__h__
+
+// eof - $RCSfile$
index 89b52f7ca8a86694ee8437059bb1cf33064e8f84..5a7a0336ac04bfed6c45b2d18bbe228ca9ef16a9 100644 (file)
@@ -45,7 +45,7 @@ void cpPluginsImageDistanceMaps::SignedMaurerDistanceMapImageFilter::
 _GenerateData( )
 {
   auto o = this->GetInputData( "Input" );
-  cpPlugins_Demangle_Image_VisualDims_1( o, _GD0 )
+  cpPlugins_Demangle_Image_ScalarPixels_VisualDims_1( o, _GD0 )
     this->_Error( "Invalid input image dimension." );
 }
 
@@ -53,30 +53,21 @@ _GenerateData( )
 template< class _TImage >
 void cpPluginsImageDistanceMaps::SignedMaurerDistanceMapImageFilter::
 _GD0( _TImage* image )
-{
-  cpPlugins_Demangle_Image_ScalarPixels_1( image, _GD1, _TImage::ImageDimension )
-    this->_Error( "Invalid input image pixel type." );
-}
-
-// -------------------------------------------------------------------------
-template< class _TImage >
-void cpPluginsImageDistanceMaps::SignedMaurerDistanceMapImageFilter::
-_GD1( _TImage* image )
 {
   std::string out_res =
     this->m_Parameters.GetSelectedChoice( "OutputResolution" );
 #ifdef cpPlugins_CONFIG_REAL_TYPES_float
-  if( out_res == "float" ) this->_GD2< _TImage, float >( image );
+  if( out_res == "float" ) this->_GD1< _TImage, float >( image );
 #endif // cpPlugins_CONFIG_REAL_TYPES_float
 #ifdef cpPlugins_CONFIG_REAL_TYPES_double
-  if( out_res == "double" ) this->_GD2< _TImage, double >( image );
+  if( out_res == "double" ) this->_GD1< _TImage, double >( image );
 #endif // cpPlugins_CONFIG_REAL_TYPES_double
 }
 
 // -------------------------------------------------------------------------
 template< class _TImage, class _TScalar >
 void cpPluginsImageDistanceMaps::SignedMaurerDistanceMapImageFilter::
-_GD2( _TImage* image )
+_GD1( _TImage* image )
 {
   typedef itk::Image< _TScalar, _TImage::ImageDimension >  _TDMap;
   typedef
index dabbaccf7552f4ec766c82fa013e40a07fa4fb40..452e6c6c732f7d88cc5f2b843ebfa4aa1e50dd1a 100644 (file)
@@ -21,11 +21,8 @@ namespace cpPluginsImageDistanceMaps
     template< class _TImage >
     inline void _GD0( _TImage* image );
 
-    template< class _TImage >
-    inline void _GD1( _TImage* image );
-
     template< class _TImage, class _TScalar >
-    inline void _GD2( _TImage* image );
+    inline void _GD1( _TImage* image );
   };
 
 } // ecapseman
diff --git a/plugins/ImageSliceFilters/ImageSliceFilters.i b/plugins/ImageSliceFilters/ImageSliceFilters.i
new file mode 100644 (file)
index 0000000..cd8395a
--- /dev/null
@@ -0,0 +1 @@
+** eof - $RCSfile$