MeVisLabToolboxReference
ml::RankFilter Class Reference

The class to apply rank based kernel filters images. More...

#include <mlRankFilter.h>

Inheritance diagram for ml::RankFilter:
ml::KernelModule ml::KernelBaseModule ml::Module ml::FieldContainer ml::Base

List of all members.

Public Types

enum  RankFilterTypes {
  ID = 0, RANK_FILTER, MIN_FILTER, MEDIAN_FILTER,
  MAX_FILTER, RANK_INDEX, NUM_RANK_FILTER_TYPES
}
 The following rank based filters are available to filter line in an image: More...

Public Member Functions

 RankFilter ()
 Constructor.
Fields to specify the filter algorithm and the rank.
EnumFieldgetRankFilterFld ()
 Specifies the rank based filter algorithm. Default is mlMedian.
IntFieldgetRankFld ()
 Specifies the rank level for the 'Rank' algorithm. Default is 0.

Static Public Attributes

static const char *const RankFilterNames []
 Strings names for rank based filters.

Protected Member Functions

void calculateOutputImageProperties (int outIndex)
 Computes the output image properties (e.g. the extents) for output outIndex.
virtual void handleNotification (Field *field)
 Called when a parameter field is changed.
virtual void activateAttachments ()
 Called when loading has finished.
 CALC_ROW_H ()
 The implementation of the calculateOutputSubImage() method overloaded from Module is done in this macro.
template<typename DATATYPE >
void calcRow (MLsoffset *indexTab, size_t indexTabSize, MLsoffset srcVoxelOffset, size_t numVox, DATATYPE *inCursor, DATATYPE *outCursor, const ImageVector &)
 In this virtual template method the filtering of one row needs to be implemented.

Detailed Description

The class to apply rank based kernel filters images.

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 36 of file mlRankFilter.h.


Member Enumeration Documentation

The following rank based filters are available to filter line in an image:

  • ID
    Applies border handling with selected pad modes but simply copies input image to output in defined ares. Useful to compare filter results with original data where only the filtered area changes.
  • RANK_FILTER
    Sorts upwards all image voxels under kernel elements and writes that one to the output which is selected by rankFld. If that one does not exist then the nearest one is used.
  • MIN_FILTER
    Writes the minimum value of all values under kernel elements to the output.
  • MEDIAN_FILTER
    Sorts upwards all image voxels under kernel elements and writes the middle one to the output image. If no middle one exists the next higher one is used.
  • MAX_FILTER
    Writes the maximum value of all values under kernel elements to the output.
  • RANK_INDEX
    Sorts upwards all input voxels 'under' kernel elements and writes the index of the position of the current voxel to the output. In case multiple voxels under the kernel have the same value as the center one the rank field is used as a relative percentage parameter to decide which of the indexes belonging to the same value will be written. Therefore the formula: index = floor(0.5+minIdx+ rank/100.0*(maxIdx-minIdx)) is used. E.g. if there are 10 voxels with the color of the center one under a 27 neigbourhood kernel (including the center) and the first / last index is 12 resp. 21 then when rank = 0 the output is 12, for rank = 100 the output is 21 and for rank = 20 the output will be 14. This mode with appropriate use of the rank as a percentage can be useful in combination with an interval thresholding to find the equivalent of local minima or maxima in a quantized image.
    RANK_INDEX: computes the index of value of the current point in the sorted list of points under the kernel. In case some points have equal value the parameter rank is treated as a percentage parameter and we return floor (0.5+ smallest index plus rank / 100 *(higest - smallest index)) intended to identify e.g. local minima or maxima
Enumerator:
ID 
RANK_FILTER 
MIN_FILTER 
MEDIAN_FILTER 
MAX_FILTER 
RANK_INDEX 
NUM_RANK_FILTER_TYPES 

Definition at line 93 of file mlRankFilter.h.


Constructor & Destructor Documentation

ml::RankFilter::RankFilter ( )

Constructor.

Initializes the fields, the members and the field connections with the image output.

Note that with the following method calls an additional field interface is created as described in KernelModule and KernelBaseModule:

Also available are the fields access methods from KernelBaseModule:


Member Function Documentation

virtual void ml::RankFilter::activateAttachments ( ) [protected, virtual]

Called when loading has finished.

It's necessary to update the current module state to the field state.

Reimplemented from ml::KernelModule.

ml::RankFilter::CALC_ROW_H ( ) [protected]

The implementation of the calculateOutputSubImage() method overloaded from Module is done in this macro.

It implements page border handling and a dispatcher to call the correct template version of calcRow with the correct parameters. Note that CALC_ROW_CPP() also needs to be added in the .cpp file.

template<typename DATATYPE >
void ml::RankFilter::calcRow ( MLsoffset indexTab,
size_t  indexTabSize,
MLsoffset  srcVoxelOffset,
size_t  numVox,
DATATYPE *  inCursor,
DATATYPE *  outCursor,
const ImageVector  
) [protected]

In this virtual template method the filtering of one row needs to be implemented.

It will be called by the CALC_ROW_H() / CALC_ROW_CPP() macro.

void ml::RankFilter::calculateOutputImageProperties ( int  outIndex) [protected, virtual]

Computes the output image properties (e.g. the extents) for output outIndex.

Reimplemented from ml::KernelModule.

EnumField* ml::RankFilter::getRankFilterFld ( ) [inline]

Specifies the rank based filter algorithm. Default is mlMedian.

Definition at line 135 of file mlRankFilter.h.

IntField* ml::RankFilter::getRankFld ( ) [inline]

Specifies the rank level for the 'Rank' algorithm. Default is 0.

Definition at line 138 of file mlRankFilter.h.

virtual void ml::RankFilter::handleNotification ( Field field) [protected, virtual]

Called when a parameter field is changed.

Reimplemented from ml::KernelModule.


Member Data Documentation

const char* const ml::RankFilter::RankFilterNames[] [static]

Strings names for rank based filters.

Definition at line 107 of file mlRankFilter.h.


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