MeVisLabToolboxReference
ml::KernelLineApplicatorBase< DATATYPE, KDATATYPE > Class Template Reference

The KernelLineApplicatorBase class is designed to implement new kernel based filters to be applied to a line of an mlSubImage and and to write the filtered line to an output mlSubImage. More...

#include <mlKernelLineApplicatorBase.h>

Inheritance diagram for ml::KernelLineApplicatorBase< DATATYPE, KDATATYPE >:
ml::LineApplicator< DATATYPE > ml::KernelLineApplicator< DATATYPE, KDATATYPE >

List of all members.

Public Member Functions

 KernelLineApplicatorBase ()
 Default constructor.
 KernelLineApplicatorBase (const KernelLineApplicatorBase< DATATYPE, KDATATYPE > &kernLineAppBase)
 Copy constructor.
 KernelLineApplicatorBase (const TKernel< KDATATYPE > &kernel)
 Convenience constructor to create a complete line applicator with all important parameters set.
virtual ~KernelLineApplicatorBase ()
 Destructor. Frees dynamic members.
const KernelLineApplicatorBase
< DATATYPE, KDATATYPE > & 
operator= (const KernelLineApplicatorBase< DATATYPE, KDATATYPE > &kernLineAppBase)
 Assignment operator. Assures that dynamic and normal members are copied correctly.
virtual void applyToLine (TSubImageWithCursor< DATATYPE > *inSubImg, TSubImageWithCursor< DATATYPE > *, size_t)
 Applies the kernel to a row of the input subimage.
Get the extents of the region around a voxel needed to filter the voxel.
virtual ImageVector getNegativeExtent () const
 Returns the negative extent of a kernel used for filtering.
virtual ImageVector getPositiveExtent () const
 Returns the positive extent of a kernel used for filtering.
Set/Get the kernel needed to filter a line.
void setKernel (const TKernel< KDATATYPE > &kernel)
const TKernel< KDATATYPE > & getKernel () const

Protected Member Functions

void _init ()
 Initialization the current instance of mlKernelApplicatorBase. To be called by constructors.
virtual void _defineIndices (const SubImage &inSubImg)
 Create the table of offsets from the voxel (0,0,0,0,0,0) of the kernel to any other voxel of the kernel in an inSubImg.
virtual void _clearIndices ()
 Removes the current _indexTab.

Protected Attributes

const TKernel< KDATATYPE > * _kernel
 Pointer to the kernel used to filter an input page.
Members for inner kernel indexing.
MLsoffset_indexTab
 Table and variables defined temporarily while filtering a page.
size_t _indexTabSize
 Size of _indexTab. Default is 0.
MLsoffset _srcVoxOffset
 Offset from origin of kernel in input image to the voxel under the replaced voxel in output image.

Detailed Description

template<typename DATATYPE, typename KDATATYPE>
class ml::KernelLineApplicatorBase< DATATYPE, KDATATYPE >

The KernelLineApplicatorBase class is designed to implement new kernel based filters to be applied to a line of an mlSubImage and and to write the filtered line to an output mlSubImage.

This class is derived from the LineApplicator which is the minimum class which has to be passed to a applyFiltering function from the KernelTools class to filter a page. The methods applyToLine, getNegativeExtent and getPositiveExtent were be overloaded in class LineApplicator.

The central method is

applyToLine(TSubImageWithCursor<DATATYPE> *inSubImg, TSubImageWithCursor<DATATYPE> *outSubImg, size_t numVox)

which applies the currently set kernel to a line of numVox voxels in the inSubImg and writes the result to outSubImg. Before doing that in both subimages the cursor position must be set adequately. This is usually done by an applyFiltering function from the KernelTools class. So usually there is no need to use this class explicitly if it's not overloaded.

So - if you want to implement a new kernel filter then just overload the virtual method applyToLine and implement your new filter in it.

