iRoCS Toolbox  1.1.0
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes
atb::SeparableConvolutionFilter< DataT, Dim > Class Template Reference

The SeparableConvolutionFilter class implements direct separable convolution. More...

#include "libArrayToolbox/SeparableConvolutionFilter.hh"

Inheritance diagram for atb::SeparableConvolutionFilter< DataT, Dim >:
Collaboration diagram for atb::SeparableConvolutionFilter< DataT, Dim >:

Public Types

typedef DataT ResultT
 

Public Member Functions

 SeparableConvolutionFilter (BoundaryTreatmentType btType=ValueBT, DataT const &boundaryValue=traits< DataT >::zero)
 Deafult Constructor. More...
 
 SeparableConvolutionFilter (blitz::TinyVector< blitz::Array< DataT, 1 > *, Dim > const &kernels, BoundaryTreatmentType btType=ValueBT, DataT const &boundaryValue=traits< DataT >::zero)
 Constructor with kernel intialization. More...
 
 ~SeparableConvolutionFilter ()
 Destructor. More...
 
virtual void apply (Array< DataT, Dim > const &data, Array< DataT, Dim > &result, iRoCS::ProgressReporter *pr=NULL) const
 Apply the filter to the given Array. More...
 
void apply (blitz::Array< DataT, Dim > const &data, blitz::TinyVector< double, Dim > const &elementSizeUm, blitz::Array< DataT, Dim > &filtered, iRoCS::ProgressReporter *pr=NULL) const
 Convolve the given data Array with this filter. More...
 
virtual void applyAlongDim (Array< DataT, Dim > const &data, Array< DataT, Dim > &result, int dim, iRoCS::ProgressReporter *pr=NULL) const
 Apply the filter along the specified dimension. More...
 
void applyAlongDim (blitz::Array< DataT, Dim > const &data, blitz::TinyVector< double, Dim > const &elementSizeUm, blitz::Array< DataT, Dim > &filtered, int dim, iRoCS::ProgressReporter *pr=NULL) const
 Convolution of the data Array along the specified dimension using the filter kernel given through the kernel setters. More...
 
BoundaryTreatment< DataT, Dim > const & boundaryTreatment () const
 Get a read-only reference to the boundary treatment object associated with this filter. More...
 
void setBoundaryTreatment (BoundaryTreatmentType bt, DataT const &boundaryValue=traits< DataT >::zero)
 Change the boundary treatment type to the type specified. More...
 
void setBoundaryTreatment (BoundaryTreatment< DataT, Dim > const &bt)
 Change the boundary treatment type to the type specified. More...
 
void setKernelForDim (blitz::Array< DataT, 1 > const *kernel, int dim)
 Set the filtering kernel component for the specified dimension. More...
 
void setKernels (blitz::TinyVector< blitz::Array< DataT, 1 > *, Dim > const &kernels)
 Set the kernels for all data dimensions. More...
 

Static Public Member Functions

static void apply (blitz::Array< DataT, Dim > const &data, blitz::TinyVector< double, Dim > const &elementSizeUm, blitz::Array< DataT, Dim > &filtered, blitz::TinyVector< blitz::Array< DataT, 1 > *, Dim > const &kernels, BoundaryTreatmentType btType=ValueBT, DataT const &boundaryValue=traits< DataT >::zero, iRoCS::ProgressReporter *pr=NULL)
 Convolve the data Array with the given kernels using the specified boundary treatment policy. More...
 
static void apply (Array< DataT, Dim > const &data, Array< DataT, Dim > &filtered, blitz::TinyVector< blitz::Array< DataT, 1 > *, Dim > const &kernels, BoundaryTreatmentType btType=ValueBT, DataT const &boundaryValue=traits< DataT >::zero, iRoCS::ProgressReporter *pr=NULL)
 Convolve the data Array with the given kernels using the specified boundary treatment policy. More...
 

Protected Attributes

BoundaryTreatment< DataT, Dim > * p_bt
 The boundary treatment object to use for out-of-Array access. More...
 

Detailed Description

template<typename DataT, int Dim>
class atb::SeparableConvolutionFilter< DataT, Dim >

The SeparableConvolutionFilter class implements direct separable convolution.

Compared to the ATB::convolve() functions this class provides functions with minimum memory overhead. The filters are parallelized and memory traversal is near optimum to give reasonable speed without employing Fourier Transforms. So this class is especially useful if you have only limited memory but much processing power. The running time scales linearly with the kernel size, though, therefore for big kernels this class can be much slower than its Fourier counterparts.

