Remove unused 'ratio' argument from _slic_cython

This commit is contained in:
Juan Nunez-Iglesias
2013-07-25 00:23:01 +10:00
parent aadd346964
commit af3ea5f817
2 changed files with 4 additions and 6 deletions
+3 -5
View File
@@ -17,7 +17,7 @@ def _slic_cython(double[:, :, :, ::1] image_zyx,
long[:, :, ::1] nearest_mean,
double[:, :, ::1] distance,
double[:, ::1] means,
float ratio, int max_iter, int n_segments):
int max_iter, int n_segments):
"""Helper function for SLIC segmentation.
Parameters
@@ -32,8 +32,6 @@ def _slic_cython(double[:, :, :, ::1] image_zyx,
The (initially infinity) array of distances to the nearest centroid.
means : 2D np.ndarray of double, shape (n_segments, 6)
The centroids obtained by SLIC.
ratio : float
The ratio of xyz-space and colorspace in the clustering.
max_iter : int
The maximum number of k-means iterations.
n_segments : int
@@ -58,7 +56,6 @@ def _slic_cython(double[:, :, :, ::1] image_zyx,
cdef Py_ssize_t i, k, x, y, z, x_min, x_max, y_min, y_max, z_min, z_max, \
changes
cdef double dist_mean
cdef double tmp
for i in range(max_iter):
changes = 0
@@ -92,7 +89,8 @@ def _slic_cython(double[:, :, :, ::1] image_zyx,
nearest_mean_ravel = np.asarray(nearest_mean).ravel()
means_list = []
for j in range(6):
image_zyx_ravel = np.ascontiguousarray(image_zyx[:, :, :, j]).ravel()
image_zyx_ravel = (
np.ascontiguousarray(image_zyx[:, :, :, j]).ravel())
means_list.append(np.bincount(nearest_mean_ravel,
image_zyx_ravel))
in_mean = np.bincount(nearest_mean_ravel)
+1 -1
View File
@@ -130,7 +130,7 @@ def slic(image, n_segments=100, ratio=10., max_iter=10, sigma=1,
nearest_mean = np.zeros((depth, height, width), dtype=np.intp)
distance = np.empty((depth, height, width), dtype=np.float)
segment_map = _slic_cython(image_zyx, nearest_mean, distance, means,
ratio, max_iter, n_segments)
max_iter, n_segments)
if segment_map.shape[0] == 1:
segment_map = segment_map[0]
return segment_map