forked from ant-trullo/SegmentTrack_v4.0
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpotsDetectionUtility.pyx
More file actions
29 lines (22 loc) · 922 Bytes
/
SpotsDetectionUtility.pyx
File metadata and controls
29 lines (22 loc) · 922 Bytes
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
import numpy as np
cimport numpy as np
DTYPE = np.int
ctypedef np.int_t DTYPE_t
cpdef spts_int_vol(np.ndarray[DTYPE_t, ndim=3] a, np.ndarray[DTYPE_t, ndim=3] raw, list i_in):
cdef np.ndarray[DTYPE_t, ndim=2] d = np.zeros([a.shape[1], a.shape[2]], dtype=np.int)
cdef np.ndarray[DTYPE_t, ndim=2] s = np.zeros([a.shape[1], a.shape[2]], dtype=np.int)
cdef np.ndarray[DTYPE_t, ndim=3] g = np.zeros([a.shape[0], a.shape[1], a.shape[2]], dtype=np.int)
cdef int j_in
cdef int zlen = a.shape[0]
cdef int xlen = a.shape[1]
cdef int ylen = a.shape[2]
cdef int x, y, z
for j_in in i_in:
for z in range(zlen):
for x in range(xlen):
for y in range(ylen):
if a[z, x, y] == j_in:
s[x, y] += 1
d[x, y] += raw[z, x, y]
g[z, x, y] += j_in
return s, d, g