Definition at line 58 of file SeparableConvolutionFilter.hh.

Member Typedef Documentation

◆ ResultT

template<typename DataT , int Dim>
typedef DataT atb::SeparableConvolutionFilter< DataT, Dim >::ResultT

Definition at line 63 of file SeparableConvolutionFilter.hh.

Constructor & Destructor Documentation

◆ SeparableConvolutionFilter() [1/2]

template<typename DataT , int Dim>
atb::SeparableConvolutionFilter< DataT, Dim >::SeparableConvolutionFilter ( BoundaryTreatmentType  btType = ValueBT,
DataT const &  boundaryValue = traits< DataT >::zero 
)

Deafult Constructor.

Parameters
btTypeDefines the border treatment of this filter. The following border treatments are available: ValueBT, RepeatBT, MirrorBT, CyclicBT, CropBT
boundaryValueThe value to use for out-of-Array positions if the btType is ValueBT

◆ SeparableConvolutionFilter() [2/2]

template<typename DataT , int Dim>
atb::SeparableConvolutionFilter< DataT, Dim >::SeparableConvolutionFilter ( blitz::TinyVector< blitz::Array< DataT, 1 > *, Dim > const &  kernels,
BoundaryTreatmentType  btType = ValueBT,
DataT const &  boundaryValue = traits< DataT >::zero 
)

Constructor with kernel intialization.

Parameters
kernelsPointers to the filter kernels for all data dimensions. The vector may contain NULL pointers for dimensions the filter should not be applied to.
btTypeDefines the border treatment of this filter. The following border treatments are available: ValueBT, RepeatBT, MirrorBT, CyclicBT, CropBT
boundaryValueThe value to use for out-of-Array positions if the btType is ValueBT

◆ ~SeparableConvolutionFilter()

template<typename DataT , int Dim>
atb::SeparableConvolutionFilter< DataT, Dim >::~SeparableConvolutionFilter ( )

Destructor.

Member Function Documentation

◆ setBoundaryTreatment() [1/2]

template<typename DataT , int Dim>
void atb::SeparableConvolutionFilter< DataT, Dim >::setBoundaryTreatment ( BoundaryTreatmentType  bt,
DataT const &  boundaryValue = traits< DataT >::zero 
)

Change the boundary treatment type to the type specified.

Parameters
btThe boundary treatment this filter uses
boundaryValueIf bt is ValueBT, this value will be used for out-of-Array access

◆ setBoundaryTreatment() [2/2]

template<typename DataT , int Dim>
void atb::SeparableConvolutionFilter< DataT, Dim >::setBoundaryTreatment ( BoundaryTreatment< DataT, Dim > const &  bt)

Change the boundary treatment type to the type specified.

Parameters
btThe boundary treatment this filter uses

◆ setKernelForDim()

template<typename DataT , int Dim>
void atb::SeparableConvolutionFilter< DataT, Dim >::setKernelForDim ( blitz::Array< DataT, 1 > const *  kernel,
int  dim 
)

Set the filtering kernel component for the specified dimension.

You can pass the NULL pointer if you don't want to filter in the specified direction. The filter will create and manage a copy of the given kernel, and not work directly on the data pointer given!

Parameters
kernelA pointer to the blitz++ Array containing the kernel to apply along dimension dim, or the NULL pointer if data should not be filtered along dim.
dimThe filtering dimension for this kernel

◆ setKernels()

template<typename DataT , int Dim>
void atb::SeparableConvolutionFilter< DataT, Dim >::setKernels ( blitz::TinyVector< blitz::Array< DataT, 1 > *, Dim > const &  kernels)

Set the kernels for all data dimensions.

You can pass NULL pointers if you don't want to filter along some dimensions. The filter will create and manage copies of the given kernels, and will not work directly on the data pointers given!

Parameters
kernelsPointers to the filter kernels for all data dimensions. The vector may contain NULL pointers for dimensions the filter should not be applied to.

◆ applyAlongDim() [1/2]

template<typename DataT , int Dim>
void atb::SeparableConvolutionFilter< DataT, Dim >::applyAlongDim ( blitz::Array< DataT, Dim > const &  data,
blitz::TinyVector< double, Dim > const &  elementSizeUm,
blitz::Array< DataT, Dim > &  filtered,
int  dim,
iRoCS::ProgressReporter pr = NULL 
) const
virtual

Convolution of the data Array along the specified dimension using the filter kernel given through the kernel setters.

Parameters
dataThe data Array to convolve
elementSizeUmThe voxel extents in micrometers
filteredThe convolution result
dimThe dimension along which to convolve

