MeVisLab Toolbox Reference
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 >

Public Member Functions

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

Protected Member Functions

void _init ()
 Initialization the current instance of mlKernelApplicatorBase. To be called by constructors. More...
 
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. More...
 
virtual void _clearIndices ()
 Removes the current _indexTab. More...
 

Protected Attributes

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

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 63 of file mlKernelLineApplicatorBase.h.

Constructor & Destructor Documentation

◆ KernelLineApplicatorBase() [1/3]

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 74 of file mlKernelLineApplicatorBase.h.

◆ KernelLineApplicatorBase() [2/3]

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

Copy constructor.

Definition at line 194 of file mlKernelLineApplicatorBase.h.

◆ KernelLineApplicatorBase() [3/3]

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 206 of file mlKernelLineApplicatorBase.h.

◆ ~KernelLineApplicatorBase()

template<typename DATATYPE , typename KDATATYPE >
ml::KernelLineApplicatorBase< DATATYPE, KDATATYPE >::~KernelLineApplicatorBase ( )
inlineoverride

Destructor. Frees dynamic members.

Definition at line 90 of file mlKernelLineApplicatorBase.h.

Member Function Documentation

◆ _clearIndices()

template<typename DATATYPE , typename KDATATYPE >
void ml::KernelLineApplicatorBase< DATATYPE, KDATATYPE >::_clearIndices
protectedvirtual

Removes the current _indexTab.

Definition at line 290 of file mlKernelLineApplicatorBase.h.

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

◆ _defineIndices()

template<typename DATATYPE , typename KDATATYPE >
void ml::KernelLineApplicatorBase< DATATYPE, KDATATYPE >::_defineIndices ( const SubImage inSubImg)
protectedvirtual

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 270 of file mlKernelLineApplicatorBase.h.

References ml::SubImage::getStride().

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

◆ _init()

template<typename DATATYPE , typename KDATATYPE >
void ml::KernelLineApplicatorBase< DATATYPE, KDATATYPE >::_init
protected

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

Definition at line 219 of file mlKernelLineApplicatorBase.h.

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

◆ applyToLine()

template<typename DATATYPE , typename KDATATYPE >
void ml::KernelLineApplicatorBase< DATATYPE, KDATATYPE >::applyToLine ( TSubImageWithCursor< DATATYPE > *  inSubImg,
TSubImageWithCursor< DATATYPE > *  ,
size_t   
)
inlineoverridevirtual

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 >.

Definition at line 120 of file mlKernelLineApplicatorBase.h.

◆ getKernel()

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

Definition at line 111 of file mlKernelLineApplicatorBase.h.

◆ getNegativeExtent()

template<typename DATATYPE , typename KDATATYPE >
ImageVector ml::KernelLineApplicatorBase< DATATYPE, KDATATYPE >::getNegativeExtent ( ) const
inlineoverridevirtual

Returns the negative extent of a kernel used for filtering.

Reimplemented from ml::LineApplicator< DATATYPE >.

Definition at line 101 of file mlKernelLineApplicatorBase.h.

◆ getPositiveExtent()

template<typename DATATYPE , typename KDATATYPE >
ImageVector ml::KernelLineApplicatorBase< DATATYPE, KDATATYPE >::getPositiveExtent ( ) const
inlineoverridevirtual

Returns the positive extent of a kernel used for filtering.

Reimplemented from ml::LineApplicator< DATATYPE >.

Definition at line 102 of file mlKernelLineApplicatorBase.h.

◆ operator=()

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

◆ setKernel()

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

Member Data Documentation

◆ _indexTab

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 167 of file mlKernelLineApplicatorBase.h.

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

◆ _indexTabSize

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

Size of _indexTab. Default is 0.

Definition at line 170 of file mlKernelLineApplicatorBase.h.

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

◆ _kernel

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 157 of file mlKernelLineApplicatorBase.h.

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

◆ _srcVoxOffset

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 174 of file mlKernelLineApplicatorBase.h.

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


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