Changed coding style to be compliant with PEP8

This commit is contained in:
Guillem Palou Visa
2013-12-24 11:35:21 +01:00
parent 53a4388e26
commit 08dc3a33d0
2 changed files with 105 additions and 108 deletions
+6 -6
View File
@@ -50,10 +50,10 @@ def slic(image, n_segments=100, compactness=10., max_iter=10, sigma=None,
Synonym for `compactness`. This keyword is deprecated.
enforce_connectivity: bool, optional
Whether the generated segments are connected or not
min_size_factor: float
min_size_factor: float, optional
proportion of the minimum segment size to be removed with respect
to the supposed segment size (depth*width*height/n_segments)
max_size_factor: float
max_size_factor: float, optional
proportion of the maximum connected segment size. A value of 3 works
in most of the cases.
Returns
@@ -169,14 +169,14 @@ def slic(image, n_segments=100, compactness=10., max_iter=10, sigma=None,
ratio = float(max((step_z, step_y, step_x))) / compactness
image = np.ascontiguousarray(image * ratio)
labels = _slic_cython(image, segments, max_iter, spacing, enforce_connectivity)
labels = _slic_cython(image, segments, max_iter, spacing)
if (enforce_connectivity):
segment_size = depth*height*width/n_segments
segment_size = depth * height * width / n_segments
labels = _enforce_label_connectivity_cython(labels,
n_segments,
min_size_factor*segment_size,
max_size_factor*segment_size)
min_size_factor * segment_size,
max_size_factor * segment_size)
if is_2d:
labels = labels[0]