[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]
Distance Transform |
Classes | |
struct | SkeletonOptions |
Option object for skeletonizeImage() More... | |
Enumerations | |
enum | BoundaryDistanceTag { OuterBoundary, InterpixelBoundary, InnerBoundary } |
Specify which boundary is used for boundaryMultiDistance(). More... | |
Functions | |
template<... > | |
void | boundaryMultiDistance (...) |
Euclidean distance to the implicit boundaries of a multi-dimensional label array. More... | |
template<... > | |
void | boundaryVectorDistance (...) |
Compute the vector distance transform to the implicit boundaries of a multi-dimensional label array. More... | |
template<... > | |
void | distanceTransform (...) |
template<unsigned int N, class T , class S , class Array > | |
void | eccentricityCenters (const MultiArrayView< N, T, S > &src, Array ¢ers) |
Find the (approximate) eccentricity center in each region of a labeled image. More... | |
template<unsigned int N, class T , class S , class Array > | |
void | eccentricityTransformOnLabels (MultiArrayView< N, T > const &src, MultiArrayView< N, S > dest, Array ¢ers) |
Computes the (approximate) eccentricity transform on each region of a labeled image. More... | |
template<... > | |
void | separableMultiDistance (...) |
Euclidean distance on multi-dimensional arrays. More... | |
template<... > | |
void | separableMultiDistSquared (...) |
Euclidean distance squared on multi-dimensional arrays. More... | |
template<... > | |
void | separableVectorDistance (...) |
Compute the vector distance transform of a N-dimensional binary array. More... | |
template<... > | |
void | skeletonizeImage (...) |
Skeletonization of all regions in a labeled 2D image. More... | |
The functions in this group perfrom Euclidean distance transforms in arbitrary dimensions, as well Manhattan and chessboard distance transforms in 2D (this can easily be extended to nD if need arises). In addition, a number of related transforms such as vector distance transforms, eccentricity transforms, and 2D skeleton computations are offered.
enum BoundaryDistanceTag |
Specify which boundary is used for boundaryMultiDistance().
Enumerator | |
---|---|
OuterBoundary |
Pixels just outside of each region. |
InterpixelBoundary |
Half-integer points between pixels of different labels. |
InnerBoundary |
Pixels just inside of each region. |
void vigra::distanceTransform | ( | ... | ) |
For all background pixels, calculate the distance to the nearest object or contour. The label of the pixels to be considered background in the source image is passed in the parameter 'background'. Source pixels with other labels will be considered objects. In the destination image, all pixels corresponding to background will be assigned the their distance value, all pixels corresponding to objects will be assigned 0.
The parameter 'norm' gives the distance norm to be used:
norm == 2: use Euclidean distance (L2 norm)
If you use the L2 norm, the destination pixels must be real valued to give correct results.
Declarations:
pass 2D array views:
Usage:
#include <vigra/distancetransform.hxx>
Namespace: vigra
void vigra::eccentricityCenters | ( | const MultiArrayView< N, T, S > & | src, |
Array & | centers | ||
) |
Find the (approximate) eccentricity center in each region of a labeled image.
Declarations:
pass arbitrary-dimensional array views:
[in] | src | : labeled array |
[out] | centers | : list of eccentricity centers (required interface: centers[k] = TinyVector<int, N>() must be supported) |
Usage:
#include <vigra/eccentricitytransform.hxx>
Namespace: vigra
void vigra::eccentricityTransformOnLabels | ( | MultiArrayView< N, T > const & | src, |
MultiArrayView< N, S > | dest, | ||
Array & | centers | ||
) |
Computes the (approximate) eccentricity transform on each region of a labeled image.
Declarations:
pass arbitrary-dimensional array views:
[in] | src | : labeled array |
[out] | dest | : eccentricity transform of src |
[out] | centers | : (optional) list of eccentricity centers (required interface: centers[k] = TinyVector<int, N>() must be supported) |
Usage:
#include <vigra/eccentricitytransform.hxx>
Namespace: vigra
void vigra::separableMultiDistSquared | ( | ... | ) |
Euclidean distance squared on multi-dimensional arrays.
The algorithm is taken from Donald Bailey: "An Efficient Euclidean Distance Transform", Proc. IWCIA'04, Springer LNCS 3322, 2004.
Declarations:
pass arbitrary-dimensional array views:
This function performs a squared Euclidean squared distance transform on the given multi-dimensional array. Both source and destination arrays are represented by iterators, shape objects and accessors. The destination array is required to already have the correct size.
This function expects a mask as its source, where background pixels are marked as zero, and non-background pixels as non-zero. If the parameter background is true, then the squared distance of all background pixels to the nearest object is calculated. Otherwise, the distance of all object pixels to the nearest background pixel is calculated.
Optionally, one can pass an array that specifies the pixel pitch in each direction. This is necessary when the data have non-uniform resolution (as is common in confocal microscopy, for example).
This function may work in-place, which means that siter == diter
is allowed. A full-sized internal array is only allocated if working on the destination array directly would cause overflow errors (i.e. if NumericTraits<typename DestAccessor::value_type>::max() < N * M*M
, where M is the size of the largest dimension of the array.
Usage:
#include <vigra/multi_distance.hxx>
Namespace: vigra
void vigra::separableMultiDistance | ( | ... | ) |
Euclidean distance on multi-dimensional arrays.
Declarations:
pass arbitrary-dimensional array views:
This function performs a Euclidean distance transform on the given multi-dimensional array. It simply calls separableMultiDistSquared() and takes the pixel-wise square root of the result. See separableMultiDistSquared() for more documentation.
Usage:
#include <vigra/multi_distance.hxx>
Namespace: vigra
void vigra::boundaryMultiDistance | ( | ... | ) |
Euclidean distance to the implicit boundaries of a multi-dimensional label array.
Declarations:
pass arbitrary-dimensional array views:
This function computes the distance transform of a labeled image simultaneously for all regions. Depending on the requested type of boundary, three modes are supported:
OuterBoundary
: In each region, compute the distance to the nearest pixel not belonging to that regions. This is the same as if a normal distance transform where applied to a binary image containing just this region. InterpixelBoundary
(default): Like OuterBoundary
, but shift the distance to the interpixel boundary by subtractiong 1/2. This make the distences consistent accross boundaries. InnerBoundary
: In each region, compute the distance to the nearest pixel in the region which is adjacent to the boundary. If array_border_is_active=true
, the outer border of the array (i.e. the interpixel boundary between the array and the infinite region) is also used. Otherwise (the default), regions touching the array border are treated as if they extended to infinity.
Usage:
#include <vigra/multi_distance.hxx>
Namespace: vigra
void vigra::skeletonizeImage | ( | ... | ) |
Skeletonization of all regions in a labeled 2D image.
Declarations:
This function computes the skeleton for each region in the 2D label image labels and paints the results into the result image dest. Input label 0
is interpreted as background and always ignored. Skeletons will be marked with the same label as the corresponding region (unless options returnLength()
or returnSalience()
are selected, see below). Non-skeleton pixels will receive label 0
.
For each region, the algorithm proceeds in the following steps:
dontPrune()
is selected. pruneCenterLine()
is selected, delete all skeleton points that do not belong to the two longest tree branches and skip the remaining steps. length
attribute as the depth of the pixel's longest subtree. Compute its salience
attribute as the ratio between length
and distance
, where distance
is the pixel's distance to the nearest boundary point according to the distance transform. It holds that length >= 0.5
and salience >= 1.0
. length
and salience
of each segment as the maximum of these attributes among the pixels in the segment. When options returnLength()
or returnSalience()
are selected, skip the remaining steps and return the requested segment attribute in dest
. In this case, dest
's value_type
should be a floating point type to exactly accomodate the attribute values. pruneLength(threshold, preserve_topology)
: Retain only segments whose length attribute exceeds the given threshold
. When preserve_topology
is true (the defult), cycles around holes are preserved regardless of their length. Otherwise, they are pruned as well. pruneLengthRelative(threshold, preserve_topology)
: Like pruneLength()
, but the threshold is specified as a fraction of the maximum segment length in the present region. pruneSalience(threshold, preserve_topology)
: Retain only segments whose salience attribute exceeds the given threshold
. When preserve_topology
is true (the defult), cycles around holes are preserved regardless of their salience. Otherwise, they are pruned as well. pruneSalienceRelative(threshold, preserve_topology)
: Like pruneSalience()
, but the threshold is specified as a fraction of the maximum segment salience in the present region. pruneTopology(preserve_center)
: Retain only segments that are essential for the region's topology. If preserve_center
is true (the default), the eccentricity center is also preserved, even if it is not essential. Otherwise, it might be removed. The eccentricity center is always the only remaining point when the region has no holes. The skeleton has the following properties:
Remark: If you have an application where a skeleton graph would be more useful than a skeleton image, function skeletonizeImage()
can be changed/extended easily.
Usage:
#include <vigra/skeleton.hxx>
Namespace: vigra
void vigra::separableVectorDistance | ( | ... | ) |
Compute the vector distance transform of a N-dimensional binary array.
Declarations:
This function works like separableMultiDistance() (see there for details), but returns in each pixel the vector to the nearest background pixel rather than the scalar distance. This enables much more powerful applications.
Usage:
#include <vigra/vector_distance.hxx>
Namespace: vigra
void vigra::boundaryVectorDistance | ( | ... | ) |
Compute the vector distance transform to the implicit boundaries of a multi-dimensional label array.
Declarations:
This function works like boundaryMultiDistance() (see there for details), but returns in each pixel the vector to the nearest boundary pixel rather than the scalar distance. This enables much more powerful applications. Additionally, it support a pixelPitch
parameter which allows to adjust the distance calculations for anisotropic grid resolution.
Usage:
#include <vigra/vector_distance.hxx>
Namespace: vigra
© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) |
html generated using doxygen and Python
|