@@ -26,7 +26,7 @@ public boolean executeCL() {
26
26
return result ;
27
27
}
28
28
29
- public static boolean generateIntegerGreyValueCooccurrenceCountMatrixHalfBox (CLIJ2 clij2 , ClearCLBuffer src_label_map1 , ClearCLBuffer dst_cooccurrence_matrix , int pixel_distance ) {
29
+ public static boolean generateIntegerGreyValueCooccurrenceCountMatrixHalfBox (CLIJ2 clij2 , ClearCLBuffer src_label_map1 , ClearCLBuffer dst_cooccurrence_matrix , int radius ) {
30
30
int num_threads = (int ) src_label_map1 .getDepth ();
31
31
32
32
long [][][] counts = new long [num_threads ][(int )dst_cooccurrence_matrix .getWidth ()][(int )dst_cooccurrence_matrix .getHeight ()];
@@ -62,7 +62,7 @@ public static boolean generateIntegerGreyValueCooccurrenceCountMatrixHalfBox(CLI
62
62
}
63
63
64
64
65
- statisticians [i ] = new Statistician (counts [i ], image_slice , image_next_slice , (int )src_label_map1 .getWidth (), (int )src_label_map1 .getHeight (), (int )pixel_distance );
65
+ statisticians [i ] = new Statistician (counts [i ], image_slice , image_next_slice , (int )src_label_map1 .getWidth (), (int )src_label_map1 .getHeight (), (int )radius );
66
66
threads [i ] = new Thread (statisticians [i ]);
67
67
threads [i ].start ();
68
68
}
@@ -107,53 +107,53 @@ public String getCategories() {
107
107
private static class Statistician implements Runnable {
108
108
private final int width ;
109
109
private final int height ;
110
- private final int pixel_distance ;
110
+ private final int radius ;
111
111
112
112
long [][] counts ;
113
113
114
114
private float [] image ;
115
115
private float [] image_next_slice ;
116
116
117
- Statistician (long [][] counts , float [] image , float [] image_next_slice , int width , int height , int pixel_distance ) {
117
+ Statistician (long [][] counts , float [] image , float [] image_next_slice , int width , int height , int radius ) {
118
118
this .counts = counts ;
119
119
this .image = image ;
120
120
this .image_next_slice = image_next_slice ;
121
121
this .width = width ;
122
122
this .height = height ;
123
- this .pixel_distance = pixel_distance ;
123
+ this .radius = radius ;
124
124
}
125
125
126
126
@ Override
127
127
public void run () {
128
128
129
129
int x = 0 ;
130
130
int y = 0 ;
131
- for (int i = 0 ; i < image .length - pixel_distance ; i ++) {
131
+ for (int i = 0 ; i < image .length - radius ; i ++) {
132
132
int value_1 = (int ) image [i ];
133
133
int value_2 ;
134
134
135
135
// right
136
- if (x < width - pixel_distance ) {
137
- value_2 = (int ) image [i + pixel_distance ];
136
+ if (x < width - radius ) {
137
+ value_2 = (int ) image [i + radius ];
138
138
counts [value_1 ][value_2 ]++;
139
139
counts [value_2 ][value_1 ]++;
140
140
}
141
141
// bottom
142
- if (y < height - pixel_distance ) {
143
- value_2 = (int ) image [i + (width * pixel_distance )];
142
+ if (y < height - radius ) {
143
+ value_2 = (int ) image [i + (width * radius )];
144
144
counts [value_1 ][value_2 ]++;
145
145
counts [value_2 ][value_1 ]++;
146
146
}
147
147
// bottom, right
148
- if (x < width - pixel_distance && y < height - pixel_distance ) {
149
- value_2 = (int ) image [i + (width * pixel_distance ) + pixel_distance ];
148
+ if (x < width - radius && y < height - radius ) {
149
+ value_2 = (int ) image [i + (width * radius ) + radius ];
150
150
counts [value_1 ][value_2 ]++;
151
151
counts [value_2 ][value_1 ]++;
152
152
}
153
153
154
154
// top, right
155
- if (y > pixel_distance && x < (width * pixel_distance ) - pixel_distance ) {
156
- value_2 = (int ) image [i - (width * pixel_distance ) + pixel_distance ];
155
+ if (y > radius && x < (width * radius ) - radius ) {
156
+ value_2 = (int ) image [i - (width * radius ) + radius ];
157
157
counts [value_1 ][value_2 ]++;
158
158
counts [value_2 ][value_1 ]++;
159
159
}
@@ -162,12 +162,12 @@ public void run() {
162
162
if (image_next_slice != null ) {
163
163
for (int delta_x = -1 ; delta_x <= 1 ; delta_x ++) {
164
164
for (int delta_y = -1 ; delta_y <= 1 ; delta_y ++) {
165
- int index = i + delta_x + width * pixel_distance * delta_y ;
166
- if (x + delta_x < width * pixel_distance &&
165
+ int index = i + delta_x + width * radius * delta_y ;
166
+ if (x + delta_x < width * radius &&
167
167
x - delta_x >= 0 &&
168
- y + delta_y < height * pixel_distance &&
168
+ y + delta_y < height * radius &&
169
169
y - delta_y >= 0 &&
170
- index >= 0 && index < image_next_slice .length - pixel_distance ) {
170
+ index >= 0 && index < image_next_slice .length - radius ) {
171
171
value_2 = (int ) image_next_slice [index ];
172
172
counts [value_1 ][value_2 ]++;
173
173
counts [value_2 ][value_1 ]++;
@@ -177,7 +177,7 @@ public void run() {
177
177
}
178
178
179
179
x ++;
180
- if (x >= width - pixel_distance ) {
180
+ if (x >= width - radius ) {
181
181
x = 0 ;
182
182
y ++;
183
183
}
0 commit comments