iRoCS Toolbox
1.1.0
|
The FastConvolutionFilter class provides n-D Array convolution using the Fast Fourier Transform. More...
#include <FastConvolutionFilter.hh>
Public Member Functions | |
FastConvolutionFilter (BoundaryTreatmentType bt=ValueBT, DataT const &boundaryValue=traits< DataT >::zero) | |
Default Constructor. More... | |
FastConvolutionFilter (blitz::Array< DataT, Dim > const &kernel, BoundaryTreatmentType bt=ValueBT, DataT const &boundaryValue=traits< DataT >::zero) | |
Constructor also taking the convolution kernel. More... | |
~FastConvolutionFilter () | |
Destructor. More... | |
void | apply (blitz::Array< DataT, Dim > const &data, blitz::TinyVector< double, Dim > const &elementSizeUm, blitz::Array< DataT, Dim > &result, iRoCS::ProgressReporter *pr=NULL) const |
Apply the filter to the given Array. 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... | |
BoundaryTreatment< DataT, Dim > const & | boundaryTreatment () const |
Get a read-only reference to the boundary treatment object associated with this filter. More... | |
blitz::Array< DataT, Dim > const & | kernel () const |
Get the convolution kernel. 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 | setKernel (blitz::Array< DataT, Dim > const &kernel) |
Set the convolution kernel. More... | |
Static Public Member Functions | |
static void | apply (blitz::Array< DataT, Dim > const &data, blitz::TinyVector< double, Dim > const &elementSizeUm, blitz::Array< DataT, Dim > &result, blitz::Array< DataT, Dim > const &kernel, BoundaryTreatmentType btType=ValueBT, DataT const &boundaryValue=traits< DataT >::zero, iRoCS::ProgressReporter *pr=NULL) |
Convolve the data Array with the given kernel using the psecified boundary treatment. More... | |
static void | apply (Array< DataT, Dim > const &data, Array< DataT, Dim > &result, blitz::Array< DataT, Dim > const &kernel, BoundaryTreatmentType btType=ValueBT, DataT const &boundaryValue=traits< DataT >::zero, iRoCS::ProgressReporter *pr=NULL) |
Convolve the data Array with the given kernel using the psecified boundary treatment. More... | |
Protected Attributes | |
BoundaryTreatment< DataT, Dim > * | p_bt |
The boundary treatment object to use for out-of-Array access. More... | |
The FastConvolutionFilter class provides n-D Array convolution using the Fast Fourier Transform.
Specifically it uses the BlitzFFTW library. For non-separable kernels this is the fastest possibility to convolve data Arrays. It uses lots of memory, though, because it has to hold padded versions of the data Array, the kernel and the corresponding fourier transforms, therefore a memory overhead of factor 4 is the minimum, factor 6 to 8 is common. If you are low on memory and have separable kernels you should use the SeparableConvolutionFilter class instead. For big kernels it is slower, but it is almost in-place and fully parallelized to give optimum performance.
Definition at line 62 of file FastConvolutionFilter.hh.
atb::FastConvolutionFilter< DataT, Dim >::FastConvolutionFilter | ( | BoundaryTreatmentType | bt = ValueBT , |
DataT const & | boundaryValue = traits< DataT >::zero |
||
) |
Default Constructor.
bt | The boundary treatment this filter uses. CropBT is not allowed for the FastConvolutionFilter and will result in a RuntimeError when the filter is applied! |
boundaryValue | If bt is ValueBT, this value will be used for out-of-Array access |
atb::FastConvolutionFilter< DataT, Dim >::FastConvolutionFilter | ( | blitz::Array< DataT, Dim > const & | kernel, |
BoundaryTreatmentType | bt = ValueBT , |
||
DataT const & | boundaryValue = traits< DataT >::zero |
||
) |
Constructor also taking the convolution kernel.
kernel | The filter kernel. Only a pointer to the kernel is stored, so, make sure that the kernel memory location stays valid as long as you use this filter. |
bt | The boundary treatment this filter uses. CropBT is not allowed for the FastConvolutionFilter and will result in a RuntimeError when the filter is applied! |
boundaryValue | If bt is ValueBT, this value will be used for out-of-Array access |
atb::FastConvolutionFilter< DataT, Dim >::~FastConvolutionFilter | ( | ) |
Destructor.
void atb::FastConvolutionFilter< DataT, Dim >::setKernel | ( | blitz::Array< DataT, Dim > const & | kernel | ) |
Set the convolution kernel.
kernel | The convolution kernel to apply |
blitz::Array<DataT,Dim> const& atb::FastConvolutionFilter< DataT, Dim >::kernel | ( | ) | const |
Get the convolution kernel.
|
virtual |
Apply the filter to the given Array.
data | The blitz++ Array to apply the filter to |
elementSizeUm | The element size of the Array |
result | The filtering result |
RuntimeError | If an error occurs during the filter operation an exception of this kind is thrown |
Implements atb::Filter< DataT, Dim, DataT >.
|
static |
Convolve the data Array with the given kernel using the psecified boundary treatment.
data | The blitz++ Array to apply the filter to |
elementSizeUm | The element size of the Array |
result | The filtering result |
kernel | The filter kernel |
btType | The boundary treatment to apply |
boundaryValue | The out-of-Array value that should be used if btType == ValueBT |
RuntimeError | If an error occurs during the filter operation an exception of this kind is thrown |
|
static |
Convolve the data Array with the given kernel using the psecified boundary treatment.
data | The Array to apply the filter to |
result | The filtering result |
kernel | The filter kernel |
btType | The boundary treatment to apply |
boundaryValue | The out-of-Array value that should be used if btType == ValueBT |
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.
|
inherited |
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 |
|
inherited |
Change the boundary treatment type to the type specified.
bt | The boundary treatment this filter uses |
|
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.