DIPlib Documentation - ©1995-2017 Quantitative Imaging Group, Delft University of Technology.

SeparableFrameWork

FrameWork for separable filters

SYNOPSIS

dip_Error dip_SeparableFrameWork (in, out, boundary, border, process )

FUNCTION

The dip_SeparableFrameWork function is a framework for separable filters. This function takes care of all the "administrative work" involved when processing a n-D DIPlib image n times with a 1-D filter. In short, using this function, one has only to create an one dimension filter function and dip_SeparableFrameWork takes care of the other stuff. The in image is filtered nrOfProcesses times using the information in each element of the process array. If nrOfProcesses is zero, only the first element of process is used to filter in in all its dimensions.

ARGUMENTS

Data typeNameDescription
dip_ImageinInput image
dip_ImageoutOutput image
dip_BoundaryArrayboundaryBoundary conditions
dip_IntegerArrayborderBorder array
dip_FrameWorkProcessArrayprocessArray of dip_FrameWorkProcess structures

NOTE

The dip_FrameWorkProcess structure contains the following members:

Data typeNameDescription
dip_Booleanprocessflags specifying to do processing or not
dipf_FrameWorkMethodframeWorkMethodflags specifying the method of how dip_SeparableFrameWork should transport data from in to out
dipf_FrameWorkOperationframeWorkOperationflags specifying requirements of the 1-D filter function
dip_intprocessDimensiondimension of in to be processed
dip_introiOriginignored in current implementation
dip_introiSizeignored in current implementation
dipf_FrameWorkFilterFrameWorkFilterTypespecifying the type of 1-D filter function
dip_FrameWorkFilterFrameWorkFilterpointer to the 1-D filter function
void *functionParametersparameters of the 1-D filter function, for all dimensions
dip_DataTypeinputBufferTypedata type of input buffer
dip_DataTypeoutputBufferTypedata type of output buffer
dip_DataTypesuggestedOutputTypedata type of output image

The dipf_FrameWorkMethod enum contains the following elements:

NameDescription
DIP_FRAMEWORK_DEFAULT_METHODuse dip_SeparableFrameWorks most optimal method
DIP_FRAMEWORK_CLASSICALuse a classical method
DIP_FRAMEWORK_DOUBLE_STRIPEuse two buffers to store temporary results

It is strongly advised to use the DIP_FRAMEWORK_DEFAULT_METHOD method.

The dipf_FrameWorkOperation enum contains the following elements:

NameDescription
DIP_FRAMEWORK_DEFAULT_OPERATIONdefault operation
DIP_FRAMEWORK_IN_PLACEfiltering operation can be performed in-place. It is up to dip_SeparableFrameWork whether the actual filtering is done in-place
DIP_FRAMEWORK_NO_IN_BORDERthe 1-D filter does not need border extension of the input data
DIP_FRAMEWORK_OUT_BORDERthe 1-D filter needs border extension of the output data
DIP_FRAMEWORK_WRITE_INPUTthe 1-D filter needs to write in the input data
DIP_FRAMEWORK_USE_BUFFER_TYPESmade the input and output buffers of the inputBufferType and outputBufferType data type
DIP_FRAMEWORK_NO_BUFFER_STRIDECreate input and output buffers with a stride of one
DIP_FRAMEWORK_DO_NOT_ADJUSTDo not adjust the output image, just check it
DIP_FRAMEWORK_USE_OUTPUT_TYPEAdjust output image to the suggestedOutputType data type

The dipf_FrameWorkFilter enum contains the following elements:

NameDescription
DIP_FRAMEWORK_SEPARABLE_FILTERdefault filter type, process one line at the time
DIP_FRAMEWORK_TWO_LINES_SEPARABLE_FILTERprocess two lines in one go
DIP_FRAMEWORK_SINGLE_OUTPUT_FILTERthis filter only needs an output buffer

The union dip_FrameWorkFunction consists of the types

NameDescription
dip_SeparableFilterone line filter function
dip_TwoLinesSeparableFiltertwo lines filter function
dip_SingleOutputFiltersingle output image filter

The functions have the following arguments: dip_SeparableFilter

Data typeNameDescription
void *inDatapointer to the input data
void *outDatapointer to the output data
dip_intelementsnumber of pixels in the inData array
dip_SeparableFilterParametersparamsparameter structure for the filter function

and dip_SeparableTwoLinesFilter

Data typeNameDescription
void *inFirstLineDatapointer to the data of the first input line
void *inSecondLineDatapointer to the data of the second input line
void *outFirstLineDatapointer to the data of the first output line
void *outSecondLineDatapointer to the data of the second output line
dip_intelementsnumber of pixels in the inFirstLineData array
dip_TwoLinesSeparableFilterParametersparamsparameter structure for the two lines filter function

The inData, inFirstLineData and inSecondLineData will always point to the first pixel of the line of in that is processed. Therefore, the 1-D filter can access pixels with indices ranging from -border[dimension] up to elements + border[dimension]. If the flag DIP_FRAMEWORK_OUT_BOUNDARY is specified, the same holds for the output data pointers.

The structure dip_SeparableFilterParameters contains the following elements:

Data typeNameDescription
void *functionParametersparameters of the 1-D filter function per dimension
dip_intdimensionthe dimension in which direction the input buffer is taken from the input image
dip_intprocessNumbernumber of times dip_SeparableFrameWork has already filtered in with an 1-D filter including current filtering
dip_DataTypeinTypedip_DataType of the input buffer
dip_intinStridestride of the elements in the input array
dip_intinPlaneplane number in case in is a binary image
dip_DataTypeoutTypedip_DataType of the output buffer
dip_intoutStridestride of the elements in the output array
dip_intoutPlaneplane number in case out is a binary image
dip_intoutDimensionthe dimension in which direction the output buffer is taken from the output image
dip_IntegerArraypositioncoordinate of the first pixel of the input buffer in the input image

The structure dip_TwoLinesSeparableFilterParameters contains the following elements:

Data typeNameDescription
void *functionParametersparameters of the 1-D filter function per dimension
dip_intdimensionthe dimension in which direction the input buffer is taken from the input image
dip_intprocessNumbernumber of times dip_SeparableFrameWork has already filtered in with an 1-D filter including current filtering
dip_DataTypeinTypedip_DataType of the input buffer
dip_intinStridestride of the elements in the input array
dip_intinPlaneplane number in case in is a binary image
dip_DataTypeoutTypedip_DataType of the output buffer
dip_intoutStridestride of the elements in the output array
dip_intoutPlaneplane number in case out is a binary image
dip_intoutDimensionthe dimension in which direction the output buffer is taken from the output image
dip_IntegerArraypositioncoordinate of the first pixel of the input buffer in the input image

The structure dip_SingleOutputFilterParameters contains the following elements:

Data typeNameDescription
void *functionParametersparameters of the 1-D filter function per dimension
dip_intdimensionthe dimension in which direction the input buffer is taken from the input image
dip_intprocessNumbernumber of times dip_SeparableFrameWork has already filtered in with an 1-D filter including current filtering
dip_DataTypetypedip_DataType of the input buffer
dip_intstridestride of the elements in the input array
dip_intplaneplane number in case in is a binary image
dip_IntegerArraypositioncoordinate of the first pixel of the input buffer in the input image

SEE ALSO

DIPlib's data types SeparableConvolution, MonadicFrameWork, SingleOutputFrameWork, PixelTableFrameWork, ScanFrameWork