25 |
__constant int s = 2; |
__constant int s = 2; |
26 |
|
|
27 |
|
|
28 |
__kernel float probe(float * img, int * sAxis, float4 imgPos) { |
__kernel float probe(float * img, int * sAxis, float4 imgPos) |
29 |
|
{ |
30 |
|
|
31 |
float probedVal; |
float probedVal; |
32 |
float4 f, nf, t, hx, hy, hz; |
float4 f, nf, t, hx, hy, hz; |
65 |
return probedVal; |
return probedVal; |
66 |
|
|
67 |
} |
} |
68 |
|
|
69 |
__kernel void mip ( float * img, |
__kernel void mip ( float * img, |
70 |
float * out, |
float * out, |
71 |
float16 transformMatrix, |
float16 transformMatrix, |
72 |
int2 workDim, |
int2 workDim, |
73 |
int * sAxis){ |
int * sAxis) |
74 |
|
{ |
75 |
|
|
76 |
int row = get_global_id(0), col = get_global_id(1); |
int row = get_global_id(0), col = get_global_id(1); |
77 |
|
|
78 |
if(row <= workDim.x && col <= workDim.y) |
if(row <= workDim.x && col <= workDim.y) { |
|
{ |
|
79 |
float t, probedVal, maxValue = -INFINITY; |
float t, probedVal, maxValue = -INFINITY; |
80 |
float4 imgPt; |
float4 imgPt; |
81 |
|
|
85 |
pos.w = 0.0; |
pos.w = 0.0; |
86 |
dir.w = 0.0; |
dir.w = 0.0; |
87 |
|
|
88 |
for(t = 0.0; t < 200; t+= stepSize) |
for(t = 0.0; t < 200; t+= stepSize) { |
|
{ |
|
89 |
pos = pos + stepSize * dir; |
pos = pos + stepSize * dir; |
90 |
|
|
91 |
// Transform the value to image space position. |
// Transform the value to image space position. |
94 |
dot(pos,transformMatrix.s89ab), |
dot(pos,transformMatrix.s89ab), |
95 |
dot(pos,transformMatrix.scdef)); |
dot(pos,transformMatrix.scdef)); |
96 |
|
|
97 |
|
if ((imgPt.x > 1 && imgPt.x < (sAxis[0] - 2) |
98 |
if( (imgPt.x > 1 && imgPt.x < (sAxis[0] - 2)) && |
&& (imgPt.y > 1 && imgPt.y < (sAxis[1] - 2)) |
99 |
(imgPt.y > 1 && imgPt.y < (sAxis[1]- 2)) && |
&& (imgPt.z > 1 && imgPt.z < (sAxis[2] - 2))) { |
|
(imgPt.z > 1 && imgPt.z < (sAxis[2] - 2))) |
|
|
{ |
|
100 |
probedVal = probe(img,sAxis,imgPt); |
probedVal = probe(img,sAxis,imgPt); |
101 |
if(maxValue < probedVal) |
if(maxValue < probedVal) |
102 |
maxValue = probedVal; |
maxValue = probedVal; |