VIP: Volume Image Processing


topology.h
Go to the documentation of this file.
1/****************************************************************************
2 * PROJECT : V.I.P. Library
3 * MODULE NAME : vip/topology * TYPE : Header
4 * AUTHOR : MANGIN J-F * CREATION : 22/01/1997
5 * VERSION : 1.1 * REVISION :
6 * LANGUAGE : C * EXAMPLE :
7 * DEVICE : Sun SPARC Station 5
8 ****************************************************************************
9 *
10 * DESCRIPTION : Calcul de composantes sur des 18 et 26 voisinages
11 * Transfert initial des codes de la these de jeff par F. Poupon
12 *
13 ****************************************************************************
14 *
15 * USED MODULES : vip/volume.h - vip/alloc.h -vip/connex.h
16 *
17 ****************************************************************************
18 * REVISIONS : DATE | AUTHOR | DESCRIPTION
19 *--------------------|--------------|---------------------------------------
20 * 10/04/97 | J-F Mangin | extensions -> skeleton
21 * 18/06/2015 | Y Leprince | introduce well-composed topology
22 * / / | |
23 ****************************************************************************/
24
25#ifndef VIP_TOPOLOGY_H
26#define VIP_TOPOLOGY_H
27
28#ifdef __cplusplus
29 extern "C" {
30#endif
31
32#include <math.h>
33
34#include <vip/volume.h>
35#include <vip/alloc.h>
36#include <vip/connex.h>
37
38
39/*The following structure could be completely hiden, but we prefer to let it
40public to make users aware of the Volume dependence of underlying offsets*/
41/*Moreover, it could be used to speed-up other computation related
42to local connectivity*/
43
44/* the Topology26Neighborhood structure embeds the precomputation of 3D connectivity
45in a 26 neighborhood -> speed-up the connectivity numbers CBAR or CSTAR computations*/
46/* relations are based on an ordering of 1+26 neighbors values corresponding
47to offset tab (namely 6/18/26 for genericity) in an internal buffer ordered_values[27]*/
48typedef struct topology26
49{
50 int *relation[27]; /*relation[a][b] means connection a-b (ordered according to 6/18/26 connectivity)*/
51 int relation_store[316]; /* stores all items of relation consecutively in memory */
52 int nb6neighbors[27]; /* nb6neighbors[a] = nb points of X 6-connected to a */
53 int nb18neighbors[27]; /* nb18neighbors[a] = nb points of X 18-connected to a (and not 6-con...)*/
54 int nb26neighbors[27]; /* nb26neighbors[a] = nb points of X 26-connected to a (and not 18-con...)*/
55 int offset[27];
56 /* offset to 26 neighbors, WARNING: volume and borderwidth dependent,
57 similar to vip/connectivity structures but not necessarily the same ordering*/
60
61#include <vip/topology/topology_gen.h>
62
63/*topolofical classification types according to CBAR and CSTAR*/
64
65#define TOPO_A 10
66#define TOPO_VOLUME_POINT 10
67
68#define TOPO_B 20
69#define TOPO_ISOLATED_POINT 20
70
71#define TOPO_C 30
72#define TOPO_BORDER_POINT 30
73
74#define TOPO_D 40
75#define TOPO_CURVE_POINT 40
76
77#define TOPO_E 50
78#define TOPO_JUNCTION_CURVES_POINT 50
79
80#define TOPO_F 60
81#define TOPO_SURFACE_POINT 60
82
83#define TOPO_G 70
84#define TOPO_JUNCTION_SURFACE_CURVES_POINT 70
85
86#define TOPO_H 80
87#define TOPO_JUNCTION_SURFACES_POINT 80
88
89#define TOPO_I 90
90#define TOPO_JUNCTION_SURFACES_CURVES_POINT 90
91
92/* chose cc adjacency-mode to central point in local cc number computation*/
93
94#define CC_6_ADJACENT 77
95#define CC_18_ADJACENT 78
96#define CC_26_ADJACENT 79
97
98
99/* ======================== Well-composed topology ======================== */
100
101/* Well-composed images are binary or multi-label images in which no
102 * topological ambiguity exists. In other words, the objects are defined
103 * non-ambiguously with regard to the connectivity used (6, 18, or
104 * 26-connectivity). This property is achieved by excluding certain ambiguous
105 * cases, called critical configurations (see below).
106 *
107 * For a thorough introduction to 3D well-composed images, see L. J. Latecki.
108 * 3D Well-Composed Pictures. Graphical Models and Image Processing 59, 164–172
109 * (1997). doi:10.1006/gmip.1997.0422
110 */
111
112/*
113 * A binary 8-neighbourhood (cube of 2x2x2 voxels) may be in one of these three
114 * states regarding well-composedness:
115 */
116enum {
117 /* Non-critical configuration: neither of the two cases below happens, hence
118 * no topological ambiguity exists. */
120
121 /* Type 1 critical configuration: two voxels of an object are 18-adjacent
122 * (edge-adjacent), but not 6-adjacent (face-adjacent). */
124
125 /* Type 2 critical configuration: two voxels of an object are 26-adjacent
126 * (corner-adjacent), but not 6-adjacent (face-adjacent). */
128};
129
130/* A binary 8-neighbourhood (cube of 2x2x2 voxels) has 2^8=256 possible
131 * configurations, which are listed in this table. This is a look-up table with
132 * an 8-bit index, whose bits represent a 2x2x2 binary neighbourhood, ordered
133 * as in VipIsWellComposedForCentralVoxel (topology/wellcomposed.gen). For
134 * each configuration the value is one of WELL_COMPOSED_CRITICAL_NONE,
135 * WELL_COMPOSED_CRITICAL_C1, or WELL_COMPOSED_CRITICAL_C2.
136 */
138
139#include <vip/topology/wellcomposed_gen.h>
140
141/*this test discard non simple point which do not really split the background*/
142/*-----------------------------------------------------------------------*/
144 Topology26Neighborhood *topo26);
145/*-----------------------------------------------------------------------*/
146
147/*----------------------------------------------------------------------------*/
149 Volume *vol
150);
151/*----------------------------------------------------------------------------*/
152
153/*----------------------------------------------------------------------------*/
154
155extern int VipGetNumberOfComponentsIn26Neighborhood(Topology26Neighborhood *topo, int connectivity, int adjacency_to_central);
156/*----------------------------------------------------------------------------*/
157
158extern int VipGetNumberOfComponentsIn18Neighborhood(Topology26Neighborhood *topo, int connectivity, int adjacency_to_central);
159/*----------------------------------------------------------------------------*/
160
161/*----------------------------------------------------------------------------*/
164);
165/*----------------------------------------------------------------------------*/
166
167/*----------------------------------------------------------------------------*/
170);
171/*----------------------------------------------------------------------------*/
172
173/*----------------------------------------------------------------------------*/
175 int C18,
176 int C26
177);
178/*----------------------------------------------------------------------------*/
179
180/*----------------------------------------------------------------------------*/
182 int type
183);
184/*----------------------------------------------------------------------------*/
185
186/*----------------------------------------------------------------------------*/
188 Volume *t
189);
190/*----------------------------------------------------------------------------*/
191
192/*----------------------------------------------------------------------------*/
195);
196/*----------------------------------------------------------------------------*/
197
198/*----------------------------------------------------------------------------*/
200 char *filename,
201 long *typeTable
202);
203/*----------------------------------------------------------------------------*/
204
205/*----------------------------------------------------------------------------*/
207 char *filename,
208 long *typeTable
209);
210/*----------------------------------------------------------------------------*/
211
212/*----------------------------------------------------------------------------*/
214Volume *vol,
215int label);
216/*----------------------------------------------------------------------------*/
217
218/*----------------------------------------------------------------------------*/
220Volume *vol,
221int label);
222/*----------------------------------------------------------------------------*/
223
224/*----------------------------------------------------------------------------*/
226Volume *vol,
227int inside,
228int outside);
229/*----------------------------------------------------------------------------*/
230
231/*----------------------------------------------------------------------------*/
232extern char *VipTopologicalStringFromDefine(int def);
233/*----------------------------------------------------------------------------*/
234
235/*----------------------------------------------------------------------------*/
237 int Cbar,
238 int Cstar
239);
240/*----------------------------------------------------------------------------*/
241
242/*----------------------------------------------------------------------------*/
244 int Cbar,
245 int Cstar
246);
247/*----------------------------------------------------------------------------*/
248
249/*----------------------------------------------------------------------------*/
252);
253/*----------------------------------------------------------------------------*/
254
255/*----------------------------------------------------------------------------*/
257VipS16BITPtrBucket *comp1,
258VipS16BITPtrBucket *comp2,
260Vip_S16BIT *adresse);
261
262/*----------------------------------------------------------------------------*/
264VipS16BITPtrBucket *comp1,
265VipS16BITPtrBucket *comp2,
266VipS16BITPtrBucket *comp1bis,
267VipS16BITPtrBucket *comp2bis);
268/*----------------------------------------------------------------------------*/
269#ifdef __cplusplus
270 }
271#endif
272
273#endif
struct vips16bitptrBucket VipS16BITPtrBucket
int offset[27]
Definition topology.h:55
int nb6neighbors[27]
Definition topology.h:52
int ordered_values[27]
Definition topology.h:58
int nb18neighbors[27]
Definition topology.h:53
int * relation[27]
Definition topology.h:50
int relation_store[316]
Definition topology.h:51
int nb26neighbors[27]
Definition topology.h:54
struct topology26 Topology26Neighborhood
void VipDisplayTopologyTypeTable(char *filename, long *typeTable)
int VipIsSimplePoint(int Cbar, int Cstar)
int VipSwitchTopology26NeighborhoodValueTable(Topology26Neighborhood *topo)
long * VipGetTopologyTypeTable(Topology26Neighborhood *topo)
Volume * VipCreateTopologyTestVolume(int type)
void VipDisplayTopologyTypeTableInFile(char *filename, long *typeTable)
int VipTopologicalClassificationForLabel(Volume *vol, int label)
Topology26Neighborhood * VipCreateTopology26Neighborhood(Volume *vol)
int IsRealSurfacePoint(Topology26Neighborhood *topo26)
int VipGetNumberOfComponentsIn26Neighborhood(Topology26Neighborhood *topo, int connectivity, int adjacency_to_central)
int VipGetNumberOfComponentsIn18Neighborhood(Topology26Neighborhood *topo, int connectivity, int adjacency_to_central)
int VipIsCurvesPoint(int Cbar, int Cstar)
int VipFillSSComponent(VipS16BITPtrBucket *comp1, VipS16BITPtrBucket *comp2, Topology26Neighborhood *top, Vip_S16BIT *adresse)
int VipFlipTopology26NeighborhoodValueTable(Topology26Neighborhood *topo)
int VipSurfaceSimpleEquivalence(VipS16BITPtrBucket *comp1, VipS16BITPtrBucket *comp2, VipS16BITPtrBucket *comp1bis, VipS16BITPtrBucket *comp2bis)
void VipDisplayTopologySingularityType(int C18, int C26)
void VipFreeTopology26Neighborhood(Topology26Neighborhood *topo)
void VipDisplayTopologyTestVolume(Volume *t)
const char vip_well_composed_critical_configuration_n8lookup[256]
@ WELL_COMPOSED_CRITICAL_C1
Definition topology.h:123
@ WELL_COMPOSED_CRITICAL_C2
Definition topology.h:127
@ WELL_COMPOSED_CRITICAL_NONE
Definition topology.h:119
char * VipTopologicalStringFromDefine(int def)
int VipTopologicalClassificationForLabelComplement(Volume *vol, int label)
int VipTopologicalClassificationForTwoLabelComplement(Volume *vol, int inside, int outside)
signed short Vip_S16BIT
Definition structure.h:93