Merge pull request #545 from odebeir/master

fix: docstring in rank/percentile and remove unused p1
This commit is contained in:
Josh Warner
2013-05-11 14:12:39 -07:00
3 changed files with 22 additions and 22 deletions
+4 -4
View File
@@ -299,11 +299,11 @@ def percentile(cnp.ndarray[dtype_t, ndim=2] image,
cnp.ndarray[cnp.uint8_t, ndim=2] mask=None,
cnp.ndarray[dtype_t, ndim=2] out=None,
char shift_x=0, char shift_y=0, int bitdepth=8,
float p0=0., float p1=0.):
float p0=0.):
"""return p0 percentile
"""
_core16(kernel_percentile, image, selem, mask, out, shift_x, shift_y,
bitdepth, p0, p1, <Py_ssize_t>0, <Py_ssize_t>0)
bitdepth, p0, .0, <Py_ssize_t>0, <Py_ssize_t>0)
def pop(cnp.ndarray[dtype_t, ndim=2] image,
@@ -323,8 +323,8 @@ def threshold(cnp.ndarray[dtype_t, ndim=2] image,
cnp.ndarray[cnp.uint8_t, ndim=2] mask=None,
cnp.ndarray[dtype_t, ndim=2] out=None,
char shift_x=0, char shift_y=0, int bitdepth=8,
float p0=0., float p1=0.):
float p0=0.):
"""return (maxbin-1) if g > percentile p0
"""
_core16(kernel_threshold, image, selem, mask, out, shift_x, shift_y,
bitdepth, p0, p1, <Py_ssize_t>0, <Py_ssize_t>0)
bitdepth, p0, 0., <Py_ssize_t>0, <Py_ssize_t>0)
+4 -4
View File
@@ -265,11 +265,11 @@ def percentile(cnp.ndarray[dtype_t, ndim=2] image,
cnp.ndarray[dtype_t, ndim=2] selem,
cnp.ndarray[dtype_t, ndim=2] mask=None,
cnp.ndarray[dtype_t, ndim=2] out=None,
char shift_x=0, char shift_y=0, float p0=0., float p1=0.):
char shift_x=0, char shift_y=0, float p0=0.):
"""return p0 percentile
"""
_core8(kernel_percentile, image, selem, mask, out, shift_x, shift_y,
p0, p1, <Py_ssize_t>0, <Py_ssize_t>0)
p0, 0., <Py_ssize_t>0, <Py_ssize_t>0)
def pop(cnp.ndarray[dtype_t, ndim=2] image,
@@ -287,8 +287,8 @@ def threshold(cnp.ndarray[dtype_t, ndim=2] image,
cnp.ndarray[dtype_t, ndim=2] selem,
cnp.ndarray[dtype_t, ndim=2] mask=None,
cnp.ndarray[dtype_t, ndim=2] out=None,
char shift_x=0, char shift_y=0, float p0=0., float p1=0.):
char shift_x=0, char shift_y=0, float p0=0.):
"""return 255 if g > percentile p0
"""
_core8(kernel_threshold, image, selem, mask, out, shift_x, shift_y, p0, p1,
_core8(kernel_threshold, image, selem, mask, out, shift_x, shift_y, p0, 0.,
<Py_ssize_t>0, <Py_ssize_t>0)
+14 -14
View File
@@ -275,11 +275,11 @@ def percentile_morph_contr_enh(
def percentile(image, selem, out=None, mask=None, shift_x=False, shift_y=False,
p0=.0, p1=1.):
p0=.0):
"""Return greyscale local percentile of an image.
percentile is computed on the given structuring element. Only levels between
percentiles [p0, p1] are used.
percentile is computed on the given structuring element. Returns the value
of the p0 lower percentile of the neighborhood value distribution.
Parameters
----------
@@ -298,9 +298,8 @@ def percentile(image, selem, out=None, mask=None, shift_x=False, shift_y=False,
Offset added to the structuring element center point. Shift is bounded
to the structuring element sizes (center must be inside the given
structuring element).
p0, p1 : float in [0, ..., 1]
Define the [p0, p1] percentile interval to be considered for computing
the value.
p0 : float in [0, ..., 1]
Set the percentile value.
Returns
-------
@@ -312,7 +311,7 @@ def percentile(image, selem, out=None, mask=None, shift_x=False, shift_y=False,
return _apply(_crank8_percentiles.percentile,
_crank16_percentiles.percentile,
image, selem, out=out, mask=mask, shift_x=shift_x,
shift_y=shift_y, p0=p0, p1=p1)
shift_y=shift_y, p0=p0, p1=0.)
def percentile_pop(image, selem, out=None, mask=None, shift_x=False,
@@ -356,11 +355,13 @@ def percentile_pop(image, selem, out=None, mask=None, shift_x=False,
def percentile_threshold(image, selem, out=None, mask=None, shift_x=False,
shift_y=False, p0=.0, p1=1.):
shift_y=False, p0=.0):
"""Return greyscale local threshold of an image.
threshold is computed on the given structuring element. Only levels between
percentiles [p0, p1] are used.
threshold is computed on the given structuring element. Returns
thresholded image such that pixels having a higher value than the the p0
percentile of the neighborhood value distribution are set to 2^nbit-1
(e.g. 255 for 8bit image).
Parameters
----------
@@ -379,9 +380,8 @@ def percentile_threshold(image, selem, out=None, mask=None, shift_x=False,
Offset added to the structuring element center point. Shift is bounded
to the structuring element sizes (center must be inside the given
structuring element).
p0, p1 : float in [0, ..., 1]
Define the [p0, p1] percentile interval to be considered for computing
the value.
p0 : float in [0, ..., 1]
Set the percentile value.
Returns
-------
@@ -393,4 +393,4 @@ def percentile_threshold(image, selem, out=None, mask=None, shift_x=False,
return _apply(
_crank8_percentiles.threshold, _crank16_percentiles.threshold,
image, selem, out=out, mask=mask, shift_x=shift_x,
shift_y=shift_y, p0=p0, p1=p1)
shift_y=shift_y, p0=p0, p1=0.)