OSDN Git Service

new file: bin/mrc2mrc
[eos/hostdependX86LINUX64.git] / include / Contour.h
1 #ifndef CONTOUR_H
2 #define CONTOUR_H
3 /*
4     contour.h
5 */
6 #include  "genUtil.h"
7
8 #ifndef MINFLOAT
9 #define MINFLOAT (1e-31)
10 #endif
11
12 #include "mrcImage.h"
13 /* constant begin */
14 #define CONTOUR_ACCURACY  (MINFLOAT)
15 /* constant end */
16
17 /* struct begin */
18 typedef long   contourParaTypeInteger;
19 typedef double contourParaTypeReal;
20
21 typedef struct contourParaElement {
22     contourParaTypeInteger n;
23     contourParaTypeReal    Min;
24     contourParaTypeReal    Max;
25     contourParaTypeReal    d;
26 } contourParaElement;
27
28 typedef struct contourImage {
29     contourParaTypeReal* image;
30     contourParaTypeReal* image2;
31     contourParaElement   x;
32     contourParaElement   y;
33     contourParaElement   z;
34     contourParaElement   w;
35     contourParaElement   h;
36     contourParaTypeReal  section;
37 } contourImage;
38
39 typedef struct contourPoint {
40     contourParaTypeReal    x;
41     contourParaTypeReal    y;
42     contourParaTypeReal    z;
43 } contourPoint;
44
45 typedef struct contourALine contourALine;
46 struct contourALine {
47     contourALine* before;
48     contourPoint p0;
49     contourPoint p1;
50     contourPoint p2;
51     contourALine* next;
52 };
53
54 typedef struct contourLine contourLine;
55 struct contourLine {
56     contourALine* top;
57     contourALine* current;
58     contourParaTypeInteger n;
59     contourLine*  next;
60 };
61
62 typedef struct contourLines contourLines;
63 struct contourLines {
64     contourLine*  top;
65     contourLine*  current;
66     contourParaTypeInteger n;
67     contourLines* next;
68 };
69
70 typedef struct contourLinesSet contourLinesSet;
71 struct contourLinesSet {
72     contourLines*  top;
73     contourLines*  current;
74     contourParaTypeInteger n;
75     contourLinesSet* next;
76 };
77
78 typedef struct contourArgs {
79     contourParaTypeReal f00;  /* For 2D Contour*/
80     contourParaTypeReal f01;
81     contourParaTypeReal f11;
82     contourParaTypeReal f10;
83     contourParaTypeReal f000; /* For 3D Contour */
84     contourParaTypeReal f001;
85     contourParaTypeReal f010;
86     contourParaTypeReal f011;
87     contourParaTypeReal f100;
88     contourParaTypeReal f101;
89     contourParaTypeReal f110;
90     contourParaTypeReal f111;
91     contourParaTypeReal x;
92     contourParaTypeReal y;
93     contourParaTypeReal z;
94     contourParaTypeReal dx;
95     contourParaTypeReal dy;
96     contourParaTypeReal dz;
97 } contourArgs;
98
99 typedef enum contourFlag {
100     contourFlagXSection,
101     contourFlagYSection,
102     contourFlagZSection,
103     contourFlag3D
104 } contourFlag;
105 /* struct end */
106
107 /* prototype begin */
108 /* search contour lines in a boxel */
109 extern void createContourALine(contourLine* ls, contourArgs c);
110
111 /* create contour lines in order */
112 extern void createContourLine (contourLines*  ls, contourLine* l);
113
114 /* craete contourLines at each section */
115 extern void createContourLines(contourLines* ls, contourImage image);
116
117 /* create contourLines at all sections */
118 extern void createContour(contourLinesSet* lsset, contourImage image, contourParaTypeReal level, contourFlag flag);
119
120 extern void appendContourLine0(contourLine* l, contourParaTypeReal xc1, contourParaTypeReal yc1, contourParaTypeReal xc2, contourParaTypeReal yc2, contourParaTypeReal z);
121 extern void appendContourLine1(contourLine* l, contourLine* als);
122
123 extern void lmrc2contour(contourLinesSet* c, mrcImage* m, contourParaTypeReal l, contourFlag f, long mode); 
124 /* prototype end */
125
126 #endif /* CONTOUR_H */