Loading...
Searching...
No Matches
Go to the documentation of this file.
4#ifndef _interpolate_macros_h_
5#define _interpolate_macros_h_
9 mijk, mijk_f, mijk_r, \
10 li_frac_1, li_frac_2, moving) \
12 li_clamp (mijk[0], moving->dim[0]-1, \
13 &mijk_f[0], &mijk_r[0], \
14 &li_frac_1[0], &li_frac_2[0]); \
15 li_clamp (mijk[1], moving->dim[1]-1, \
16 &mijk_f[1], &mijk_r[1], \
17 &li_frac_1[1], &li_frac_2[1]); \
18 li_clamp (mijk[2], moving->dim[2]-1, \
19 &mijk_f[2], &mijk_r[2], \
20 &li_frac_1[2], &li_frac_2[2]); \
23#define LI_VALUE(m_val, fx1, fx2, fy1, fy2, fz1, fz2, mvf, m_img, moving) \
25 float m_x1y1z1, m_x2y1z1, m_x1y2z1, m_x2y2z1; \
26 float m_x1y1z2, m_x2y1z2, m_x1y2z2, m_x2y2z2; \
28 m_x1y1z1 = fx1 * fy1 * fz1 * m_img[mvf]; \
29 m_x2y1z1 = fx2 * fy1 * fz1 * m_img[mvf+1]; \
30 m_x1y2z1 = fx1 * fy2 * fz1 * m_img[mvf+moving->dim[0]]; \
31 m_x2y2z1 = fx2 * fy2 * fz1 * m_img[mvf+moving->dim[0]+1]; \
32 m_x1y1z2 = fx1 * fy1 * fz2 * m_img[mvf+moving->dim[1]*moving->dim[0]]; \
33 m_x2y1z2 = fx2 * fy1 * fz2 * m_img[mvf+moving->dim[1]*moving->dim[0]+1]; \
34 m_x1y2z2 = fx1 * fy2 * fz2 * m_img[mvf+moving->dim[1]*moving->dim[0]+moving->dim[0]]; \
35 m_x2y2z2 = fx2 * fy2 * fz2 * m_img[mvf+moving->dim[1]*moving->dim[0]+moving->dim[0]+1]; \
36 m_val = m_x1y1z1 + m_x2y1z1 + m_x1y2z1 + m_x2y2z1 \
37 + m_x1y1z2 + m_x2y1z2 + m_x1y2z2 + m_x2y2z2; \
40#define LI_VALUE_x(m_val, rx, fy1, fy2, fz1, fz2, mvf, m_img, moving) \
42 float m_x1y1z1, m_x2y1z1, m_x1y2z1, m_x2y2z1; \
43 float m_x1y1z2, m_x2y1z2, m_x1y2z2, m_x2y2z2; \
45 m_x1y1z1 = (1/rx) * fy1 * fz1 * m_img[mvf]; \
46 m_x2y1z1 = -(1/rx) * fy1 * fz1 * m_img[mvf+1]; \
47 m_x1y2z1 = (1/rx) * fy2 * fz1 * m_img[mvf+moving->dim[0]]; \
48 m_x2y2z1 = -(1/rx) * fy2 * fz1 * m_img[mvf+moving->dim[0]+1]; \
49 m_x1y1z2 = (1/rx) * fy1 * fz2 * m_img[mvf+moving->dim[1]*moving->dim[0]]; \
50 m_x2y1z2 = -(1/rx) * fy1 * fz2 * m_img[mvf+moving->dim[1]*moving->dim[0]+1]; \
51 m_x1y2z2 = (1/rx) * fy2 * fz2 * m_img[mvf+moving->dim[1]*moving->dim[0]+moving->dim[0]]; \
52 m_x2y2z2 = -(1/rx) * fy2 * fz2 * m_img[mvf+moving->dim[1]*moving->dim[0]+moving->dim[0]+1]; \
53 m_val = m_x1y1z1 + m_x2y1z1 + m_x1y2z1 + m_x2y2z1 \
54 + m_x1y1z2 + m_x2y1z2 + m_x1y2z2 + m_x2y2z2; \
57#define LI_VALUE_y(m_val, fx1, fx2, ry, fz1, fz2, mvf, m_img, moving) \
59 float m_x1y1z1, m_x2y1z1, m_x1y2z1, m_x2y2z1; \
60 float m_x1y1z2, m_x2y1z2, m_x1y2z2, m_x2y2z2; \
62 m_x1y1z1 = fx1 * (1/ry) * fz1 * m_img[mvf]; \
63 m_x2y1z1 = fx2 * (1/ry) * fz1 * m_img[mvf+1]; \
64 m_x1y2z1 = -fx1 * (1/ry) * fz1 * m_img[mvf+moving->dim[0]]; \
65 m_x2y2z1 = -fx2 * (1/ry) * fz1 * m_img[mvf+moving->dim[0]+1]; \
66 m_x1y1z2 = fx1 * (1/ry) * fz2 * m_img[mvf+moving->dim[1]*moving->dim[0]]; \
67 m_x2y1z2 = fx2 * (1/ry) * fz2 * m_img[mvf+moving->dim[1]*moving->dim[0]+1]; \
68 m_x1y2z2 = -fx1 * (1/ry) * fz2 * m_img[mvf+moving->dim[1]*moving->dim[0]+moving->dim[0]]; \
69 m_x2y2z2 = -fx2 * (1/ry) * fz2 * m_img[mvf+moving->dim[1]*moving->dim[0]+moving->dim[0]+1]; \
70 m_val = m_x1y1z1 + m_x2y1z1 + m_x1y2z1 + m_x2y2z1 \
71 + m_x1y1z2 + m_x2y1z2 + m_x1y2z2 + m_x2y2z2; \
74#define LI_VALUE_z(m_val, fx1, fx2, fy1, fy2, rz, mvf, m_img, moving) \
76 float m_x1y1z1, m_x2y1z1, m_x1y2z1, m_x2y2z1; \
77 float m_x1y1z2, m_x2y1z2, m_x1y2z2, m_x2y2z2; \
79 m_x1y1z1 = fx1 * fy1 * (1/rz) * m_img[mvf]; \
80 m_x2y1z1 = fx2 * fy1 * (1/rz) * m_img[mvf+1]; \
81 m_x1y2z1 = fx1 * fy2 * (1/rz) * m_img[mvf+moving->dim[0]]; \
82 m_x2y2z1 = fx2 * fy2 * (1/rz) * m_img[mvf+moving->dim[0]+1]; \
83 m_x1y1z2 = -fx1 * fy1 * (1/rz) * m_img[mvf+moving->dim[1]*moving->dim[0]]; \
84 m_x2y1z2 = -fx2 * fy1 * (1/rz) * m_img[mvf+moving->dim[1]*moving->dim[0]+1]; \
85 m_x1y2z2 = -fx1 * fy2 * (1/rz) * m_img[mvf+moving->dim[1]*moving->dim[0]+moving->dim[0]]; \
86 m_x2y2z2 = -fx2 * fy2 * (1/rz) * m_img[mvf+moving->dim[1]*moving->dim[0]+moving->dim[0]+1]; \
87 m_val = m_x1y1z1 + m_x2y1z1 + m_x1y2z1 + m_x2y2z1 \
88 + m_x1y1z2 + m_x2y1z2 + m_x1y2z2 + m_x2y2z2; \
91#define LI_VALUE_ALT(m_val, fx1, fx2, fy1, fy2, fz1, fz2, \
92 mvf, m_img, moving, plane) \
94 int idx_x1y1z1, idx_x2y1z1, idx_x1y2z1, idx_x2y2z1; \
95 int idx_x1y1z2, idx_x2y1z2, idx_x1y2z2, idx_x2y2z2; \
96 float m_x1y1z1, m_x2y1z1, m_x1y2z1, m_x2y2z1; \
97 float m_x1y1z2, m_x2y1z2, m_x1y2z2, m_x2y2z2; \
100 idx_x2y1z1 = mvf+1; \
101 idx_x1y2z1 = mvf+moving->dim[0]; \
102 idx_x2y2z1 = mvf+moving->dim[0+1]; \
103 idx_x1y1z2 = mvf+moving->dim[1]*moving->dim[0]; \
104 idx_x2y1z2 = mvf+moving->dim[1]*moving->dim[0]+1; \
105 idx_x1y2z2 = mvf+moving->dim[1]*moving->dim[0]+moving->dim[0]; \
106 idx_x2y2z2 = mvf+moving->dim[1]*moving->dim[0]+moving->dim[0]+1; \
108 m_x1y1z1 = fx1 * fy1 * fz1 * m_img[idx_x1y1z1]; \
109 m_x2y1z1 = fx2 * fy1 * fz1 * m_img[idx_x2y1z1]; \
110 m_x1y2z1 = fx1 * fy2 * fz1 * m_img[idx_x1y2z1]; \
111 m_x2y2z1 = fx2 * fy2 * fz1 * m_img[idx_x2y2z1]; \
112 m_x1y1z2 = fx1 * fy1 * fz2 * m_img[idx_x1y1z2]; \
113 m_x2y1z2 = fx2 * fy1 * fz2 * m_img[idx_x2y1z2]; \
114 m_x1y2z2 = fx1 * fy2 * fz2 * m_img[idx_x1y2z2]; \
115 m_x2y2z2 = fx2 * fy2 * fz2 * m_img[idx_x2y2z2]; \
116 m_val = m_x1y1z1 + m_x2y1z1 + m_x1y2z1 + m_x2y2z1 \
117 + m_x1y1z2 + m_x2y1z2 + m_x1y2z2 + m_x2y2z2; \
120#define LI_VALUE_INTERLEAVED(m_val, fx1, fx2, fy1, fy2, fz1, fz2, \
121 mvf, m_img, moving, plane) \
123 plm_ssize_t idx_x1y1z1, idx_x2y1z1, idx_x1y2z1, idx_x2y2z1; \
124 plm_ssize_t idx_x1y1z2, idx_x2y1z2, idx_x1y2z2, idx_x2y2z2; \
125 float m_x1y1z1, m_x2y1z1, m_x1y2z1, m_x2y2z1; \
126 float m_x1y1z2, m_x2y1z2, m_x1y2z2, m_x2y2z2; \
129 idx_x2y1z1 = mvf+1; \
130 idx_x1y2z1 = mvf+moving->dim[0]; \
131 idx_x2y2z1 = mvf+moving->dim[0+1]; \
132 idx_x1y1z2 = mvf+moving->dim[1]*moving->dim[0]; \
133 idx_x2y1z2 = mvf+moving->dim[1]*moving->dim[0]+1; \
134 idx_x1y2z2 = mvf+moving->dim[1]*moving->dim[0]+moving->dim[0]; \
135 idx_x2y2z2 = mvf+moving->dim[1]*moving->dim[0]+moving->dim[0]+1; \
137 idx_x1y1z1 = idx_x1y1z1 * moving->vox_planes + plane; \
138 idx_x2y1z1 = idx_x2y1z1 * moving->vox_planes + plane; \
139 idx_x1y2z1 = idx_x1y2z1 * moving->vox_planes + plane; \
140 idx_x2y2z1 = idx_x2y2z1 * moving->vox_planes + plane; \
141 idx_x1y1z2 = idx_x1y1z2 * moving->vox_planes + plane; \
142 idx_x2y1z2 = idx_x2y1z2 * moving->vox_planes + plane; \
143 idx_x1y2z2 = idx_x1y2z2 * moving->vox_planes + plane; \
144 idx_x2y2z2 = idx_x2y2z2 * moving->vox_planes + plane; \
146 m_x1y1z1 = fx1 * fy1 * fz1 * m_img[idx_x1y1z1]; \
147 m_x2y1z1 = fx2 * fy1 * fz1 * m_img[idx_x2y1z1]; \
148 m_x1y2z1 = fx1 * fy2 * fz1 * m_img[idx_x1y2z1]; \
149 m_x2y2z1 = fx2 * fy2 * fz1 * m_img[idx_x2y2z1]; \
150 m_x1y1z2 = fx1 * fy1 * fz2 * m_img[idx_x1y1z2]; \
151 m_x2y1z2 = fx2 * fy1 * fz2 * m_img[idx_x2y1z2]; \
152 m_x1y2z2 = fx1 * fy2 * fz2 * m_img[idx_x1y2z2]; \
153 m_x2y2z2 = fx2 * fy2 * fz2 * m_img[idx_x2y2z2]; \
154 m_val = m_x1y1z1 + m_x2y1z1 + m_x1y2z1 + m_x2y2z1 \
155 + m_x1y1z2 + m_x2y1z2 + m_x1y2z2 + m_x2y2z2; \