diplib/chain_code.h file

Support for chain-code and polygon object representation and quantification. Everything declared in this file is explicitly 2D. See Measurement.

Contents

Classes

struct dip::FeretValues
Contains the various Feret diameters as returned by dip::ConvexHull::Feret and dip::ChainCode::Feret.
class dip::RadiusValues
Holds the various output values of the dip::Polygon::RadiusStatistics function.
template<typename T>
struct dip::Vertex
Encodes a location in a 2D image.
template<typename T>
struct dip::BoundingBox
Encodes a bounding box in a 2D image by the top left and bottom right corners (both coordinates included in the box).
class dip::CovarianceMatrix
A 2D covariance matrix for computation with 2D vertices.
struct dip::Polygon
A polygon with floating-point vertices.
struct dip::ConvexHull
A convex hull is a convex polygon. It can be constructed from a simple dip::Polygon, and is guaranteed clockwise.
struct dip::ChainCode
The contour of an object as a chain code sequence.

Aliases

using dip::VertexFloat = dip::Vertex
A vertex with floating-point coordinates.
using dip::VertexInteger = dip::Vertex
A vertex with integer coordinates
using dip::BoundingBoxFloat = dip::BoundingBox
A bounding box with floating-point coordinates.
using dip::BoundingBoxInteger = dip::BoundingBox
A bounding box with integer coordinates.
using dip::ChainCodeArray = std::vector<ChainCode>
A collection of object contours.

Functions

template<typename T>
auto dip::Norm(dip::Vertex const& v) -> dip::dfloat
The norm of the vector v.
template<typename T>
auto dip::NormSquare(dip::Vertex const& v) -> dip::dfloat
The square of the norm of the vector v.
template<typename T>
auto dip::Distance(dip::Vertex const& v1, dip::Vertex const& v2) -> dip::dfloat
The norm of the vector v2-v1.
template<typename T>
auto dip::DistanceSquare(dip::Vertex const& v1, dip::Vertex const& v2) -> dip::dfloat
The square norm of the vector v2-v1.
template<typename T>
auto dip::Angle(dip::Vertex const& v1, dip::Vertex const& v2) -> dip::dfloat
The angle of the vector v2-v1.
template<typename T>
auto dip::CrossProduct(dip::Vertex const& v1, dip::Vertex const& v2) -> dip::dfloat
Compute the z component of the cross product of vectors v1 and v2.
template<typename T>
auto dip::ParallelogramSignedArea(dip::Vertex const& v1, dip::Vertex const& v2, dip::Vertex const& v3) -> dip::dfloat
Compute the z component of the cross product of vectors v2-v1 and v3-v1.
template<typename T>
auto dip::TriangleArea(dip::Vertex const& v1, dip::Vertex const& v2, dip::Vertex const& v3) -> dip::dfloat
Compute the area of the triangle formed by vertices v1, v2 and v3.
template<typename T>
auto dip::TriangleHeight(dip::Vertex const& v1, dip::Vertex const& v2, dip::Vertex const& v3) -> dip::dfloat
Compute the height of the triangle formed by vertices v1, v2 and v3, with v3 the tip.
auto dip::GetImageChainCodes(dip::Image const& labels, std::vector<LabelType> const& objectIDs = {}, dip::uint connectivity = 2) -> dip::ChainCodeArray
Returns the set of chain codes sequences that encode the contours of the given objects in a labeled image.
auto dip::GetSingleChainCode(dip::Image const& labels, dip::UnsignedArray const& startCoord, dip::uint connectivity = 2) -> dip::ChainCode
Returns the chain codes sequence that encodes the contour of one object in a binary or labeled image.

Operators

template<typename T>
auto dip::operator==(dip::Vertex v1, dip::Vertex v2) -> bool
Compare two vertices.
template<typename T>
auto dip::operator+(dip::Vertex lhs, dip::Vertex const& rhs) -> dip::Vertex
Add two vertices together, with identical types.
auto dip::operator+(dip::VertexFloat lhs, dip::VertexInteger const& rhs) -> dip::VertexFloat
Add two vertices together, where the LHS is floating-point and the RHS is integer.
auto dip::operator+(dip::VertexInteger const& lhs, dip::VertexFloat rhs) -> dip::VertexFloat
Add two vertices together, where the LHS is integer and the RHS is floating-point.
template<typename T>
auto dip::operator-(dip::Vertex lhs, dip::Vertex const& rhs) -> dip::Vertex
Subtract two vertices from each other.
auto dip::operator-(dip::VertexFloat lhs, dip::VertexInteger const& rhs) -> dip::VertexFloat
Subtract two vertices from each other, where the LHS is floating-point and the RHS is integer.
auto dip::operator-(dip::VertexInteger const& lhs, dip::VertexFloat const& rhs) -> dip::VertexFloat
Subtract two vertices from each other, where the LHS is integer and the RHS is floating-point.
template<typename T, typename S>
auto dip::operator+(dip::Vertex v, S t) -> dip::Vertex
Add a vertex and a constant.
template<typename T, typename S>
auto dip::operator-(dip::Vertex v, S t) -> dip::Vertex
Subtract a vertex and a constant.
template<typename T>
auto dip::operator*(dip::Vertex v, dip::dfloat s) -> dip::Vertex
Multiply a vertex and a constant, scaling isotropically.
template<typename T>
auto dip::operator*(dip::Vertex lhs, dip::Vertex const& rhs) -> dip::Vertex
Multiply a vertex by another vertex, scaling anisotropically.
auto dip::operator*(dip::VertexFloat lhs, dip::VertexInteger const& rhs) -> dip::VertexFloat
Multiply a vertex by another vertex, scaling anisotropically, where the LHS is floating-point and the RHS is integer.
auto dip::operator*(dip::VertexInteger const& lhs, dip::VertexFloat const& rhs) -> dip::VertexFloat
Multiply a vertex by another vertex, scaling anisotropically, where the LHS is integer and the RHS is floating-point.
template<typename T>
auto dip::operator/(dip::Vertex v, dip::dfloat s) -> dip::Vertex
Divide a vertex by a constant, scaling isotropically.
template<typename T>
auto dip::operator/(dip::Vertex lhs, dip::Vertex const& rhs) -> dip::Vertex
Divide a vertex by another vertex, scaling anisotropically.
auto dip::operator/(dip::VertexFloat lhs, dip::VertexInteger const& rhs) -> dip::VertexFloat
Divide a vertex by another vertex, scaling anisotropically, where the LHS is floating-point and the RHS is integer.
auto dip::operator/(dip::VertexInteger const& lhs, dip::VertexFloat const& rhs) -> dip::VertexFloat
Divide a vertex by another vertex, scaling anisotropically, where the LHS is integer and the RHS is floating-point.