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

The SeparableCorrelationFilter class implements direct separable correlation. More...

#include "libArrayToolbox/SeparableCorrelationFilter.hh"

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

Public Member Functions

 SeparableCorrelationFilter (BoundaryTreatmentType btType=ValueBT, DataT const &boundaryValue=traits< DataT >::zero)
 Default Constructor. More...
 
 SeparableCorrelationFilter (blitz::TinyVector< blitz::Array< DataT, 1 > *, Dim > const &kernels, BoundaryTreatmentType btType=ValueBT, DataT const &boundaryValue=traits< DataT >::zero)
 Constructor with kernel intialization. More...
 
 ~SeparableCorrelationFilter ()
 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
 Correlate 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
 Correlation of the data Array with the kernel along the specified dimension. 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)
 Correlate 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)
 Correlate 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::SeparableCorrelationFilter< DataT, Dim >

The SeparableCorrelationFilter class implements direct separable correlation.

Compared to the ATB::correlate() 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 SeparableCorrelationFilter.hh.

Constructor & Destructor Documentation

◆ SeparableCorrelationFilter() [1/2]

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

Default 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

◆ SeparableCorrelationFilter() [2/2]

template<typename DataT, int Dim>
atb::SeparableCorrelationFilter< DataT, Dim >::SeparableCorrelationFilter ( 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

◆ ~SeparableCorrelationFilter()

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

Destructor.

Member Function Documentation

◆ setKernelForDim()

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

Correlation of the data Array with the kernel along the specified dimension.

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

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

◆ apply() [1/4]

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

Correlate the given data Array with this filter.

Parameters
dataThe data Array to correlate
elementSizeUmThe voxel extents in micrometers
filteredThe correlation result

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

◆ apply() [2/4]

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

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

Parameters
dataThe data Array to correlate
elementSizeUmThe voxel extents in micrometers
filteredThe correlation 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::SeparableCorrelationFilter< 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

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

Parameters
dataThe data Array to correlate
filteredThe correlation 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

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