Detection » Line detectors module

Line detection algorithms

Contents

See dip::MonogenicSignalAnalysis for yet another way to detect lines.

Functions

void dip::FrangiVesselness(dip::Image const& in, dip::Image& out, dip::FloatArray const& sigmas = {2.0}, dip::FloatArray parameters = {}, dip::String const& polarity = S::WHITE, dip::StringArray const& boundaryCondition = {})
Frangi vessel detector, single scale (Hessian based)
void dip::MatchedFiltersLineDetector2D(dip::Image const& in, dip::Image& out, dip::dfloat sigma = 2.0, dip::dfloat length = 10.0, dip::String const& polarity = S::WHITE, dip::StringArray const& boundaryCondition = {})
Matched filters for line detection in 2D
void dip::DanielssonLineDetector(dip::Image const& in, dip::Image& out, dip::FloatArray const& sigmas = {2.0}, dip::String const& polarity = S::WHITE, dip::StringArray const& boundaryCondition = {})
Danielsson’s Hessian-based line detector
void dip::RORPOLineDetector(dip::Image const& in, dip::Image& out, dip::uint length = 15, dip::String const& polarity = S::WHITE)
Line detector based on robust path openings

Function documentation

void dip::FrangiVesselness(dip::Image const& in, dip::Image& out, dip::FloatArray const& sigmas = {2.0}, dip::FloatArray parameters = {}, dip::String const& polarity = S::WHITE, dip::StringArray const& boundaryCondition = {})

Frangi vessel detector, single scale (Hessian based)

Frangi’s vesselness measure is based on the eigenvalues of the Hessian matrix. The core concept is that one eigenvalue must be significantly smaller than the others for a local region to resemble a line.

sigmas are used for the computation of the Hessian (which uses Gaussian gradients, see dip::Hessian), and determine the scale. To detect wider vessels, increase sigmas.

parameters are the two (β and c in 2D) or three (α, β and c in 3D) thresholds used in the method. An empty array indicates the default values ({0.5, 15} in 2D and {0.5, 0.5, 500} in 3D).

polarity indicates whether to look for light lines on a dark background ("white") or dark lines on a light background ("black"). The sign of the one (2D) or two (3D) larger eigenvalues are examined at each pixel to determine the polarity of the line, if the signs don’t match, the pixel is set to 0.

in must be scalar, real-valued, and either 2D or 3D. This function has not been generalized to other dimensionalities.

The complete multi-scale vessel detector simply applies this function at multiple scales and takes the maximum response at each scale. Even though the original paper didn’t mention this, best results are obtained when scaling the input image with the square of the sigma:

std::vector< double > scales = { 1, 2, 4, 8 };
dip::Image out = dip::FrangiVesselness( in * ( scales[ 0 ] * scales[ 0 ] ), { scales[ 0 ] } );
for( std::size_t ii = 1; ii < scales.size(); ++ii ) {
   dip::Supremum( out,  dip::FrangiVesselness( in * ( scales[ ii ] * scales[ ii ] ), { scales[ ii ] } ), out );
}

void dip::MatchedFiltersLineDetector2D(dip::Image const& in, dip::Image& out, dip::dfloat sigma = 2.0, dip::dfloat length = 10.0, dip::String const& polarity = S::WHITE, dip::StringArray const& boundaryCondition = {})

Matched filters for line detection in 2D

Matched filters are a filter bank designed to match the shape being detected. In this case, it is a line-line filter of length length, with a Gaussian profile (sigma determines the width). The filter has an average of zero so that it yields a zero response in flat areas. It is created at 12 different orientations (thus using 15 degree steps to cover the full 180 degree half-circle), and the maximum response over all orientations is returned.

polarity indicates whether to look for light lines on a dark background ("white") or dark lines on a light background ("black"). in must be scalar, real-valued, and 2D.

void dip::DanielssonLineDetector(dip::Image const& in, dip::Image& out, dip::FloatArray const& sigmas = {2.0}, dip::String const& polarity = S::WHITE, dip::StringArray const& boundaryCondition = {})

Danielsson’s Hessian-based line detector

This is a different approach to detecting lines based on the Hessian matrix (2nd order derivatives) compared to Frangi’s vesselness measure (dip::FrangiVesselness). It is perfectly isotropic, but has some response also to edges, especially in 2D.

sigmas are used for the computation of the Hessian (which uses Gaussian gradients, see dip::Hessian), and determine the scale. To detect wider lines, increase sigmas.

polarity indicates whether to look for light lines on a dark background ("white") or dark lines on a light background ("black"). in must be scalar, real-valued, and either 2D or 3D.

void dip::RORPOLineDetector(dip::Image const& in, dip::Image& out, dip::uint length = 15, dip::String const& polarity = S::WHITE)

Line detector based on robust path openings

RORPO stands for Ranking the Orientation Responses of Path Operators. It filters in with 4 (2D) or 7 (3D) different directions of path openings (see dip::DirectedPathOpening), ranks the results point-wise, and compares appropriate ranks to determine if a pixel belongs to a line or not.

length is the length of the path operator. Longer paths make for a more selective filter that requires lines to be straighter.

polarity indicates whether to look for light lines on a dark background ("white") or dark lines on a light background ("black"). in must be scalar, real-valued, and either 2D or 3D.