]> Creatis software - cpPlugins.git/commitdiff
New plugins added.
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Tue, 21 Jun 2016 22:09:33 +0000 (17:09 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Tue, 21 Jun 2016 22:09:33 +0000 (17:09 -0500)
19 files changed:
lib/cpExtensions/Algorithms/RegionOfInterestImageCalculator.h [new file with mode: 0644]
lib/cpExtensions/Algorithms/RegionOfInterestImageCalculator.hxx [new file with mode: 0644]
lib/cpExtensions/Algorithms/UnaryThresholdImageFilter.h [new file with mode: 0644]
lib/cpExtensions/Algorithms/UnaryThresholdImageFilter.hxx [new file with mode: 0644]
lib/cpPlugins_Instances/CMakeLists.txt
lib/cpPlugins_Instances/ExtractImageFilters.i [new file with mode: 0644]
lib/cpPlugins_Instances/MorphologicalImageFilters.i [new file with mode: 0644]
lib/cpPlugins_Instances/ThresholdFilters.i
plugins/cpPluginsImageFilters/BinaryDilateParaImageFilter.cxx [new file with mode: 0644]
plugins/cpPluginsImageFilters/BinaryDilateParaImageFilter.h [new file with mode: 0644]
plugins/cpPluginsImageFilters/BinaryErodeParaImageFilter.cxx [new file with mode: 0644]
plugins/cpPluginsImageFilters/BinaryErodeParaImageFilter.h [new file with mode: 0644]
plugins/cpPluginsImageFilters/CastImageFilter.h
plugins/cpPluginsImageFilters/OrImageFilter.h
plugins/cpPluginsImageFilters/RegionOfInterestImageFilter.cxx [new file with mode: 0644]
plugins/cpPluginsImageFilters/RegionOfInterestImageFilter.h [new file with mode: 0644]
plugins/cpPluginsImageFilters/UnaryThresholdImageFilter.cxx [new file with mode: 0644]
plugins/cpPluginsImageFilters/UnaryThresholdImageFilter.h [new file with mode: 0644]
third_party_installers/cpPlugins_Install_ITK.sh

diff --git a/lib/cpExtensions/Algorithms/RegionOfInterestImageCalculator.h b/lib/cpExtensions/Algorithms/RegionOfInterestImageCalculator.h
new file mode 100644 (file)
index 0000000..84102ad
--- /dev/null
@@ -0,0 +1,73 @@
+// -------------------------------------------------------------------------
+// @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
+// -------------------------------------------------------------------------
+
+#ifndef __CPEXTENSIONS__ALGORITHMS__REGIONOFINTERESTIMAGECALCULATOR__H__
+#define __CPEXTENSIONS__ALGORITHMS__REGIONOFINTERESTIMAGECALCULATOR__H__
+
+#include <itkObject.h>
+#include <itkObjectFactory.h>
+
+namespace cpExtensions
+{
+  namespace Algorithms
+  {
+    /**
+     */
+    template< class _TImage >
+    class RegionOfInterestImageCalculator
+      : public itk::Object
+    {
+    public:
+      // Basic types
+      typedef RegionOfInterestImageCalculator Self;
+      typedef itk::Object                     Superclass;
+      typedef itk::SmartPointer< Self >       Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
+
+      typedef _TImage TImage;
+      typedef typename _TImage::IndexType TIndex;
+      typedef typename _TImage::PixelType TPixel;
+
+    public:
+      itkNewMacro( Self );
+      itkTypeMacro( RegionOfInterestImageCalculator, itkObject );
+
+      itkGetConstObjectMacro( Image, _TImage );
+      itkGetConstMacro( BackgroundValue, TPixel );
+      itkGetConstMacro( Minimum, TIndex );
+      itkGetConstMacro( Maximum, TIndex );
+
+      itkSetConstObjectMacro( Image, _TImage );
+      itkSetMacro( BackgroundValue, TPixel );
+
+    public:
+      void Compute( );
+      
+    protected:
+      RegionOfInterestImageCalculator( );
+      virtual ~RegionOfInterestImageCalculator( );
+
+    private:
+      // Purposely not implemented
+      RegionOfInterestImageCalculator( const Self& );
+      void operator=( const Self& );
+
+    protected:
+      typename _TImage::ConstPointer m_Image;
+      TPixel m_BackgroundValue;
+      TIndex m_Minimum;
+      TIndex m_Maximum;
+    };
+
+  } // ecapseman
+
+} // ecapseman
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#  include <cpExtensions/Algorithms/RegionOfInterestImageCalculator.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+
+#endif // __CPEXTENSIONS__ALGORITHMS__REGIONOFINTERESTIMAGECALCULATOR__H__
+
+// eof - $RCSfile$
diff --git a/lib/cpExtensions/Algorithms/RegionOfInterestImageCalculator.hxx b/lib/cpExtensions/Algorithms/RegionOfInterestImageCalculator.hxx
new file mode 100644 (file)
index 0000000..fd7867f
--- /dev/null
@@ -0,0 +1,92 @@
+// -------------------------------------------------------------------------
+// @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
+// -------------------------------------------------------------------------
+
+#ifndef __CPEXTENSIONS__ALGORITHMS__REGIONOFINTERESTIMAGECALCULATOR__HXX__
+#define __CPEXTENSIONS__ALGORITHMS__REGIONOFINTERESTIMAGECALCULATOR__HXX__
+
+#include <itkImageRegionConstIteratorWithIndex.h>
+
+// -------------------------------------------------------------------------
+template< class _TImage >
+void cpExtensions::Algorithms::RegionOfInterestImageCalculator< _TImage >::
+Compute( )
+{
+  typedef itk::ImageRegionConstIteratorWithIndex< _TImage > _TIterator;
+  typedef typename _TImage::RegionType _TRegion;
+
+  if( this->m_Image.IsNotNull( ) )
+  {
+    _TRegion region = this->m_Image->GetRequestedRegion( );
+    TIndex minidx = region.GetIndex( );
+    TIndex maxidx = minidx + region.GetSize( );
+    for( unsigned int d = 0; d < _TImage::ImageDimension; ++d )
+      maxidx[ d ] -= 1;
+
+    bool first = true;
+    _TIterator i( this->m_Image, region );
+    for( i.GoToBegin( ); !i.IsAtEnd( ); ++i )
+    {
+      if( i.Get( ) != this->m_BackgroundValue )
+      {
+        TIndex idx = i.GetIndex( );
+        if( !first )
+        {
+          for( unsigned int d = 0; d < _TImage::ImageDimension; ++d )
+          {
+            minidx[ d ] = ( idx[ d ] < minidx[ d ] )? idx[ d ]: minidx[ d ];
+            maxidx[ d ] = ( idx[ d ] > maxidx[ d ] )? idx[ d ]: maxidx[ d ];
+
+          } // rof
+        }
+        else
+        {
+          minidx = maxidx = idx;
+          first = false;
+
+        } // fi
+
+      } // fi
+
+    } // rof
+    this->m_Minimum = minidx;
+    this->m_Maximum = maxidx;
+  }
+  else
+  {
+    this->m_Minimum.Fill( 0 );
+    this->m_Maximum.Fill( 0 );
+
+  } // fi
+}
+      
+// -------------------------------------------------------------------------
+template< class _TImage >
+cpExtensions::Algorithms::RegionOfInterestImageCalculator< _TImage >::
+RegionOfInterestImageCalculator( )
+  : Superclass( ),
+    m_BackgroundValue( TPixel( 0 ) )
+{
+  this->m_Minimum.Fill( 0 );
+  this->m_Maximum.Fill( 0 );
+}
+
+// -------------------------------------------------------------------------
+template< class _TImage >
+cpExtensions::Algorithms::RegionOfInterestImageCalculator< _TImage >::
+~RegionOfInterestImageCalculator( )
+{
+}
+
+
+/* TODO
+   typename _TImage::ConstPointer m_Image;
+   TPixel m_BackgroundValue;
+   TIndex m_Minimum;
+   TIndex m_Maximum;
+   };
+*/
+
+#endif // __CPEXTENSIONS__ALGORITHMS__REGIONOFINTERESTIMAGECALCULATOR__HXX__
+
+// eof - $RCSfile$
diff --git a/lib/cpExtensions/Algorithms/UnaryThresholdImageFilter.h b/lib/cpExtensions/Algorithms/UnaryThresholdImageFilter.h
new file mode 100644 (file)
index 0000000..7de8b66
--- /dev/null
@@ -0,0 +1,102 @@
+// -------------------------------------------------------------------------
+// @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
+// -------------------------------------------------------------------------
+
+#ifndef __CPEXTENSIONS__ALGORITHMS__UNARYTHRESHOLDIMAGEFILTER__H__
+#define __CPEXTENSIONS__ALGORITHMS__UNARYTHRESHOLDIMAGEFILTER__H__
+
+#include <itkUnaryFunctorImageFilter.h>
+
+namespace cpExtensions
+{
+  namespace Algorithms
+  {
+    namespace Functor
+    {
+      /**
+       */
+      template< typename _TInput >
+      class UnaryThreshold
+      {
+      public:
+        UnaryThreshold( );
+        virtual ~UnaryThreshold( );
+
+        const _TInput& GetThreshold( ) const;
+        const _TInput& GetInsideValue( ) const;
+        const _TInput& GetOutsideValue( ) const;
+        const bool& GetStrict( ) const;
+
+        void StrictOn( );
+        void StrictOff( );
+        void SetStrict( bool s );
+        void SetThreshold( const _TInput& thresh );
+        void SetInsideValue( const _TInput& value );
+        void SetOutsideValue( const _TInput& value );
+        bool operator!=( const UnaryThreshold& other ) const;
+        bool operator==( const UnaryThreshold& other ) const;
+        _TInput operator()( const _TInput& A ) const;
+
+      private:
+        _TInput m_Threshold;
+        _TInput m_InsideValue;
+        _TInput m_OutsideValue;
+        bool    m_Strict;
+      };
+    }
+
+    /**
+     */
+    template< class _TImage >
+    class UnaryThresholdImageFilter
+      : public itk::UnaryFunctorImageFilter< _TImage, _TImage, cpExtensions::Algorithms::Functor::UnaryThreshold< typename _TImage::PixelType > >
+    {
+    public:
+      // Basic types
+      typedef typename _TImage::PixelType TPixel;
+      typedef cpExtensions::Algorithms::Functor::UnaryThreshold< TPixel > TFunctor;
+      typedef itk::UnaryFunctorImageFilter< _TImage, _TImage, TFunctor > Superclass;
+      typedef UnaryThresholdImageFilter       Self;
+      typedef itk::SmartPointer< Self >       Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
+
+      typedef _TImage TImage;
+
+    public:
+      itkNewMacro( Self );
+      itkTypeMacro( UnaryThresholdImageFilter, itkUnaryFunctorImageFilter );
+
+    public:
+      const TPixel& GetThreshold( ) const;
+      const TPixel& GetInsideValue( ) const;
+      const TPixel& GetOutsideValue( ) const;
+      const bool&    GetStrict( ) const;
+
+      void StrictOn( );
+      void StrictOff( );
+      void SetStrict( bool s );
+      void SetThreshold( const TPixel& thresh );
+      void SetInsideValue( const TPixel& value );
+      void SetOutsideValue( const TPixel& value );
+      
+    protected:
+      UnaryThresholdImageFilter( );
+      virtual ~UnaryThresholdImageFilter( );
+
+    private:
+      // Purposely not implemented
+      UnaryThresholdImageFilter( const Self& );
+      void operator=( const Self& );
+    };
+
+  } // ecapseman
+
+} // ecapseman
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#  include <cpExtensions/Algorithms/UnaryThresholdImageFilter.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+
+#endif // __CPEXTENSIONS__ALGORITHMS__UNARYTHRESHOLDIMAGEFILTER__H__
+
+// eof - $RCSfile$
diff --git a/lib/cpExtensions/Algorithms/UnaryThresholdImageFilter.hxx b/lib/cpExtensions/Algorithms/UnaryThresholdImageFilter.hxx
new file mode 100644 (file)
index 0000000..ff85edd
--- /dev/null
@@ -0,0 +1,245 @@
+// -------------------------------------------------------------------------
+// @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
+// -------------------------------------------------------------------------
+
+#ifndef __CPEXTENSIONS__ALGORITHMS__UNARYTHRESHOLDIMAGEFILTER__HXX__
+#define __CPEXTENSIONS__ALGORITHMS__UNARYTHRESHOLDIMAGEFILTER__HXX__
+
+// -------------------------------------------------------------------------
+template< typename _TInput >
+cpExtensions::Algorithms::Functor::UnaryThreshold< _TInput >::
+UnaryThreshold( )
+  : m_Strict( false )
+{
+  this->m_Threshold    = itk::NumericTraits< _TInput >::NonpositiveMin( );
+  this->m_OutsideValue = itk::NumericTraits< _TInput >::ZeroValue( );
+  this->m_InsideValue  = itk::NumericTraits< _TInput >::max( );
+}
+
+// -------------------------------------------------------------------------
+template< typename _TInput >
+cpExtensions::Algorithms::Functor::UnaryThreshold< _TInput >::
+~UnaryThreshold( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< typename _TInput >
+const _TInput& cpExtensions::Algorithms::Functor::UnaryThreshold< _TInput >::
+GetThreshold( ) const
+{
+  return( this->m_Threshold );
+}
+
+// -------------------------------------------------------------------------
+template< typename _TInput >
+const _TInput& cpExtensions::Algorithms::Functor::UnaryThreshold< _TInput >::
+GetInsideValue( ) const
+{
+  return( this->m_InsideValue );
+}
+
+// -------------------------------------------------------------------------
+template< typename _TInput >
+const _TInput& cpExtensions::Algorithms::Functor::UnaryThreshold< _TInput >::
+GetOutsideValue( ) const
+{
+  return( this->m_OutsideValue );
+}
+
+// -------------------------------------------------------------------------
+template< typename _TInput >
+const bool& cpExtensions::Algorithms::Functor::UnaryThreshold< _TInput >::
+GetStrict( ) const
+{
+  return( this->m_Strict );
+}
+
+// -------------------------------------------------------------------------
+template< typename _TInput >
+void cpExtensions::Algorithms::Functor::UnaryThreshold< _TInput >::
+StrictOn( )
+{
+  this->SetStrict( true );
+}
+
+// -------------------------------------------------------------------------
+template< typename _TInput >
+void cpExtensions::Algorithms::Functor::UnaryThreshold< _TInput >::
+StrictOff( )
+{
+  this->SetStrict( false );
+}
+
+// -------------------------------------------------------------------------
+template< typename _TInput >
+void cpExtensions::Algorithms::Functor::UnaryThreshold< _TInput >::
+SetStrict( bool s )
+{
+  this->m_Strict = s;
+}
+
+// -------------------------------------------------------------------------
+template< typename _TInput >
+void cpExtensions::Algorithms::Functor::UnaryThreshold< _TInput >::
+SetThreshold( const _TInput& thresh )
+{
+  this->m_Threshold = thresh;
+}
+
+// -------------------------------------------------------------------------
+template< typename _TInput >
+void cpExtensions::Algorithms::Functor::UnaryThreshold< _TInput >::
+SetInsideValue( const _TInput& value )
+{
+  this->m_InsideValue = value;
+}
+
+// -------------------------------------------------------------------------
+template< typename _TInput >
+void cpExtensions::Algorithms::Functor::UnaryThreshold< _TInput >::
+SetOutsideValue( const _TInput& value )
+{
+  this->m_OutsideValue = value;
+}
+
+// -------------------------------------------------------------------------
+template< typename _TInput >
+bool cpExtensions::Algorithms::Functor::UnaryThreshold< _TInput >::
+operator!=( const UnaryThreshold& other ) const
+{
+  return(
+    this->m_Threshold != other.m_Threshold ||
+    itk::Math::NotExactlyEquals( this->m_InsideValue, other.m_InsideValue ) ||
+    itk::Math::NotExactlyEquals( this->m_OutsideValue, other.m_OutsideValue )
+    );
+}
+
+// -------------------------------------------------------------------------
+template< typename _TInput >
+bool cpExtensions::Algorithms::Functor::UnaryThreshold< _TInput >::
+operator==( const UnaryThreshold& other ) const
+{
+  return( !( *this != other ) );
+}
+
+// -------------------------------------------------------------------------
+template< typename _TInput >
+_TInput cpExtensions::Algorithms::Functor::UnaryThreshold< _TInput >::
+operator()( const _TInput& A ) const
+{
+  if( this->m_Strict )
+  {
+    if( this->m_Threshold < A  )
+      return( this->m_InsideValue );
+    return( this->m_OutsideValue );
+  }
+  else
+  {
+    if( this->m_Threshold <= A  )
+      return( this->m_InsideValue );
+    return( this->m_OutsideValue );
+
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+template< class _TImage >
+const typename cpExtensions::Algorithms::UnaryThresholdImageFilter< _TImage >::
+TPixel& cpExtensions::Algorithms::UnaryThresholdImageFilter< _TImage >::
+GetThreshold( ) const
+{
+  return( this->GetFunctor( ).GetThreshold( ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TImage >
+const typename cpExtensions::Algorithms::UnaryThresholdImageFilter< _TImage >::
+TPixel& cpExtensions::Algorithms::UnaryThresholdImageFilter< _TImage >::
+GetInsideValue( ) const
+{
+  return( this->GetFunctor( ).GetInsideValue( ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TImage >
+const typename cpExtensions::Algorithms::UnaryThresholdImageFilter< _TImage >::
+TPixel& cpExtensions::Algorithms::UnaryThresholdImageFilter< _TImage >::
+GetOutsideValue( ) const
+{
+  return( this->GetFunctor( ).GetOutsideValue( ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TImage >
+const bool& cpExtensions::Algorithms::UnaryThresholdImageFilter< _TImage >::
+GetStrict( ) const
+{
+  return( this->GetFunctor( ).GetStrict( ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TImage >
+void cpExtensions::Algorithms::UnaryThresholdImageFilter< _TImage >::
+StrictOn( )
+{
+  this->GetFunctor( ).SetStrict( true );
+}
+
+// -------------------------------------------------------------------------
+template< class _TImage >
+void cpExtensions::Algorithms::UnaryThresholdImageFilter< _TImage >::
+StrictOff( )
+{
+  this->GetFunctor( ).SetStrict( false );
+}
+
+// -------------------------------------------------------------------------
+template< class _TImage >
+void cpExtensions::Algorithms::UnaryThresholdImageFilter< _TImage >::
+SetStrict( bool s )
+{
+  this->GetFunctor( ).SetStrict( s );
+}
+
+// -------------------------------------------------------------------------
+template< class _TImage >
+void cpExtensions::Algorithms::UnaryThresholdImageFilter< _TImage >::
+SetThreshold( const TPixel& thresh )
+{
+  this->GetFunctor( ).SetThreshold( thresh );
+}
+
+// -------------------------------------------------------------------------
+template< class _TImage >
+void cpExtensions::Algorithms::UnaryThresholdImageFilter< _TImage >::
+SetInsideValue( const TPixel& value )
+{
+  this->GetFunctor( ).SetInsideValue( value );
+}
+
+// -------------------------------------------------------------------------
+template< class _TImage >
+void cpExtensions::Algorithms::UnaryThresholdImageFilter< _TImage >::
+SetOutsideValue( const TPixel& value )
+{
+  this->GetFunctor( ).SetOutsideValue( value );
+}
+
+// -------------------------------------------------------------------------
+template< class _TImage >
+cpExtensions::Algorithms::UnaryThresholdImageFilter< _TImage >::
+UnaryThresholdImageFilter( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TImage >
+cpExtensions::Algorithms::UnaryThresholdImageFilter< _TImage >::
+~UnaryThresholdImageFilter( )
+{
+}
+
+#endif // __CPEXTENSIONS__ALGORITHMS__UNARYTHRESHOLDIMAGEFILTER__HXX__
+
+// eof - $RCSfile$
index cece9b5a869a29a3e46080e20212ef8a199c3885..d248386f17c213da486438b169e451963fd1254e 100644 (file)
@@ -50,6 +50,8 @@ cpPlugins_WrapInstances(
   GaussianImageFilters ${arg}
   ${pfx}ScalarImagesBaseFilters ${pfx}ScalarVectorImagesBaseFilters
   )
+cpPlugins_WrapInstances(MorphologicalImageFilters ${arg} ${pfx}ScalarImagesBaseFilters)
+cpPlugins_WrapInstances(ExtractImageFilters ${arg} ${pfx}ScalarImages)
 
 SET(
   cpPlugins_LIBRARIES
@@ -73,6 +75,8 @@ SET(
   ${pfx}ResamplingFilters
   ${pfx}DistanceMapFilters
   ${pfx}GaussianImageFilters
+  ${pfx}MorphologicalImageFilters
+  ${pfx}ExtractImageFilters
   CACHE INTERNAL "All valid instances." FORCE
   )
 
diff --git a/lib/cpPlugins_Instances/ExtractImageFilters.i b/lib/cpPlugins_Instances/ExtractImageFilters.i
new file mode 100644 (file)
index 0000000..4d0e548
--- /dev/null
@@ -0,0 +1,18 @@
+d #ints=char;short;int;long
+d #uints=unsigned #ints
+d #floats=float;double
+d #pixels=#ints;#uints;#floats
+d #dims=2;3
+
+i cpPlugins_Instances/ScalarImages.h
+t cpExtensions/Algorithms/RegionOfInterestImageCalculator.h
+t itkRegionOfInterestImageFilter.h
+
+* ===========
+* = Filters =
+* ===========
+
+c cpExtensions::Algorithms::RegionOfInterestImageCalculator< itk::Image< #pixels, #dims > >
+c itk::RegionOfInterestImageFilter< itk::Image< #pixels, #dims >, itk::Image< #pixels, #dims > >
+
+* eof - $RCSfile$
diff --git a/lib/cpPlugins_Instances/MorphologicalImageFilters.i b/lib/cpPlugins_Instances/MorphologicalImageFilters.i
new file mode 100644 (file)
index 0000000..f5d6c1e
--- /dev/null
@@ -0,0 +1,21 @@
+d #ints=char;short;int;long
+d #uints=unsigned #ints
+d #floats=float;double
+d #pixels=#ints;#uints;#floats
+d #dims=2;3
+d #itk_filters=BinaryDilateParaImage;BinaryErodeParaImage
+
+i cpPlugins_Instances/ScalarImagesBaseFilters.h
+t itkParabolicErodeDilateImageFilter.h
+t itk{#itk_filters}Filter.h
+t itkUnaryFunctorImageFilter.h
+
+* ===========
+* = Filters =
+* ===========
+
+c itk::UnaryFunctorImageFilter< itk::Image< #pixels, #dims >, itk::Image< double, #dims >, itk::Functor::GEConst< #pixels, double > >
+c itk::ParabolicErodeDilateImageFilter< itk::Image< double, #dims >, false, itk::Image< #pixels, #dims > >
+c itk::{#itk_filters}Filter< itk::Image< #pixels, #dims > >
+
+* eof - $RCSfile$
index 9d1a884e6a1a8d56e551b1e1780ce570307befaf..99b860b0a007ca19e2ba4db65c0c782ef690e5a4 100644 (file)
@@ -3,6 +3,7 @@ f cpPlugins_Instances/ScalarImagesBaseFilters.h
 t itkBinaryThresholdImageFilter.h
 t itkUnaryFunctorImageFilter.h
 t itkSimpleDataObjectDecorator.h
+t cpExtensions/Algorithms/UnaryThresholdImageFilter.h
 
 d #dims=2;3
 d #int=char;short;int;long
@@ -11,3 +12,4 @@ d #scalar=#int;unsigned #int;#float
 d #output=#int;unsigned #int;#float
 
 c itk::BinaryThresholdImageFilter< itk::Image< #scalar, #dims >, itk::Image< #output, #dims > >
+c cpExtensions::Algorithms::UnaryThresholdImageFilter< itk::Image< #scalar, #dims > >
diff --git a/plugins/cpPluginsImageFilters/BinaryDilateParaImageFilter.cxx b/plugins/cpPluginsImageFilters/BinaryDilateParaImageFilter.cxx
new file mode 100644 (file)
index 0000000..fe37f74
--- /dev/null
@@ -0,0 +1,53 @@
+#include <cpPluginsImageFilters/BinaryDilateParaImageFilter.h>
+#include <cpPlugins/Image.h>
+#include <cpPlugins_Instances/MorphologicalImageFilters.h>
+
+// -------------------------------------------------------------------------
+cpPluginsImageFilters::BinaryDilateParaImageFilter::
+BinaryDilateParaImageFilter( )
+  : Superclass( )
+{
+  this->_AddInput( "Input" );
+  this->_AddOutput< cpPlugins::Image >( "Output" );
+  this->m_Parameters.ConfigureAsReal( "Radius" );
+  this->m_Parameters.ConfigureAsBool( "Circular" );
+  this->m_Parameters.ConfigureAsBool( "UseImageSpacing" );
+
+  this->m_Parameters.SetReal( "Radius", 3 );
+  this->m_Parameters.SetBool( "Circular", true );
+  this->m_Parameters.SetBool( "UseImageSpacing", false );
+}
+
+// -------------------------------------------------------------------------
+cpPluginsImageFilters::BinaryDilateParaImageFilter::
+~BinaryDilateParaImageFilter( )
+{
+}
+
+// -------------------------------------------------------------------------
+void cpPluginsImageFilters::BinaryDilateParaImageFilter::
+_GenerateData( )
+{
+  auto image = this->GetInputData< itk::DataObject >( "Input" );
+  cpPlugins_Image_Demangle_Pixel_AllScalars     ( _GD0, image, 2 );
+  else cpPlugins_Image_Demangle_Pixel_AllScalars( _GD0, image, 3 );
+  else this->_Error( "No valid input image." );
+}
+
+// -------------------------------------------------------------------------
+template< class _TInputImage >
+void cpPluginsImageFilters::BinaryDilateParaImageFilter::
+_GD0( _TInputImage* input_image )
+{
+  typedef itk::BinaryDilateParaImageFilter< _TInputImage > _TFilter;
+
+  auto filter = this->_CreateITK< _TFilter >( );
+  filter->SetInput( input_image );
+  filter->SetRadius( this->m_Parameters.GetReal( "Radius" ) );
+  filter->SetCircular( this->m_Parameters.GetBool( "Circular" ) );
+  filter->SetUseImageSpacing( this->m_Parameters.GetBool( "UseImageSpacing" ) );
+  filter->Update( );
+  this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
+}
+
+// eof - $RCSfile$
diff --git a/plugins/cpPluginsImageFilters/BinaryDilateParaImageFilter.h b/plugins/cpPluginsImageFilters/BinaryDilateParaImageFilter.h
new file mode 100644 (file)
index 0000000..36f957a
--- /dev/null
@@ -0,0 +1,44 @@
+#ifndef __CPPLUGINSIMAGEFILTERS__BINARYDILATEPARAIMAGEFILTER__H__
+#define __CPPLUGINSIMAGEFILTERS__BINARYDILATEPARAIMAGEFILTER__H__
+
+#include <plugins/cpPluginsImageFilters/cpPluginsImageFilters_Export.h>
+#include <cpPlugins/ProcessObject.h>
+
+namespace cpPluginsImageFilters
+{
+  /**
+   */
+  class cpPluginsImageFilters_EXPORT BinaryDilateParaImageFilter
+    : public cpPlugins::ProcessObject
+  {
+  public:
+    typedef BinaryDilateParaImageFilter     Self;
+    typedef cpPlugins::ProcessObject        Superclass;
+    typedef itk::SmartPointer< Self >       Pointer;
+    typedef itk::SmartPointer< const Self > ConstPointer;
+
+  public:
+    itkNewMacro( Self );
+    itkTypeMacro( BinaryDilateParaImageFilter, cpPlugins::ProcessObject );
+    cpPlugins_Id_Macro( BinaryDilateParaImageFilter, ImageFilters );
+
+  protected:
+    BinaryDilateParaImageFilter( );
+    virtual ~BinaryDilateParaImageFilter( );
+
+    virtual void _GenerateData( ) ITK_OVERRIDE;
+
+    template< class _TInputImage >
+      inline void _GD0( _TInputImage* input_image );
+
+  private:
+    // Purposely not implemented
+    BinaryDilateParaImageFilter( const Self& );
+    Self& operator=( const Self& );
+  };
+
+} // ecapseman
+
+#endif // __CPPLUGINSIMAGEFILTERS__BINARYDILATEPARAIMAGEFILTER__H__
+
+// eof - $RCSfile$
diff --git a/plugins/cpPluginsImageFilters/BinaryErodeParaImageFilter.cxx b/plugins/cpPluginsImageFilters/BinaryErodeParaImageFilter.cxx
new file mode 100644 (file)
index 0000000..7aad8cc
--- /dev/null
@@ -0,0 +1,53 @@
+#include <cpPluginsImageFilters/BinaryErodeParaImageFilter.h>
+#include <cpPlugins/Image.h>
+#include <cpPlugins_Instances/MorphologicalImageFilters.h>
+
+// -------------------------------------------------------------------------
+cpPluginsImageFilters::BinaryErodeParaImageFilter::
+BinaryErodeParaImageFilter( )
+  : Superclass( )
+{
+  this->_AddInput( "Input" );
+  this->_AddOutput< cpPlugins::Image >( "Output" );
+  this->m_Parameters.ConfigureAsReal( "Radius" );
+  this->m_Parameters.ConfigureAsBool( "Circular" );
+  this->m_Parameters.ConfigureAsBool( "UseImageSpacing" );
+
+  this->m_Parameters.SetReal( "Radius", 3 );
+  this->m_Parameters.SetBool( "Circular", true );
+  this->m_Parameters.SetBool( "UseImageSpacing", false );
+}
+
+// -------------------------------------------------------------------------
+cpPluginsImageFilters::BinaryErodeParaImageFilter::
+~BinaryErodeParaImageFilter( )
+{
+}
+
+// -------------------------------------------------------------------------
+void cpPluginsImageFilters::BinaryErodeParaImageFilter::
+_GenerateData( )
+{
+  auto image = this->GetInputData< itk::DataObject >( "Input" );
+  cpPlugins_Image_Demangle_Pixel_AllScalars     ( _GD0, image, 2 );
+  else cpPlugins_Image_Demangle_Pixel_AllScalars( _GD0, image, 3 );
+  else this->_Error( "No valid input image." );
+}
+
+// -------------------------------------------------------------------------
+template< class _TInputImage >
+void cpPluginsImageFilters::BinaryErodeParaImageFilter::
+_GD0( _TInputImage* input_image )
+{
+  typedef itk::BinaryErodeParaImageFilter< _TInputImage > _TFilter;
+
+  auto filter = this->_CreateITK< _TFilter >( );
+  filter->SetInput( input_image );
+  filter->SetRadius( this->m_Parameters.GetReal( "Radius" ) );
+  filter->SetCircular( this->m_Parameters.GetBool( "Circular" ) );
+  filter->SetUseImageSpacing( this->m_Parameters.GetBool( "UseImageSpacing" ) );
+  filter->Update( );
+  this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
+}
+
+// eof - $RCSfile$
diff --git a/plugins/cpPluginsImageFilters/BinaryErodeParaImageFilter.h b/plugins/cpPluginsImageFilters/BinaryErodeParaImageFilter.h
new file mode 100644 (file)
index 0000000..a7c9c41
--- /dev/null
@@ -0,0 +1,44 @@
+#ifndef __CPPLUGINSIMAGEFILTERS__BINARYERODEPARAIMAGEFILTER__H__
+#define __CPPLUGINSIMAGEFILTERS__BINARYERODEPARAIMAGEFILTER__H__
+
+#include <plugins/cpPluginsImageFilters/cpPluginsImageFilters_Export.h>
+#include <cpPlugins/ProcessObject.h>
+
+namespace cpPluginsImageFilters
+{
+  /**
+   */
+  class cpPluginsImageFilters_EXPORT BinaryErodeParaImageFilter
+    : public cpPlugins::ProcessObject
+  {
+  public:
+    typedef BinaryErodeParaImageFilter     Self;
+    typedef cpPlugins::ProcessObject        Superclass;
+    typedef itk::SmartPointer< Self >       Pointer;
+    typedef itk::SmartPointer< const Self > ConstPointer;
+
+  public:
+    itkNewMacro( Self );
+    itkTypeMacro( BinaryErodeParaImageFilter, cpPlugins::ProcessObject );
+    cpPlugins_Id_Macro( BinaryErodeParaImageFilter, ImageFilters );
+
+  protected:
+    BinaryErodeParaImageFilter( );
+    virtual ~BinaryErodeParaImageFilter( );
+
+    virtual void _GenerateData( ) ITK_OVERRIDE;
+
+    template< class _TInputImage >
+      inline void _GD0( _TInputImage* input_image );
+
+  private:
+    // Purposely not implemented
+    BinaryErodeParaImageFilter( const Self& );
+    Self& operator=( const Self& );
+  };
+
+} // ecapseman
+
+#endif // __CPPLUGINSIMAGEFILTERS__BINARYERODEPARAIMAGEFILTER__H__
+
+// eof - $RCSfile$
index d9760b0db68b3bbf51c706d51f9172cacfa9bb57..e3b0eda0ce17bf17b0d7a644148e63162b7c366a 100644 (file)
@@ -12,7 +12,7 @@ namespace cpPluginsImageFilters
     : public cpPlugins::ProcessObject
   {
   public:
-    typedef CastImageFilter      Self;
+    typedef CastImageFilter                 Self;
     typedef cpPlugins::ProcessObject        Superclass;
     typedef itk::SmartPointer< Self >       Pointer;
     typedef itk::SmartPointer< const Self > ConstPointer;
index a970d6145f7b8d9795c84f386120aa931db7366f..f7658b4e206b414bbb9d54435095b63758fda2fb 100644 (file)
@@ -12,7 +12,7 @@ namespace cpPluginsImageFilters
     : public cpPlugins::ProcessObject
   {
   public:
-    typedef OrImageFilter      Self;
+    typedef OrImageFilter                   Self;
     typedef cpPlugins::ProcessObject        Superclass;
     typedef itk::SmartPointer< Self >       Pointer;
     typedef itk::SmartPointer< const Self > ConstPointer;
diff --git a/plugins/cpPluginsImageFilters/RegionOfInterestImageFilter.cxx b/plugins/cpPluginsImageFilters/RegionOfInterestImageFilter.cxx
new file mode 100644 (file)
index 0000000..6a18098
--- /dev/null
@@ -0,0 +1,72 @@
+#include <cpPluginsImageFilters/RegionOfInterestImageFilter.h>
+#include <cpPlugins/Image.h>
+#include <cpPlugins_Instances/ExtractImageFilters.h>
+
+// -------------------------------------------------------------------------
+cpPluginsImageFilters::RegionOfInterestImageFilter::
+RegionOfInterestImageFilter( )
+  : Superclass( )
+{
+  this->_AddInput( "Input" );
+  this->_AddOutput< cpPlugins::Image >( "Output" );
+  this->m_Parameters.ConfigureAsBool( "AutomaticRegion" );
+  this->m_Parameters.ConfigureAsReal( "BackgroundValue" );
+  this->m_Parameters.SetBool( "AutomaticRegion", true );
+  this->m_Parameters.SetReal( "BackgroundValue", 0 );
+}
+
+// -------------------------------------------------------------------------
+cpPluginsImageFilters::RegionOfInterestImageFilter::
+~RegionOfInterestImageFilter( )
+{
+}
+
+// -------------------------------------------------------------------------
+void cpPluginsImageFilters::RegionOfInterestImageFilter::
+_GenerateData( )
+{
+  auto image = this->GetInputData< itk::DataObject >( "Input" );
+  cpPlugins_Image_Demangle_Pixel_AllScalars     ( _GD0, image, 2 );
+  else cpPlugins_Image_Demangle_Pixel_AllScalars( _GD0, image, 3 );
+  else this->_Error( "No valid input image." );
+}
+
+// -------------------------------------------------------------------------
+template< class _TInputImage >
+void cpPluginsImageFilters::RegionOfInterestImageFilter::
+_GD0( _TInputImage* image )
+{
+  typedef
+    itk::RegionOfInterestImageFilter< _TInputImage, _TInputImage >
+    _TFilter;
+  typedef
+    cpExtensions::Algorithms::RegionOfInterestImageCalculator< _TInputImage >
+    _TCalculator;
+
+  if( this->m_Parameters.GetBool( "AutomaticRegion" ) )
+  {
+    typename _TCalculator::Pointer calculator = _TCalculator::New( );
+    calculator->SetImage( image );
+    calculator->Compute( );
+
+    auto minidx = calculator->GetMinimum( );
+    auto maxidx = calculator->GetMaximum( );
+    typename _TInputImage::SizeType size;
+    for( unsigned int d = 0; d < _TInputImage::ImageDimension; ++d )
+      size[ d ] = maxidx[ d ] - minidx[ d ] + 1;
+
+    typename _TInputImage::RegionType roi;
+    roi.SetIndex( minidx );
+    roi.SetSize( size );
+    
+    auto filter = this->_CreateITK< _TFilter >( );
+    filter->SetInput( image );
+    filter->SetRegionOfInterest( roi );
+    filter->Update( );
+    this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
+  }
+  else
+    this->_Error( "Manual region not yet implemented." );
+}
+
+// eof - $RCSfile$
diff --git a/plugins/cpPluginsImageFilters/RegionOfInterestImageFilter.h b/plugins/cpPluginsImageFilters/RegionOfInterestImageFilter.h
new file mode 100644 (file)
index 0000000..b1294b1
--- /dev/null
@@ -0,0 +1,44 @@
+#ifndef __CPPLUGINSIMAGEFILTERS__REGIONOFINTERESTIMAGEFILTER__H__
+#define __CPPLUGINSIMAGEFILTERS__REGIONOFINTERESTIMAGEFILTER__H__
+
+#include <plugins/cpPluginsImageFilters/cpPluginsImageFilters_Export.h>
+#include <cpPlugins/ProcessObject.h>
+
+namespace cpPluginsImageFilters
+{
+  /**
+   */
+  class cpPluginsImageFilters_EXPORT RegionOfInterestImageFilter
+    : public cpPlugins::ProcessObject
+  {
+  public:
+    typedef RegionOfInterestImageFilter     Self;
+    typedef cpPlugins::ProcessObject        Superclass;
+    typedef itk::SmartPointer< Self >       Pointer;
+    typedef itk::SmartPointer< const Self > ConstPointer;
+
+  public:
+    itkNewMacro( Self );
+    itkTypeMacro( RegionOfInterestImageFilter, cpPlugins::ProcessObject );
+    cpPlugins_Id_Macro( RegionOfInterestImageFilter, ImageFilters );
+
+  protected:
+    RegionOfInterestImageFilter( );
+    virtual ~RegionOfInterestImageFilter( );
+
+    virtual void _GenerateData( ) ITK_OVERRIDE;
+
+    template< class _TInputImage >
+      inline void _GD0( _TInputImage* image );
+
+  private:
+    // Purposely not implemented
+    RegionOfInterestImageFilter( const Self& );
+    Self& operator=( const Self& );
+  };
+
+} // ecapseman
+
+#endif // __CPPLUGINSIMAGEFILTERS__REGIONOFINTERESTIMAGEFILTER__H__
+
+// eof - $RCSfile$
diff --git a/plugins/cpPluginsImageFilters/UnaryThresholdImageFilter.cxx b/plugins/cpPluginsImageFilters/UnaryThresholdImageFilter.cxx
new file mode 100644 (file)
index 0000000..e46ac82
--- /dev/null
@@ -0,0 +1,59 @@
+#include <cpPluginsImageFilters/UnaryThresholdImageFilter.h>
+#include <cpPlugins/Image.h>
+#include <cpPlugins_Instances/ThresholdFilters.h>
+
+// -------------------------------------------------------------------------
+cpPluginsImageFilters::UnaryThresholdImageFilter::
+UnaryThresholdImageFilter( )
+  : Superclass( )
+{
+  this->_AddInput( "Input" );
+  this->_AddOutput< cpPlugins::Image >( "Output" );
+
+  this->m_Parameters.ConfigureAsReal( "Threshold" );
+  this->m_Parameters.ConfigureAsReal( "InsideValue" );
+  this->m_Parameters.ConfigureAsReal( "OutsideValue" );
+  this->m_Parameters.ConfigureAsBool( "Strict" );
+
+  this->m_Parameters.SetReal( "Threshold", 0 );
+  this->m_Parameters.SetReal( "InsideValue", 1 );
+  this->m_Parameters.SetReal( "OutsideValue", 0 );
+  this->m_Parameters.SetBool( "Strict", false );
+}
+
+// -------------------------------------------------------------------------
+cpPluginsImageFilters::UnaryThresholdImageFilter::
+~UnaryThresholdImageFilter( )
+{
+}
+
+// -------------------------------------------------------------------------
+void cpPluginsImageFilters::UnaryThresholdImageFilter::
+_GenerateData( )
+{
+  auto image = this->GetInputData< itk::DataObject >( "Input" );
+  cpPlugins_Image_Demangle_Pixel_AllScalars     ( _GD0, image, 2 );
+  else cpPlugins_Image_Demangle_Pixel_AllScalars( _GD0, image, 3 );
+  else this->_Error( "No valid input image." );
+}
+
+// -------------------------------------------------------------------------
+template< class _TImage >
+void cpPluginsImageFilters::UnaryThresholdImageFilter::
+_GD0( _TImage* image )
+{
+  typedef
+    cpExtensions::Algorithms::UnaryThresholdImageFilter< _TImage >
+    _TFilter;
+
+  _TFilter* filter = this->_CreateITK< _TFilter >( );
+  filter->SetInput( image );
+  filter->SetThreshold( this->m_Parameters.GetReal( "Threshold" ) );
+  filter->SetInsideValue( this->m_Parameters.GetReal( "InsideValue" ) );
+  filter->SetOutsideValue( this->m_Parameters.GetReal( "OutsideValue" ) );
+  filter->SetStrict( this->m_Parameters.GetBool( "Strict" ) );
+  filter->Update( );
+  this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
+}
+
+// eof - $RCSfile$
diff --git a/plugins/cpPluginsImageFilters/UnaryThresholdImageFilter.h b/plugins/cpPluginsImageFilters/UnaryThresholdImageFilter.h
new file mode 100644 (file)
index 0000000..533690a
--- /dev/null
@@ -0,0 +1,44 @@
+#ifndef __CPPLUGINSIMAGEFILTERS__UNARYTHRESHOLDIMAGEFILTER__H__
+#define __CPPLUGINSIMAGEFILTERS__UNARYTHRESHOLDIMAGEFILTER__H__
+
+#include <plugins/cpPluginsImageFilters/cpPluginsImageFilters_Export.h>
+#include <cpPlugins/ProcessObject.h>
+
+namespace cpPluginsImageFilters
+{
+  /**
+   */
+  class cpPluginsImageFilters_EXPORT UnaryThresholdImageFilter
+    : public cpPlugins::ProcessObject
+  {
+  public:
+    typedef UnaryThresholdImageFilter      Self;
+    typedef cpPlugins::ProcessObject        Superclass;
+    typedef itk::SmartPointer< Self >       Pointer;
+    typedef itk::SmartPointer< const Self > ConstPointer;
+
+  public:
+    itkNewMacro( Self );
+    itkTypeMacro( UnaryThresholdImageFilter, cpPlugins::ProcessObject );
+    cpPlugins_Id_Macro( UnaryThresholdImageFilter, ImageFilters );
+
+  protected:
+    UnaryThresholdImageFilter( );
+    virtual ~UnaryThresholdImageFilter( );
+
+    virtual void _GenerateData( ) ITK_OVERRIDE;
+
+    template< class _TImage >
+      inline void _GD0( _TImage* image );
+
+  private:
+    // Purposely not implemented
+    UnaryThresholdImageFilter( const Self& );
+    Self& operator=( const Self& );
+  };
+
+} // ecapseman
+
+#endif // __CPPLUGINSIMAGEFILTERS__UNARYTHRESHOLDIMAGEFILTER__H__
+
+// eof - $RCSfile$
index 99dcd851ab913aa4f9e031d102a0a2e00acff861..51e0ea0ba62c37923759bdd485d802b7e8a72f6a 100755 (executable)
@@ -194,6 +194,7 @@ $cmake_exec \
     -DCMAKE_BUILD_TYPE:STRING=$build_type \
     -DModule_ITKReview:BOOL=ON \
     -DModule_ITKVtkGlue:BOOL=OFF \
+    -DModule_ParabolicMorphology:BOOL=ON \
     -DCMAKE_INSTALL_PREFIX:PATH=$prefix \
     ${source_dir}
 echo "==> Configuring sources... done."