iRoCS Toolbox
1.1.0
|
The SeparableConvolutionFilter class implements direct separable convolution. More...
#include "libArrayToolbox/SeparableConvolutionFilter.hh"
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... | |
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.
typedef DataT atb::SeparableConvolutionFilter< DataT, Dim >::ResultT |
Definition at line 63 of file SeparableConvolutionFilter.hh.
atb::SeparableConvolutionFilter< DataT, Dim >::SeparableConvolutionFilter | ( | BoundaryTreatmentType | btType = ValueBT , |
DataT const & | boundaryValue = traits< DataT >::zero |
||
) |
Deafult Constructor.
btType | Defines the border treatment of this filter. The following border treatments are available: ValueBT , RepeatBT , MirrorBT , CyclicBT , CropBT |
boundaryValue | The value to use for out-of-Array positions if the btType is ValueBT |
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.
kernels | Pointers to the filter kernels for all data dimensions. The vector may contain NULL pointers for dimensions the filter should not be applied to. |
btType | Defines the border treatment of this filter. The following border treatments are available: ValueBT , RepeatBT , MirrorBT , CyclicBT , CropBT |
boundaryValue | The value to use for out-of-Array positions if the btType is ValueBT |
atb::SeparableConvolutionFilter< DataT, Dim >::~SeparableConvolutionFilter | ( | ) |
Destructor.
void atb::SeparableConvolutionFilter< DataT, Dim >::setBoundaryTreatment | ( | BoundaryTreatmentType | bt, |
DataT const & | boundaryValue = traits< DataT >::zero |
||
) |
Change the boundary treatment type to the type specified.
bt | The boundary treatment this filter uses |
boundaryValue | If bt is ValueBT, this value will be used for out-of-Array access |
void atb::SeparableConvolutionFilter< DataT, Dim >::setBoundaryTreatment | ( | BoundaryTreatment< DataT, Dim > const & | bt | ) |
Change the boundary treatment type to the type specified.
bt | The boundary treatment this filter uses |
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!
kernel | A 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. |
dim | The filtering dimension for this kernel |
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!
kernels | Pointers to the filter kernels for all data dimensions. The vector may contain NULL pointers for dimensions the filter should not be applied to. |
|
virtual |
Convolution of the data Array along the specified dimension using the filter kernel given through the kernel setters.
data | The data Array to convolve |
elementSizeUm | The voxel extents in micrometers |
filtered | The convolution result |
dim | The dimension along which to convolve |
Implements atb::SeparableFilter< DataT, Dim, DataT >.
|
virtual |
Convolve the given data Array with this filter.
data | The data Array to convolve |
elementSizeUm | The voxel extents in micrometers |
filtered | The convolution result |
Implements atb::Filter< DataT, Dim, DataT >.
|
static |
Convolve the data Array with the given kernels using the specified boundary treatment policy.
data | The data Array to convolve |
elementSizeUm | The voxel extents in micrometers |
filtered | The convolution result |
kernels | Pointers to the filter kernels for all data dimensions. The vector may contain NULL pointers for dimensions the filter should not be applied to. |
btType | The boundary treatment to apply |
boundaryValue | The out-of-Array value that should be used if btType == ValueBT |
|
static |
Convolve the data Array with the given kernels using the specified boundary treatment policy.
data | The data Array to convolve |
filtered | The convolution result |
kernels | Pointers to the filter kernels for all data dimensions. The vector may contain NULL pointers for dimensions the filter should not be applied to. |
btType | The boundary treatment to apply |
boundaryValue | The out-of-Array value that should be used if btType == ValueBT |
|
virtualinherited |
Apply the filter along the specified dimension.
data | The data Array to filter |
result | The filter result |
dim | The dimension along which to apply the filter |
RuntimeError | If an error occurs during the filter operation an exception of this kind is thrown |
|
inherited |
Get a read-only reference to the boundary treatment object associated with this filter.
|
virtualinherited |
Apply the filter to the given Array.
data | The Array to apply the filter to |
result | The filtering result |
pr | If given progress will be reported to this ProgressReporter |
RuntimeError | If an error occurs during the filter operation an exception of this kind is thrown |
|
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.