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

Tophat

Morphological high-pass filter

SYNOPSIS

#include "dip_morphology.h"

dip_Error dip_Tophat ( in, out, se, boundary, param, shape, edgeType, polarity )

DATA TYPES

integer, float

FUNCTION

The top-hat is the difference between a morphological operation and the original image, comparable to a high-pass filter. Which operation is used can be chosen through the dip_MphEdgeType and dip_MphTophatPolarity parameters.

The rectangular, elliptic and diamond structuring elements are "flat", i.e. these structuring elements have a constant value. For these structuring elements, param determines the sizes of the structuring elements.

When shape is DIP_FLT_SHAPE_DISCRETE_LINE or DIP_FLT_SHAPE_INTERPOLATED_LINE, the structuring element is a line. param->array[0] determines the length, param->array[1] the angle. This is currently only supported for 2D images. Interpolated lines use interpolation to obtain a more accurate result, but loose the strict increasingness and extensivity (these properties are satisfied only by approximation).

When shape is set to DIP_FLT_SHAPE_PARABOLIC, params specifies the curvature of the parabola.

When shape is set to DIP_FLT_SHAPE_STRUCTURING_ELEMENT, se is used as structuring element. It can be either a binary or a grey-value image. Its origin is the center, or one pixel to the left of the center if the size is even.

If shape is not equal to DIP_FLT_SHAPE_STRUCTURING_ELEMENT, se can be set to zero. When shape is set to DIP_FLT_SHAPE_STRUCTURING_ELEMENT, param is ignored, and can be set to zero.

ARGUMENTS

Data typeNameDescription
dip_ImageinInput
dip_ImageoutOutput
dip_ImageseCustom structuring element
dip_BoundaryArrayboundaryBoundary conditions
dip_FloatArrayparamFilter parameters
dip_FilterShapeshapeStructuring element
dip_MphEdgeTypeedgeTypeedgeType
dip_MphTophatPolaritypolaritypolarity

The enumerator dip_FilterShape contains the following constants:

NameDescription
DIP_FLT_SHAPE_DEFAULTDefault filter window, same as DIP_FLT_SHAPE_RECTANGULAR
DIP_FLT_SHAPE_RECTANGULARRectangular filter window, can be even in size
DIP_FLT_SHAPE_ELLIPTICElliptic filter window, always odd in size
DIP_FLT_SHAPE_DIAMONDDiamond-shaped filter window, always odd in size
DIP_FLT_SHAPE_PARABOLICParabolic filter window (morphology only)
DIP_FLT_SHAPE_DISCRETE_LINERotated line structuring element (morphology only)
DIP_FLT_SHAPE_INTERPOLATED_LINERotated line structuring element, through interpolation (morphology only)
DIP_FLT_SHAPE_PERIODIC_LINE(not implemented)
DIP_FLT_SHAPE_STRUCTURING_ELEMENTUse se as filter window, can be any size

The enumerator dip_MphEdgeType contains the following constants:

NameDescription
DIP_MPH_TEXTUREResponse is limited to edges in texture
DIP_MPH_OBJECTResponse is limited to object edges
DIP_MPH_BOTHAll edges produce equal response

The enumerator dip_MphTophatPolarity contains the following constants:

NameDescription
DIP_MPH_TEXTUREResponse is limited to edges in texture
DIP_MPH_OBJECTResponse is limited to object edges
DIP_MPH_BOTHAll edges produce equal response

SEE ALSO

Lee, MorphologicalGradientMagnitude, MorphologicalRange, MultiScaleMorphologicalGradient, MorphologicalSmoothing, MorphologicalThreshold