MeVisLabToolboxReference
|
The KernelLineApplicator
class takes a Kernel
instance and filters one line of an mlSubImage
and writes it to an output also given by another mlSubImage
.
More...
#include <mlKernelLineApplicator.h>
Public Types | |
enum | ApplyMode { APPLY_COPY = 0, APPLY_NORMALLY, APPLY_USER_FILTER, APPLY_IMAGE_INTERVAL_FILTER, APPLY_KERNEL_INTERVAL_FILTER, APPLY_IMAGE_AND_KERNEL_INTERVAL_FILTER, NUM_APPLY_MODES } |
The ApplyModes decide about the way how the kernel is used to filter the input image and which parts of it. More... | |
Public Member Functions | |
KernelLineApplicator () | |
Default constructor. | |
KernelLineApplicator (const KernelLineApplicator &kernLineApp) | |
Copy constructor. | |
KernelLineApplicator (const TKernel< KDATATYPE > &kernel, ApplyMode applyMode, MLdouble iIntMin=-DBL_MIN, MLdouble iIntMax=DBL_MAX, MLdouble kIntMin=-DBL_MIN, MLdouble kIntMax=DBL_MAX) | |
Convenience constructor to create a complete line applicator with all important parameters set. | |
virtual | ~KernelLineApplicator () |
Destructor. Frees dynamic members. | |
const KernelLineApplicator & | operator= (const KernelLineApplicator &kernLineApp) |
Assignment operator. Assures that dynamic and normal members are copied correctly. | |
void | setImageInterval (MLdouble min=-DBL_MAX, MLdouble max=DBL_MAX) |
Correlations can be applied to a subset of voxels by setting a threshold interval which includes the convoluted voxels. | |
void | setKernelInterval (MLdouble min=-DBL_MAX, MLdouble max=DBL_MAX) |
When filtering an image then voxels covered by the kernel elements outside a certain grey level interval can be excluded. | |
bool | isInImageInterval (DATATYPE v) const |
Test whether the value v is within image interval. | |
bool | isInKernelInterval (DATATYPE v) const |
Test whether the value v is within kernel interval. | |
void | applyToLine (TSubImageWithCursor< DATATYPE > *inSubImg, TSubImageWithCursor< DATATYPE > *outSubImg, size_t numVox) |
Selects the correct line filter mode and filters a row with the currently specified kernel. | |
virtual void | applyUserFilterToLine (TSubImageWithCursor< DATATYPE > *inSubImg, TSubImageWithCursor< DATATYPE > *outSubImg, long numVox) const |
Filter a row with the current kernel with a user defined algorithm. | |
Set/Get the mode how the kernel is applied to the image. | |
void | setApplyMode (ApplyMode mode) |
ApplyMode | getApplyMode () const |
Return the interval limits for image and kernel interval. | |
DATATYPE | getImageIntervalMin () const |
DATATYPE | getImageIntervalMax () const |
DATATYPE | getKernelIntervalMin () const |
DATATYPE | getKernelIntervalMax () const |
Static Public Attributes | |
static const char *const | ApplyModeNames [] |
Strings for ApplyMode names. See mlKernalLineApplicator.cpp for the names. | |
Protected Member Functions | |
void | _init () |
Initialization the current instance of mlKernelApplicator. To be called by constructors. | |
Protected Attributes | |
ApplyMode | _applyMode |
The mode how the kernel is applied to the image. | |
bool | _normOrigI |
_normOrigI==true indicates that the interval is used exclusively. | |
bool | _normKernI |
_normKernI==true indicates that the interval is used exclusively. | |
Minimum/Maximum limits of interval limiting the input image voxels to be filtered. | |
MLdouble | _origIMin |
MLdouble | _origIMax |
DATATYPE | _origIMinDT |
DATATYPE | _origIMaxDT |
Minimum/Maximum limits of interval limiting the input image voxels used for filtering. | |
MLdouble | _kernIMin |
MLdouble | _kernIMax |
DATATYPE | _kernIMinDT |
DATATYPE | _kernIMaxDT |
The KernelLineApplicator
class takes a Kernel
instance and filters one line of an mlSubImage
and writes it to an output also given by another mlSubImage
.
This class is derived from the KernelLineApplicatorBase
where it needs to overload the central method
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 applyFiltering
functions from the KernelTools
class. So usually there is no need to use this class explicitly if it's not overloaded.
There are some modes how the kernel can be applied to inSubImg
and the user can implement its own mode by overloading the method
applyUserFilterToLine
(TSubImageWithCursor<DATATYPE> *inSubImg, TSubImageWithCursor<DATATYPE> *outSubImg, int numVox)
Then pass an instance of your KernelLineApplicator
to an applyFiltering
functions from the KernelTools
class which filters an entire subimage with 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 72 of file mlKernelLineApplicator.h.
enum ml::KernelLineApplicator::ApplyMode |
The ApplyModes decide about the way how the kernel is used to filter the input image and which parts of it.
-APPLY_COPY Copy those row voxels from input subimage which correspond to the row to be modified in the output image.
-APPLY_NORMALLY Filter a row with the current kernel.
-APPLY_USER_FILTER Filter a row with the current kernel with a user defined algorithm.
-APPLY_IMAGE_INTERVAL_FILTER Filter a row with the current kernel. Apply kernel only to voxels which fulfil the image interval.
-APPLY_KERNEL_INTERVAL_FILTER Filter a voxel with the current kernel. All input image voxels under kernel elements which are not in the kernel interval are not multiplied with kernel element values and are not added to result value.
-APPLY_IMAGE_AND_KERNEL_INTERVAL_FILTER Filter a voxel with the current kernel. All input image voxels under kernel elements which are not in the kernel interval are not multiplied with kernel element values and are not added to result value. Only input image voxels are filtered which fulfil the image interval.
APPLY_COPY | |
APPLY_NORMALLY | |
APPLY_USER_FILTER | |
APPLY_IMAGE_INTERVAL_FILTER | |
APPLY_KERNEL_INTERVAL_FILTER | |
APPLY_IMAGE_AND_KERNEL_INTERVAL_FILTER | |
NUM_APPLY_MODES |
Definition at line 106 of file mlKernelLineApplicator.h.
ml::KernelLineApplicator< DATATYPE, KDATATYPE >::KernelLineApplicator | ( | ) | [inline] |
Default constructor.
Default settings are an invalid kernel, empty index tables, unlimited image and filter intervals and _srcVoxOffset=0. _applyMode is ApplyNormally.
Definition at line 126 of file mlKernelLineApplicator.h.
References ml::KernelLineApplicatorBase< DATATYPE, KDATATYPE >::_init().
ml::KernelLineApplicator< DATATYPE, KDATATYPE >::KernelLineApplicator | ( | const KernelLineApplicator< DATATYPE, KDATATYPE > & | kernLineApp | ) | [inline] |
Copy constructor.
Definition at line 134 of file mlKernelLineApplicator.h.
References ml::KernelLineApplicatorBase< DATATYPE, KDATATYPE >::_init().
ml::KernelLineApplicator< DATATYPE, KDATATYPE >::KernelLineApplicator | ( | const TKernel< KDATATYPE > & | kernel, |
ApplyMode | applyMode, | ||
MLdouble | iIntMin = -DBL_MIN , |
||
MLdouble | iIntMax = DBL_MAX , |
||
MLdouble | kIntMin = -DBL_MIN , |
||
MLdouble | kIntMax = DBL_MAX |
||
) | [inline] |
Convenience constructor to create a complete line applicator with all important parameters set.
An instance of an mlKernelApplicator and the kernel application mode must be passed. Image and kernel interval are optional and default to unlimited intervals.
Definition at line 147 of file mlKernelLineApplicator.h.
References ml::KernelLineApplicatorBase< DATATYPE, KDATATYPE >::_init(), and ml::KernelLineApplicatorBase< DATATYPE, KDATATYPE >::setKernel().
virtual ml::KernelLineApplicator< DATATYPE, KDATATYPE >::~KernelLineApplicator | ( | ) | [inline, virtual] |
Destructor. Frees dynamic members.
Definition at line 170 of file mlKernelLineApplicator.h.
void ml::KernelLineApplicator< DATATYPE, KDATATYPE >::_init | ( | ) | [inline, protected] |
Initialization the current instance of mlKernelApplicator. To be called by constructors.
Reimplemented from ml::KernelLineApplicatorBase< DATATYPE, KDATATYPE >.
Definition at line 403 of file mlKernelLineApplicator.h.
void ml::KernelLineApplicator< DATATYPE, KDATATYPE >::applyToLine | ( | TSubImageWithCursor< DATATYPE > * | inSubImg, |
TSubImageWithCursor< DATATYPE > * | outSubImg, | ||
size_t | numVox | ||
) | [inline, virtual] |
Selects the correct line filter mode and filters a row with the currently specified kernel.
Cursors must have been set in input and output subimage. Define the index table before using this method. On empty index tables the voxel of the input image is copied to the output.
Reimplemented from ml::KernelLineApplicatorBase< DATATYPE, KDATATYPE >.
Definition at line 304 of file mlKernelLineApplicator.h.
References ml::KernelLineApplicatorBase< DATATYPE, KDATATYPE >::_defineIndices(), and ml::TSubImageWithCursor< DATATYPE >::getCursorPos().
virtual void ml::KernelLineApplicator< DATATYPE, KDATATYPE >::applyUserFilterToLine | ( | TSubImageWithCursor< DATATYPE > * | inSubImg, |
TSubImageWithCursor< DATATYPE > * | outSubImg, | ||
long | numVox | ||
) | const [inline, virtual] |
Filter a row with the current kernel with a user defined algorithm.
Cursors in input and output subimage and index table must be up to date. Overload this method to implement you own algorithm to apply the kernel to the image.
Definition at line 387 of file mlKernelLineApplicator.h.
References ml::TSubImageWithCursor< DATATYPE >::getCursorPos().
ApplyMode ml::KernelLineApplicator< DATATYPE, KDATATYPE >::getApplyMode | ( | ) | const [inline] |
Definition at line 204 of file mlKernelLineApplicator.h.
DATATYPE ml::KernelLineApplicator< DATATYPE, KDATATYPE >::getImageIntervalMax | ( | ) | const [inline] |
Definition at line 213 of file mlKernelLineApplicator.h.
DATATYPE ml::KernelLineApplicator< DATATYPE, KDATATYPE >::getImageIntervalMin | ( | ) | const [inline] |
Definition at line 212 of file mlKernelLineApplicator.h.
DATATYPE ml::KernelLineApplicator< DATATYPE, KDATATYPE >::getKernelIntervalMax | ( | ) | const [inline] |
Definition at line 215 of file mlKernelLineApplicator.h.
DATATYPE ml::KernelLineApplicator< DATATYPE, KDATATYPE >::getKernelIntervalMin | ( | ) | const [inline] |
Definition at line 214 of file mlKernelLineApplicator.h.
bool ml::KernelLineApplicator< DATATYPE, KDATATYPE >::isInImageInterval | ( | DATATYPE | v | ) | const [inline] |
Test whether the value v is within image interval.
Note that the interval is considered exclusively if maximum is smaller than minimum, i.e. all values between maximum and minimum are excluded and all others are included. Default is false.
Definition at line 257 of file mlKernelLineApplicator.h.
References MLIsStandardTypePtr().
bool ml::KernelLineApplicator< DATATYPE, KDATATYPE >::isInKernelInterval | ( | DATATYPE | v | ) | const [inline] |
Test whether the value v is within kernel interval.
Note that the interval is considered exclusively if maximum is smaller than minimum, i.e. all values between maximum and minimum are excluded and all other are included. Default is false.
Definition at line 282 of file mlKernelLineApplicator.h.
References MLIsStandardTypePtr().
const KernelLineApplicator& ml::KernelLineApplicator< DATATYPE, KDATATYPE >::operator= | ( | const KernelLineApplicator< DATATYPE, KDATATYPE > & | kernLineApp | ) | [inline] |
Assignment operator. Assures that dynamic and normal members are copied correctly.
Definition at line 178 of file mlKernelLineApplicator.h.
References ml::KernelLineApplicator< DATATYPE, KDATATYPE >::_applyMode, ml::KernelLineApplicator< DATATYPE, KDATATYPE >::_kernIMax, ml::KernelLineApplicator< DATATYPE, KDATATYPE >::_kernIMin, ml::KernelLineApplicator< DATATYPE, KDATATYPE >::_origIMax, and ml::KernelLineApplicator< DATATYPE, KDATATYPE >::_origIMin.
void ml::KernelLineApplicator< DATATYPE, KDATATYPE >::setApplyMode | ( | ApplyMode | mode | ) | [inline] |
Definition at line 203 of file mlKernelLineApplicator.h.
void ml::KernelLineApplicator< DATATYPE, KDATATYPE >::setImageInterval | ( | MLdouble | min = -DBL_MAX , |
MLdouble | max = DBL_MAX |
||
) | [inline] |
Correlations can be applied to a subset of voxels by setting a threshold interval which includes the convoluted voxels.
If used then only voxels >= min and <=max are modified by correlations. Default is (-DBL_MAX, DBL_MAX).
Definition at line 224 of file mlKernelLineApplicator.h.
void ml::KernelLineApplicator< DATATYPE, KDATATYPE >::setKernelInterval | ( | MLdouble | min = -DBL_MAX , |
MLdouble | max = DBL_MAX |
||
) | [inline] |
When filtering an image then voxels covered by the kernel elements outside a certain grey level interval can be excluded.
If used then only voxels >= min and <=max are multiplied with kernel values. Otherwise these products are not added to the resulting output image voxel. Default is (-DBL_MAX, DBL_MAX).
Definition at line 241 of file mlKernelLineApplicator.h.
ApplyMode ml::KernelLineApplicator< DATATYPE, KDATATYPE >::_applyMode [protected] |
The mode how the kernel is applied to the image.
Definition at line 425 of file mlKernelLineApplicator.h.
Referenced by ml::KernelLineApplicator< DATATYPE, KDATATYPE >::operator=().
MLdouble ml::KernelLineApplicator< DATATYPE, KDATATYPE >::_kernIMax [protected] |
Definition at line 446 of file mlKernelLineApplicator.h.
Referenced by ml::KernelLineApplicator< DATATYPE, KDATATYPE >::operator=().
DATATYPE ml::KernelLineApplicator< DATATYPE, KDATATYPE >::_kernIMaxDT [protected] |
Definition at line 448 of file mlKernelLineApplicator.h.
MLdouble ml::KernelLineApplicator< DATATYPE, KDATATYPE >::_kernIMin [protected] |
Definition at line 445 of file mlKernelLineApplicator.h.
Referenced by ml::KernelLineApplicator< DATATYPE, KDATATYPE >::operator=().
DATATYPE ml::KernelLineApplicator< DATATYPE, KDATATYPE >::_kernIMinDT [protected] |
Definition at line 447 of file mlKernelLineApplicator.h.
bool ml::KernelLineApplicator< DATATYPE, KDATATYPE >::_normKernI [protected] |
_normKernI==true indicates that the interval is used exclusively.
Definition at line 452 of file mlKernelLineApplicator.h.
bool ml::KernelLineApplicator< DATATYPE, KDATATYPE >::_normOrigI [protected] |
_normOrigI==true indicates that the interval is used exclusively.
Definition at line 439 of file mlKernelLineApplicator.h.
MLdouble ml::KernelLineApplicator< DATATYPE, KDATATYPE >::_origIMax [protected] |
Definition at line 433 of file mlKernelLineApplicator.h.
Referenced by ml::KernelLineApplicator< DATATYPE, KDATATYPE >::operator=().
DATATYPE ml::KernelLineApplicator< DATATYPE, KDATATYPE >::_origIMaxDT [protected] |
Definition at line 435 of file mlKernelLineApplicator.h.
MLdouble ml::KernelLineApplicator< DATATYPE, KDATATYPE >::_origIMin [protected] |
Definition at line 432 of file mlKernelLineApplicator.h.
Referenced by ml::KernelLineApplicator< DATATYPE, KDATATYPE >::operator=().
DATATYPE ml::KernelLineApplicator< DATATYPE, KDATATYPE >::_origIMinDT [protected] |
Definition at line 434 of file mlKernelLineApplicator.h.
const char *const ml::KernelLineApplicator< DATATYPE, KDATATYPE >::ApplyModeNames [static] |
{ "ApplyCopy", "ApplyNormally", "ApplyUserFilter", "ApplyImageIntervalFilter", "ApplyKernelIntervalFilter", "ApplyImageAndKernelInterval" }
Strings for ApplyMode names. See mlKernalLineApplicator.cpp for the names.
Strings for mlApplyModeNames.
Definition at line 120 of file mlKernelLineApplicator.h.