For related code and more information see mlKernelExample.h, mlKernel.h, mlKernelBaseModule.h, mlKernelModule.h, mlKernelEditor.h, mlRankFilter.h, mlExtConvolutionFilter.h, mlKernelMacros, mlKernelTools.h and mlConvolutionFilter.h.

Definition at line 66 of file mlKernelLineApplicatorBase.h.


Constructor & Destructor Documentation

template<typename DATATYPE, typename KDATATYPE>
ml::KernelLineApplicatorBase< DATATYPE, KDATATYPE >::KernelLineApplicatorBase ( ) [inline]

Default constructor.

Default settings are an invalid kernel, empty index tables, unlimited image and filter intervals and _srcVoxOffset=0. _applyMode is APPLY_NORMALLY.

Definition at line 77 of file mlKernelLineApplicatorBase.h.

template<typename DATATYPE , typename KDATATYPE >
ml::KernelLineApplicatorBase< DATATYPE, KDATATYPE >::KernelLineApplicatorBase ( const KernelLineApplicatorBase< DATATYPE, KDATATYPE > &  kernLineAppBase)

Copy constructor.

Definition at line 197 of file mlKernelLineApplicatorBase.h.

template<typename DATATYPE , typename KDATATYPE >
ml::KernelLineApplicatorBase< DATATYPE, KDATATYPE >::KernelLineApplicatorBase ( const TKernel< KDATATYPE > &  kernel)

Convenience constructor to create a complete line applicator with all important parameters set.

A kernel must be passed to initialize all.

Definition at line 209 of file mlKernelLineApplicatorBase.h.

template<typename DATATYPE, typename KDATATYPE>
virtual ml::KernelLineApplicatorBase< DATATYPE, KDATATYPE >::~KernelLineApplicatorBase ( ) [inline, virtual]

Destructor. Frees dynamic members.

Definition at line 93 of file mlKernelLineApplicatorBase.h.


Member Function Documentation

template<typename DATATYPE , typename KDATATYPE >
void ml::KernelLineApplicatorBase< DATATYPE, KDATATYPE >::_clearIndices ( ) [protected, virtual]

Removes the current _indexTab.

Definition at line 302 of file mlKernelLineApplicatorBase.h.

template<typename DATATYPE , typename KDATATYPE >
void ml::KernelLineApplicatorBase< DATATYPE, KDATATYPE >::_defineIndices ( const SubImage inSubImg) [protected, virtual]

Create the table of offsets from the voxel (0,0,0,0,0,0) of the kernel to any other voxel of the kernel in an inSubImg.

Pass the subimage page to make correct calculations. It's the same like multiplying the coordinates of the kernel elements with inSubImg strides. This method also initializes the member _srcVoxOffset.

Definition at line 282 of file mlKernelLineApplicatorBase.h.

References ml::SubImage::getStride().

Referenced by ml::KernelLineApplicator< DATATYPE, KDATATYPE >::applyToLine().

template<typename DATATYPE , typename KDATATYPE >
void ml::KernelLineApplicatorBase< DATATYPE, KDATATYPE >::_init ( ) [protected]

Initialization the current instance of mlKernelApplicatorBase. To be called by constructors.

Reimplemented in ml::KernelLineApplicator< DATATYPE, KDATATYPE >.

Definition at line 226 of file mlKernelLineApplicatorBase.h.

Referenced by ml::KernelLineApplicator< DATATYPE, KDATATYPE >::KernelLineApplicator().

template<typename DATATYPE, typename KDATATYPE>
virtual void ml::KernelLineApplicatorBase< DATATYPE, KDATATYPE >::applyToLine ( TSubImageWithCursor< DATATYPE > *  inSubImg,
TSubImageWithCursor< DATATYPE > *  ,
size_t   
) [inline, virtual]

Applies the kernel to a row of the input subimage.

Cursors must have been set in input and output subimage. Define the index table in this method when requiring access to image voxels covered by kernel elements.

