neulab/docprompting-conala huggingface dataset:
skimage.filters.rank.gradient(image, selem, out=None, mask=None, shift_x=False, shift_y=False, shift_z=False) [source]
 
Return local gradient of an image (i.e. local maximum - local minimum).  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 import data
>>> from skimage.morphology import disk, ball
>>> from skimage.filters.rank import gradient
>>> import numpy as np
>>> img = data.camera()
>>> volume = np.random.randint(0, 255, size=(10,10,10), dtype=np.uint8)
>>> out = gradient(img, disk(5))
>>> out_vol = gradient(volume, ball(5))
skimage.filters.rank.gradient_percentile(image, selem, out=None, mask=None, shift_x=False, shift_y=False, p0=0, p1=1) [source]
 
Return local gradient of an image (i.e. local maximum - local minimum). 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).  
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.majority(image, selem, *, out=None, mask=None, shift_x=False, shift_y=False, shift_z=False) [source]
 
Majority filter assign to each pixel the most occuring value within its neighborhood.  Parameters 
 
imagendarray 

Image array (uint8, uint16 array).  
selem2-D array (integer or float) 

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

If None, a new array will be 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.     Examples >>> from skimage import data
>>> from skimage.filters.rank import majority
>>> 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)
>>> maj_img = majority(img, disk(5))
>>> maj_img_vol = majority(volume, ball(5))
skimage.filters.rank.maximum(image, selem, out=None, mask=None, shift_x=False, shift_y=False, shift_z=False) [source]
 
Return local maximum of an image.  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.      See also  
skimage.morphology.dilation

  Notes The lower algorithm complexity makes skimage.filters.rank.maximum more efficient for larger images and structuring elements. Examples >>> from skimage import data
>>> from skimage.morphology import disk, ball
>>> from skimage.filters.rank import maximum
>>> import numpy as np
>>> img = data.camera()
>>> volume = np.random.randint(0, 255, size=(10,10,10), dtype=np.uint8)
>>> out = maximum(img, disk(5))
>>> out_vol = maximum(volume, ball(5))
skimage.filters.rank.mean(image, selem, out=None, mask=None, shift_x=False, shift_y=False, shift_z=False) [source]
 
Return local mean of an image.  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 import data
>>> from skimage.morphology import disk, ball
>>> from skimage.filters.rank import mean
>>> import numpy as np
>>> img = data.camera()
>>> volume = np.random.randint(0, 255, size=(10,10,10), dtype=np.uint8)
>>> avg = mean(img, disk(5))
>>> avg_vol = mean(volume, ball(5))
skimage.filters.rank.mean_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. 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 averaged.  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 mean_bilateral
>>> img = data.camera().astype(np.uint16)
>>> bilat_img = mean_bilateral(img, disk(20), s0=10,s1=10)
skimage.filters.rank.mean_percentile(image, selem, out=None, mask=None, shift_x=False, shift_y=False, p0=0, p1=1) [source]
 
Return local mean of an image. 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).  
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.median(image, selem=None, out=None, mask=None, shift_x=False, shift_y=False, shift_z=False) [source]
 
Return local median of an image.  Parameters 
 
image([P,] M, N) ndarray (uint8, uint16) 

Input image.  
selemndarray 

The neighborhood expressed as an ndarray of 1’s and 0’s. If None, a full square of size 3 is used.  
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.      See also  
skimage.filters.median


Implementation of a median filtering which handles images with floating precision.    Examples >>> from skimage import data
>>> from skimage.morphology import disk, ball
>>> from skimage.filters.rank import median
>>> import numpy as np
>>> img = data.camera()
>>> volume = np.random.randint(0, 255, size=(10,10,10), dtype=np.uint8)
>>> med = median(img, disk(5))
>>> med_vol = median(volume, ball(5))
skimage.filters.rank.minimum(image, selem, out=None, mask=None, shift_x=False, shift_y=False, shift_z=False) [source]
 
Return local minimum of an image.  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.      See also  
skimage.morphology.erosion

  Notes The lower algorithm complexity makes skimage.filters.rank.minimum more efficient for larger images and structuring elements. Examples >>> from skimage import data
>>> from skimage.morphology import disk, ball
>>> from skimage.filters.rank import minimum
>>> import numpy as np
>>> img = data.camera()
>>> volume = np.random.randint(0, 255, size=(10,10,10), dtype=np.uint8)
>>> out = minimum(img, disk(5))
>>> out_vol = minimum(volume, ball(5))
skimage.filters.rank.modal(image, selem, out=None, mask=None, shift_x=False, shift_y=False, shift_z=False) [source]
 
Return local mode of an image. The mode is the value that appears most often in the local histogram.  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 import data
>>> from skimage.morphology import disk, ball
>>> from skimage.filters.rank import modal
>>> import numpy as np
>>> img = data.camera()
>>> volume = np.random.randint(0, 255, size=(10,10,10), dtype=np.uint8)
>>> out = modal(img, disk(5))
>>> out_vol = modal(volume, ball(5))
skimage.filters.rank.noise_filter(image, selem, out=None, mask=None, shift_x=False, shift_y=False, shift_z=False) [source]
 
Noise feature.  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.     References  
1  
N. Hashimoto et al. Referenceless image quality evaluation for whole slide imaging. J Pathol Inform 2012;3:9.   Examples >>> from skimage import data
>>> from skimage.morphology import disk, ball
>>> from skimage.filters.rank import noise_filter
>>> import numpy as np
>>> img = data.camera()
>>> volume = np.random.randint(0, 255, size=(10,10,10), dtype=np.uint8)
>>> out = noise_filter(img, disk(5))
>>> out_vol = noise_filter(volume, ball(5))
skimage.filters.rank.otsu(image, selem, out=None, mask=None, shift_x=False, shift_y=False, shift_z=False) [source]
 
Local Otsu’s threshold value for each pixel.  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.     References  
1  
https://en.wikipedia.org/wiki/Otsu’s_method   Examples >>> from skimage import data
>>> from skimage.filters.rank import otsu
>>> 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)
>>> local_otsu = otsu(img, disk(5))
>>> thresh_image = img >= local_otsu
>>> local_otsu_vol = otsu(volume, ball(5))
>>> thresh_image_vol = volume >= local_otsu_vol
skimage.filters.rank.percentile(image, selem, out=None, mask=None, shift_x=False, shift_y=False, p0=0) [source]
 
Return local percentile of an image. Returns the value of the p0 lower percentile of the local greyvalue distribution. 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.pop(image, selem, out=None, mask=None, shift_x=False, shift_y=False, shift_z=False) [source]
 
Return the local number (population) of pixels. The number of pixels is defined as the number of pixels which are included in the structuring element and the mask.  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
>>> import skimage.filters.rank as rank
>>> 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)
>>> rank.pop(img, square(3))
array([[4, 6, 6, 6, 4],
       [6, 9, 9, 9, 6],
       [6, 9, 9, 9, 6],
       [6, 9, 9, 9, 6],
       [4, 6, 6, 6, 4]], dtype=uint8)
skimage.filters.rank.pop_bilateral(image, selem, out=None, mask=None, shift_x=False, shift_y=False, s0=10, s1=10) [source]
 
Return the local number (population) of pixels. The number of pixels is defined as the number of pixels which are included in the structuring element and the mask. Additionally pixels must have a greylevel inside the interval [g-s0, g+s1] where g is the greyvalue of the center pixel.  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.     Examples >>> from skimage.morphology import square
>>> import skimage.filters.rank as rank
>>> 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.uint16)
>>> rank.pop_bilateral(img, square(3), s0=10, s1=10)
array([[3, 4, 3, 4, 3],
       [4, 4, 6, 4, 4],
       [3, 6, 9, 6, 3],
       [4, 4, 6, 4, 4],
       [3, 4, 3, 4, 3]], dtype=uint16)
skimage.filters.rank.pop_percentile(image, selem, out=None, mask=None, shift_x=False, shift_y=False, p0=0, p1=1) [source]
 
Return the local number (population) of pixels. The number of pixels is defined as the number of pixels which are included in the structuring element and the mask. 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).  
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.subtract_mean(image, selem, out=None, mask=None, shift_x=False, shift_y=False, shift_z=False) [source]
 
Return image subtracted from its 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.     Notes Subtracting the mean value may introduce underflow. To compensate this potential underflow, the obtained difference is downscaled by a factor of 2 and shifted by n_bins / 2 - 1, the median value of the local histogram (n_bins = max(3, image.max()) +1 for 16-bits images and 256 otherwise). Examples >>> from skimage import data
>>> from skimage.morphology import disk, ball
>>> from skimage.filters.rank import subtract_mean
>>> import numpy as np
>>> img = data.camera()
>>> volume = np.random.randint(0, 255, size=(10,10,10), dtype=np.uint8)
>>> out = subtract_mean(img, disk(5))
>>> out_vol = subtract_mean(volume, ball(5))
skimage.filters.rank.subtract_mean_percentile(image, selem, out=None, mask=None, shift_x=False, shift_y=False, p0=0, p1=1) [source]
 
Return image subtracted from its 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).  
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.sum(image, selem, out=None, mask=None, shift_x=False, shift_y=False, shift_z=False) [source]
 
Return the local sum of pixels. Note that the sum may overflow depending on the data type of the input array.  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
>>> import skimage.filters.rank as rank         # Cube seems to fail but
>>> img = np.array([[0, 0, 0, 0, 0],            # Ball can pass
...                 [0, 1, 1, 1, 0],
...                 [0, 1, 1, 1, 0],
...                 [0, 1, 1, 1, 0],
...                 [0, 0, 0, 0, 0]], dtype=np.uint8)
>>> rank.sum(img, square(3))
array([[1, 2, 3, 2, 1],
       [2, 4, 6, 4, 2],
       [3, 6, 9, 6, 3],
       [2, 4, 6, 4, 2],
       [1, 2, 3, 2, 1]], dtype=uint8)