VIA - Volumetric Image Analysis
Main Page
Data Structures
Files
File List
Globals
include
viaio
VEdges.h
1
/*
2
* $Id: VEdges.h 726 2004-03-08 13:12:45Z lohmann $
3
*
4
* Definitions associated with edges: their representation in files and
5
* in memory, and operations that can be performed with them.
6
*/
7
8
#ifndef V_VEdges_h
9
#define V_VEdges_h 1
10
11
/*
12
* Copyright 1993, 1994 University of British Columbia
13
*
14
* Permission to use, copy, modify, distribute, and sell this software and its
15
* documentation for any purpose is hereby granted without fee, provided that
16
* the above copyright notice appears in all copies and that both that
17
* copyright notice and this permission notice appear in supporting
18
* documentation. UBC makes no representations about the suitability of this
19
* software for any purpose. It is provided "as is" without express or
20
* implied warranty.
21
*
22
* Author: David Lowe, UBC Laboratory for Computational Intelligence
23
*/
24
25
/* From the Vista library: */
26
#include "viaio/Vlib.h"
27
#include "viaio/file.h"
28
29
/* For portability: */
30
#include <X11/Xfuncproto.h>
31
32
#ifdef __cplusplus
33
extern
"C"
{
34
#endif
35
36
37
/* Structures for representing edges in memory.
38
* -------------------------------------------
39
*
40
* The edges are stored as a linked list of edge records, as this makes
41
* it easy to allocate and add individual edges.
42
* The point data for each edge are stored in a 2-D array of floating point
43
* values.
44
*/
45
46
typedef
struct
V_EdgesRec {
47
int
nrows;
/* number of rows */
48
int
ncolumns;
/* number of columns */
49
VAttrList attributes;
/* list of other attributes */
50
int
nedge_fields;
/* number of fields in each edge record */
51
int
npoint_fields;
/* number of fields in each point record */
52
int
nedges;
/* number of edges */
53
int
npoints;
/* total number of points */
54
struct
VEdgeStruct *first;
/* first edge in linked list of edges */
55
struct
VEdgeStruct *last;
/* last edge in linked list of edges */
56
VPointer free;
/* free this storage when destroying edges */
57
} VEdgesRec;
58
59
60
typedef
struct
VEdgeStruct {
61
struct
VEdgeStruct *next;
/* next edge in linked list of edges */
62
VFloat *edge_fields;
/* vector of field entries for this edge */
63
VBoolean closed;
/* indicates closed edge (a loop) */
64
int
npoints;
/* number of points in this edge */
65
VFloat **point_index;
/* pointers to start of each point */
66
VPointer free;
/* free this storage when destroying edges */
67
} VEdgeRec, *VEdge;
68
69
70
/*
71
* Attributes used to represent edges
72
* ----------------------------------
73
*/
74
75
/* Attribute type names: */
76
#define VEdgesAttr "edges"
77
#define VNEdgeFieldsAttr "nedge_fields"
78
#define VNPointFieldsAttr "npoint_fields"
79
#define VNEdgesAttr "nedges"
80
#define VNPointsAttr "npoints"
81
82
83
/*
84
* Macros for accessing edges attributes in memory.
85
* -----------------------------------------------
86
*/
87
88
#define VEdgesNRows(edges) ((edges)->nrows)
89
90
#define VEdgesNColumns(edges) ((edges)->ncolumns)
91
92
#define VEdgesAttrList(edges) ((edges)->attributes)
93
94
#define VNEdgeFields(edges) ((edges)->nedge_fields)
95
96
#define VNPointFields(edges) ((edges)->npoint_fields)
97
98
#define VNEdges(edges) ((edges)->nedges)
99
100
#define VFirstEdge(edges) ((edges)->first)
101
102
#define VNextEdge(edge) ((edge)->next)
103
104
#define VEdgeExists(edge) ((edge) != NULL)
105
106
#define VEdgeFields(edge) ((edge)->edge_fields)
107
108
#define VEdgeNPoints(edge) ((edge)->npoints)
109
110
#define VEdgeClosed(edge) ((edge)->closed)
111
112
#define VEdgePointArray(edge) ((edge)->point_index)
113
114
/* Following are old macro names which should no longer be used.
115
They can be removed in a future version once all of the documentation
116
is in place and has been announced. */
117
#define VEdgesCount(edges) ((edges)->nedges)
118
#define VEdgePoints(edge) ((edge)->point_index)
119
#define VEdgesEdgeFields(edges) ((edges)->nedge_fields)
120
#define VEdgesPointFields(edges) ((edges)->npoint_fields)
121
#define VEdgesRows(edges) ((edges)->nrows)
122
#define VEdgesColumns(edges) ((edges)->ncolumns)
123
#define VEdgePointCount(edge) ((edge)->npoints)
124
125
126
/*
127
* Declarations of library routines.
128
*/
129
130
/* From Edges.c: */
131
132
extern
VEdges VCreateEdges (
133
#
if
NeedFunctionPrototypes
134
int
/* nrows */
,
135
int
/* ncols */
,
136
int
/* nedge_fields */
,
137
int
/* npoint_fields */
138
#endif
139
);
140
141
extern
VEdge VAddEdge (
142
#
if
NeedFunctionPrototypes
143
VEdges
/* edges */
,
144
VFloat *
/* edge_fields */
,
145
int
/* npoints */
,
146
VFloat *
/* points */
,
147
VBooleanPromoted
/* closed */
,
148
VBooleanPromoted
/* copy */
149
#endif
150
);
151
152
153
extern
VEdges VCopyEdges (
154
#
if
NeedFunctionPrototypes
155
VEdges
/* edges */
156
#endif
157
);
158
159
extern
void
VDestroyEdges (
160
#
if
NeedFunctionPrototypes
161
VEdges
/* edges */
162
#endif
163
);
164
165
/* From EdgesIO.c: */
166
167
extern
int
VReadEdges (
168
#
if
NeedFunctionPrototypes
169
FILE *
/* file */
,
170
VAttrList *
/* attributes */
,
171
VEdges **
/* edge_sets */
172
#endif
173
);
174
175
extern
VBoolean VWriteEdges (
176
#
if
NeedFunctionPrototypes
177
FILE *
/* file */
,
178
VAttrList
/* attributes */
,
179
int
/* nedge_sets */
,
180
VEdges *
/* edge_sets */
181
#endif
182
);
183
184
/* From EdgesToPS.c: */
185
186
extern
VBoolean VEdgesToPS (
187
#
if
NeedFunctionPrototypes
188
FILE *
/* f */
,
189
VEdges
/* edge_set */
,
190
VBooleanPromoted
/* endpoints */
191
#endif
192
);
193
194
/* From Link.c: */
195
196
extern
VEdges VLinkImage (
197
#
if
NeedFunctionPrototypes
198
VImage
/* image */
,
199
int
/* low */
,
200
int
/* high */
,
201
int
/* minlength */
202
#endif
203
);
204
205
/* From SegEdges.c: */
206
207
extern
VEdges VSegEdgesIntoLines (
208
#
if
NeedFunctionPrototypes
209
VEdges
/* edge_set */
,
210
double
/* accuracy */
,
211
int
/* granularity */
,
212
double
/* magnitude */
,
213
int
/* product */
214
#endif
215
);
216
217
#ifdef __cplusplus
218
}
219
#endif
220
221
#endif
/* V_VEdges_h */
Generated on Sat Sep 14 2013 16:16:04 for VIA - Volumetric Image Analysis by
1.8.4