Speed up memory views in watershed function

This commit is contained in:
Johannes Schönberger
2013-10-18 21:00:40 +02:00
parent 3e28168914
commit 1b66ab479a
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -23,12 +23,12 @@ include "heap_watershed.pxi"
@cython.boundscheck(False)
def watershed(DTYPE_INT32_t[:] image,
def watershed(DTYPE_INT32_t[::1] image,
DTYPE_INT32_t[:, ::1] pq,
Py_ssize_t age,
DTYPE_INT32_t[:, ::1] structure,
DTYPE_BOOL_t[:] mask,
DTYPE_INT32_t[:] output):
DTYPE_BOOL_t[::1] mask,
DTYPE_INT32_t[::1] output):
"""Do heavy lifting of watershed algorithm
Parameters
+1 -1
View File
@@ -202,7 +202,7 @@ def watershed(image, markers, connectivity=None, offset=None, mask=None):
stride = np.dot(image_stride, np.array(offs))
offs.insert(0, stride)
c.append(offs)
c = np.array(c, np.int32)
c = np.array(c, dtype=np.int32)
pq, age = __heapify_markers(c_markers, c_image)
pq = np.ascontiguousarray(pq, dtype=np.int32)