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

The FastNormalizedCorrelationFilter class provides normalized cross-correlation for n-D Arrays employing the Fast Fourier Transform. More...

#include <FastNormalizedCorrelationFilter.hh>

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

Public Member Functions

 FastNormalizedCorrelationFilter (BoundaryTreatmentType bt=ValueBT, DataT const &boundaryValue=traits< DataT >::zero)
 Default Constructor. More...
 
 FastNormalizedCorrelationFilter (blitz::Array< DataT, Dim > const &kernel, BoundaryTreatmentType bt=ValueBT, DataT const &boundaryValue=traits< DataT >::zero)
 Constructor also taking the correlation kernel. More...
 
 ~FastNormalizedCorrelationFilter ()
 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 normalized correlation 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 correlation 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)
 Correlate 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)
 Correlate 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...
 

Detailed Description

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

The FastNormalizedCorrelationFilter class provides normalized cross-correlation for n-D Arrays employing the Fast Fourier Transform.

Specifically it uses the BlitzFFTW library. For non-separable kernels this is the fastest possibility to compute the normalized cross-correlation of two 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.

Definition at line 63 of file FastNormalizedCorrelationFilter.hh.

Constructor & Destructor Documentation

◆ FastNormalizedCorrelationFilter() [1/2]

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

Default Constructor.

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

◆ FastNormalizedCorrelationFilter() [2/2]

template<typename DataT , int Dim>
atb::FastNormalizedCorrelationFilter< DataT, Dim >::FastNormalizedCorrelationFilter ( blitz::Array< DataT, Dim > const &  kernel,
BoundaryTreatmentType  bt = ValueBT,
DataT const &  boundaryValue = traits< DataT >::zero 
)

Constructor also taking the correlation kernel.

Parameters
kernelThe filter kernel. A normalized copy of the kernel will be stored, so when you change the kernel you have to set it again.
btThe boundary treatment this filter uses.
boundaryValueIf bt is ValueBT, this value will be used for out-of-Array access

◆ ~FastNormalizedCorrelationFilter()

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

Destructor.

Member Function Documentation

◆ setKernel()

template<typename DataT , int Dim>
void atb::FastNormalizedCorrelationFilter< DataT, Dim >::setKernel ( blitz::Array< DataT, Dim > const &  kernel)

Set the correlation kernel.

Parameters
kernelThe correlation kernel to apply

◆ kernel()

template<typename DataT , int Dim>
blitz::Array<DataT,Dim> const& atb::FastNormalizedCorrelationFilter< DataT, Dim >::kernel ( ) const

Get the normalized correlation kernel.

Returns
The currently set normalized correlation kernel

◆ apply() [1/4]

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

Apply the filter to the given Array.

Parameters
dataThe blitz++ Array to apply the filter to
elementSizeUmThe element size of the Array
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

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

◆ apply() [2/4]

template<typename DataT , int Dim>
static void atb::FastNormalizedCorrelationFilter< DataT, Dim >::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 
)
static

Correlate the data Array with the given kernel using the psecified boundary treatment.

Parameters
dataThe blitz++ Array to apply the filter to
elementSizeUmThe element size of the Array
resultThe filtering result
kernelThe filter kernel
btTypeThe boundary treatment to apply
boundaryValueThe out-of-Array value that should be used if btType == ValueBT
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

◆ apply() [3/4]

template<typename DataT , int Dim>
static void atb::FastNormalizedCorrelationFilter< DataT, Dim >::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 
)
static

Correlate the data Array with the given kernel using the psecified boundary treatment.

Parameters
dataThe Array to apply the filter to
resultThe filtering result
kernelThe filter kernel
btTypeThe boundary treatment to apply
boundaryValueThe out-of-Array value that should be used if btType == ValueBT
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

◆ 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

◆ setBoundaryTreatment() [1/2]

void atb::Filter< DataT, Dim, DataT >::setBoundaryTreatment ( BoundaryTreatmentType  bt,
DataT const &  boundaryValue = traits<DataT>::zero 
)
inherited

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]

void atb::Filter< DataT, Dim, DataT >::setBoundaryTreatment ( BoundaryTreatment< DataT, Dim > const &  bt)
inherited

Change the boundary treatment type to the type specified.

Parameters
btThe boundary treatment this filter uses

◆ 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: