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.
 
 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.
 
 ~KernelLineApplicatorBase () override
 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.
 
void applyToLine (TSubImageWithCursor< DATATYPE > *inSubImg, TSubImageWithCursor< DATATYPE > *, size_t) override
 Applies the kernel to a row of the input subimage.
 
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.
 
ImageVector getPositiveExtent () const override
 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
 
- Public Member Functions inherited from ml::LineApplicator< DATATYPE >
virtual ~LineApplicator ()
 Virtual destructor. Currently it does nothing.
 

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

Constructor & Destructor Documentation

◆ KernelLineApplicatorBase() [1/3]

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]

Copy constructor.

Definition at line 194 of file mlKernelLineApplicatorBase.h.

References mlrange_cast().

◆ KernelLineApplicatorBase() [3/3]

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.

References mlrange_cast().

◆ ~KernelLineApplicatorBase()

Destructor. Frees dynamic members.

Definition at line 90 of file mlKernelLineApplicatorBase.h.

Member Function Documentation

◆ _clearIndices()

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()

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 mlrange_cast().

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

◆ _init()

◆ applyToLine()

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.

References mlrange_cast().

◆ getKernel()

Definition at line 111 of file mlKernelLineApplicatorBase.h.

◆ getNegativeExtent()

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()

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=()

◆ setKernel()

Member Data Documentation

◆ _indexTab

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.

◆ _indexTabSize

Size of _indexTab. Default is 0.

Definition at line 170 of file mlKernelLineApplicatorBase.h.

◆ _kernel

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

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.


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