Reimplemented from ml::LineApplicator< DATATYPE >.

Reimplemented in ml::KernelLineApplicator< DATATYPE, KDATATYPE >.

Definition at line 123 of file mlKernelLineApplicatorBase.h.

template<typename DATATYPE, typename KDATATYPE>
const TKernel<KDATATYPE>& ml::KernelLineApplicatorBase< DATATYPE, KDATATYPE >::getKernel ( ) const [inline]

Definition at line 114 of file mlKernelLineApplicatorBase.h.

template<typename DATATYPE, typename KDATATYPE>
virtual ImageVector ml::KernelLineApplicatorBase< DATATYPE, KDATATYPE >::getNegativeExtent ( ) const [inline, virtual]

Returns the negative extent of a kernel used for filtering.

Reimplemented from ml::LineApplicator< DATATYPE >.

Definition at line 104 of file mlKernelLineApplicatorBase.h.

References ml::ImageVector.

template<typename DATATYPE, typename KDATATYPE>
virtual ImageVector ml::KernelLineApplicatorBase< DATATYPE, KDATATYPE >::getPositiveExtent ( ) const [inline, virtual]

Returns the positive extent of a kernel used for filtering.

Reimplemented from ml::LineApplicator< DATATYPE >.

Definition at line 105 of file mlKernelLineApplicatorBase.h.

References ml::ImageVector.

template<typename DATATYPE , typename KDATATYPE >
const KernelLineApplicatorBase< DATATYPE, KDATATYPE > & ml::KernelLineApplicatorBase< DATATYPE, KDATATYPE >::operator= ( const KernelLineApplicatorBase< DATATYPE, KDATATYPE > &  kernLineAppBase)
template<typename DATATYPE, typename KDATATYPE>
void ml::KernelLineApplicatorBase< DATATYPE, KDATATYPE >::setKernel ( const TKernel< KDATATYPE > &  kernel) [inline]

Member Data Documentation

template<typename DATATYPE, typename KDATATYPE>
MLsoffset* ml::KernelLineApplicatorBase< DATATYPE, KDATATYPE >::_indexTab [protected]

Table and variables defined temporarily while filtering a page.

The table contains the offsets from kernel voxel (0,0,0,0,0,0) to all other kernel voxels in the input page. So all input SubImage voxels can be addressed within a page by indexing the base voxel of the kernel in the input subImg. Default is NULL.

Definition at line 170 of file mlKernelLineApplicatorBase.h.

Referenced by ml::KernelLineApplicatorBase< DATATYPE, KDATATYPE >::operator=().

template<typename DATATYPE, typename KDATATYPE>
size_t ml::KernelLineApplicatorBase< DATATYPE, KDATATYPE >::_indexTabSize [protected]

Size of _indexTab. Default is 0.

Definition at line 173 of file mlKernelLineApplicatorBase.h.

Referenced by ml::KernelLineApplicatorBase< DATATYPE, KDATATYPE >::operator=().

template<typename DATATYPE, typename KDATATYPE>
const TKernel<KDATATYPE>* ml::KernelLineApplicatorBase< DATATYPE, KDATATYPE >::_kernel [protected]

Pointer to the kernel used to filter an input page.

Definition at line 160 of file mlKernelLineApplicatorBase.h.

Referenced by ml::KernelLineApplicatorBase< DATATYPE, KDATATYPE >::operator=().

template<typename DATATYPE, typename KDATATYPE>
MLsoffset ml::KernelLineApplicatorBase< DATATYPE, KDATATYPE >::_srcVoxOffset [protected]

Offset from origin of kernel in input image to the voxel under the replaced voxel in output image.

Default is 0.

Definition at line 177 of file mlKernelLineApplicatorBase.h.

Referenced by ml::KernelLineApplicatorBase< DATATYPE, KDATATYPE >::operator=().


The documentation for this class was generated from the following file: