-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathexclude_labels_on_edges_3d_x.cl
85 lines (69 loc) · 2.39 KB
/
exclude_labels_on_edges_3d_x.cl
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
__kernel void exclude_on_edges_x_3d (
IMAGE_src_TYPE src,
IMAGE_label_index_dst_TYPE label_index_dst
)
{
const sampler_t intsampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_NONE | CLK_FILTER_NEAREST;
int x = get_global_id(0);
const int y = get_global_id(1);
const int z = get_global_id(2);
const int width = GET_IMAGE_WIDTH(src);
x = 0;
POS_src_TYPE pos = POS_src_INSTANCE(x, y, z,0);
int index = READ_src_IMAGE(src, intsampler, pos).x;
if (index > 0) {
WRITE_label_index_dst_IMAGE (label_index_dst, POS_label_index_dst_INSTANCE(index,0,0,0), 0);
}
x = width - 1;
pos = POS_src_INSTANCE(x, y, z,0);
index = READ_src_IMAGE(src, intsampler, pos).x;
if (index > 0) {
WRITE_label_index_dst_IMAGE (label_index_dst, POS_label_index_dst_INSTANCE(index,0,0,0), 0);
}
}
__kernel void exclude_on_edges_y_3d (
IMAGE_src_TYPE src,
IMAGE_label_index_dst_TYPE label_index_dst
)
{
const sampler_t intsampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_NONE | CLK_FILTER_NEAREST;
const int x = get_global_id(0);
int y = get_global_id(1);
const int z = get_global_id(2);
const int height = GET_IMAGE_HEIGHT(src);
y = 0;
POS_src_TYPE pos = POS_src_INSTANCE(x, y, z,0);
int index = READ_src_IMAGE(src, intsampler, pos).x;
if (index > 0) {
WRITE_label_index_dst_IMAGE (label_index_dst, POS_label_index_dst_INSTANCE(index,0,0,0), 0);
}
y = height - 1;
pos = POS_src_INSTANCE(x, y, z,0);
index = READ_src_IMAGE(src, intsampler, pos).x;
if (index > 0) {
WRITE_label_index_dst_IMAGE (label_index_dst, POS_label_index_dst_INSTANCE(index,0,0,0), 0);
}
}
__kernel void exclude_on_edges_z_3d (
IMAGE_src_TYPE src,
IMAGE_label_index_dst_TYPE label_index_dst
)
{
const sampler_t intsampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_NONE | CLK_FILTER_NEAREST;
const int x = get_global_id(0);
const int y = get_global_id(1);
int z = get_global_id(2);
const int depth = GET_IMAGE_DEPTH(src);
z = 0;
POS_src_TYPE pos = POS_src_INSTANCE(x, y, z,0);
int index = READ_src_IMAGE(src, intsampler, pos).x;
if (index > 0) {
WRITE_label_index_dst_IMAGE (label_index_dst, POS_label_index_dst_INSTANCE(index,0,0,0), 0);
}
z = depth - 1;
pos = POS_src_INSTANCE(x, y, z,0);
index = READ_src_IMAGE(src, intsampler, pos).x;
if (index > 0) {
WRITE_label_index_dst_IMAGE (label_index_dst, POS_label_index_dst_INSTANCE(index,0,0,0), 0);
}
}