Implements atb::SeparableFilter< DataT, Dim, DataT >.

◆ apply() [1/4]

template<typename DataT , int Dim>
void atb::SeparableConvolutionFilter< DataT, Dim >::apply ( blitz::Array< DataT, Dim > const &  data,
blitz::TinyVector< double, Dim > const &  elementSizeUm,
blitz::Array< DataT, Dim > &  filtered,
iRoCS::ProgressReporter pr = NULL 
) const
virtual

Convolve the given data Array with this filter.

Parameters
dataThe data Array to convolve
elementSizeUmThe voxel extents in micrometers
filteredThe convolution result

Implements atb::Filter< DataT, Dim, DataT >.

◆ apply() [2/4]

template<typename DataT , int Dim>
static void atb::SeparableConvolutionFilter< DataT, Dim >::apply ( blitz::Array< DataT, Dim > const &  data,
blitz::TinyVector< double, Dim > const &  elementSizeUm,
blitz::Array< DataT, Dim > &  filtered,
blitz::TinyVector< blitz::Array< DataT, 1 > *, Dim > const &  kernels,
BoundaryTreatmentType  btType = ValueBT,
DataT const &  boundaryValue = traits< DataT >::zero,
iRoCS::ProgressReporter pr = NULL 
)
static

Convolve the data Array with the given kernels using the specified boundary treatment policy.

Parameters
dataThe data Array to convolve
elementSizeUmThe voxel extents in micrometers
filteredThe convolution result
kernelsPointers to the filter kernels for all data dimensions. The vector may contain NULL pointers for dimensions the filter should not be applied to.
btTypeThe boundary treatment to apply
boundaryValueThe out-of-Array value that should be used if btType == ValueBT

◆ apply() [3/4]

template<typename DataT , int Dim>
static void atb::SeparableConvolutionFilter< DataT, Dim >::apply ( Array< DataT, Dim > const &  data,
Array< DataT, Dim > &  filtered,
blitz::TinyVector< blitz::Array< DataT, 1 > *, Dim > const &  kernels,
BoundaryTreatmentType  btType = ValueBT,
DataT const &  boundaryValue = traits< DataT >::zero,
iRoCS::ProgressReporter pr = NULL 
)
static

Convolve the data Array with the given kernels using the specified boundary treatment policy.

Parameters
dataThe data Array to convolve
filteredThe convolution result
kernelsPointers to the filter kernels for all data dimensions. The vector may contain NULL pointers for dimensions the filter should not be applied to.
btTypeThe boundary treatment to apply
boundaryValueThe out-of-Array value that should be used if btType == ValueBT

◆ applyAlongDim() [2/2]

virtual void atb::SeparableFilter< DataT, Dim, DataT >::applyAlongDim ( Array< DataT, Dim > const &  data,
Array< DataT , Dim > &  result,
int  dim,
iRoCS::ProgressReporter pr = NULL 
) const
virtualinherited

Apply the filter along the specified dimension.

Parameters
dataThe data Array to filter
resultThe filter result
dimThe dimension along which to apply the filter
Exceptions
RuntimeErrorIf an error occurs during the filter operation an exception of this kind is thrown

◆ boundaryTreatment()

BoundaryTreatment<DataT,Dim> const& atb::Filter< DataT, Dim, DataT >::boundaryTreatment ( ) const
inherited

Get a read-only reference to the boundary treatment object associated with this filter.

Returns
A reference to the associated BoundaryTreatment object

◆ apply() [4/4]

virtual void atb::Filter< DataT, Dim, DataT >::apply ( Array< DataT, Dim > const &  data,
Array< DataT , Dim > &  result,
iRoCS::ProgressReporter pr = NULL 
) const
virtualinherited

Apply the filter to the given Array.

Parameters
dataThe Array to apply the filter to
resultThe filtering result
prIf given progress will be reported to this ProgressReporter
Exceptions
RuntimeErrorIf an error occurs during the filter operation an exception of this kind is thrown

Field Documentation

◆ p_bt

BoundaryTreatment<DataT,Dim>* atb::Filter< DataT, Dim, DataT >::p_bt
protectedinherited

The boundary treatment object to use for out-of-Array access.

This is set during Filter object creation and can be changed by calling the setBoundaryTreatment() method. It gets destroyed, when the filter is deleted. If you delete the BoundaryTreatment object in a subclass, you must set this pointer to the NULL pointer.

Definition at line 159 of file Filter.hh.


The documentation for this class was generated from the following file: