neulab/docprompting-conala huggingface dataset:
skimage.filters.rank.sum_bilateral(image, selem, out=None, mask=None, shift_x=False, shift_y=False, s0=10, s1=10) [source]
 
Apply a flat kernel bilateral filter. This is an edge-preserving and noise reducing denoising filter. It averages pixels based on their spatial closeness and radiometric similarity. Spatial closeness is measured by considering only the local pixel neighborhood given by a structuring element (selem). Radiometric similarity is defined by the greylevel interval [g-s0, g+s1] where g is the current pixel greylevel. Only pixels belonging to the structuring element AND having a greylevel inside this interval are summed. Note that the sum may overflow depending on the data type of the input array.  Parameters 
 
image2-D array (uint8, uint16) 

Input image.  
selem2-D array 

The neighborhood expressed as a 2-D array of 1’s and 0’s.  
out2-D array (same dtype as input) 

If None, a new array is allocated.  
maskndarray 

Mask array that defines (>0) area of the image included in the local neighborhood. If None, the complete image is used (default).  
shift_x, shift_yint 

Offset added to the structuring element center point. Shift is bounded to the structuring element sizes (center must be inside the given structuring element).  
s0, s1int 

Define the [s0, s1] interval around the greyvalue of the center pixel to be considered for computing the value.    Returns 
 
out2-D array (same dtype as input image) 

Output image.      See also  
denoise_bilateral 
  Examples >>> from skimage import data
>>> from skimage.morphology import disk
>>> from skimage.filters.rank import sum_bilateral
>>> img = data.camera().astype(np.uint16)
>>> bilat_img = sum_bilateral(img, disk(10), s0=10, s1=10)
skimage.filters.rank.sum_percentile(image, selem, out=None, mask=None, shift_x=False, shift_y=False, p0=0, p1=1) [source]
 
Return the local sum of pixels. Only greyvalues between percentiles [p0, p1] are considered in the filter. Note that the sum may overflow depending on the data type of the input array.  Parameters 
 
image2-D array (uint8, uint16) 

Input image.  
selem2-D array 

The neighborhood expressed as a 2-D array of 1’s and 0’s.  
out2-D array (same dtype as input) 

If None, a new array is allocated.  
maskndarray 

Mask array that defines (>0) area of the image included in the local neighborhood. If None, the complete image is used (default).  
shift_x, shift_yint 

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, p1float in [0, …, 1] 

Define the [p0, p1] percentile interval to be considered for computing the value.    Returns 
 
out2-D array (same dtype as input image) 

Output image.
skimage.filters.rank.threshold(image, selem, out=None, mask=None, shift_x=False, shift_y=False, shift_z=False) [source]
 
Local threshold of an image. The resulting binary mask is True if the gray value of the center pixel is greater than the local mean.  Parameters 
 
image([P,] M, N) ndarray (uint8, uint16) 

Input image.  
selemndarray 

The neighborhood expressed as an ndarray of 1’s and 0’s.  
out([P,] M, N) array (same dtype as input) 

If None, a new array is allocated.  
maskndarray (integer or float), optional 

Mask array that defines (>0) area of the image included in the local neighborhood. If None, the complete image is used (default).  
shift_x, shift_y, shift_zint 

Offset added to the structuring element center point. Shift is bounded to the structuring element sizes (center must be inside the given structuring element).    Returns 
 
out([P,] M, N) ndarray (same dtype as input image) 

Output image.     Examples >>> from skimage.morphology import square, cube # Need to add 3D example
>>> from skimage.filters.rank import threshold
>>> img = 255 * np.array([[0, 0, 0, 0, 0],
...                       [0, 1, 1, 1, 0],
...                       [0, 1, 1, 1, 0],
...                       [0, 1, 1, 1, 0],
...                       [0, 0, 0, 0, 0]], dtype=np.uint8)
>>> threshold(img, square(3))
array([[0, 0, 0, 0, 0],
       [0, 1, 1, 1, 0],
       [0, 1, 0, 1, 0],
       [0, 1, 1, 1, 0],
       [0, 0, 0, 0, 0]], dtype=uint8)
skimage.filters.rank.threshold_percentile(image, selem, out=None, mask=None, shift_x=False, shift_y=False, p0=0) [source]
 
Local threshold of an image. The resulting binary mask is True if the greyvalue of the center pixel is greater than the local mean. Only greyvalues between percentiles [p0, p1] are considered in the filter.  Parameters 
 
image2-D array (uint8, uint16) 

Input image.  
selem2-D array 

The neighborhood expressed as a 2-D array of 1’s and 0’s.  
out2-D array (same dtype as input) 

If None, a new array is allocated.  
maskndarray 

Mask array that defines (>0) area of the image included in the local neighborhood. If None, the complete image is used (default).  
shift_x, shift_yint 

Offset added to the structuring element center point. Shift is bounded to the structuring element sizes (center must be inside the given structuring element).  
p0float in [0, …, 1] 

Set the percentile value.    Returns 
 
out2-D array (same dtype as input image) 

Output image.
skimage.filters.rank.tophat(image, selem, out=None, mask=None, shift_x=False, shift_y=False) [source]
 
Local top-hat of an image. This filter computes the morphological opening of the image and then subtracts the result from the original image.  Parameters 
 
image2-D array (integer or float) 

Input image.  
selem2-D array (integer or float) 

The neighborhood expressed as a 2-D array of 1’s and 0’s.  
out2-D array (integer or float), optional 

If None, a new array is allocated.  
maskndarray (integer or float), optional 

Mask array that defines (>0) area of the image included in the local neighborhood. If None, the complete image is used (default).  
shift_x, shift_yint, optional 

Offset added to the structuring element center point. Shift is bounded to the structuring element sizes (center must be inside the given structuring element).    Returns 
 
out2-D array (same dtype as input image) 

Output image.    Warns 
 Deprecated:

 New in version 0.17.  This function is deprecated and will be removed in scikit-image 0.19. This filter was misnamed and we believe that the usefulness is narrow.     Examples >>> from skimage import data
>>> from skimage.morphology import disk
>>> from skimage.filters.rank import tophat
>>> img = data.camera()
>>> out = tophat(img, disk(5))
skimage.filters.rank.windowed_histogram(image, selem, out=None, mask=None, shift_x=False, shift_y=False, n_bins=None) [source]
 
Normalized sliding window histogram  Parameters 
 
image2-D array (integer or float) 

Input image.  
selem2-D array (integer or float) 

The neighborhood expressed as a 2-D array of 1’s and 0’s.  
out2-D array (integer or float), optional 

If None, a new array is allocated.  
maskndarray (integer or float), optional 

Mask array that defines (>0) area of the image included in the local neighborhood. If None, the complete image is used (default).  
shift_x, shift_yint, optional 

Offset added to the structuring element center point. Shift is bounded to the structuring element sizes (center must be inside the given structuring element).  
n_binsint or None 

The number of histogram bins. Will default to image.max() + 1 if None is passed.    Returns 
 
out3-D array (float) 

Array of dimensions (H,W,N), where (H,W) are the dimensions of the input image and N is n_bins or image.max() + 1 if no value is provided as a parameter. Effectively, each pixel is a N-D feature vector that is the histogram. The sum of the elements in the feature vector will be 1, unless no pixels in the window were covered by both selem and mask, in which case all elements will be 0.     Examples >>> from skimage import data
>>> from skimage.filters.rank import windowed_histogram
>>> from skimage.morphology import disk, ball
>>> import numpy as np
>>> img = data.camera()
>>> volume = np.random.randint(0, 255, size=(10,10,10), dtype=np.uint8)
>>> hist_img = windowed_histogram(img, disk(5))
skimage.filters.rank_order(image) [source]
 
Return an image of the same shape where each pixel is the index of the pixel value in the ascending order of the unique values of image, aka the rank-order value.  Parameters 
 
imagendarray 
  Returns 
 
labelsndarray of type np.uint32, of shape image.shape 

New array where each pixel has the rank-order value of the corresponding pixel in image. Pixel values are between 0 and n - 1, where n is the number of distinct unique values in image.  
original_values1-D ndarray 

Unique original values of image     Examples >>> a = np.array([[1, 4, 5], [4, 4, 1], [5, 1, 1]])
>>> a
array([[1, 4, 5],
       [4, 4, 1],
       [5, 1, 1]])
>>> rank_order(a)
(array([[0, 1, 2],
       [1, 1, 0],
       [2, 0, 0]], dtype=uint32), array([1, 4, 5]))
>>> b = np.array([-1., 2.5, 3.1, 2.5])
>>> rank_order(b)
(array([0, 1, 2, 1], dtype=uint32), array([-1. ,  2.5,  3.1]))
skimage.filters.roberts(image, mask=None) [source]
 
Find the edge magnitude using Roberts’ cross operator.  Parameters 
 
image2-D array 

Image to process.  
mask2-D array, optional 

An optional mask to limit the application to a certain area. Note that pixels surrounding masked regions are also masked to prevent masked regions from affecting the result.    Returns 
 
output2-D array 

