mirror of
https://github.com/wassname/scikit-image.git
synced 2026-08-11 11:25:30 +08:00
Speed up memory views in watershed function
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user