--- /dev/null
+// -------------------------------------------------------------------------
+// @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$
--- /dev/null
+// -------------------------------------------------------------------------
+// @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$
--- /dev/null
+// -------------------------------------------------------------------------
+// @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$
--- /dev/null
+// -------------------------------------------------------------------------
+// @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$
GaussianImageFilters ${arg}
${pfx}ScalarImagesBaseFilters ${pfx}ScalarVectorImagesBaseFilters
)
+cpPlugins_WrapInstances(MorphologicalImageFilters ${arg} ${pfx}ScalarImagesBaseFilters)
+cpPlugins_WrapInstances(ExtractImageFilters ${arg} ${pfx}ScalarImages)
SET(
cpPlugins_LIBRARIES
${pfx}ResamplingFilters
${pfx}DistanceMapFilters
${pfx}GaussianImageFilters
+ ${pfx}MorphologicalImageFilters
+ ${pfx}ExtractImageFilters
CACHE INTERNAL "All valid instances." FORCE
)
--- /dev/null
+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$
--- /dev/null
+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$
t itkBinaryThresholdImageFilter.h
t itkUnaryFunctorImageFilter.h
t itkSimpleDataObjectDecorator.h
+t cpExtensions/Algorithms/UnaryThresholdImageFilter.h
d #dims=2;3
d #int=char;short;int;long
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 > >
--- /dev/null
+#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$
--- /dev/null
+#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$
--- /dev/null
+#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$
--- /dev/null
+#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$
: 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;
: 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;
--- /dev/null
+#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$
--- /dev/null
+#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$
--- /dev/null
+#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$
--- /dev/null
+#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$
-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."