The Roberts’ Cross edge map.      See also  
sobel, scharr, prewitt, feature.canny 
  Examples >>> from skimage import data
>>> camera = data.camera()
>>> from skimage import filters
>>> edges = filters.roberts(camera)
skimage.filters.roberts_neg_diag(image, mask=None) [source]
 
Find the cross edges of an image using the Roberts’ Cross operator. The kernel is applied to the input image to produce separate measurements of the gradient component one orientation.  Parameters 
 
image2-D array 

Image to process.  
mask2-D array, optional 

An optional mask to limit the application to a certain area. Note that pixels surrounding masked regions are also masked to prevent masked regions from affecting the result.    Returns 
 
output2-D array 

The Robert’s edge map.     Notes We use the following kernel:  0   1
-1   0
skimage.filters.roberts_pos_diag(image, mask=None) [source]
 
Find the cross edges of an image using Roberts’ cross operator. The kernel is applied to the input image to produce separate measurements of the gradient component one orientation.  Parameters 
 
image2-D array 

Image to process.  
mask2-D array, optional 

An optional mask to limit the application to a certain area. Note that pixels surrounding masked regions are also masked to prevent masked regions from affecting the result.    Returns 
 
output2-D array 

The Robert’s edge map.     Notes We use the following kernel: 1   0
0  -1
skimage.filters.sato(image, sigmas=range(1, 10, 2), black_ridges=True, mode=None, cval=0) [source]
 
Filter an image with the Sato tubeness filter. This filter can be used to detect continuous ridges, e.g. tubes, wrinkles, rivers. It can be used to calculate the fraction of the whole image containing such objects. Defined only for 2-D and 3-D images. Calculates the eigenvectors of the Hessian to compute the similarity of an image region to tubes, according to the method described in [1].  Parameters 
 
image(N, M[, P]) ndarray 

Array with input image data.  
sigmasiterable of floats, optional 

Sigmas used as scales of filter.  
black_ridgesboolean, optional 

When True (the default), the filter detects black ridges; when False, it detects white ridges.  
mode{‘constant’, ‘reflect’, ‘wrap’, ‘nearest’, ‘mirror’}, optional 

How to handle values outside the image borders.  
cvalfloat, optional 

Used in conjunction with mode ‘constant’, the value outside the image boundaries.    Returns 
 
out(N, M[, P]) ndarray 

Filtered image (maximum of pixels across all scales).      See also  
meijering


frangi


hessian

  References  
1  
Sato, Y., Nakajima, S., Shiraga, N., Atsumi, H., Yoshida, S., Koller, T., …, Kikinis, R. (1998). Three-dimensional multi-scale line filter for segmentation and visualization of curvilinear structures in medical images. Medical image analysis, 2(2), 143-168. DOI:10.1016/S1361-8415(98)80009-1
skimage.filters.scharr(image, mask=None, *, axis=None, mode='reflect', cval=0.0) [source]
 
Find the edge magnitude using the Scharr transform.  Parameters 
 
imagearray 

The input image.  
maskarray of bool, optional 

Clip the output image to this mask. (Values where mask=0 will be set to 0.)  
axisint or sequence of int, optional 

Compute the edge filter along this axis. If not provided, the edge magnitude is computed. This is defined as: sch_mag = np.sqrt(sum([scharr(image, axis=i)**2
                       for i in range(image.ndim)]) / image.ndim)
 The magnitude is also computed if axis is a sequence.  
modestr or sequence of str, optional 

The boundary mode for the convolution. See scipy.ndimage.convolve for a description of the modes. This can be either a single boundary mode or one boundary mode per axis.  
cvalfloat, optional 

When mode is 'constant', this is the constant used in values outside the boundary of the image data.    Returns 
 
outputarray of float 

The Scharr edge map.      See also  
sobel, prewitt, canny 
  Notes The Scharr operator has a better rotation invariance than other edge filters such as the Sobel or the Prewitt operators. References  
1  
D. Kroon, 2009, Short Paper University Twente, Numerical Optimization of Kernel Based Image Derivatives.  
2  
https://en.wikipedia.org/wiki/Sobel_operator#Alternative_operators   Examples >>> from skimage import data
>>> from skimage import filters
>>> camera = data.camera()
>>> edges = filters.scharr(camera)
skimage.filters.scharr_h(image, mask=None) [source]
 
Find the horizontal edges of an image using the Scharr transform.  Parameters 
 
image2-D array 

Image to process.  
mask2-D array, optional 

An optional mask to limit the application to a certain area. Note that pixels surrounding masked regions are also masked to prevent masked regions from affecting the result.    Returns 
 
output2-D array 

