-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.h
More file actions
49 lines (35 loc) · 2.29 KB
/
Copy pathsetup.h
File metadata and controls
49 lines (35 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "types.h"
#include "queue.h"
#define PIXELS_PER_MM 1000
#define DENSE_SCALE 1.2 // multiply density by this factor
#define SIZE (20 * PIXELS_PER_MM) // 20 mm square
#define AXIAL_LENGTH 25 // mm
#define FOVEA_RADIUS ( 0.2 * PIXELS_PER_MM)
#define ONH_X (int)((SIZE/2 + (15.0 /180.0*M_PI*AXIAL_LENGTH/2.0*PIXELS_PER_MM))) // degrees -> pixels
#define ONH_Y (int)((SIZE/2 + ( 2.0 /180.0*M_PI*AXIAL_LENGTH/2.0*PIXELS_PER_MM))) // degrees -> pixels
#define ONH_MAJOR (int)(1.66/2.0 * (double)PIXELS_PER_MM) /* 1.66mm 2*major axis (x) of optic nerve */
#define ONH_MINOR (int)(1.94/2.0 * (double)PIXELS_PER_MM) /* 1.94mm 2*minor axis (y) of optic nerve */
#define DIST(_p1, _p2) (float)sqrt( ((double)(_p1).x-(double)(_p2).x)*((double)(_p1).x-(double)(_p2).x) + ((double)(_p1).y-(double)(_p2).y)*((double)(_p1).y-(double)(_p2).y) )
#define ONH_EDGE(_theta) ((float)ONH_MAJOR*(float)ONH_MINOR/sqrt( \
(float)ONH_MINOR*cos(_theta)*(float)ONH_MINOR*cos(_theta) + \
(float)ONH_MAJOR*sin(_theta)*(float)ONH_MAJOR*sin(_theta)))
#define START_DIST 0.2*PIXELS_PER_MM // number of pixels from ONH_EDGE to be included in first pool
// macros to control thickness
#define MACULAR_RADIUS (3 * PIXELS_PER_MM)
#define MACULAR_RADIUS_SQ (MACULAR_RADIUS * MACULAR_RADIUS)
#define MACULAR_DIST(_p) (int)round(sqrt( ((_p).x-SIZE/2)*((_p).x-SIZE/2)+((_p).y-SIZE/2)*((_p).y-SIZE/2)))
#define MACULAR_DIST_SQ(_p) ( ((_p).x - SIZE/2)*((_p).x - SIZE/2) + ((_p).y - SIZE/2)*((_p).y - SIZE/2))
// linear from (FOVEA_RADIUS,0) to (MACULAR_RADIUS, MAX_THICK)
#define min(_a, _b) ((_a) < (_b) ? (_a) : (_b))
//#define MAX_THICK 20
//#define MAX_AXON_COUNT(_dist) (int)round(((float)(_dist)-(float)FOVEA_RADIUS)/(float)MACULAR_RADIUS * (float)MAX_THICK*(float)DENSE_SCALE)
#define MAX_THICK 60
#define MAX_AXON_COUNT(_dist) min(MAX_THICK, (int)round(((float)(_dist)-(float)FOVEA_RADIUS)/(float)MACULAR_RADIUS * (float)MAX_THICK))
// how far to search for a new path during growth?
#define NEW_PATH_RADIUS_LIMIT (MACULAR_RADIUS/2.0*1.1)
// don't search outside +- this from proposed trajectory during growth
#define THETA_LIMIT M_PI // (M_PI/3.0)
// all in pixels
void init_grid(int *size, Grid ***grid);
void init_cells();
int cmp_PointD(const void *a, const void *b);