MeVisLab Toolbox Reference
|
Class collecting a set of templated an normal functions for filtering operations using kernels. More...
#include <mlKernelTools.h>
Border handling type and names. | |
enum | BorderHandling { NO_PAD = 0 , PAD_SRC_FILL , PAD_DST_FILL , PAD_DST_ORIGFILL , PAD_SRC_UNDEFINED , PAD_DST_UNDEFINED , PAD_SRC_CLAMP , NUM_BORDER_HANDLINGS } |
The border handling defines how an image is filtered at its borders if the kernel reaches undefined regions. More... | |
static const char *const | BorderHandlingNames [] |
Strings for BorderHandling names. | |
Class collecting a set of templated an normal functions for filtering operations using kernels.
This file defines the BorderHandling
enum type and a set of string names corresponding to the enum values.
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
.
This file also contains a set of helper functions in the class KernelTools
. IMPORTANT NOTE: There are some functions called like "correlateLine..." which do the same like that what's typically called a "convolution" in a programming context. We use the correct mathematical name "correlate" here. A convolution then can be implemented correctly by mirroring the kernel elements and using one of the "correlate..." functions. For the usage of correlations see
The following helper functions are available:
createIndexTab
calcSrcVoxelOffset
calcOutImageExt
calculateOutputImageProperties()
.adaptWorldCoordinates
calculateOutputImageProperties()
.expandForSeparableOrIterativeFiltering
calcInSubImageBoxForOutSubImg
calculateInputSubImageBox()
.calcOutInCoordShift
calcAreaToBeCalculated
copyLine
correlateLine
correlateLineWithImageInterval
correlateLineWithKernelInterval
correlateLineWithImageAndKernelInterval
correlateLineEvtWithIntervals
correlateLineWithImageAndKernelInterval
correlateLineWithKernelInterval
correlateLineWithImageInterval
orcorrelateLine
is used to accomplish filtering.fillBorders
applyFiltering
Definition at line 641 of file mlKernelTools.h.
The border handling defines how an image is filtered at its borders if the kernel reaches undefined regions.
NO_PAD
Only those voxels are passed to the output which can be filtered correctly by the entire kernel. So the output image usually shrinks by the kernel extents-1.PAD_SRC_FILL
The input image is virtually expanded by so many voxels that all input image voxels can be filtered correctly with the kernel. The area added around the input image is filled with the fill value.PAD_DST_FILL
All pixels of the output image which can be filtered correctly with the kernel without accessing voxels outside the output image are filtered with the kernel. All other voxels in the image are filled with the fill value.PAD_DST_ORIGFILL
All pixels of the output image which can be filtered correctly with the kernel without accessing voxels outside the output image are filtered with the kernel. All other voxels are copied from the input image.PAD_SRC_UNDEFINED
All pixels of the output image which can be filtered correctly with the kernel without accessing voxels outside the output image are filtered with the kernel. All other voxels are left undefined.PAD_DST_UNDEFINED
The input image is virtually expanded by so many voxels that all input image voxels can be filtered correctly with the kernel. The contents of the area added around the input image is left undefined. So the filtered image will also have a border with undefined image values.PAD_SRC_CLAMP
The input image is virtually expanded by so many voxels that all input image voxels can be filtered correctly with the kernel. The contents of the area added around the input image is filled with the next voxel found in the input image.Notes:
PAD_DST_CLAMP
cannot work, because clamping to valid data does not work for requested pages which are completely outside the valid area. E.g. slice 64 cannot be calculated if last valid page is 62 - clamping to 62 cannot work, because it does not exist when 64 is requested. Sorry, because that would be a nice mode.
Enumerator | |
---|---|
NO_PAD | |
PAD_SRC_FILL | |
PAD_DST_FILL | |
PAD_DST_ORIGFILL | |
PAD_SRC_UNDEFINED | |
PAD_DST_UNDEFINED | |
PAD_SRC_CLAMP | |
NUM_BORDER_HANDLINGS |
Definition at line 697 of file mlKernelTools.h.
|
static |
Convenience function to correct the world matrix of the image outImg
when a kernel is applied to outImg
with border handling borderHandling
.
negExt
needs to be passed (can be retrieved from the applied kernel).
|
inlinestatic |
See MLKernelToolsApplyFiltering.
Definition at line 953 of file mlKernelTools.h.
References ml::MLKernelToolsApplyFiltering(), and mlrange_cast().
|
inlinestatic |
See MLKernelToolsApplyFiltering.
Definition at line 941 of file mlKernelTools.h.
References ml::MLKernelToolsApplyFiltering(), and mlrange_cast().
|
static |
Calculate the area of the output to be calculated when the kernel the negative negKernelExt
and the positive posKernelExt
extents and the border handling mode borderHandling
is used on an image of extent inImgExt
.
isSeparable
denotes whether a separable kernel filtering is applied; its default value is false. numIterations
denotes the number of iterations to be applied; its default is 1. All values below 1 will be considered as 1. The area is in OUTPUT image coordinates.
|
static |
Computes the size of the input page needed to calculate the page whose extents are given by outSubImgBox
.
The extents are influenced by borderHandling
and the negative and positive kernel extents given by negExt
and posExt
.
outSubImgBox | is the region of the output subimage to be calculated. |
borderHandling | describes the handling at image borders and needs to an enumerator values from BorderHandling . |
negExt | is the negative kernel extent given by getNegativeExtent() method of class kernel. |
posExt | is the positive kernel extent given by getPositiveExtent() method of class kernel. |
isSeparable | denotes whether a separable kernel filtering is applied; its default value is false. |
numIterations | denotes the number of iterations to be applied; its default is 1. All values below 1 will be considered as 1. |
outSubImgBox
.
|
static |
Calculate extents of output image for input image extents imgExt
and kernel extents kernelExt
if border handling borderHandling
is used.
For the number of iterations 1 (the default) needs to be used for normal filtering.
|
static |
For every voxel coordinate written into the output image there is a voxel coordinate in the input image which serves as the origin for the kernel.
The shift between the voxel coordinate in the output image and kernel origin coordinate in input image is specified with this return value. To explain it another way: This is the shift vector in global image coordinates from an output voxel coordinate O to the voxel coordinate V where the filter kernel is placed so that V gets the right filter result. This value is the negative kernel extent for all BorderHandling modes, only in case of NO_PAD
it's the null vector.
|
static |
Computes the offset index from voxel in output image to voxel in input image which can be returned as original voxel, e.g.
if filter operation fails or if it does nothing.
|
inlinestatic |
Wrapping of functions globally available in ML_NAMESPACE for backward compatibility.
See MLKernelToolsCopyLine.
Definition at line 851 of file mlKernelTools.h.
References ml::MLKernelToolsCopyLine(), and mlrange_cast().
Referenced by ml::KernelLineApplicator< DATATYPE, KDATATYPE >::applyToLine(), and ml::KernelLineApplicator< DATATYPE, KDATATYPE >::applyUserFilterToLine().
|
inlinestatic |
See MLKernelToolsCorrelateLine.
Definition at line 861 of file mlKernelTools.h.
References ml::MLKernelToolsCorrelateLine(), and mlrange_cast().
Referenced by ml::KernelLineApplicator< DATATYPE, KDATATYPE >::applyToLine().
|
inlinestatic |
See MLKernelToolsCorrelateLineEvtWithIntervals.
Definition at line 921 of file mlKernelTools.h.
References ml::MLKernelToolsCorrelateLineEvtWithIntervals(), and mlrange_cast().
|
inlinestatic |
See MLKernelToolsCorrelateLineWithImageAndKernelInterval.
Definition at line 903 of file mlKernelTools.h.
References ml::MLKernelToolsCorrelateLineWithImageAndKernelInterval(), and mlrange_cast().
Referenced by ml::KernelLineApplicator< DATATYPE, KDATATYPE >::applyToLine().
|
inlinestatic |
See MLKernelToolsCorrelateLineWithImageInterval.
Definition at line 873 of file mlKernelTools.h.
References ml::MLKernelToolsCorrelateLineWithImageInterval(), and mlrange_cast().
Referenced by ml::KernelLineApplicator< DATATYPE, KDATATYPE >::applyToLine().
|
inlinestatic |
See MLKernelToolsCorrelateLineWithKernelInterval.
Definition at line 888 of file mlKernelTools.h.
References ml::MLKernelToolsCorrelateLineWithKernelInterval(), and mlrange_cast().
Referenced by ml::KernelLineApplicator< DATATYPE, KDATATYPE >::applyToLine().
|
static |
Create the table of offsets from the voxel (0,0,0,0,0,0) to the coordinates given by kernel.getCoordTab()
.
The offsets work corresponding to the strides given by inSubImgStrides
. If kernel.isSeparable()
then kernel.getSeparableCoordTab()
is used instead kernel.getCoordTab()
. The returned table must be deleted with deleteIndexTab()
. On error NULL (e.g. allocation failure) NULL is returned.
Function to delete an index table created with createIndexTab
.
NULL pointers can be passed safely.
|
static |
Adds additional "borders around a box for separable or iterative filtering, for example around requested input subimages.
box | is the region to be expanded. |
negKernelExt | is the negative extent of the kernel. |
posKernelExt | is the positive extent of the kernel. |
isSeparable | is true for separable filtering, otherwise false. |
numIterations | is 1 for normal filtering or greater for additional iterations; values <=1 are set to 1. |
|
static |
Fill the borders of the input or the output subimage (inSubImg
or outSubImg
) with the correct values dependent on the passed border handling borderHandling
.
For border handling modes which fill a border (*fill) fillValue
is used as fill value, otherwise it's not used. For correct operation the negative negKernelExt
and the positive posKernelExt
extents of the kernel dimensions are needed, the extents of inSubImg
must have been calculated with calcInSubImageBoxForOutSubImg()
and the operator output image image extents must have been calculated with calcOutImageExt()
. Also the extent of the used input image inImgExt
must be passed.
Strings for BorderHandling names.
Definition at line 710 of file mlKernelTools.h.