The Scharr edge map.     Notes We use the following kernel:  3   10   3
 0    0   0
-3  -10  -3
 References  
1  
D. Kroon, 2009, Short Paper University Twente, Numerical Optimization of Kernel Based Image Derivatives.
skimage.filters.scharr_v(image, mask=None) [source]
 
Find the vertical edges of an image using the Scharr transform.  Parameters 
 
image2-D array 

Image to process  
mask2-D array, optional 

An optional mask to limit the application to a certain area. Note that pixels surrounding masked regions are also masked to prevent masked regions from affecting the result.    Returns 
 
output2-D array 

The Scharr edge map.     Notes We use the following kernel:  3   0   -3
10   0  -10
 3   0   -3
 References  
1  
D. Kroon, 2009, Short Paper University Twente, Numerical Optimization of Kernel Based Image Derivatives.
skimage.filters.sobel(image, mask=None, *, axis=None, mode='reflect', cval=0.0) [source]
 
Find edges in an image using the Sobel filter.  Parameters 
 
imagearray 

The input image.  
maskarray of bool, optional 

Clip the output image to this mask. (Values where mask=0 will be set to 0.)  
axisint or sequence of int, optional 

Compute the edge filter along this axis. If not provided, the edge magnitude is computed. This is defined as: sobel_mag = np.sqrt(sum([sobel(image, axis=i)**2
                         for i in range(image.ndim)]) / image.ndim)
 The magnitude is also computed if axis is a sequence.  
modestr or sequence of str, optional 

The boundary mode for the convolution. See scipy.ndimage.convolve for a description of the modes. This can be either a single boundary mode or one boundary mode per axis.  
cvalfloat, optional 

When mode is 'constant', this is the constant used in values outside the boundary of the image data.    Returns 
 
outputarray of float 

The Sobel edge map.      See also  
scharr, prewitt, canny 
  References  
1  
D. Kroon, 2009, Short Paper University Twente, Numerical Optimization of Kernel Based Image Derivatives.  
2  
https://en.wikipedia.org/wiki/Sobel_operator   Examples >>> from skimage import data
>>> from skimage import filters
>>> camera = data.camera()
>>> edges = filters.sobel(camera)
skimage.filters.sobel_h(image, mask=None) [source]
 
Find the horizontal edges of an image using the Sobel transform.  Parameters 
 
image2-D array 

Image to process.  
mask2-D array, optional 

An optional mask to limit the application to a certain area. Note that pixels surrounding masked regions are also masked to prevent masked regions from affecting the result.    Returns 
 
output2-D array 

The Sobel edge map.     Notes We use the following kernel:  1   2   1
 0   0   0
-1  -2  -1
skimage.filters.sobel_v(image, mask=None) [source]
 
Find the vertical edges of an image using the Sobel transform.  Parameters 
 
image2-D array 

Image to process.  
mask2-D array, optional 

An optional mask to limit the application to a certain area. Note that pixels surrounding masked regions are also masked to prevent masked regions from affecting the result.    Returns 
 
output2-D array 

The Sobel edge map.     Notes We use the following kernel: 1   0  -1
2   0  -2
1   0  -1
skimage.filters.threshold_isodata(image=None, nbins=256, return_all=False, *, hist=None) [source]
 
Return threshold value(s) based on ISODATA method. Histogram-based threshold, known as Ridler-Calvard method or inter-means. Threshold values returned satisfy the following equality: threshold = (image[image <= threshold].mean() +
             image[image > threshold].mean()) / 2.0
 That is, returned thresholds are intensities that separate the image into two groups of pixels, where the threshold intensity is midway between the mean intensities of these groups. For integer images, the above equality holds to within one; for floating- point images, the equality holds to within the histogram bin-width. Either image or hist must be provided. In case hist is given, the actual histogram of the image is ignored.  Parameters 
 
image(N, M) ndarray, optional 

Input image.  
nbinsint, optional 

Number of bins used to calculate histogram. This value is ignored for integer arrays.  
return_allbool, optional 

If False (default), return only the lowest threshold that satisfies the above equality. If True, return all valid thresholds.  
histarray, or 2-tuple of arrays, optional 

Histogram to determine the threshold from and a corresponding array of bin center intensities. Alternatively, only the histogram can be passed.    Returns 
 
thresholdfloat or int or array 

