MeVisLabToolboxReference
|
The class to apply CloseGap based kernel filters to images. More...
#include <mlCloseGapFilter.h>
Public Types | |
enum | CloseGapFilters { ID = 0, CLOSEGAP, MAJORITY, PAIR_MAJORITY, DILATION, EROSION, CONTOUR_POINT_FILTER, NUM_CLOSEGAP_FILTERS } |
The following morphology based filters are available to filter a line in an image: More... | |
enum | CloseGapKernels { CLOSEGAP_KERNEL = 0, FULL_KERNEL, STAR_KERNEL, BOX_KERNEL, NUM_CLOSEGAP_KERNELS } |
Selects the kernel that will be used for the current filter. More... | |
Public Member Functions | |
CloseGapFilter () | |
Constructor. | |
Field access. Refer to field documentation for more infos. | |
EnumField * | getCloseGapFilterFld () const |
FloatField * | getSensitivityFld () const |
EnumField * | getSelectInternalKernelFld () const |
Static Public Attributes | |
static const char *const | CloseGapFilterNames [] |
Strings names for CloseGap based filters. | |
static const char *const | CloseGapKernelNames [] |
String names for the mlCloseGapKernels enum. | |
Protected Member Functions | |
virtual void | handleNotification (Field *field) |
Called when a parameter field is changed. | |
virtual void | activateAttachments () |
Called when loading has finished. | |
CALC_ROW_H () | |
Macro which needs to be added to the implementation of a class derived from KernelModule or KernelBaseModule . | |
template<typename DATATYPE > | |
void | calcRow (MLsoffset *indexTab, size_t indexTabSize, MLsoffset srcVoxelOffset, size_t numVox, DATATYPE *inCursor, DATATYPE *outCursor, const ImageVector &) |
In this template method the filtering of one row needs to be implemented. | |
virtual void | _userKernelPostUpdate () |
Typical method to be overloaded by derived modules to apply kernel changes. |
The class to apply CloseGap based kernel filters to images.
This class implements some filters to close gaps in 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 35 of file mlCloseGapFilter.h.
The following morphology based filters are available to filter a line in an image:
ID
: Applies typical border handling of kernel classes and copies image contentsCLOSEGAP
: Closes gaps in binary images. Use only with the CLOSEGAP_KERNEL provided by this module. Using the sensitivity-parameter, it does the following:newVoxelValue = oldVoxelValue OR [(#positiveVoxelPairs / #totalVoxelPairs) > (sensitivity / 100)]
If a 2D kernel dimension is chosen, 4 voxel pairs will be tested. The current voxel lies exactly between each voxel pair in order to avoid contour changes. The 2D situation looks like this:
<----kernelExt.x-----> 1 2 3 4 current 4 3 2 1
In 3D there are 8 pairs, each corner of the kernel cube belonging to one. Two voxels with the same number are considered a pair. The logical value of a pair is the AND of the corresponding values in the original image. Ordinarily the sequential use of multiple filters with decreasing kernel size performs best, eventually in combination with ordinary dilation and erosion filters.
MAJORITY
: Writes the gray value that occurs most often. All voxels that lie beneath a kernel element will be considered (unless a kernel interval is used). The actual values of the kernel elements specified are irrelevant.This filter mode is useful for performing morphological operations on images that contain differently gray-value-coded object masks.
PAIR_MAJORITY
: A combination of the CloseGap and Majority filter modes. We examine the pairs from the CloseGap filter, but only take into account those pairs (valid pairs) that consist of voxels with equal gray values. We count all valid pairs with the same gray value (while the center voxel counts as a pair itself) and write the value that occurs most often. This filter is supposed to preserve the original structure shapes more effectively than the ordinary majority filter. Just like the CloseGap filter mode, this one is restricted to the CloseGap kernel.CLOSEGAP_DILATION
: The voxels covered by the kernel elements are ORed to determine whether the result voxel will be set or not.CLOSEGAP_EROSION
: The voxels covered by the kernel elements are ANDed to determine whether the result voxel will be set or not.CONTOUR_POINT_FILTER
: This filter deletes all voxels that have more than sensitivity % voxels of the same gray value in their neighborhood (the neighborhood is defined by the kernel). For example, to obtain the complete 2D-contours of a solid object, you could set the kernel type to full and specify the kernel extensions as 3x3x1 and set the sensitivity to 75. You can play with the sensitivity parameter to reduce or increase the number of remaining contour points.NUM_CLOSEGAP_FILTERS
: Number of available CloseGapFilters. Do not use as filtering mode; it is only the number of available filters. ID | |
CLOSEGAP | |
MAJORITY | |
PAIR_MAJORITY | |
DILATION | |
EROSION | |
CONTOUR_POINT_FILTER | |
NUM_CLOSEGAP_FILTERS |
Definition at line 131 of file mlCloseGapFilter.h.
Selects the kernel that will be used for the current filter.
CLOSEGAP_KERNEL:
See CloseGap filter option for information.FULL_KERNEL:
The whole kernel mask will be filled with 1'sSTAR_KERNEL:
A 2D/3D star will be used as kernel.BOX_KERNEL
: The only kernel elements set (to 1) will be the center element and all boundary elements.NUM_CLOSEGAP_KERNELS
: Number of available CloseGapFilters : Do not use as filtering mode; only the number of available filters. Definition at line 163 of file mlCloseGapFilter.h.
ml::CloseGapFilter::CloseGapFilter | ( | ) |
Constructor.
Initializes the fields, the members and the field connections with the field container.
Note that with the following method calls an additional field interface is created as described in KernelModule
and KernelBaseModule:
_createKernelExtentFields
(3);_createMakeSphericalField()
;_createImageIntervalFields
(0,1024,true,false);_createKernelIntervalFields
(0,1024,true,false);_createExternalKernelFields
(true,false);_createKernelInfoField
();_createNumKernelElementsField
();Also available are the fields access methods from KernelBaseModule:
virtual void ml::CloseGapFilter::_userKernelPostUpdate | ( | ) | [protected, virtual] |
Typical method to be overloaded by derived modules to apply kernel changes.
This method is called by _updateKernel(permitExtentChanges)
to supply a method where the application can change the kernel AFTER all automatic changes and BEFORE the output kernel fields, the _kernelInfoFld
, the _numKernelElementsFld
and the _kernelElementSumFld
are updated. See _updateKernel(permitExtentChanges)
for more Infos.
Reimplemented from ml::KernelModule.
virtual void ml::CloseGapFilter::activateAttachments | ( | ) | [protected, virtual] |
Called when loading has finished.
It's necessary to update the kernel then to the current state of the fields.
Reimplemented from ml::KernelModule.
ml::CloseGapFilter::CALC_ROW_H | ( | ) | [protected] |
Macro which needs to be added to the implementation of a class derived from KernelModule
or KernelBaseModule
.
It guarantees that the correct template functions are called for images with any data type. It also overloads calculateOutputSubImage()
of the base class Module
. Note that CALC_ROW_CPP() also needs to be added to the .cpp file.
void ml::CloseGapFilter::calcRow | ( | MLsoffset * | indexTab, |
size_t | indexTabSize, | ||
MLsoffset | srcVoxelOffset, | ||
size_t | numVox, | ||
DATATYPE * | inCursor, | ||
DATATYPE * | outCursor, | ||
const ImageVector & | |||
) | [protected] |
In this template method the filtering of one row needs to be implemented.
It will be called by the CALC_ROW_H()
/ CALC_ROW_CPP()
macro.
EnumField* ml::CloseGapFilter::getCloseGapFilterFld | ( | ) | const [inline] |
Definition at line 202 of file mlCloseGapFilter.h.
EnumField* ml::CloseGapFilter::getSelectInternalKernelFld | ( | ) | const [inline] |
Definition at line 204 of file mlCloseGapFilter.h.
FloatField* ml::CloseGapFilter::getSensitivityFld | ( | ) | const [inline] |
Definition at line 203 of file mlCloseGapFilter.h.
virtual void ml::CloseGapFilter::handleNotification | ( | Field * | field | ) | [protected, virtual] |
Called when a parameter field is changed.
Reimplemented from ml::KernelModule.
const char* const ml::CloseGapFilter::CloseGapFilterNames[] [static] |
Strings names for CloseGap based filters.
Definition at line 144 of file mlCloseGapFilter.h.
const char* const ml::CloseGapFilter::CloseGapKernelNames[] [static] |
String names for the mlCloseGapKernels enum.
Definition at line 173 of file mlCloseGapFilter.h.