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

The LocalSumFilter class is a box filter with a filter kernel containing only ones. More...

#include "libArrayToolbox/LocalSumFilter.hh"

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

Public Member Functions

 LocalSumFilter (BoundaryTreatmentType btType=ValueBT, DataT const &boundaryValue=traits< DataT >::zero)
 Default Constructor. More...
 
 LocalSumFilter (blitz::TinyVector< BlitzIndexT, Dim > const &kernelShapePx, BoundaryTreatmentType btType=ValueBT, DataT const &boundaryValue=traits< DataT >::zero)
 Constructor with kernel parameter intialization. More...
 
 ~LocalSumFilter ()
 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
 Application of the local sum filter onto the data Array. 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
 Application of the local sum filter onto the data Array 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...
 
blitz::TinyVector< BlitzIndexT, Dim > const & kernelShapePx () const
 Get the box kernel shape. More...
 
BlitzIndexT kernelSizePxInDim (int dim) const
 Get the box width in the specified dimension. 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 setKernelShapePx (blitz::TinyVector< BlitzIndexT, Dim > const &kernelShapePx)
 Set the box kernel shape. More...
 
void setKernelSizePxInDim (int dim, BlitzIndexT kernelSizePx)
 Set the box width in the specified dimension. 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< BlitzIndexT, Dim > const &kernelShapePx, BoundaryTreatmentType btType=ValueBT, DataT const &boundaryValue=traits< DataT >::zero, iRoCS::ProgressReporter *pr=NULL)
 Application of a local sum filter with given kernel shape and boundary treatment policy onto the data Array. More...
 
static void apply (Array< DataT, Dim > const &data, Array< DataT, Dim > &filtered, blitz::TinyVector< BlitzIndexT, Dim > const &kernelShapePx, BoundaryTreatmentType btType=ValueBT, DataT const &boundaryValue=traits< DataT >::zero, iRoCS::ProgressReporter *pr=NULL)
 Application of a local sum filter with given kernel shape and boundary treatment policy onto the data Array. 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::LocalSumFilter< DataT, Dim >

The LocalSumFilter class is a box filter with a filter kernel containing only ones.

The filtering result can be divided by the kernel size to get a normalized box-filter response. It is implemented as an $O(n)$ algorithm by exploiting the fact that for each kernel shift only the point entering the kernel has to be added and the point leaving the kernel has to be subtracted (for each direction).

Definition at line 59 of file LocalSumFilter.hh.

Constructor & Destructor Documentation

◆ LocalSumFilter() [1/2]

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

◆ LocalSumFilter() [2/2]

template<typename DataT , int Dim>
atb::LocalSumFilter< DataT, Dim >::LocalSumFilter ( blitz::TinyVector< BlitzIndexT, Dim > const &  kernelShapePx,
BoundaryTreatmentType  btType = ValueBT,
DataT const &  boundaryValue = traits< DataT >::zero 
)

Constructor with kernel parameter intialization.

Parameters
kernelShapePxThe box shape in pixels. If you pass values $\leq 0$ the filter will not be applied in the corresponding dimensions.
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

◆ ~LocalSumFilter()

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

Destructor.

Member Function Documentation

◆ kernelSizePxInDim()

template<typename DataT , int Dim>
BlitzIndexT atb::LocalSumFilter< DataT, Dim >::kernelSizePxInDim ( int  dim) const

Get the box width in the specified dimension.

Parameters
dimThe dimension to get the filter width for
Returns
The filterwidth along dimension dim in pixels

◆ setKernelSizePxInDim()

template<typename DataT , int Dim>
void atb::LocalSumFilter< DataT, Dim >::setKernelSizePxInDim ( int  dim,
BlitzIndexT  kernelSizePx 
)

Set the box width in the specified dimension.

Parameters
dimThe dimension to set the filter width for
kernelSizePxThe new width of the kernel along dimension dim in pixels.

◆ kernelShapePx()

template<typename DataT , int Dim>
blitz::TinyVector<BlitzIndexT,Dim> const& atb::LocalSumFilter< DataT, Dim >::kernelShapePx ( ) const

Get the box kernel shape.

Returns
The kernel shape in pixels

◆ setKernelShapePx()

template<typename DataT , int Dim>
void atb::LocalSumFilter< DataT, Dim >::setKernelShapePx ( blitz::TinyVector< BlitzIndexT, Dim > const &  kernelShapePx)

Set the box kernel shape.

Parameters
kernelShapePxThe new box shape in pixels. If you pass values $\leq 0$ the filter will not be applied in the corresponding dimensions.

◆ applyAlongDim() [1/2]

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

Application of the local sum filter onto the data Array along the specified dimension.

Parameters
dataThe data Array to filter
elementSizeUmThe voxel extents in micrometers
filteredThe filter result
dimThe dimension along which to apply the filter

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

◆ apply() [1/4]

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

Application of the local sum filter onto the data Array.

Parameters
dataThe data Array to filter
elementSizeUmThe voxel extents in micrometers
filteredThe filtering result

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

◆ apply() [2/4]

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

Application of a local sum filter with given kernel shape and boundary treatment policy onto the data Array.

Parameters
dataThe data Array to filter
elementSizeUmThe voxel extents in micrometers
filteredThe filtering result
kernelShapePxThe box shape in pixels. If you pass values $\leq 0$ the filter will not be applied in the corresponding dimensions.
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::LocalSumFilter< DataT, Dim >::apply ( Array< DataT, Dim > const &  data,
Array< DataT, Dim > &  filtered,
blitz::TinyVector< BlitzIndexT, Dim > const &  kernelShapePx,
BoundaryTreatmentType  btType = ValueBT,
DataT const &  boundaryValue = traits< DataT >::zero,
iRoCS::ProgressReporter pr = NULL 
)
static

Application of a local sum filter with given kernel shape and boundary treatment policy onto the data Array.

Parameters
dataThe data Array to filter
filteredThe filtering result
kernelShapePxThe box shape in pixels. If you pass values $\leq 0$ the filter will not be applied in the corresponding dimensions.
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: