|
pink26 0.1.1
Image processing and digital topology for teaching
|
Topological numbers, simple points and point types of binary images. More...
Go to the source code of this file.
Enumerations | |
| enum | p26_point_type { P26_POINT_BACKGROUND = 0 , P26_POINT_SIMPLE = 1 , P26_POINT_MULTIPLE = 2 , P26_POINT_SEPARATING = 3 , P26_POINT_ISOLATED = 4 , P26_POINT_INTERIOR = 5 , P26_POINT_OTHER = 6 } |
| Type of a point, as in Pink's typetopobin(). More... | |
| enum | p26_point_class_3d { P26_CLASS_BACKGROUND = 0 , P26_CLASS_INTERIOR = 1 , P26_CLASS_ISOLATED = 2 , P26_CLASS_BORDER = 3 , P26_CLASS_CURVE = 4 , P26_CLASS_CURVES_JUNCTION = 5 , P26_CLASS_SURFACE = 6 , P26_CLASS_SURFACE_CURVE_JUNCTION = 7 , P26_CLASS_SURFACES_JUNCTION = 8 , P26_CLASS_SURFACES_CURVES_JUNCTION = 9 } |
| Class of a 3D point in the topological classification of Malandain, Bertrand & Ayache [MBA93] (Table 1): what the object looks like around the point (a volume, a surface, a curve, or a junction of several of them). More... | |
Functions | |
| p26_status | p26_topological_numbers (const p26_image *binary, int connectivity, p26_image **t_out, p26_image **tbar_out) |
| Computes the topological numbers T and T-bar of every point. | |
| p26_status | p26_simple_points (const p26_image *binary, int connectivity, p26_image **out) |
| Marks the simple points of a binary image (Bertrand 1994). | |
| p26_status | p26_point_types (const p26_image *binary, int connectivity, p26_image **out) |
| Classifies every point of a binary image (see p26_point_type). | |
| p26_status | p26_topological_numbers_at (const p26_image *binary, p26_index point, int connectivity, int *t, int *tbar) |
| Computes T and T-bar at one point, without processing the whole image. | |
| p26_status | p26_point_classes_3d (const p26_image *binary, int connectivity, p26_image **out) |
| Classifies every point of a 3D binary image as in [MBA93] Table 1 (see p26_point_class_3d). | |
Topological numbers, simple points and point types of binary images.
Definitions (Bertrand 1994, "Simple points, topological numbers and geodesic neighborhoods in cubic grids", Pattern Recognition Letters 15(10); Couprie & Bertrand 2009, IEEE TPAMI 31(4)). X is the object, X-bar its complement, n the connectivity of the object; the background uses the complementary connectivity n-bar (4 <-> 8 in 2D, 6 <-> 26 in 3D). N*8, N*18 and N*26 are the 8-, 18- and 26-neighborhoods of p without p.
T(p, X) is the number of n-connected components of X ∩ N*(p) that are n-adjacent to p; the neighborhood N* depends on n:
2D: T4 and T8 use N*8 (4-components 4-adjacent to p for T4); 3D: T26 uses N*26 (26-components of X ∩ N*26(p)); T6 uses N*18 (6-components of X ∩ N*18(p) 6-adjacent to p). This is the geodesic neighborhood G6(p, X) of order 2 of Bertrand 1994: the corner voxels of N*26 do not count.
The topological number of the background, T-bar(p) = T-bar_n(p, X), is the number T_n-bar(p, X-bar) of X-bar with the complementary connectivity and the neighborhood rule above: for a 6-object it is T26 of X-bar (over N*26), for a 26-object it is T6 of X-bar (over N*18), for a 4-object T8 of X-bar and for an 8-object T4 of X-bar (both over N*8).
An object point is simple (its removal does not change the topology) iff T(p) = 1 and T-bar(p) = 1 (Bertrand 1994). Likewise, a background point with T(p) = T-bar(p) = 1 can be added to the object without changing the topology.
Border convention: every image is surrounded by an infinite background, so the points of the first and last rows, columns and planes have a complete neighborhood.
| enum p26_point_type |
Type of a point, as in Pink's typetopobin().
The values 0 to 5 are Pink's constants (NONE or fond, SIMPLE, MULTIPLE, SEPARANT, ISOLE, INTERIEUR). The rules are applied in this order, with (T, T-bar) the topological numbers: background point -> BACKGROUND; (1, 1) -> SIMPLE; T > 2 -> MULTIPLE; T = 2 -> SEPARATING; T = 0 -> ISOLATED; T-bar = 0 -> INTERIOR; otherwise OTHER.
| enum p26_point_class_3d |
Class of a 3D point in the topological classification of Malandain, Bertrand & Ayache [MBA93] (Table 1): what the object looks like around the point (a volume, a surface, a curve, or a junction of several of them).
Code 0 is the background; codes 1 to 9 follow types A to I of Table 1. The paper uses two numbers, C* and C-bar; they are the topological numbers of a 26-connected object: C* = T (26-components of the object in N*26) and C-bar = T-bar (6-components of the background in N*18 that are 6-adjacent to the point). The rules are applied in this order (A before B), and every pair (T, T-bar) gets a class: "there will not remain any unclassified point" ([MBA93] section 4.3).
Link with p26_point_type (same T and T-bar): BORDER is a simple point (P26_POINT_SIMPLE); INTERIOR and ISOLATED are the point types of the same name; SURFACE and SURFACES_JUNCTION (T = 1, T-bar >= 2) are P26_POINT_OTHER.
Two meanings of "junction". Here a junction is read on T and T-bar: it is a topological notion, which holds on thick objects as well as on surfaces and curves one voxel thick. The junction points of Pink's point selectors (p26_junction_points() in pink26/point_selection.h) only count neighbors: a point with at least 3 object neighbors. That count makes sense on a thin skeleton only; on a thick object nearly every point is a junction in that sense (all 27 points of a full 3 x 3 x 3 cube, none of which is a junction here: 26 are BORDER, the center INTERIOR).
The digital grid hides some junctions ([MBA93] section 5): the foot of a line planted perpendicularly on a flat plate is a BORDER point. T = 1, because the first voxel of the line touches the plate voxels around the foot. T-bar = 1, because the line voxel fills the only face neighbor above the foot, so no background voxel above the foot is 6-adjacent to it. With T = 1 and T-bar = 2 the point would be SURFACE.
[MBA93] G. Malandain, G. Bertrand, N. Ayache, "Topological segmentation of discrete surfaces", International Journal of Computer Vision 10(2), pp. 183-197, 1993.
| p26_status p26_topological_numbers | ( | const p26_image * | binary, |
| int | connectivity, | ||
| p26_image ** | t_out, | ||
| p26_image ** | tbar_out ) |
Computes the topological numbers T and T-bar of every point.
Both numbers are computed for all points, object or background (Bertrand 1994: they only look at the neighbors of p).
| binary | P26_U8 image; any nonzero value is an object point. |
| connectivity | Connectivity of the object: 4 or 8 for a 2D image, 6 or 26 for a 3D image (the background uses the complementary one). |
| t_out | Receives a new P26_U8 image of the shape of binary holding T; owned by the caller (p26_image_free()). |
| tbar_out | Same for T-bar. |
Complexity: O(N) time for N pixels, 3 * N bytes of memory (one bordered copy of the input and the two outputs), no allocation per point.
| p26_status p26_simple_points | ( | const p26_image * | binary, |
| int | connectivity, | ||
| p26_image ** | out ) |
Marks the simple points of a binary image (Bertrand 1994).
| binary | P26_U8 image; any nonzero value is an object point. |
| connectivity | See p26_topological_numbers(). |
| out | Receives a new P26_U8 image of the shape of binary, 1 on the simple object points and 0 elsewhere; owned by the caller. |
Complexity: O(N) time, same memory as p26_topological_numbers().
| p26_status p26_point_types | ( | const p26_image * | binary, |
| int | connectivity, | ||
| p26_image ** | out ) |
Classifies every point of a binary image (see p26_point_type).
| binary | P26_U8 image; any nonzero value is an object point. |
| connectivity | See p26_topological_numbers(). |
| out | Receives a new P26_U8 image of the shape of binary holding a p26_point_type per pixel; owned by the caller. |
Complexity: O(N) time, same memory as p26_topological_numbers().
| p26_status p26_topological_numbers_at | ( | const p26_image * | binary, |
| p26_index | point, | ||
| int | connectivity, | ||
| int * | t, | ||
| int * | tbar ) |
Computes T and T-bar at one point, without processing the whole image.
Only the neighborhood of the point is read; the cost is O(1).
| binary | P26_U8 image; any nonzero value is an object point. |
| point | Index of the point, i = z * rs * cs + y * rs + x (0 <= i < number of pixels). |
| connectivity | See p26_topological_numbers(). |
| t | Receives T(point). |
| tbar | Receives T-bar(point). |
| p26_status p26_point_classes_3d | ( | const p26_image * | binary, |
| int | connectivity, | ||
| p26_image ** | out ) |
Classifies every point of a 3D binary image as in [MBA93] Table 1 (see p26_point_class_3d).
The classification is defined for a 26-connected object (6-connected background) in 3D, the case of the paper.
| binary | 3D P26_U8 image; any nonzero value is an object point. A 3D image of a single plane, of shape (1, H, W), is a plate one voxel thick. |
| connectivity | Connectivity of the object: must be 26. |
| out | Receives a new P26_U8 image of the shape of binary holding a p26_point_class_3d per voxel; owned by the caller (p26_image_free()). |
Complexity: O(N) time, same memory as p26_topological_numbers().