Threshold value(s).     References  
1  
Ridler, TW & Calvard, S (1978), “Picture thresholding using an iterative selection method” IEEE Transactions on Systems, Man and Cybernetics 8: 630-632, DOI:10.1109/TSMC.1978.4310039  
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 DOI:10.1117/1.1631315  
3  
ImageJ AutoThresholder code, http://fiji.sc/wiki/index.php/Auto_Threshold   Examples >>> from skimage.data import coins
>>> image = coins()
>>> thresh = threshold_isodata(image)
>>> binary = image > thresh
skimage.filters.threshold_li(image, *, tolerance=None, initial_guess=None, iter_callback=None) [source]
 
Compute threshold value by Li’s iterative Minimum Cross Entropy method.  Parameters 
 
imagendarray 

Input image.  
tolerancefloat, optional 

Finish the computation when the change in the threshold in an iteration is less than this value. By default, this is half the smallest difference between intensity values in image.  
initial_guessfloat or Callable[[array[float]], float], optional 

Li’s iterative method uses gradient descent to find the optimal threshold. If the image intensity histogram contains more than two modes (peaks), the gradient descent could get stuck in a local optimum. An initial guess for the iteration can help the algorithm find the globally-optimal threshold. A float value defines a specific start point, while a callable should take in an array of image intensities and return a float value. Example valid callables include numpy.mean (default), lambda arr: numpy.quantile(arr, 0.95), or even skimage.filters.threshold_otsu().  
iter_callbackCallable[[float], Any], optional 

A function that will be called on the threshold at every iteration of the algorithm.    Returns 
 
thresholdfloat 

Upper threshold value. All pixels with an intensity higher than this value are assumed to be foreground.     References  
1  
Li C.H. and Lee C.K. (1993) “Minimum Cross Entropy Thresholding” Pattern Recognition, 26(4): 617-625 DOI:10.1016/0031-3203(93)90115-D  
2  
Li C.H. and Tam P.K.S. (1998) “An Iterative Algorithm for Minimum Cross Entropy Thresholding” Pattern Recognition Letters, 18(8): 771-776 DOI:10.1016/S0167-8655(98)00057-9  
3  
Sezgin M. and Sankur B. (2004) “Survey over Image Thresholding Techniques and Quantitative Performance Evaluation” Journal of Electronic Imaging, 13(1): 146-165 DOI:10.1117/1.1631315  
4  
ImageJ AutoThresholder code, http://fiji.sc/wiki/index.php/Auto_Threshold   Examples >>> from skimage.data import camera
>>> image = camera()
>>> thresh = threshold_li(image)
>>> binary = image > thresh
skimage.filters.threshold_local(image, block_size, method='gaussian', offset=0, mode='reflect', param=None, cval=0) [source]
 
Compute a threshold mask image based on local pixel neighborhood. Also known as adaptive or dynamic thresholding. The threshold value is the weighted mean for the local neighborhood of a pixel subtracted by a constant. Alternatively the threshold can be determined dynamically by a given function, using the ‘generic’ method.  Parameters 
 
image(N, M) ndarray 

Input image.  
block_sizeint 

Odd size of pixel neighborhood which is used to calculate the threshold value (e.g. 3, 5, 7, …, 21, …).  
method{‘generic’, ‘gaussian’, ‘mean’, ‘median’}, optional 

Method used to determine adaptive threshold for local neighbourhood in weighted mean image.  ‘generic’: use custom function (see param parameter) ‘gaussian’: apply gaussian filter (see param parameter for custom sigma value) ‘mean’: apply arithmetic mean filter ‘median’: apply median rank filter  By default the ‘gaussian’ method is used.  
offsetfloat, optional 

Constant subtracted from weighted mean of neighborhood to calculate the local threshold value. Default offset is 0.  
mode{‘reflect’, ‘constant’, ‘nearest’, ‘mirror’, ‘wrap’}, optional 

The mode parameter determines how the array borders are handled, where cval is the value when mode is equal to ‘constant’. Default is ‘reflect’.  
param{int, function}, optional 

Either specify sigma for ‘gaussian’ method or function object for ‘generic’ method. This functions takes the flat array of local neighbourhood as a single argument and returns the calculated threshold for the centre pixel.  
cvalfloat, optional 

Value to fill past edges of input if mode is ‘constant’.    Returns 
 
threshold(N, M) ndarray 

Threshold image. All pixels in the input image higher than the corresponding pixel in the threshold image are considered foreground.     References  
1  
https://docs.opencv.org/modules/imgproc/doc/miscellaneous_transformations.html?highlight=threshold#adaptivethreshold   Examples >>> from skimage.data import camera
>>> image = camera()[:50, :50]
>>> binary_image1 = image > threshold_local(image, 15, 'mean')
>>> func = lambda arr: arr.mean()
>>> binary_image2 = image > threshold_local(image, 15, 'generic',
...                                         param=func)