PEP8: fix indentation

This commit is contained in:
François Boulogne
2013-10-02 18:14:21 +02:00
parent 90db96f3eb
commit 8f20fff3f8
3 changed files with 16 additions and 16 deletions
+11 -11
View File
@@ -1,4 +1,4 @@
__all__ = ['threshold_adaptive', 'threshold_otsu', 'threshold_yen']
__all__ = ['threshold_adaptive', 'threshold_otsu', 'threshold_yen']
import numpy as np
import scipy.ndimage
@@ -65,7 +65,7 @@ def threshold_adaptive(image, block_size, method='gaussian', offset=0,
thresh_image = np.zeros(image.shape, 'double')
if method == 'generic':
scipy.ndimage.generic_filter(image, param, block_size,
output=thresh_image, mode=mode)
output=thresh_image, mode=mode)
elif method == 'gaussian':
if param is None:
# automatically determine sigma which covers > 99% of distribution
@@ -73,17 +73,17 @@ def threshold_adaptive(image, block_size, method='gaussian', offset=0,
else:
sigma = param
scipy.ndimage.gaussian_filter(image, sigma, output=thresh_image,
mode=mode)
mode=mode)
elif method == 'mean':
mask = 1. / block_size * np.ones((block_size,))
# separation of filters to speedup convolution
scipy.ndimage.convolve1d(image, mask, axis=0, output=thresh_image,
mode=mode)
mode=mode)
scipy.ndimage.convolve1d(thresh_image, mask, axis=1,
output=thresh_image, mode=mode)
output=thresh_image, mode=mode)
elif method == 'median':
scipy.ndimage.median_filter(image, block_size, output=thresh_image,
mode=mode)
mode=mode)
return image > (thresh_image - offset)
@@ -146,7 +146,7 @@ def threshold_yen(image, nbins=256):
nbins : int, optional
Number of bins used to calculate histogram. This value is ignored for
integer arrays.
Returns
-------
threshold : float
@@ -155,11 +155,11 @@ def threshold_yen(image, nbins=256):
References
----------
.. [1] Yen J.C., Chang F.J., and Chang S. (1995) "A New Criterion
for Automatic Multilevel Thresholding" IEEE Trans. on Image
.. [1] Yen J.C., Chang F.J., and Chang S. (1995) "A New Criterion
for Automatic Multilevel Thresholding" IEEE Trans. on Image
Processing, 4(3): 370-378
.. [2] Sezgin M. and Sankur B. (2004) "Survey over Image Thresholding
Techniques and Quantitative Performance Evaluation" Journal of
.. [2] Sezgin M. and Sankur B. (2004) "Survey over Image Thresholding
Techniques and Quantitative Performance Evaluation" Journal of
Electronic Imaging, 13(1): 146-165,
http://www.busim.ee.boun.edu.tr/~sankur/SankurFolder/Threshold_survey.pdf
.. [3] ImageJ AutoThresholder code, http://fiji.sc/wiki/index.php/Auto_Threshold