doc_content stringlengths 1 386k | doc_id stringlengths 5 188 |
|---|---|
skimage.transform.swirl(image, center=None, strength=1, radius=100, rotation=0, output_shape=None, order=None, mode='reflect', cval=0, clip=True, preserve_range=False) [source]
Perform a swirl transformation. Parameters
imagendarray
Input image.
center(column, row) tuple or (2,) ndarray, optional
Center coordinate of transformation.
strengthfloat, optional
The amount of swirling applied.
radiusfloat, optional
The extent of the swirl in pixels. The effect dies out rapidly beyond radius.
rotationfloat, optional
Additional rotation applied to the image. Returns
swirledndarray
Swirled version of the input. Other Parameters
output_shapetuple (rows, cols), optional
Shape of the output image generated. By default the shape of the input image is preserved.
orderint, optional
The order of the spline interpolation, default is 0 if image.dtype is bool and 1 otherwise. The order has to be in the range 0-5. See skimage.transform.warp for detail.
mode{‘constant’, ‘edge’, ‘symmetric’, ‘reflect’, ‘wrap’}, optional
Points outside the boundaries of the input are filled according to the given mode, with ‘constant’ used as the default. Modes match the behaviour of numpy.pad.
cvalfloat, optional
Used in conjunction with mode ‘constant’, the value outside the image boundaries.
clipbool, optional
Whether to clip the output to the range of values of the input image. This is enabled by default, since higher order interpolation may produce values outside the given input range.
preserve_rangebool, optional
Whether to keep the original range of values. Otherwise, the input image is converted according to the conventions of img_as_float. Also see https://scikit-image.org/docs/dev/user_guide/data_types.html | skimage.api.skimage.transform#skimage.transform.swirl |
skimage.transform.warp(image, inverse_map, map_args={}, output_shape=None, order=None, mode='constant', cval=0.0, clip=True, preserve_range=False) [source]
Warp an image according to a given coordinate transformation. Parameters
imagendarray
Input image.
inverse_maptransformation object, callable cr = f(cr, **kwargs), or ndarray
Inverse coordinate map, which transforms coordinates in the output images into their corresponding coordinates in the input image. There are a number of different options to define this map, depending on the dimensionality of the input image. A 2-D image can have 2 dimensions for gray-scale images, or 3 dimensions with color information. For 2-D images, you can directly pass a transformation object, e.g. skimage.transform.SimilarityTransform, or its inverse. For 2-D images, you can pass a (3, 3) homogeneous transformation matrix, e.g. skimage.transform.SimilarityTransform.params. For 2-D images, a function that transforms a (M, 2) array of (col, row) coordinates in the output image to their corresponding coordinates in the input image. Extra parameters to the function can be specified through map_args. For N-D images, you can directly pass an array of coordinates. The first dimension specifies the coordinates in the input image, while the subsequent dimensions determine the position in the output image. E.g. in case of 2-D images, you need to pass an array of shape (2, rows, cols), where rows and cols determine the shape of the output image, and the first dimension contains the (row, col) coordinate in the input image. See scipy.ndimage.map_coordinates for further documentation. Note, that a (3, 3) matrix is interpreted as a homogeneous transformation matrix, so you cannot interpolate values from a 3-D input, if the output is of shape (3,). See example section for usage.
map_argsdict, optional
Keyword arguments passed to inverse_map.
output_shapetuple (rows, cols), optional
Shape of the output image generated. By default the shape of the input image is preserved. Note that, even for multi-band images, only rows and columns need to be specified.
orderint, optional
The order of interpolation. The order has to be in the range 0-5:
0: Nearest-neighbor 1: Bi-linear (default) 2: Bi-quadratic 3: Bi-cubic 4: Bi-quartic 5: Bi-quintic Default is 0 if image.dtype is bool and 1 otherwise.
mode{‘constant’, ‘edge’, ‘symmetric’, ‘reflect’, ‘wrap’}, optional
Points outside the boundaries of the input are filled according to the given mode. Modes match the behaviour of numpy.pad.
cvalfloat, optional
Used in conjunction with mode ‘constant’, the value outside the image boundaries.
clipbool, optional
Whether to clip the output to the range of values of the input image. This is enabled by default, since higher order interpolation may produce values outside the given input range.
preserve_rangebool, optional
Whether to keep the original range of values. Otherwise, the input image is converted according to the conventions of img_as_float. Also see https://scikit-image.org/docs/dev/user_guide/data_types.html Returns
warpeddouble ndarray
The warped input image. Notes The input image is converted to a double image. In case of a SimilarityTransform, AffineTransform and ProjectiveTransform and order in [0, 3] this function uses the underlying transformation matrix to warp the image with a much faster routine. Examples >>> from skimage.transform import warp
>>> from skimage import data
>>> image = data.camera()
The following image warps are all equal but differ substantially in execution time. The image is shifted to the bottom. Use a geometric transform to warp an image (fast): >>> from skimage.transform import SimilarityTransform
>>> tform = SimilarityTransform(translation=(0, -10))
>>> warped = warp(image, tform)
Use a callable (slow): >>> def shift_down(xy):
... xy[:, 1] -= 10
... return xy
>>> warped = warp(image, shift_down)
Use a transformation matrix to warp an image (fast): >>> matrix = np.array([[1, 0, 0], [0, 1, -10], [0, 0, 1]])
>>> warped = warp(image, matrix)
>>> from skimage.transform import ProjectiveTransform
>>> warped = warp(image, ProjectiveTransform(matrix=matrix))
You can also use the inverse of a geometric transformation (fast): >>> warped = warp(image, tform.inverse)
For N-D images you can pass a coordinate array, that specifies the coordinates in the input image for every element in the output image. E.g. if you want to rescale a 3-D cube, you can do: >>> cube_shape = np.array([30, 30, 30])
>>> cube = np.random.rand(*cube_shape)
Setup the coordinate array, that defines the scaling: >>> scale = 0.1
>>> output_shape = (scale * cube_shape).astype(int)
>>> coords0, coords1, coords2 = np.mgrid[:output_shape[0],
... :output_shape[1], :output_shape[2]]
>>> coords = np.array([coords0, coords1, coords2])
Assume that the cube contains spatial data, where the first array element center is at coordinate (0.5, 0.5, 0.5) in real space, i.e. we have to account for this extra offset when scaling the image: >>> coords = (coords + 0.5) / scale - 0.5
>>> warped = warp(cube, coords) | skimage.api.skimage.transform#skimage.transform.warp |
skimage.transform.warp_coords(coord_map, shape, dtype=<class 'numpy.float64'>) [source]
Build the source coordinates for the output of a 2-D image warp. Parameters
coord_mapcallable like GeometricTransform.inverse
Return input coordinates for given output coordinates. Coordinates are in the shape (P, 2), where P is the number of coordinates and each element is a (row, col) pair.
shapetuple
Shape of output image (rows, cols[, bands]).
dtypenp.dtype or string
dtype for return value (sane choices: float32 or float64). Returns
coords(ndim, rows, cols[, bands]) array of dtype dtype
Coordinates for scipy.ndimage.map_coordinates, that will yield an image of shape (orows, ocols, bands) by drawing from source points according to the coord_transform_fn. Notes This is a lower-level routine that produces the source coordinates for 2-D images used by warp(). It is provided separately from warp to give additional flexibility to users who would like, for example, to re-use a particular coordinate mapping, to use specific dtypes at various points along the the image-warping process, or to implement different post-processing logic than warp performs after the call to ndi.map_coordinates. Examples Produce a coordinate map that shifts an image up and to the right: >>> from skimage import data
>>> from scipy.ndimage import map_coordinates
>>>
>>> def shift_up10_left20(xy):
... return xy - np.array([-20, 10])[None, :]
>>>
>>> image = data.astronaut().astype(np.float32)
>>> coords = warp_coords(shift_up10_left20, image.shape)
>>> warped_image = map_coordinates(image, coords) | skimage.api.skimage.transform#skimage.transform.warp_coords |
skimage.transform.warp_polar(image, center=None, *, radius=None, output_shape=None, scaling='linear', multichannel=False, **kwargs) [source]
Remap image to polar or log-polar coordinates space. Parameters
imagendarray
Input image. Only 2-D arrays are accepted by default. If multichannel=True, 3-D arrays are accepted and the last axis is interpreted as multiple channels.
centertuple (row, col), optional
Point in image that represents the center of the transformation (i.e., the origin in cartesian space). Values can be of type float. If no value is given, the center is assumed to be the center point of the image.
radiusfloat, optional
Radius of the circle that bounds the area to be transformed.
output_shapetuple (row, col), optional
scaling{‘linear’, ‘log’}, optional
Specify whether the image warp is polar or log-polar. Defaults to ‘linear’.
multichannelbool, optional
Whether the image is a 3-D array in which the third axis is to be interpreted as multiple channels. If set to False (default), only 2-D arrays are accepted.
**kwargskeyword arguments
Passed to transform.warp. Returns
warpedndarray
The polar or log-polar warped image. Examples Perform a basic polar warp on a grayscale image: >>> from skimage import data
>>> from skimage.transform import warp_polar
>>> image = data.checkerboard()
>>> warped = warp_polar(image)
Perform a log-polar warp on a grayscale image: >>> warped = warp_polar(image, scaling='log')
Perform a log-polar warp on a grayscale image while specifying center, radius, and output shape: >>> warped = warp_polar(image, (100,100), radius=100,
... output_shape=image.shape, scaling='log')
Perform a log-polar warp on a color image: >>> image = data.astronaut()
>>> warped = warp_polar(image, scaling='log', multichannel=True) | skimage.api.skimage.transform#skimage.transform.warp_polar |
Tutorials Image Segmentation How to parallelize loops | skimage.user_guide.tutorials |
Module: util
skimage.util.apply_parallel(function, array) Map a function in parallel across an array.
skimage.util.compare_images(image1, image2) Return an image showing the differences between two images.
skimage.util.crop(ar, crop_width[, copy, order]) Crop array ar by crop_width along each dimension.
skimage.util.dtype_limits(image[, clip_negative]) Return intensity limits, i.e.
skimage.util.img_as_bool(image[, force_copy]) Convert an image to boolean format.
skimage.util.img_as_float(image[, force_copy]) Convert an image to floating point format.
skimage.util.img_as_float32(image[, force_copy]) Convert an image to single-precision (32-bit) floating point format.
skimage.util.img_as_float64(image[, force_copy]) Convert an image to double-precision (64-bit) floating point format.
skimage.util.img_as_int(image[, force_copy]) Convert an image to 16-bit signed integer format.
skimage.util.img_as_ubyte(image[, force_copy]) Convert an image to 8-bit unsigned integer format.
skimage.util.img_as_uint(image[, force_copy]) Convert an image to 16-bit unsigned integer format.
skimage.util.invert(image[, signed_float]) Invert an image.
skimage.util.map_array(input_arr, …[, out]) Map values from input array from input_vals to output_vals.
skimage.util.montage(arr_in[, fill, …]) Create a montage of several single- or multichannel images.
skimage.util.pad(array, pad_width[, mode]) Pad an array.
skimage.util.random_noise(image[, mode, …]) Function to add random noise of various types to a floating-point image.
skimage.util.regular_grid(ar_shape, n_points) Find n_points regularly spaced along ar_shape.
skimage.util.regular_seeds(ar_shape, n_points) Return an image with ~`n_points` regularly-spaced nonzero pixels.
skimage.util.unique_rows(ar) Remove repeated rows from a 2D array.
skimage.util.view_as_blocks(arr_in, block_shape) Block view of the input n-dimensional array (using re-striding).
skimage.util.view_as_windows(arr_in, …[, step]) Rolling window view of the input n-dimensional array. apply_parallel
skimage.util.apply_parallel(function, array, chunks=None, depth=0, mode=None, extra_arguments=(), extra_keywords={}, *, dtype=None, multichannel=False, compute=None) [source]
Map a function in parallel across an array. Split an array into possibly overlapping chunks of a given depth and boundary type, call the given function in parallel on the chunks, combine the chunks and return the resulting array. Parameters
functionfunction
Function to be mapped which takes an array as an argument.
arraynumpy array or dask array
Array which the function will be applied to.
chunksint, tuple, or tuple of tuples, optional
A single integer is interpreted as the length of one side of a square chunk that should be tiled across the array. One tuple of length array.ndim represents the shape of a chunk, and it is tiled across the array. A list of tuples of length ndim, where each sub-tuple is a sequence of chunk sizes along the corresponding dimension. If None, the array is broken up into chunks based on the number of available cpus. More information about chunks is in the documentation here.
depthint, optional
Integer equal to the depth of the added boundary cells. Defaults to zero.
mode{‘reflect’, ‘symmetric’, ‘periodic’, ‘wrap’, ‘nearest’, ‘edge’}, optional
type of external boundary padding.
extra_argumentstuple, optional
Tuple of arguments to be passed to the function.
extra_keywordsdictionary, optional
Dictionary of keyword arguments to be passed to the function.
dtypedata-type or None, optional
The data-type of the function output. If None, Dask will attempt to infer this by calling the function on data of shape (1,) * ndim. For functions expecting RGB or multichannel data this may be problematic. In such cases, the user should manually specify this dtype argument instead. New in version 0.18: dtype was added in 0.18.
multichannelbool, optional
If chunks is None and multichannel is True, this function will keep only a single chunk along the channels axis. When depth is specified as a scalar value, that depth will be applied only to the non-channels axes (a depth of 0 will be used along the channels axis). If the user manually specified both chunks and a depth tuple, then this argument will have no effect. New in version 0.18: multichannel was added in 0.18.
computebool, optional
If True, compute eagerly returning a NumPy Array. If False, compute lazily returning a Dask Array. If None (default), compute based on array type provided (eagerly for NumPy Arrays and lazily for Dask Arrays). Returns
outndarray or dask Array
Returns the result of the applying the operation. Type is dependent on the compute argument. Notes Numpy edge modes ‘symmetric’, ‘wrap’, and ‘edge’ are converted to the equivalent dask boundary modes ‘reflect’, ‘periodic’ and ‘nearest’, respectively. Setting compute=False can be useful for chaining later operations. For example region selection to preview a result or storing large data to disk instead of loading in memory.
compare_images
skimage.util.compare_images(image1, image2, method='diff', *, n_tiles=(8, 8)) [source]
Return an image showing the differences between two images. New in version 0.16. Parameters
image1, image22-D array
Images to process, must be of the same shape.
methodstring, optional
Method used for the comparison. Valid values are {‘diff’, ‘blend’, ‘checkerboard’}. Details are provided in the note section.
n_tilestuple, optional
Used only for the checkerboard method. Specifies the number of tiles (row, column) to divide the image. Returns
comparison2-D array
Image showing the differences. Notes 'diff' computes the absolute difference between the two images. 'blend' computes the mean value. 'checkerboard' makes tiles of dimension n_tiles that display alternatively the first and the second image.
crop
skimage.util.crop(ar, crop_width, copy=False, order='K') [source]
Crop array ar by crop_width along each dimension. Parameters
ararray-like of rank N
Input array.
crop_width{sequence, int}
Number of values to remove from the edges of each axis. ((before_1, after_1), … (before_N, after_N)) specifies unique crop widths at the start and end of each axis. ((before, after),) or (before, after) specifies a fixed start and end crop for every axis. (n,) or n for integer n is a shortcut for before = after = n for all axes.
copybool, optional
If True, ensure the returned array is a contiguous copy. Normally, a crop operation will return a discontiguous view of the underlying input array.
order{‘C’, ‘F’, ‘A’, ‘K’}, optional
If copy==True, control the memory layout of the copy. See np.copy. Returns
croppedarray
The cropped array. If copy=False (default), this is a sliced view of the input array.
dtype_limits
skimage.util.dtype_limits(image, clip_negative=False) [source]
Return intensity limits, i.e. (min, max) tuple, of the image’s dtype. Parameters
imagendarray
Input image.
clip_negativebool, optional
If True, clip the negative range (i.e. return 0 for min intensity) even if the image dtype allows negative values. Returns
imin, imaxtuple
Lower and upper intensity limits.
img_as_bool
skimage.util.img_as_bool(image, force_copy=False) [source]
Convert an image to boolean format. Parameters
imagendarray
Input image.
force_copybool, optional
Force a copy of the data, irrespective of its current dtype. Returns
outndarray of bool (bool_)
Output image. Notes The upper half of the input dtype’s positive range is True, and the lower half is False. All negative values (if present) are False.
img_as_float
skimage.util.img_as_float(image, force_copy=False) [source]
Convert an image to floating point format. This function is similar to img_as_float64, but will not convert lower-precision floating point arrays to float64. Parameters
imagendarray
Input image.
force_copybool, optional
Force a copy of the data, irrespective of its current dtype. Returns
outndarray of float
Output image. Notes The range of a floating point image is [0.0, 1.0] or [-1.0, 1.0] when converting from unsigned or signed datatypes, respectively. If the input image has a float type, intensity values are not modified and can be outside the ranges [0.0, 1.0] or [-1.0, 1.0].
img_as_float32
skimage.util.img_as_float32(image, force_copy=False) [source]
Convert an image to single-precision (32-bit) floating point format. Parameters
imagendarray
Input image.
force_copybool, optional
Force a copy of the data, irrespective of its current dtype. Returns
outndarray of float32
Output image. Notes The range of a floating point image is [0.0, 1.0] or [-1.0, 1.0] when converting from unsigned or signed datatypes, respectively. If the input image has a float type, intensity values are not modified and can be outside the ranges [0.0, 1.0] or [-1.0, 1.0].
img_as_float64
skimage.util.img_as_float64(image, force_copy=False) [source]
Convert an image to double-precision (64-bit) floating point format. Parameters
imagendarray
Input image.
force_copybool, optional
Force a copy of the data, irrespective of its current dtype. Returns
outndarray of float64
Output image. Notes The range of a floating point image is [0.0, 1.0] or [-1.0, 1.0] when converting from unsigned or signed datatypes, respectively. If the input image has a float type, intensity values are not modified and can be outside the ranges [0.0, 1.0] or [-1.0, 1.0].
img_as_int
skimage.util.img_as_int(image, force_copy=False) [source]
Convert an image to 16-bit signed integer format. Parameters
imagendarray
Input image.
force_copybool, optional
Force a copy of the data, irrespective of its current dtype. Returns
outndarray of int16
Output image. Notes The values are scaled between -32768 and 32767. If the input data-type is positive-only (e.g., uint8), then the output image will still only have positive values.
img_as_ubyte
skimage.util.img_as_ubyte(image, force_copy=False) [source]
Convert an image to 8-bit unsigned integer format. Parameters
imagendarray
Input image.
force_copybool, optional
Force a copy of the data, irrespective of its current dtype. Returns
outndarray of ubyte (uint8)
Output image. Notes Negative input values will be clipped. Positive values are scaled between 0 and 255.
img_as_uint
skimage.util.img_as_uint(image, force_copy=False) [source]
Convert an image to 16-bit unsigned integer format. Parameters
imagendarray
Input image.
force_copybool, optional
Force a copy of the data, irrespective of its current dtype. Returns
outndarray of uint16
Output image. Notes Negative input values will be clipped. Positive values are scaled between 0 and 65535.
invert
skimage.util.invert(image, signed_float=False) [source]
Invert an image. Invert the intensity range of the input image, so that the dtype maximum is now the dtype minimum, and vice-versa. This operation is slightly different depending on the input dtype: unsigned integers: subtract the image from the dtype maximum signed integers: subtract the image from -1 (see Notes) floats: subtract the image from 1 (if signed_float is False, so we assume the image is unsigned), or from 0 (if signed_float is True). See the examples for clarification. Parameters
imagendarray
Input image.
signed_floatbool, optional
If True and the image is of type float, the range is assumed to be [-1, 1]. If False and the image is of type float, the range is assumed to be [0, 1]. Returns
invertedndarray
Inverted image. Notes Ideally, for signed integers we would simply multiply by -1. However, signed integer ranges are asymmetric. For example, for np.int8, the range of possible values is [-128, 127], so that -128 * -1 equals -128! By subtracting from -1, we correctly map the maximum dtype value to the minimum. Examples >>> img = np.array([[100, 0, 200],
... [ 0, 50, 0],
... [ 30, 0, 255]], np.uint8)
>>> invert(img)
array([[155, 255, 55],
[255, 205, 255],
[225, 255, 0]], dtype=uint8)
>>> img2 = np.array([[ -2, 0, -128],
... [127, 0, 5]], np.int8)
>>> invert(img2)
array([[ 1, -1, 127],
[-128, -1, -6]], dtype=int8)
>>> img3 = np.array([[ 0., 1., 0.5, 0.75]])
>>> invert(img3)
array([[1. , 0. , 0.5 , 0.25]])
>>> img4 = np.array([[ 0., 1., -1., -0.25]])
>>> invert(img4, signed_float=True)
array([[-0. , -1. , 1. , 0.25]])
Examples using skimage.util.invert
Use rolling-ball algorithm for estimating background intensity map_array
skimage.util.map_array(input_arr, input_vals, output_vals, out=None) [source]
Map values from input array from input_vals to output_vals. Parameters
input_arrarray of int, shape (M[, N][, P][, …])
The input label image.
input_valsarray of int, shape (N,)
The values to map from.
output_valsarray, shape (N,)
The values to map to. out: array, same shape as `input_arr`
The output array. Will be created if not provided. It should have the same dtype as output_vals. Returns
outarray, same shape as input_arr
The array of mapped values.
montage
skimage.util.montage(arr_in, fill='mean', rescale_intensity=False, grid_shape=None, padding_width=0, multichannel=False) [source]
Create a montage of several single- or multichannel images. Create a rectangular montage from an input array representing an ensemble of equally shaped single- (gray) or multichannel (color) images. For example, montage(arr_in) called with the following arr_in
1 2 3 will return
1 2
3
where the ‘*’ patch will be determined by the fill parameter. Parameters
arr_in(K, M, N[, C]) ndarray
An array representing an ensemble of K images of equal shape.
fillfloat or array-like of floats or ‘mean’, optional
Value to fill the padding areas and/or the extra tiles in the output array. Has to be float for single channel collections. For multichannel collections has to be an array-like of shape of number of channels. If mean, uses the mean value over all images.
rescale_intensitybool, optional
Whether to rescale the intensity of each image to [0, 1].
grid_shapetuple, optional
The desired grid shape for the montage (ntiles_row, ntiles_column). The default aspect ratio is square.
padding_widthint, optional
The size of the spacing between the tiles and between the tiles and the borders. If non-zero, makes the boundaries of individual images easier to perceive.
multichannelboolean, optional
If True, the last arr_in dimension is threated as a color channel, otherwise as spatial. Returns
arr_out(K*(M+p)+p, K*(N+p)+p[, C]) ndarray
Output array with input images glued together (including padding p). Examples >>> import numpy as np
>>> from skimage.util import montage
>>> arr_in = np.arange(3 * 2 * 2).reshape(3, 2, 2)
>>> arr_in
array([[[ 0, 1],
[ 2, 3]],
[[ 4, 5],
[ 6, 7]],
[[ 8, 9],
[10, 11]]])
>>> arr_out = montage(arr_in)
>>> arr_out.shape
(4, 4)
>>> arr_out
array([[ 0, 1, 4, 5],
[ 2, 3, 6, 7],
[ 8, 9, 5, 5],
[10, 11, 5, 5]])
>>> arr_in.mean()
5.5
>>> arr_out_nonsquare = montage(arr_in, grid_shape=(1, 3))
>>> arr_out_nonsquare
array([[ 0, 1, 4, 5, 8, 9],
[ 2, 3, 6, 7, 10, 11]])
>>> arr_out_nonsquare.shape
(2, 6)
pad
skimage.util.pad(array, pad_width, mode='constant', **kwargs) [source]
Pad an array. Parameters
arrayarray_like of rank N
The array to pad.
pad_width{sequence, array_like, int}
Number of values padded to the edges of each axis. ((before_1, after_1), … (before_N, after_N)) unique pad widths for each axis. ((before, after),) yields same before and after pad for each axis. (pad,) or int is a shortcut for before = after = pad width for all axes.
modestr or function, optional
One of the following string values or a user supplied function. ‘constant’ (default)
Pads with a constant value. ‘edge’
Pads with the edge values of array. ‘linear_ramp’
Pads with the linear ramp between end_value and the array edge value. ‘maximum’
Pads with the maximum value of all or part of the vector along each axis. ‘mean’
Pads with the mean value of all or part of the vector along each axis. ‘median’
Pads with the median value of all or part of the vector along each axis. ‘minimum’
Pads with the minimum value of all or part of the vector along each axis. ‘reflect’
Pads with the reflection of the vector mirrored on the first and last values of the vector along each axis. ‘symmetric’
Pads with the reflection of the vector mirrored along the edge of the array. ‘wrap’
Pads with the wrap of the vector along the axis. The first values are used to pad the end and the end values are used to pad the beginning. ‘empty’
Pads with undefined values. New in version 1.17. <function>
Padding function, see Notes.
stat_lengthsequence or int, optional
Used in ‘maximum’, ‘mean’, ‘median’, and ‘minimum’. Number of values at edge of each axis used to calculate the statistic value. ((before_1, after_1), … (before_N, after_N)) unique statistic lengths for each axis. ((before, after),) yields same before and after statistic lengths for each axis. (stat_length,) or int is a shortcut for before = after = statistic length for all axes. Default is None, to use the entire axis.
constant_valuessequence or scalar, optional
Used in ‘constant’. The values to set the padded values for each axis. ((before_1, after_1), ... (before_N, after_N)) unique pad constants for each axis. ((before, after),) yields same before and after constants for each axis. (constant,) or constant is a shortcut for before = after = constant for all axes. Default is 0.
end_valuessequence or scalar, optional
Used in ‘linear_ramp’. The values used for the ending value of the linear_ramp and that will form the edge of the padded array. ((before_1, after_1), ... (before_N, after_N)) unique end values for each axis. ((before, after),) yields same before and after end values for each axis. (constant,) or constant is a shortcut for before = after = constant for all axes. Default is 0.
reflect_type{‘even’, ‘odd’}, optional
Used in ‘reflect’, and ‘symmetric’. The ‘even’ style is the default with an unaltered reflection around the edge value. For the ‘odd’ style, the extended part of the array is created by subtracting the reflected values from two times the edge value. Returns
padndarray
Padded array of rank equal to array with shape increased according to pad_width. Notes New in version 1.7.0. For an array with rank greater than 1, some of the padding of later axes is calculated from padding of previous axes. This is easiest to think about with a rank 2 array where the corners of the padded array are calculated by using padded values from the first axis. The padding function, if used, should modify a rank 1 array in-place. It has the following signature: padding_func(vector, iaxis_pad_width, iaxis, kwargs)
where
vectorndarray
A rank 1 array already padded with zeros. Padded values are vector[:iaxis_pad_width[0]] and vector[-iaxis_pad_width[1]:].
iaxis_pad_widthtuple
A 2-tuple of ints, iaxis_pad_width[0] represents the number of values padded at the beginning of vector where iaxis_pad_width[1] represents the number of values padded at the end of vector.
iaxisint
The axis currently being calculated.
kwargsdict
Any keyword arguments the function requires. Examples >>> a = [1, 2, 3, 4, 5]
>>> np.pad(a, (2, 3), 'constant', constant_values=(4, 6))
array([4, 4, 1, ..., 6, 6, 6])
>>> np.pad(a, (2, 3), 'edge')
array([1, 1, 1, ..., 5, 5, 5])
>>> np.pad(a, (2, 3), 'linear_ramp', end_values=(5, -4))
array([ 5, 3, 1, 2, 3, 4, 5, 2, -1, -4])
>>> np.pad(a, (2,), 'maximum')
array([5, 5, 1, 2, 3, 4, 5, 5, 5])
>>> np.pad(a, (2,), 'mean')
array([3, 3, 1, 2, 3, 4, 5, 3, 3])
>>> np.pad(a, (2,), 'median')
array([3, 3, 1, 2, 3, 4, 5, 3, 3])
>>> a = [[1, 2], [3, 4]]
>>> np.pad(a, ((3, 2), (2, 3)), 'minimum')
array([[1, 1, 1, 2, 1, 1, 1],
[1, 1, 1, 2, 1, 1, 1],
[1, 1, 1, 2, 1, 1, 1],
[1, 1, 1, 2, 1, 1, 1],
[3, 3, 3, 4, 3, 3, 3],
[1, 1, 1, 2, 1, 1, 1],
[1, 1, 1, 2, 1, 1, 1]])
>>> a = [1, 2, 3, 4, 5]
>>> np.pad(a, (2, 3), 'reflect')
array([3, 2, 1, 2, 3, 4, 5, 4, 3, 2])
>>> np.pad(a, (2, 3), 'reflect', reflect_type='odd')
array([-1, 0, 1, 2, 3, 4, 5, 6, 7, 8])
>>> np.pad(a, (2, 3), 'symmetric')
array([2, 1, 1, 2, 3, 4, 5, 5, 4, 3])
>>> np.pad(a, (2, 3), 'symmetric', reflect_type='odd')
array([0, 1, 1, 2, 3, 4, 5, 5, 6, 7])
>>> np.pad(a, (2, 3), 'wrap')
array([4, 5, 1, 2, 3, 4, 5, 1, 2, 3])
>>> def pad_with(vector, pad_width, iaxis, kwargs):
... pad_value = kwargs.get('padder', 10)
... vector[:pad_width[0]] = pad_value
... vector[-pad_width[1]:] = pad_value
>>> a = np.arange(6)
>>> a = a.reshape((2, 3))
>>> np.pad(a, 2, pad_with)
array([[10, 10, 10, 10, 10, 10, 10],
[10, 10, 10, 10, 10, 10, 10],
[10, 10, 0, 1, 2, 10, 10],
[10, 10, 3, 4, 5, 10, 10],
[10, 10, 10, 10, 10, 10, 10],
[10, 10, 10, 10, 10, 10, 10]])
>>> np.pad(a, 2, pad_with, padder=100)
array([[100, 100, 100, 100, 100, 100, 100],
[100, 100, 100, 100, 100, 100, 100],
[100, 100, 0, 1, 2, 100, 100],
[100, 100, 3, 4, 5, 100, 100],
[100, 100, 100, 100, 100, 100, 100],
[100, 100, 100, 100, 100, 100, 100]])
random_noise
skimage.util.random_noise(image, mode='gaussian', seed=None, clip=True, **kwargs) [source]
Function to add random noise of various types to a floating-point image. Parameters
imagendarray
Input image data. Will be converted to float.
modestr, optional
One of the following strings, selecting the type of noise to add: ‘gaussian’ Gaussian-distributed additive noise.
‘localvar’ Gaussian-distributed additive noise, with specified
local variance at each point of image. ‘poisson’ Poisson-distributed noise generated from the data. ‘salt’ Replaces random pixels with 1.
‘pepper’ Replaces random pixels with 0 (for unsigned images) or
-1 (for signed images).
‘s&p’ Replaces random pixels with either 1 or low_val, where
low_val is 0 for unsigned images or -1 for signed images.
‘speckle’ Multiplicative noise using out = image + n*image, where
n is Gaussian noise with specified mean & variance.
seedint, optional
If provided, this will set the random seed before generating noise, for valid pseudo-random comparisons.
clipbool, optional
If True (default), the output will be clipped after noise applied for modes ‘speckle’, ‘poisson’, and ‘gaussian’. This is needed to maintain the proper image data range. If False, clipping is not applied, and the output may extend beyond the range [-1, 1].
meanfloat, optional
Mean of random distribution. Used in ‘gaussian’ and ‘speckle’. Default : 0.
varfloat, optional
Variance of random distribution. Used in ‘gaussian’ and ‘speckle’. Note: variance = (standard deviation) ** 2. Default : 0.01
local_varsndarray, optional
Array of positive floats, same shape as image, defining the local variance at every image point. Used in ‘localvar’.
amountfloat, optional
Proportion of image pixels to replace with noise on range [0, 1]. Used in ‘salt’, ‘pepper’, and ‘salt & pepper’. Default : 0.05
salt_vs_pepperfloat, optional
Proportion of salt vs. pepper noise for ‘s&p’ on range [0, 1]. Higher values represent more salt. Default : 0.5 (equal amounts) Returns
outndarray
Output floating-point image data on range [0, 1] or [-1, 1] if the input image was unsigned or signed, respectively. Notes Speckle, Poisson, Localvar, and Gaussian noise may generate noise outside the valid image range. The default is to clip (not alias) these values, but they may be preserved by setting clip=False. Note that in this case the output may contain values outside the ranges [0, 1] or [-1, 1]. Use this option with care. Because of the prevalence of exclusively positive floating-point images in intermediate calculations, it is not possible to intuit if an input is signed based on dtype alone. Instead, negative values are explicitly searched for. Only if found does this function assume signed input. Unexpected results only occur in rare, poorly exposes cases (e.g. if all values are above 50 percent gray in a signed image). In this event, manually scaling the input to the positive domain will solve the problem. The Poisson distribution is only defined for positive integers. To apply this noise type, the number of unique values in the image is found and the next round power of two is used to scale up the floating-point result, after which it is scaled back down to the floating-point image range. To generate Poisson noise against a signed image, the signed image is temporarily converted to an unsigned image in the floating point domain, Poisson noise is generated, then it is returned to the original range.
regular_grid
skimage.util.regular_grid(ar_shape, n_points) [source]
Find n_points regularly spaced along ar_shape. The returned points (as slices) should be as close to cubically-spaced as possible. Essentially, the points are spaced by the Nth root of the input array size, where N is the number of dimensions. However, if an array dimension cannot fit a full step size, it is “discarded”, and the computation is done for only the remaining dimensions. Parameters
ar_shapearray-like of ints
The shape of the space embedding the grid. len(ar_shape) is the number of dimensions.
n_pointsint
The (approximate) number of points to embed in the space. Returns
slicestuple of slice objects
A slice along each dimension of ar_shape, such that the intersection of all the slices give the coordinates of regularly spaced points. Changed in version 0.14.1: In scikit-image 0.14.1 and 0.15, the return type was changed from a list to a tuple to ensure compatibility with Numpy 1.15 and higher. If your code requires the returned result to be a list, you may convert the output of this function to a list with: >>> result = list(regular_grid(ar_shape=(3, 20, 40), n_points=8))
Examples >>> ar = np.zeros((20, 40))
>>> g = regular_grid(ar.shape, 8)
>>> g
(slice(5, None, 10), slice(5, None, 10))
>>> ar[g] = 1
>>> ar.sum()
8.0
>>> ar = np.zeros((20, 40))
>>> g = regular_grid(ar.shape, 32)
>>> g
(slice(2, None, 5), slice(2, None, 5))
>>> ar[g] = 1
>>> ar.sum()
32.0
>>> ar = np.zeros((3, 20, 40))
>>> g = regular_grid(ar.shape, 8)
>>> g
(slice(1, None, 3), slice(5, None, 10), slice(5, None, 10))
>>> ar[g] = 1
>>> ar.sum()
8.0
regular_seeds
skimage.util.regular_seeds(ar_shape, n_points, dtype=<class 'int'>) [source]
Return an image with ~`n_points` regularly-spaced nonzero pixels. Parameters
ar_shapetuple of int
The shape of the desired output image.
n_pointsint
The desired number of nonzero points.
dtypenumpy data type, optional
The desired data type of the output. Returns
seed_imgarray of int or bool
The desired image. Examples >>> regular_seeds((5, 5), 4)
array([[0, 0, 0, 0, 0],
[0, 1, 0, 2, 0],
[0, 0, 0, 0, 0],
[0, 3, 0, 4, 0],
[0, 0, 0, 0, 0]])
unique_rows
skimage.util.unique_rows(ar) [source]
Remove repeated rows from a 2D array. In particular, if given an array of coordinates of shape (Npoints, Ndim), it will remove repeated points. Parameters
ar2-D ndarray
The input array. Returns
ar_out2-D ndarray
A copy of the input array with repeated rows removed. Raises
ValueErrorif ar is not two-dimensional.
Notes The function will generate a copy of ar if it is not C-contiguous, which will negatively affect performance for large input arrays. Examples >>> ar = np.array([[1, 0, 1],
... [0, 1, 0],
... [1, 0, 1]], np.uint8)
>>> unique_rows(ar)
array([[0, 1, 0],
[1, 0, 1]], dtype=uint8)
view_as_blocks
skimage.util.view_as_blocks(arr_in, block_shape) [source]
Block view of the input n-dimensional array (using re-striding). Blocks are non-overlapping views of the input array. Parameters
arr_inndarray
N-d input array.
block_shapetuple
The shape of the block. Each dimension must divide evenly into the corresponding dimensions of arr_in. Returns
arr_outndarray
Block view of the input array. Examples >>> import numpy as np
>>> from skimage.util.shape import view_as_blocks
>>> A = np.arange(4*4).reshape(4,4)
>>> A
array([[ 0, 1, 2, 3],
[ 4, 5, 6, 7],
[ 8, 9, 10, 11],
[12, 13, 14, 15]])
>>> B = view_as_blocks(A, block_shape=(2, 2))
>>> B[0, 0]
array([[0, 1],
[4, 5]])
>>> B[0, 1]
array([[2, 3],
[6, 7]])
>>> B[1, 0, 1, 1]
13
>>> A = np.arange(4*4*6).reshape(4,4,6)
>>> A
array([[[ 0, 1, 2, 3, 4, 5],
[ 6, 7, 8, 9, 10, 11],
[12, 13, 14, 15, 16, 17],
[18, 19, 20, 21, 22, 23]],
[[24, 25, 26, 27, 28, 29],
[30, 31, 32, 33, 34, 35],
[36, 37, 38, 39, 40, 41],
[42, 43, 44, 45, 46, 47]],
[[48, 49, 50, 51, 52, 53],
[54, 55, 56, 57, 58, 59],
[60, 61, 62, 63, 64, 65],
[66, 67, 68, 69, 70, 71]],
[[72, 73, 74, 75, 76, 77],
[78, 79, 80, 81, 82, 83],
[84, 85, 86, 87, 88, 89],
[90, 91, 92, 93, 94, 95]]])
>>> B = view_as_blocks(A, block_shape=(1, 2, 2))
>>> B.shape
(4, 2, 3, 1, 2, 2)
>>> B[2:, 0, 2]
array([[[[52, 53],
[58, 59]]],
[[[76, 77],
[82, 83]]]])
view_as_windows
skimage.util.view_as_windows(arr_in, window_shape, step=1) [source]
Rolling window view of the input n-dimensional array. Windows are overlapping views of the input array, with adjacent windows shifted by a single row or column (or an index of a higher dimension). Parameters
arr_inndarray
N-d input array.
window_shapeinteger or tuple of length arr_in.ndim
Defines the shape of the elementary n-dimensional orthotope (better know as hyperrectangle [1]) of the rolling window view. If an integer is given, the shape will be a hypercube of sidelength given by its value.
stepinteger or tuple of length arr_in.ndim
Indicates step size at which extraction shall be performed. If integer is given, then the step is uniform in all dimensions. Returns
arr_outndarray
(rolling) window view of the input array. Notes One should be very careful with rolling views when it comes to memory usage. Indeed, although a ‘view’ has the same memory footprint as its base array, the actual array that emerges when this ‘view’ is used in a computation is generally a (much) larger array than the original, especially for 2-dimensional arrays and above. For example, let us consider a 3 dimensional array of size (100, 100, 100) of float64. This array takes about 8*100**3 Bytes for storage which is just 8 MB. If one decides to build a rolling view on this array with a window of (3, 3, 3) the hypothetical size of the rolling view (if one was to reshape the view for example) would be 8*(100-3+1)**3*3**3 which is about 203 MB! The scaling becomes even worse as the dimension of the input array becomes larger. References
1
https://en.wikipedia.org/wiki/Hyperrectangle Examples >>> import numpy as np
>>> from skimage.util.shape import view_as_windows
>>> A = np.arange(4*4).reshape(4,4)
>>> A
array([[ 0, 1, 2, 3],
[ 4, 5, 6, 7],
[ 8, 9, 10, 11],
[12, 13, 14, 15]])
>>> window_shape = (2, 2)
>>> B = view_as_windows(A, window_shape)
>>> B[0, 0]
array([[0, 1],
[4, 5]])
>>> B[0, 1]
array([[1, 2],
[5, 6]])
>>> A = np.arange(10)
>>> A
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
>>> window_shape = (3,)
>>> B = view_as_windows(A, window_shape)
>>> B.shape
(8, 3)
>>> B
array([[0, 1, 2],
[1, 2, 3],
[2, 3, 4],
[3, 4, 5],
[4, 5, 6],
[5, 6, 7],
[6, 7, 8],
[7, 8, 9]])
>>> A = np.arange(5*4).reshape(5, 4)
>>> A
array([[ 0, 1, 2, 3],
[ 4, 5, 6, 7],
[ 8, 9, 10, 11],
[12, 13, 14, 15],
[16, 17, 18, 19]])
>>> window_shape = (4, 3)
>>> B = view_as_windows(A, window_shape)
>>> B.shape
(2, 2, 4, 3)
>>> B
array([[[[ 0, 1, 2],
[ 4, 5, 6],
[ 8, 9, 10],
[12, 13, 14]],
[[ 1, 2, 3],
[ 5, 6, 7],
[ 9, 10, 11],
[13, 14, 15]]],
[[[ 4, 5, 6],
[ 8, 9, 10],
[12, 13, 14],
[16, 17, 18]],
[[ 5, 6, 7],
[ 9, 10, 11],
[13, 14, 15],
[17, 18, 19]]]]) | skimage.api.skimage.util |
skimage.util.apply_parallel(function, array, chunks=None, depth=0, mode=None, extra_arguments=(), extra_keywords={}, *, dtype=None, multichannel=False, compute=None) [source]
Map a function in parallel across an array. Split an array into possibly overlapping chunks of a given depth and boundary type, call the given function in parallel on the chunks, combine the chunks and return the resulting array. Parameters
functionfunction
Function to be mapped which takes an array as an argument.
arraynumpy array or dask array
Array which the function will be applied to.
chunksint, tuple, or tuple of tuples, optional
A single integer is interpreted as the length of one side of a square chunk that should be tiled across the array. One tuple of length array.ndim represents the shape of a chunk, and it is tiled across the array. A list of tuples of length ndim, where each sub-tuple is a sequence of chunk sizes along the corresponding dimension. If None, the array is broken up into chunks based on the number of available cpus. More information about chunks is in the documentation here.
depthint, optional
Integer equal to the depth of the added boundary cells. Defaults to zero.
mode{‘reflect’, ‘symmetric’, ‘periodic’, ‘wrap’, ‘nearest’, ‘edge’}, optional
type of external boundary padding.
extra_argumentstuple, optional
Tuple of arguments to be passed to the function.
extra_keywordsdictionary, optional
Dictionary of keyword arguments to be passed to the function.
dtypedata-type or None, optional
The data-type of the function output. If None, Dask will attempt to infer this by calling the function on data of shape (1,) * ndim. For functions expecting RGB or multichannel data this may be problematic. In such cases, the user should manually specify this dtype argument instead. New in version 0.18: dtype was added in 0.18.
multichannelbool, optional
If chunks is None and multichannel is True, this function will keep only a single chunk along the channels axis. When depth is specified as a scalar value, that depth will be applied only to the non-channels axes (a depth of 0 will be used along the channels axis). If the user manually specified both chunks and a depth tuple, then this argument will have no effect. New in version 0.18: multichannel was added in 0.18.
computebool, optional
If True, compute eagerly returning a NumPy Array. If False, compute lazily returning a Dask Array. If None (default), compute based on array type provided (eagerly for NumPy Arrays and lazily for Dask Arrays). Returns
outndarray or dask Array
Returns the result of the applying the operation. Type is dependent on the compute argument. Notes Numpy edge modes ‘symmetric’, ‘wrap’, and ‘edge’ are converted to the equivalent dask boundary modes ‘reflect’, ‘periodic’ and ‘nearest’, respectively. Setting compute=False can be useful for chaining later operations. For example region selection to preview a result or storing large data to disk instead of loading in memory. | skimage.api.skimage.util#skimage.util.apply_parallel |
skimage.util.compare_images(image1, image2, method='diff', *, n_tiles=(8, 8)) [source]
Return an image showing the differences between two images. New in version 0.16. Parameters
image1, image22-D array
Images to process, must be of the same shape.
methodstring, optional
Method used for the comparison. Valid values are {‘diff’, ‘blend’, ‘checkerboard’}. Details are provided in the note section.
n_tilestuple, optional
Used only for the checkerboard method. Specifies the number of tiles (row, column) to divide the image. Returns
comparison2-D array
Image showing the differences. Notes 'diff' computes the absolute difference between the two images. 'blend' computes the mean value. 'checkerboard' makes tiles of dimension n_tiles that display alternatively the first and the second image. | skimage.api.skimage.util#skimage.util.compare_images |
skimage.util.crop(ar, crop_width, copy=False, order='K') [source]
Crop array ar by crop_width along each dimension. Parameters
ararray-like of rank N
Input array.
crop_width{sequence, int}
Number of values to remove from the edges of each axis. ((before_1, after_1), … (before_N, after_N)) specifies unique crop widths at the start and end of each axis. ((before, after),) or (before, after) specifies a fixed start and end crop for every axis. (n,) or n for integer n is a shortcut for before = after = n for all axes.
copybool, optional
If True, ensure the returned array is a contiguous copy. Normally, a crop operation will return a discontiguous view of the underlying input array.
order{‘C’, ‘F’, ‘A’, ‘K’}, optional
If copy==True, control the memory layout of the copy. See np.copy. Returns
croppedarray
The cropped array. If copy=False (default), this is a sliced view of the input array. | skimage.api.skimage.util#skimage.util.crop |
skimage.util.dtype_limits(image, clip_negative=False) [source]
Return intensity limits, i.e. (min, max) tuple, of the image’s dtype. Parameters
imagendarray
Input image.
clip_negativebool, optional
If True, clip the negative range (i.e. return 0 for min intensity) even if the image dtype allows negative values. Returns
imin, imaxtuple
Lower and upper intensity limits. | skimage.api.skimage.util#skimage.util.dtype_limits |
skimage.util.img_as_bool(image, force_copy=False) [source]
Convert an image to boolean format. Parameters
imagendarray
Input image.
force_copybool, optional
Force a copy of the data, irrespective of its current dtype. Returns
outndarray of bool (bool_)
Output image. Notes The upper half of the input dtype’s positive range is True, and the lower half is False. All negative values (if present) are False. | skimage.api.skimage.util#skimage.util.img_as_bool |
skimage.util.img_as_float(image, force_copy=False) [source]
Convert an image to floating point format. This function is similar to img_as_float64, but will not convert lower-precision floating point arrays to float64. Parameters
imagendarray
Input image.
force_copybool, optional
Force a copy of the data, irrespective of its current dtype. Returns
outndarray of float
Output image. Notes The range of a floating point image is [0.0, 1.0] or [-1.0, 1.0] when converting from unsigned or signed datatypes, respectively. If the input image has a float type, intensity values are not modified and can be outside the ranges [0.0, 1.0] or [-1.0, 1.0]. | skimage.api.skimage.util#skimage.util.img_as_float |
skimage.util.img_as_float32(image, force_copy=False) [source]
Convert an image to single-precision (32-bit) floating point format. Parameters
imagendarray
Input image.
force_copybool, optional
Force a copy of the data, irrespective of its current dtype. Returns
outndarray of float32
Output image. Notes The range of a floating point image is [0.0, 1.0] or [-1.0, 1.0] when converting from unsigned or signed datatypes, respectively. If the input image has a float type, intensity values are not modified and can be outside the ranges [0.0, 1.0] or [-1.0, 1.0]. | skimage.api.skimage.util#skimage.util.img_as_float32 |
skimage.util.img_as_float64(image, force_copy=False) [source]
Convert an image to double-precision (64-bit) floating point format. Parameters
imagendarray
Input image.
force_copybool, optional
Force a copy of the data, irrespective of its current dtype. Returns
outndarray of float64
Output image. Notes The range of a floating point image is [0.0, 1.0] or [-1.0, 1.0] when converting from unsigned or signed datatypes, respectively. If the input image has a float type, intensity values are not modified and can be outside the ranges [0.0, 1.0] or [-1.0, 1.0]. | skimage.api.skimage.util#skimage.util.img_as_float64 |
skimage.util.img_as_int(image, force_copy=False) [source]
Convert an image to 16-bit signed integer format. Parameters
imagendarray
Input image.
force_copybool, optional
Force a copy of the data, irrespective of its current dtype. Returns
outndarray of int16
Output image. Notes The values are scaled between -32768 and 32767. If the input data-type is positive-only (e.g., uint8), then the output image will still only have positive values. | skimage.api.skimage.util#skimage.util.img_as_int |
skimage.util.img_as_ubyte(image, force_copy=False) [source]
Convert an image to 8-bit unsigned integer format. Parameters
imagendarray
Input image.
force_copybool, optional
Force a copy of the data, irrespective of its current dtype. Returns
outndarray of ubyte (uint8)
Output image. Notes Negative input values will be clipped. Positive values are scaled between 0 and 255. | skimage.api.skimage.util#skimage.util.img_as_ubyte |
skimage.util.img_as_uint(image, force_copy=False) [source]
Convert an image to 16-bit unsigned integer format. Parameters
imagendarray
Input image.
force_copybool, optional
Force a copy of the data, irrespective of its current dtype. Returns
outndarray of uint16
Output image. Notes Negative input values will be clipped. Positive values are scaled between 0 and 65535. | skimage.api.skimage.util#skimage.util.img_as_uint |
skimage.util.invert(image, signed_float=False) [source]
Invert an image. Invert the intensity range of the input image, so that the dtype maximum is now the dtype minimum, and vice-versa. This operation is slightly different depending on the input dtype: unsigned integers: subtract the image from the dtype maximum signed integers: subtract the image from -1 (see Notes) floats: subtract the image from 1 (if signed_float is False, so we assume the image is unsigned), or from 0 (if signed_float is True). See the examples for clarification. Parameters
imagendarray
Input image.
signed_floatbool, optional
If True and the image is of type float, the range is assumed to be [-1, 1]. If False and the image is of type float, the range is assumed to be [0, 1]. Returns
invertedndarray
Inverted image. Notes Ideally, for signed integers we would simply multiply by -1. However, signed integer ranges are asymmetric. For example, for np.int8, the range of possible values is [-128, 127], so that -128 * -1 equals -128! By subtracting from -1, we correctly map the maximum dtype value to the minimum. Examples >>> img = np.array([[100, 0, 200],
... [ 0, 50, 0],
... [ 30, 0, 255]], np.uint8)
>>> invert(img)
array([[155, 255, 55],
[255, 205, 255],
[225, 255, 0]], dtype=uint8)
>>> img2 = np.array([[ -2, 0, -128],
... [127, 0, 5]], np.int8)
>>> invert(img2)
array([[ 1, -1, 127],
[-128, -1, -6]], dtype=int8)
>>> img3 = np.array([[ 0., 1., 0.5, 0.75]])
>>> invert(img3)
array([[1. , 0. , 0.5 , 0.25]])
>>> img4 = np.array([[ 0., 1., -1., -0.25]])
>>> invert(img4, signed_float=True)
array([[-0. , -1. , 1. , 0.25]]) | skimage.api.skimage.util#skimage.util.invert |
skimage.util.map_array(input_arr, input_vals, output_vals, out=None) [source]
Map values from input array from input_vals to output_vals. Parameters
input_arrarray of int, shape (M[, N][, P][, …])
The input label image.
input_valsarray of int, shape (N,)
The values to map from.
output_valsarray, shape (N,)
The values to map to. out: array, same shape as `input_arr`
The output array. Will be created if not provided. It should have the same dtype as output_vals. Returns
outarray, same shape as input_arr
The array of mapped values. | skimage.api.skimage.util#skimage.util.map_array |
skimage.util.montage(arr_in, fill='mean', rescale_intensity=False, grid_shape=None, padding_width=0, multichannel=False) [source]
Create a montage of several single- or multichannel images. Create a rectangular montage from an input array representing an ensemble of equally shaped single- (gray) or multichannel (color) images. For example, montage(arr_in) called with the following arr_in
1 2 3 will return
1 2
3
where the ‘*’ patch will be determined by the fill parameter. Parameters
arr_in(K, M, N[, C]) ndarray
An array representing an ensemble of K images of equal shape.
fillfloat or array-like of floats or ‘mean’, optional
Value to fill the padding areas and/or the extra tiles in the output array. Has to be float for single channel collections. For multichannel collections has to be an array-like of shape of number of channels. If mean, uses the mean value over all images.
rescale_intensitybool, optional
Whether to rescale the intensity of each image to [0, 1].
grid_shapetuple, optional
The desired grid shape for the montage (ntiles_row, ntiles_column). The default aspect ratio is square.
padding_widthint, optional
The size of the spacing between the tiles and between the tiles and the borders. If non-zero, makes the boundaries of individual images easier to perceive.
multichannelboolean, optional
If True, the last arr_in dimension is threated as a color channel, otherwise as spatial. Returns
arr_out(K*(M+p)+p, K*(N+p)+p[, C]) ndarray
Output array with input images glued together (including padding p). Examples >>> import numpy as np
>>> from skimage.util import montage
>>> arr_in = np.arange(3 * 2 * 2).reshape(3, 2, 2)
>>> arr_in
array([[[ 0, 1],
[ 2, 3]],
[[ 4, 5],
[ 6, 7]],
[[ 8, 9],
[10, 11]]])
>>> arr_out = montage(arr_in)
>>> arr_out.shape
(4, 4)
>>> arr_out
array([[ 0, 1, 4, 5],
[ 2, 3, 6, 7],
[ 8, 9, 5, 5],
[10, 11, 5, 5]])
>>> arr_in.mean()
5.5
>>> arr_out_nonsquare = montage(arr_in, grid_shape=(1, 3))
>>> arr_out_nonsquare
array([[ 0, 1, 4, 5, 8, 9],
[ 2, 3, 6, 7, 10, 11]])
>>> arr_out_nonsquare.shape
(2, 6) | skimage.api.skimage.util#skimage.util.montage |
skimage.util.pad(array, pad_width, mode='constant', **kwargs) [source]
Pad an array. Parameters
arrayarray_like of rank N
The array to pad.
pad_width{sequence, array_like, int}
Number of values padded to the edges of each axis. ((before_1, after_1), … (before_N, after_N)) unique pad widths for each axis. ((before, after),) yields same before and after pad for each axis. (pad,) or int is a shortcut for before = after = pad width for all axes.
modestr or function, optional
One of the following string values or a user supplied function. ‘constant’ (default)
Pads with a constant value. ‘edge’
Pads with the edge values of array. ‘linear_ramp’
Pads with the linear ramp between end_value and the array edge value. ‘maximum’
Pads with the maximum value of all or part of the vector along each axis. ‘mean’
Pads with the mean value of all or part of the vector along each axis. ‘median’
Pads with the median value of all or part of the vector along each axis. ‘minimum’
Pads with the minimum value of all or part of the vector along each axis. ‘reflect’
Pads with the reflection of the vector mirrored on the first and last values of the vector along each axis. ‘symmetric’
Pads with the reflection of the vector mirrored along the edge of the array. ‘wrap’
Pads with the wrap of the vector along the axis. The first values are used to pad the end and the end values are used to pad the beginning. ‘empty’
Pads with undefined values. New in version 1.17. <function>
Padding function, see Notes.
stat_lengthsequence or int, optional
Used in ‘maximum’, ‘mean’, ‘median’, and ‘minimum’. Number of values at edge of each axis used to calculate the statistic value. ((before_1, after_1), … (before_N, after_N)) unique statistic lengths for each axis. ((before, after),) yields same before and after statistic lengths for each axis. (stat_length,) or int is a shortcut for before = after = statistic length for all axes. Default is None, to use the entire axis.
constant_valuessequence or scalar, optional
Used in ‘constant’. The values to set the padded values for each axis. ((before_1, after_1), ... (before_N, after_N)) unique pad constants for each axis. ((before, after),) yields same before and after constants for each axis. (constant,) or constant is a shortcut for before = after = constant for all axes. Default is 0.
end_valuessequence or scalar, optional
Used in ‘linear_ramp’. The values used for the ending value of the linear_ramp and that will form the edge of the padded array. ((before_1, after_1), ... (before_N, after_N)) unique end values for each axis. ((before, after),) yields same before and after end values for each axis. (constant,) or constant is a shortcut for before = after = constant for all axes. Default is 0.
reflect_type{‘even’, ‘odd’}, optional
Used in ‘reflect’, and ‘symmetric’. The ‘even’ style is the default with an unaltered reflection around the edge value. For the ‘odd’ style, the extended part of the array is created by subtracting the reflected values from two times the edge value. Returns
padndarray
Padded array of rank equal to array with shape increased according to pad_width. Notes New in version 1.7.0. For an array with rank greater than 1, some of the padding of later axes is calculated from padding of previous axes. This is easiest to think about with a rank 2 array where the corners of the padded array are calculated by using padded values from the first axis. The padding function, if used, should modify a rank 1 array in-place. It has the following signature: padding_func(vector, iaxis_pad_width, iaxis, kwargs)
where
vectorndarray
A rank 1 array already padded with zeros. Padded values are vector[:iaxis_pad_width[0]] and vector[-iaxis_pad_width[1]:].
iaxis_pad_widthtuple
A 2-tuple of ints, iaxis_pad_width[0] represents the number of values padded at the beginning of vector where iaxis_pad_width[1] represents the number of values padded at the end of vector.
iaxisint
The axis currently being calculated.
kwargsdict
Any keyword arguments the function requires. Examples >>> a = [1, 2, 3, 4, 5]
>>> np.pad(a, (2, 3), 'constant', constant_values=(4, 6))
array([4, 4, 1, ..., 6, 6, 6])
>>> np.pad(a, (2, 3), 'edge')
array([1, 1, 1, ..., 5, 5, 5])
>>> np.pad(a, (2, 3), 'linear_ramp', end_values=(5, -4))
array([ 5, 3, 1, 2, 3, 4, 5, 2, -1, -4])
>>> np.pad(a, (2,), 'maximum')
array([5, 5, 1, 2, 3, 4, 5, 5, 5])
>>> np.pad(a, (2,), 'mean')
array([3, 3, 1, 2, 3, 4, 5, 3, 3])
>>> np.pad(a, (2,), 'median')
array([3, 3, 1, 2, 3, 4, 5, 3, 3])
>>> a = [[1, 2], [3, 4]]
>>> np.pad(a, ((3, 2), (2, 3)), 'minimum')
array([[1, 1, 1, 2, 1, 1, 1],
[1, 1, 1, 2, 1, 1, 1],
[1, 1, 1, 2, 1, 1, 1],
[1, 1, 1, 2, 1, 1, 1],
[3, 3, 3, 4, 3, 3, 3],
[1, 1, 1, 2, 1, 1, 1],
[1, 1, 1, 2, 1, 1, 1]])
>>> a = [1, 2, 3, 4, 5]
>>> np.pad(a, (2, 3), 'reflect')
array([3, 2, 1, 2, 3, 4, 5, 4, 3, 2])
>>> np.pad(a, (2, 3), 'reflect', reflect_type='odd')
array([-1, 0, 1, 2, 3, 4, 5, 6, 7, 8])
>>> np.pad(a, (2, 3), 'symmetric')
array([2, 1, 1, 2, 3, 4, 5, 5, 4, 3])
>>> np.pad(a, (2, 3), 'symmetric', reflect_type='odd')
array([0, 1, 1, 2, 3, 4, 5, 5, 6, 7])
>>> np.pad(a, (2, 3), 'wrap')
array([4, 5, 1, 2, 3, 4, 5, 1, 2, 3])
>>> def pad_with(vector, pad_width, iaxis, kwargs):
... pad_value = kwargs.get('padder', 10)
... vector[:pad_width[0]] = pad_value
... vector[-pad_width[1]:] = pad_value
>>> a = np.arange(6)
>>> a = a.reshape((2, 3))
>>> np.pad(a, 2, pad_with)
array([[10, 10, 10, 10, 10, 10, 10],
[10, 10, 10, 10, 10, 10, 10],
[10, 10, 0, 1, 2, 10, 10],
[10, 10, 3, 4, 5, 10, 10],
[10, 10, 10, 10, 10, 10, 10],
[10, 10, 10, 10, 10, 10, 10]])
>>> np.pad(a, 2, pad_with, padder=100)
array([[100, 100, 100, 100, 100, 100, 100],
[100, 100, 100, 100, 100, 100, 100],
[100, 100, 0, 1, 2, 100, 100],
[100, 100, 3, 4, 5, 100, 100],
[100, 100, 100, 100, 100, 100, 100],
[100, 100, 100, 100, 100, 100, 100]]) | skimage.api.skimage.util#skimage.util.pad |
skimage.util.random_noise(image, mode='gaussian', seed=None, clip=True, **kwargs) [source]
Function to add random noise of various types to a floating-point image. Parameters
imagendarray
Input image data. Will be converted to float.
modestr, optional
One of the following strings, selecting the type of noise to add: ‘gaussian’ Gaussian-distributed additive noise.
‘localvar’ Gaussian-distributed additive noise, with specified
local variance at each point of image. ‘poisson’ Poisson-distributed noise generated from the data. ‘salt’ Replaces random pixels with 1.
‘pepper’ Replaces random pixels with 0 (for unsigned images) or
-1 (for signed images).
‘s&p’ Replaces random pixels with either 1 or low_val, where
low_val is 0 for unsigned images or -1 for signed images.
‘speckle’ Multiplicative noise using out = image + n*image, where
n is Gaussian noise with specified mean & variance.
seedint, optional
If provided, this will set the random seed before generating noise, for valid pseudo-random comparisons.
clipbool, optional
If True (default), the output will be clipped after noise applied for modes ‘speckle’, ‘poisson’, and ‘gaussian’. This is needed to maintain the proper image data range. If False, clipping is not applied, and the output may extend beyond the range [-1, 1].
meanfloat, optional
Mean of random distribution. Used in ‘gaussian’ and ‘speckle’. Default : 0.
varfloat, optional
Variance of random distribution. Used in ‘gaussian’ and ‘speckle’. Note: variance = (standard deviation) ** 2. Default : 0.01
local_varsndarray, optional
Array of positive floats, same shape as image, defining the local variance at every image point. Used in ‘localvar’.
amountfloat, optional
Proportion of image pixels to replace with noise on range [0, 1]. Used in ‘salt’, ‘pepper’, and ‘salt & pepper’. Default : 0.05
salt_vs_pepperfloat, optional
Proportion of salt vs. pepper noise for ‘s&p’ on range [0, 1]. Higher values represent more salt. Default : 0.5 (equal amounts) Returns
outndarray
Output floating-point image data on range [0, 1] or [-1, 1] if the input image was unsigned or signed, respectively. Notes Speckle, Poisson, Localvar, and Gaussian noise may generate noise outside the valid image range. The default is to clip (not alias) these values, but they may be preserved by setting clip=False. Note that in this case the output may contain values outside the ranges [0, 1] or [-1, 1]. Use this option with care. Because of the prevalence of exclusively positive floating-point images in intermediate calculations, it is not possible to intuit if an input is signed based on dtype alone. Instead, negative values are explicitly searched for. Only if found does this function assume signed input. Unexpected results only occur in rare, poorly exposes cases (e.g. if all values are above 50 percent gray in a signed image). In this event, manually scaling the input to the positive domain will solve the problem. The Poisson distribution is only defined for positive integers. To apply this noise type, the number of unique values in the image is found and the next round power of two is used to scale up the floating-point result, after which it is scaled back down to the floating-point image range. To generate Poisson noise against a signed image, the signed image is temporarily converted to an unsigned image in the floating point domain, Poisson noise is generated, then it is returned to the original range. | skimage.api.skimage.util#skimage.util.random_noise |
skimage.util.regular_grid(ar_shape, n_points) [source]
Find n_points regularly spaced along ar_shape. The returned points (as slices) should be as close to cubically-spaced as possible. Essentially, the points are spaced by the Nth root of the input array size, where N is the number of dimensions. However, if an array dimension cannot fit a full step size, it is “discarded”, and the computation is done for only the remaining dimensions. Parameters
ar_shapearray-like of ints
The shape of the space embedding the grid. len(ar_shape) is the number of dimensions.
n_pointsint
The (approximate) number of points to embed in the space. Returns
slicestuple of slice objects
A slice along each dimension of ar_shape, such that the intersection of all the slices give the coordinates of regularly spaced points. Changed in version 0.14.1: In scikit-image 0.14.1 and 0.15, the return type was changed from a list to a tuple to ensure compatibility with Numpy 1.15 and higher. If your code requires the returned result to be a list, you may convert the output of this function to a list with: >>> result = list(regular_grid(ar_shape=(3, 20, 40), n_points=8))
Examples >>> ar = np.zeros((20, 40))
>>> g = regular_grid(ar.shape, 8)
>>> g
(slice(5, None, 10), slice(5, None, 10))
>>> ar[g] = 1
>>> ar.sum()
8.0
>>> ar = np.zeros((20, 40))
>>> g = regular_grid(ar.shape, 32)
>>> g
(slice(2, None, 5), slice(2, None, 5))
>>> ar[g] = 1
>>> ar.sum()
32.0
>>> ar = np.zeros((3, 20, 40))
>>> g = regular_grid(ar.shape, 8)
>>> g
(slice(1, None, 3), slice(5, None, 10), slice(5, None, 10))
>>> ar[g] = 1
>>> ar.sum()
8.0 | skimage.api.skimage.util#skimage.util.regular_grid |
skimage.util.regular_seeds(ar_shape, n_points, dtype=<class 'int'>) [source]
Return an image with ~`n_points` regularly-spaced nonzero pixels. Parameters
ar_shapetuple of int
The shape of the desired output image.
n_pointsint
The desired number of nonzero points.
dtypenumpy data type, optional
The desired data type of the output. Returns
seed_imgarray of int or bool
The desired image. Examples >>> regular_seeds((5, 5), 4)
array([[0, 0, 0, 0, 0],
[0, 1, 0, 2, 0],
[0, 0, 0, 0, 0],
[0, 3, 0, 4, 0],
[0, 0, 0, 0, 0]]) | skimage.api.skimage.util#skimage.util.regular_seeds |
skimage.util.unique_rows(ar) [source]
Remove repeated rows from a 2D array. In particular, if given an array of coordinates of shape (Npoints, Ndim), it will remove repeated points. Parameters
ar2-D ndarray
The input array. Returns
ar_out2-D ndarray
A copy of the input array with repeated rows removed. Raises
ValueErrorif ar is not two-dimensional.
Notes The function will generate a copy of ar if it is not C-contiguous, which will negatively affect performance for large input arrays. Examples >>> ar = np.array([[1, 0, 1],
... [0, 1, 0],
... [1, 0, 1]], np.uint8)
>>> unique_rows(ar)
array([[0, 1, 0],
[1, 0, 1]], dtype=uint8) | skimage.api.skimage.util#skimage.util.unique_rows |
skimage.util.view_as_blocks(arr_in, block_shape) [source]
Block view of the input n-dimensional array (using re-striding). Blocks are non-overlapping views of the input array. Parameters
arr_inndarray
N-d input array.
block_shapetuple
The shape of the block. Each dimension must divide evenly into the corresponding dimensions of arr_in. Returns
arr_outndarray
Block view of the input array. Examples >>> import numpy as np
>>> from skimage.util.shape import view_as_blocks
>>> A = np.arange(4*4).reshape(4,4)
>>> A
array([[ 0, 1, 2, 3],
[ 4, 5, 6, 7],
[ 8, 9, 10, 11],
[12, 13, 14, 15]])
>>> B = view_as_blocks(A, block_shape=(2, 2))
>>> B[0, 0]
array([[0, 1],
[4, 5]])
>>> B[0, 1]
array([[2, 3],
[6, 7]])
>>> B[1, 0, 1, 1]
13
>>> A = np.arange(4*4*6).reshape(4,4,6)
>>> A
array([[[ 0, 1, 2, 3, 4, 5],
[ 6, 7, 8, 9, 10, 11],
[12, 13, 14, 15, 16, 17],
[18, 19, 20, 21, 22, 23]],
[[24, 25, 26, 27, 28, 29],
[30, 31, 32, 33, 34, 35],
[36, 37, 38, 39, 40, 41],
[42, 43, 44, 45, 46, 47]],
[[48, 49, 50, 51, 52, 53],
[54, 55, 56, 57, 58, 59],
[60, 61, 62, 63, 64, 65],
[66, 67, 68, 69, 70, 71]],
[[72, 73, 74, 75, 76, 77],
[78, 79, 80, 81, 82, 83],
[84, 85, 86, 87, 88, 89],
[90, 91, 92, 93, 94, 95]]])
>>> B = view_as_blocks(A, block_shape=(1, 2, 2))
>>> B.shape
(4, 2, 3, 1, 2, 2)
>>> B[2:, 0, 2]
array([[[[52, 53],
[58, 59]]],
[[[76, 77],
[82, 83]]]]) | skimage.api.skimage.util#skimage.util.view_as_blocks |
skimage.util.view_as_windows(arr_in, window_shape, step=1) [source]
Rolling window view of the input n-dimensional array. Windows are overlapping views of the input array, with adjacent windows shifted by a single row or column (or an index of a higher dimension). Parameters
arr_inndarray
N-d input array.
window_shapeinteger or tuple of length arr_in.ndim
Defines the shape of the elementary n-dimensional orthotope (better know as hyperrectangle [1]) of the rolling window view. If an integer is given, the shape will be a hypercube of sidelength given by its value.
stepinteger or tuple of length arr_in.ndim
Indicates step size at which extraction shall be performed. If integer is given, then the step is uniform in all dimensions. Returns
arr_outndarray
(rolling) window view of the input array. Notes One should be very careful with rolling views when it comes to memory usage. Indeed, although a ‘view’ has the same memory footprint as its base array, the actual array that emerges when this ‘view’ is used in a computation is generally a (much) larger array than the original, especially for 2-dimensional arrays and above. For example, let us consider a 3 dimensional array of size (100, 100, 100) of float64. This array takes about 8*100**3 Bytes for storage which is just 8 MB. If one decides to build a rolling view on this array with a window of (3, 3, 3) the hypothetical size of the rolling view (if one was to reshape the view for example) would be 8*(100-3+1)**3*3**3 which is about 203 MB! The scaling becomes even worse as the dimension of the input array becomes larger. References
1
https://en.wikipedia.org/wiki/Hyperrectangle Examples >>> import numpy as np
>>> from skimage.util.shape import view_as_windows
>>> A = np.arange(4*4).reshape(4,4)
>>> A
array([[ 0, 1, 2, 3],
[ 4, 5, 6, 7],
[ 8, 9, 10, 11],
[12, 13, 14, 15]])
>>> window_shape = (2, 2)
>>> B = view_as_windows(A, window_shape)
>>> B[0, 0]
array([[0, 1],
[4, 5]])
>>> B[0, 1]
array([[1, 2],
[5, 6]])
>>> A = np.arange(10)
>>> A
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
>>> window_shape = (3,)
>>> B = view_as_windows(A, window_shape)
>>> B.shape
(8, 3)
>>> B
array([[0, 1, 2],
[1, 2, 3],
[2, 3, 4],
[3, 4, 5],
[4, 5, 6],
[5, 6, 7],
[6, 7, 8],
[7, 8, 9]])
>>> A = np.arange(5*4).reshape(5, 4)
>>> A
array([[ 0, 1, 2, 3],
[ 4, 5, 6, 7],
[ 8, 9, 10, 11],
[12, 13, 14, 15],
[16, 17, 18, 19]])
>>> window_shape = (4, 3)
>>> B = view_as_windows(A, window_shape)
>>> B.shape
(2, 2, 4, 3)
>>> B
array([[[[ 0, 1, 2],
[ 4, 5, 6],
[ 8, 9, 10],
[12, 13, 14]],
[[ 1, 2, 3],
[ 5, 6, 7],
[ 9, 10, 11],
[13, 14, 15]]],
[[[ 4, 5, 6],
[ 8, 9, 10],
[12, 13, 14],
[16, 17, 18]],
[[ 5, 6, 7],
[ 9, 10, 11],
[13, 14, 15],
[17, 18, 19]]]]) | skimage.api.skimage.util#skimage.util.view_as_windows |
Module: viewer
skimage.viewer.CollectionViewer(image_collection) Viewer for displaying image collections.
skimage.viewer.ImageViewer(image[, useblit]) Viewer for displaying images.
skimage.viewer.canvastools
skimage.viewer.plugins
skimage.viewer.qt
skimage.viewer.utils
skimage.viewer.viewers
skimage.viewer.widgets Widgets for interacting with ImageViewer. CollectionViewer
class skimage.viewer.CollectionViewer(image_collection, update_on='move', **kwargs) [source]
Bases: skimage.viewer.viewers.core.ImageViewer Viewer for displaying image collections. Select the displayed frame of the image collection using the slider or with the following keyboard shortcuts: left/right arrows
Previous/next image in collection. number keys, 0–9
0% to 90% of collection. For example, “5” goes to the image in the middle (i.e. 50%) of the collection. home/end keys
First/last image in collection. Parameters
image_collectionlist of images
List of images to be displayed.
update_on{‘move’ | ‘release’}
Control whether image is updated on slide or release of the image slider. Using ‘on_release’ will give smoother behavior when displaying large images or when writing a plugin/subclass that requires heavy computation.
__init__(image_collection, update_on='move', **kwargs) [source]
Initialize self. See help(type(self)) for accurate signature.
keyPressEvent(event) [source]
update_index(name, index) [source]
Select image on display using index into image collection.
ImageViewer
class skimage.viewer.ImageViewer(image, useblit=True) [source]
Bases: object Viewer for displaying images. This viewer is a simple container object that holds a Matplotlib axes for showing images. ImageViewer doesn’t subclass the Matplotlib axes (or figure) because of the high probability of name collisions. Subclasses and plugins will likely extend the update_image method to add custom overlays or filter the displayed image. Parameters
imagearray
Image being viewed. Examples >>> from skimage import data
>>> image = data.coins()
>>> viewer = ImageViewer(image)
>>> viewer.show()
Attributes
canvas, fig, axMatplotlib canvas, figure, and axes
Matplotlib canvas, figure, and axes used to display image.
imagearray
Image being viewed. Setting this value will update the displayed frame.
original_imagearray
Plugins typically operate on (but don’t change) the original image.
pluginslist
List of attached plugins.
__init__(image, useblit=True) [source]
Initialize self. See help(type(self)) for accurate signature.
add_tool(tool) [source]
closeEvent(event) [source]
connect_event(event, callback) [source]
Connect callback function to matplotlib event and return id.
disconnect_event(callback_id) [source]
Disconnect callback by its id (returned by connect_event).
dock_areas = {'bottom': None, 'left': None, 'right': None, 'top': None}
property image
open_file(filename=None) [source]
Open image file and display in viewer.
original_image_changed = None
redraw() [source]
remove_tool(tool) [source]
reset_image() [source]
save_to_file(filename=None) [source]
Save current image to file. The current behavior is not ideal: It saves the image displayed on screen, so all images will be converted to RGB, and the image size is not preserved (resizing the viewer window will alter the size of the saved image).
show(main_window=True) [source]
Show ImageViewer and attached plugins. This behaves much like matplotlib.pyplot.show and QWidget.show.
update_image(image) [source]
Update displayed image. This method can be overridden or extended in subclasses and plugins to react to image changes. | skimage.api.skimage.viewer |
Module: viewer.canvastools
skimage.viewer.canvastools.LineTool(manager) Widget for line selection in a plot.
skimage.viewer.canvastools.PaintTool(…[, …]) Widget for painting on top of a plot.
skimage.viewer.canvastools.RectangleTool(manager) Widget for selecting a rectangular region in a plot.
skimage.viewer.canvastools.ThickLineTool(manager) Widget for line selection in a plot.
skimage.viewer.canvastools.base
skimage.viewer.canvastools.linetool
skimage.viewer.canvastools.painttool
skimage.viewer.canvastools.recttool LineTool
class skimage.viewer.canvastools.LineTool(manager, on_move=None, on_release=None, on_enter=None, maxdist=10, line_props=None, handle_props=None, **kwargs) [source]
Bases: skimage.viewer.canvastools.base.CanvasToolBase Widget for line selection in a plot. Parameters
managerViewer or PlotPlugin.
Skimage viewer or plot plugin object.
on_movefunction
Function called whenever a control handle is moved. This function must accept the end points of line as the only argument.
on_releasefunction
Function called whenever the control handle is released.
on_enterfunction
Function called whenever the “enter” key is pressed.
maxdistfloat
Maximum pixel distance allowed when selecting control handle.
line_propsdict
Properties for matplotlib.lines.Line2D.
handle_propsdict
Marker properties for the handles (also see matplotlib.lines.Line2D). Attributes
end_points2D array
End points of line ((x1, y1), (x2, y2)).
__init__(manager, on_move=None, on_release=None, on_enter=None, maxdist=10, line_props=None, handle_props=None, **kwargs) [source]
Initialize self. See help(type(self)) for accurate signature.
property end_points
property geometry
Geometry information that gets passed to callback functions.
hit_test(event) [source]
on_mouse_press(event) [source]
on_mouse_release(event) [source]
on_move(event) [source]
update(x=None, y=None) [source]
PaintTool
class skimage.viewer.canvastools.PaintTool(manager, overlay_shape, radius=5, alpha=0.3, on_move=None, on_release=None, on_enter=None, rect_props=None) [source]
Bases: skimage.viewer.canvastools.base.CanvasToolBase Widget for painting on top of a plot. Parameters
managerViewer or PlotPlugin.
Skimage viewer or plot plugin object.
overlay_shapeshape tuple
2D shape tuple used to initialize overlay image.
radiusint
The size of the paint cursor.
alphafloat (between [0, 1])
Opacity of overlay.
on_movefunction
Function called whenever a control handle is moved. This function must accept the end points of line as the only argument.
on_releasefunction
Function called whenever the control handle is released.
on_enterfunction
Function called whenever the “enter” key is pressed.
rect_propsdict
Properties for matplotlib.patches.Rectangle. This class redefines defaults in matplotlib.widgets.RectangleSelector. Examples >>> from skimage.data import camera
>>> import matplotlib.pyplot as plt
>>> from skimage.viewer.canvastools import PaintTool
>>> import numpy as np
>>> img = camera()
>>> ax = plt.subplot(111)
>>> plt.imshow(img, cmap=plt.cm.gray)
>>> p = PaintTool(ax,np.shape(img[:-1]),10,0.2)
>>> plt.show()
>>> mask = p.overlay
>>> plt.imshow(mask,cmap=plt.cm.gray)
>>> plt.show()
Attributes
overlayarray
Overlay of painted labels displayed on top of image.
labelint
Current paint color.
__init__(manager, overlay_shape, radius=5, alpha=0.3, on_move=None, on_release=None, on_enter=None, rect_props=None) [source]
Initialize self. See help(type(self)) for accurate signature.
property geometry
Geometry information that gets passed to callback functions.
property label
on_key_press(event) [source]
on_mouse_press(event) [source]
on_mouse_release(event) [source]
on_move(event) [source]
property overlay
property radius
property shape
update_cursor(x, y) [source]
update_overlay(x, y) [source]
RectangleTool
class skimage.viewer.canvastools.RectangleTool(manager, on_move=None, on_release=None, on_enter=None, maxdist=10, rect_props=None) [source]
Bases: skimage.viewer.canvastools.base.CanvasToolBase, matplotlib.widgets.RectangleSelector Widget for selecting a rectangular region in a plot. After making the desired selection, press “Enter” to accept the selection and call the on_enter callback function. Parameters
managerViewer or PlotPlugin.
Skimage viewer or plot plugin object.
on_movefunction
Function called whenever a control handle is moved. This function must accept the rectangle extents as the only argument.
on_releasefunction
Function called whenever the control handle is released.
on_enterfunction
Function called whenever the “enter” key is pressed.
maxdistfloat
Maximum pixel distance allowed when selecting control handle.
rect_propsdict
Properties for matplotlib.patches.Rectangle. This class redefines defaults in matplotlib.widgets.RectangleSelector. Examples >>> from skimage import data
>>> from skimage.viewer import ImageViewer
>>> from skimage.viewer.canvastools import RectangleTool
>>> from skimage.draw import line
>>> from skimage.draw import set_color
>>> viewer = ImageViewer(data.coffee())
>>> def print_the_rect(extents):
... global viewer
... im = viewer.image
... coord = np.int64(extents)
... [rr1, cc1] = line(coord[2],coord[0],coord[2],coord[1])
... [rr2, cc2] = line(coord[2],coord[1],coord[3],coord[1])
... [rr3, cc3] = line(coord[3],coord[1],coord[3],coord[0])
... [rr4, cc4] = line(coord[3],coord[0],coord[2],coord[0])
... set_color(im, (rr1, cc1), [255, 255, 0])
... set_color(im, (rr2, cc2), [0, 255, 255])
... set_color(im, (rr3, cc3), [255, 0, 255])
... set_color(im, (rr4, cc4), [0, 0, 0])
... viewer.image=im
>>> rect_tool = RectangleTool(viewer, on_enter=print_the_rect)
>>> viewer.show()
Attributes
extentstuple
Return (xmin, xmax, ymin, ymax).
__init__(manager, on_move=None, on_release=None, on_enter=None, maxdist=10, rect_props=None) [source]
Parameters
axAxes
The parent axes for the widget.
onselectfunction
A callback function that is called after a selection is completed. It must have the signature: def onselect(eclick: MouseEvent, erelease: MouseEvent)
where eclick and erelease are the mouse click and release MouseEvents that start and complete the selection.
drawtype{“box”, “line”, “none”}, default: “box”
Whether to draw the full rectangle box, the diagonal line of the rectangle, or nothing at all.
minspanxfloat, default: 0
Selections with an x-span less than minspanx are ignored.
minspanyfloat, default: 0
Selections with an y-span less than minspany are ignored.
useblitbool, default: False
Whether to use blitting for faster drawing (if supported by the backend).
linepropsdict, optional
Properties with which the line is drawn, if drawtype == "line". Default: dict(color="black", linestyle="-", linewidth=2, alpha=0.5)
rectpropsdict, optional
Properties with which the rectangle is drawn, if drawtype ==
"box". Default: dict(facecolor="red", edgecolor="black", alpha=0.2, fill=True)
spancoords{“data”, “pixels”}, default: “data”
Whether to interpret minspanx and minspany in data or in pixel coordinates.
buttonMouseButton, list of MouseButton, default: all buttons
Button(s) that trigger rectangle selection.
maxdistfloat, default: 10
Distance in pixels within which the interactive tool handles can be activated.
marker_propsdict
Properties with which the interactive handles are drawn. Currently not implemented and ignored.
interactivebool, default: False
Whether to draw a set of handles that allow interaction with the widget after it is drawn.
state_modifier_keysdict, optional
Keyboard modifiers which affect the widget’s behavior. Values amend the defaults. “move”: Move the existing shape, default: no modifier. “clear”: Clear the current shape, default: “escape”. “square”: Makes the shape square, default: “shift”. “center”: Make the initial point the center of the shape, default: “ctrl”. “square” and “center” can be combined.
property corners
Corners of rectangle from lower left, moving clockwise.
property edge_centers
Midpoint of rectangle edges from left, moving clockwise.
property extents
Return (xmin, xmax, ymin, ymax).
property geometry
Geometry information that gets passed to callback functions.
on_mouse_press(event) [source]
on_mouse_release(event) [source]
on_move(event) [source]
ThickLineTool
class skimage.viewer.canvastools.ThickLineTool(manager, on_move=None, on_enter=None, on_release=None, on_change=None, maxdist=10, line_props=None, handle_props=None) [source]
Bases: skimage.viewer.canvastools.linetool.LineTool Widget for line selection in a plot. The thickness of the line can be varied using the mouse scroll wheel, or with the ‘+’ and ‘-‘ keys. Parameters
managerViewer or PlotPlugin.
Skimage viewer or plot plugin object.
on_movefunction
Function called whenever a control handle is moved. This function must accept the end points of line as the only argument.
on_releasefunction
Function called whenever the control handle is released.
on_enterfunction
Function called whenever the “enter” key is pressed.
on_changefunction
Function called whenever the line thickness is changed.
maxdistfloat
Maximum pixel distance allowed when selecting control handle.
line_propsdict
Properties for matplotlib.lines.Line2D.
handle_propsdict
Marker properties for the handles (also see matplotlib.lines.Line2D). Attributes
end_points2D array
End points of line ((x1, y1), (x2, y2)).
__init__(manager, on_move=None, on_enter=None, on_release=None, on_change=None, maxdist=10, line_props=None, handle_props=None) [source]
Initialize self. See help(type(self)) for accurate signature.
on_key_press(event) [source]
on_scroll(event) [source] | skimage.api.skimage.viewer.canvastools |
class skimage.viewer.canvastools.LineTool(manager, on_move=None, on_release=None, on_enter=None, maxdist=10, line_props=None, handle_props=None, **kwargs) [source]
Bases: skimage.viewer.canvastools.base.CanvasToolBase Widget for line selection in a plot. Parameters
managerViewer or PlotPlugin.
Skimage viewer or plot plugin object.
on_movefunction
Function called whenever a control handle is moved. This function must accept the end points of line as the only argument.
on_releasefunction
Function called whenever the control handle is released.
on_enterfunction
Function called whenever the “enter” key is pressed.
maxdistfloat
Maximum pixel distance allowed when selecting control handle.
line_propsdict
Properties for matplotlib.lines.Line2D.
handle_propsdict
Marker properties for the handles (also see matplotlib.lines.Line2D). Attributes
end_points2D array
End points of line ((x1, y1), (x2, y2)).
__init__(manager, on_move=None, on_release=None, on_enter=None, maxdist=10, line_props=None, handle_props=None, **kwargs) [source]
Initialize self. See help(type(self)) for accurate signature.
property end_points
property geometry
Geometry information that gets passed to callback functions.
hit_test(event) [source]
on_mouse_press(event) [source]
on_mouse_release(event) [source]
on_move(event) [source]
update(x=None, y=None) [source] | skimage.api.skimage.viewer.canvastools#skimage.viewer.canvastools.LineTool |
property end_points | skimage.api.skimage.viewer.canvastools#skimage.viewer.canvastools.LineTool.end_points |
property geometry
Geometry information that gets passed to callback functions. | skimage.api.skimage.viewer.canvastools#skimage.viewer.canvastools.LineTool.geometry |
hit_test(event) [source] | skimage.api.skimage.viewer.canvastools#skimage.viewer.canvastools.LineTool.hit_test |
on_mouse_press(event) [source] | skimage.api.skimage.viewer.canvastools#skimage.viewer.canvastools.LineTool.on_mouse_press |
on_mouse_release(event) [source] | skimage.api.skimage.viewer.canvastools#skimage.viewer.canvastools.LineTool.on_mouse_release |
on_move(event) [source] | skimage.api.skimage.viewer.canvastools#skimage.viewer.canvastools.LineTool.on_move |
update(x=None, y=None) [source] | skimage.api.skimage.viewer.canvastools#skimage.viewer.canvastools.LineTool.update |
__init__(manager, on_move=None, on_release=None, on_enter=None, maxdist=10, line_props=None, handle_props=None, **kwargs) [source]
Initialize self. See help(type(self)) for accurate signature. | skimage.api.skimage.viewer.canvastools#skimage.viewer.canvastools.LineTool.__init__ |
class skimage.viewer.canvastools.PaintTool(manager, overlay_shape, radius=5, alpha=0.3, on_move=None, on_release=None, on_enter=None, rect_props=None) [source]
Bases: skimage.viewer.canvastools.base.CanvasToolBase Widget for painting on top of a plot. Parameters
managerViewer or PlotPlugin.
Skimage viewer or plot plugin object.
overlay_shapeshape tuple
2D shape tuple used to initialize overlay image.
radiusint
The size of the paint cursor.
alphafloat (between [0, 1])
Opacity of overlay.
on_movefunction
Function called whenever a control handle is moved. This function must accept the end points of line as the only argument.
on_releasefunction
Function called whenever the control handle is released.
on_enterfunction
Function called whenever the “enter” key is pressed.
rect_propsdict
Properties for matplotlib.patches.Rectangle. This class redefines defaults in matplotlib.widgets.RectangleSelector. Examples >>> from skimage.data import camera
>>> import matplotlib.pyplot as plt
>>> from skimage.viewer.canvastools import PaintTool
>>> import numpy as np
>>> img = camera()
>>> ax = plt.subplot(111)
>>> plt.imshow(img, cmap=plt.cm.gray)
>>> p = PaintTool(ax,np.shape(img[:-1]),10,0.2)
>>> plt.show()
>>> mask = p.overlay
>>> plt.imshow(mask,cmap=plt.cm.gray)
>>> plt.show()
Attributes
overlayarray
Overlay of painted labels displayed on top of image.
labelint
Current paint color.
__init__(manager, overlay_shape, radius=5, alpha=0.3, on_move=None, on_release=None, on_enter=None, rect_props=None) [source]
Initialize self. See help(type(self)) for accurate signature.
property geometry
Geometry information that gets passed to callback functions.
property label
on_key_press(event) [source]
on_mouse_press(event) [source]
on_mouse_release(event) [source]
on_move(event) [source]
property overlay
property radius
property shape
update_cursor(x, y) [source]
update_overlay(x, y) [source] | skimage.api.skimage.viewer.canvastools#skimage.viewer.canvastools.PaintTool |
property geometry
Geometry information that gets passed to callback functions. | skimage.api.skimage.viewer.canvastools#skimage.viewer.canvastools.PaintTool.geometry |
property label | skimage.api.skimage.viewer.canvastools#skimage.viewer.canvastools.PaintTool.label |
on_key_press(event) [source] | skimage.api.skimage.viewer.canvastools#skimage.viewer.canvastools.PaintTool.on_key_press |
on_mouse_press(event) [source] | skimage.api.skimage.viewer.canvastools#skimage.viewer.canvastools.PaintTool.on_mouse_press |
on_mouse_release(event) [source] | skimage.api.skimage.viewer.canvastools#skimage.viewer.canvastools.PaintTool.on_mouse_release |
on_move(event) [source] | skimage.api.skimage.viewer.canvastools#skimage.viewer.canvastools.PaintTool.on_move |
property overlay | skimage.api.skimage.viewer.canvastools#skimage.viewer.canvastools.PaintTool.overlay |
property radius | skimage.api.skimage.viewer.canvastools#skimage.viewer.canvastools.PaintTool.radius |
property shape | skimage.api.skimage.viewer.canvastools#skimage.viewer.canvastools.PaintTool.shape |
update_cursor(x, y) [source] | skimage.api.skimage.viewer.canvastools#skimage.viewer.canvastools.PaintTool.update_cursor |
update_overlay(x, y) [source] | skimage.api.skimage.viewer.canvastools#skimage.viewer.canvastools.PaintTool.update_overlay |
__init__(manager, overlay_shape, radius=5, alpha=0.3, on_move=None, on_release=None, on_enter=None, rect_props=None) [source]
Initialize self. See help(type(self)) for accurate signature. | skimage.api.skimage.viewer.canvastools#skimage.viewer.canvastools.PaintTool.__init__ |
class skimage.viewer.canvastools.RectangleTool(manager, on_move=None, on_release=None, on_enter=None, maxdist=10, rect_props=None) [source]
Bases: skimage.viewer.canvastools.base.CanvasToolBase, matplotlib.widgets.RectangleSelector Widget for selecting a rectangular region in a plot. After making the desired selection, press “Enter” to accept the selection and call the on_enter callback function. Parameters
managerViewer or PlotPlugin.
Skimage viewer or plot plugin object.
on_movefunction
Function called whenever a control handle is moved. This function must accept the rectangle extents as the only argument.
on_releasefunction
Function called whenever the control handle is released.
on_enterfunction
Function called whenever the “enter” key is pressed.
maxdistfloat
Maximum pixel distance allowed when selecting control handle.
rect_propsdict
Properties for matplotlib.patches.Rectangle. This class redefines defaults in matplotlib.widgets.RectangleSelector. Examples >>> from skimage import data
>>> from skimage.viewer import ImageViewer
>>> from skimage.viewer.canvastools import RectangleTool
>>> from skimage.draw import line
>>> from skimage.draw import set_color
>>> viewer = ImageViewer(data.coffee())
>>> def print_the_rect(extents):
... global viewer
... im = viewer.image
... coord = np.int64(extents)
... [rr1, cc1] = line(coord[2],coord[0],coord[2],coord[1])
... [rr2, cc2] = line(coord[2],coord[1],coord[3],coord[1])
... [rr3, cc3] = line(coord[3],coord[1],coord[3],coord[0])
... [rr4, cc4] = line(coord[3],coord[0],coord[2],coord[0])
... set_color(im, (rr1, cc1), [255, 255, 0])
... set_color(im, (rr2, cc2), [0, 255, 255])
... set_color(im, (rr3, cc3), [255, 0, 255])
... set_color(im, (rr4, cc4), [0, 0, 0])
... viewer.image=im
>>> rect_tool = RectangleTool(viewer, on_enter=print_the_rect)
>>> viewer.show()
Attributes
extentstuple
Return (xmin, xmax, ymin, ymax).
__init__(manager, on_move=None, on_release=None, on_enter=None, maxdist=10, rect_props=None) [source]
Parameters
axAxes
The parent axes for the widget.
onselectfunction
A callback function that is called after a selection is completed. It must have the signature: def onselect(eclick: MouseEvent, erelease: MouseEvent)
where eclick and erelease are the mouse click and release MouseEvents that start and complete the selection.
drawtype{“box”, “line”, “none”}, default: “box”
Whether to draw the full rectangle box, the diagonal line of the rectangle, or nothing at all.
minspanxfloat, default: 0
Selections with an x-span less than minspanx are ignored.
minspanyfloat, default: 0
Selections with an y-span less than minspany are ignored.
useblitbool, default: False
Whether to use blitting for faster drawing (if supported by the backend).
linepropsdict, optional
Properties with which the line is drawn, if drawtype == "line". Default: dict(color="black", linestyle="-", linewidth=2, alpha=0.5)
rectpropsdict, optional
Properties with which the rectangle is drawn, if drawtype ==
"box". Default: dict(facecolor="red", edgecolor="black", alpha=0.2, fill=True)
spancoords{“data”, “pixels”}, default: “data”
Whether to interpret minspanx and minspany in data or in pixel coordinates.
buttonMouseButton, list of MouseButton, default: all buttons
Button(s) that trigger rectangle selection.
maxdistfloat, default: 10
Distance in pixels within which the interactive tool handles can be activated.
marker_propsdict
Properties with which the interactive handles are drawn. Currently not implemented and ignored.
interactivebool, default: False
Whether to draw a set of handles that allow interaction with the widget after it is drawn.
state_modifier_keysdict, optional
Keyboard modifiers which affect the widget’s behavior. Values amend the defaults. “move”: Move the existing shape, default: no modifier. “clear”: Clear the current shape, default: “escape”. “square”: Makes the shape square, default: “shift”. “center”: Make the initial point the center of the shape, default: “ctrl”. “square” and “center” can be combined.
property corners
Corners of rectangle from lower left, moving clockwise.
property edge_centers
Midpoint of rectangle edges from left, moving clockwise.
property extents
Return (xmin, xmax, ymin, ymax).
property geometry
Geometry information that gets passed to callback functions.
on_mouse_press(event) [source]
on_mouse_release(event) [source]
on_move(event) [source] | skimage.api.skimage.viewer.canvastools#skimage.viewer.canvastools.RectangleTool |
property corners
Corners of rectangle from lower left, moving clockwise. | skimage.api.skimage.viewer.canvastools#skimage.viewer.canvastools.RectangleTool.corners |
property edge_centers
Midpoint of rectangle edges from left, moving clockwise. | skimage.api.skimage.viewer.canvastools#skimage.viewer.canvastools.RectangleTool.edge_centers |
property extents
Return (xmin, xmax, ymin, ymax). | skimage.api.skimage.viewer.canvastools#skimage.viewer.canvastools.RectangleTool.extents |
property geometry
Geometry information that gets passed to callback functions. | skimage.api.skimage.viewer.canvastools#skimage.viewer.canvastools.RectangleTool.geometry |
on_mouse_press(event) [source] | skimage.api.skimage.viewer.canvastools#skimage.viewer.canvastools.RectangleTool.on_mouse_press |
on_mouse_release(event) [source] | skimage.api.skimage.viewer.canvastools#skimage.viewer.canvastools.RectangleTool.on_mouse_release |
on_move(event) [source] | skimage.api.skimage.viewer.canvastools#skimage.viewer.canvastools.RectangleTool.on_move |
__init__(manager, on_move=None, on_release=None, on_enter=None, maxdist=10, rect_props=None) [source]
Parameters
axAxes
The parent axes for the widget.
onselectfunction
A callback function that is called after a selection is completed. It must have the signature: def onselect(eclick: MouseEvent, erelease: MouseEvent)
where eclick and erelease are the mouse click and release MouseEvents that start and complete the selection.
drawtype{“box”, “line”, “none”}, default: “box”
Whether to draw the full rectangle box, the diagonal line of the rectangle, or nothing at all.
minspanxfloat, default: 0
Selections with an x-span less than minspanx are ignored.
minspanyfloat, default: 0
Selections with an y-span less than minspany are ignored.
useblitbool, default: False
Whether to use blitting for faster drawing (if supported by the backend).
linepropsdict, optional
Properties with which the line is drawn, if drawtype == "line". Default: dict(color="black", linestyle="-", linewidth=2, alpha=0.5)
rectpropsdict, optional
Properties with which the rectangle is drawn, if drawtype ==
"box". Default: dict(facecolor="red", edgecolor="black", alpha=0.2, fill=True)
spancoords{“data”, “pixels”}, default: “data”
Whether to interpret minspanx and minspany in data or in pixel coordinates.
buttonMouseButton, list of MouseButton, default: all buttons
Button(s) that trigger rectangle selection.
maxdistfloat, default: 10
Distance in pixels within which the interactive tool handles can be activated.
marker_propsdict
Properties with which the interactive handles are drawn. Currently not implemented and ignored.
interactivebool, default: False
Whether to draw a set of handles that allow interaction with the widget after it is drawn.
state_modifier_keysdict, optional
Keyboard modifiers which affect the widget’s behavior. Values amend the defaults. “move”: Move the existing shape, default: no modifier. “clear”: Clear the current shape, default: “escape”. “square”: Makes the shape square, default: “shift”. “center”: Make the initial point the center of the shape, default: “ctrl”. “square” and “center” can be combined. | skimage.api.skimage.viewer.canvastools#skimage.viewer.canvastools.RectangleTool.__init__ |
class skimage.viewer.canvastools.ThickLineTool(manager, on_move=None, on_enter=None, on_release=None, on_change=None, maxdist=10, line_props=None, handle_props=None) [source]
Bases: skimage.viewer.canvastools.linetool.LineTool Widget for line selection in a plot. The thickness of the line can be varied using the mouse scroll wheel, or with the ‘+’ and ‘-‘ keys. Parameters
managerViewer or PlotPlugin.
Skimage viewer or plot plugin object.
on_movefunction
Function called whenever a control handle is moved. This function must accept the end points of line as the only argument.
on_releasefunction
Function called whenever the control handle is released.
on_enterfunction
Function called whenever the “enter” key is pressed.
on_changefunction
Function called whenever the line thickness is changed.
maxdistfloat
Maximum pixel distance allowed when selecting control handle.
line_propsdict
Properties for matplotlib.lines.Line2D.
handle_propsdict
Marker properties for the handles (also see matplotlib.lines.Line2D). Attributes
end_points2D array
End points of line ((x1, y1), (x2, y2)).
__init__(manager, on_move=None, on_enter=None, on_release=None, on_change=None, maxdist=10, line_props=None, handle_props=None) [source]
Initialize self. See help(type(self)) for accurate signature.
on_key_press(event) [source]
on_scroll(event) [source] | skimage.api.skimage.viewer.canvastools#skimage.viewer.canvastools.ThickLineTool |
on_key_press(event) [source] | skimage.api.skimage.viewer.canvastools#skimage.viewer.canvastools.ThickLineTool.on_key_press |
on_scroll(event) [source] | skimage.api.skimage.viewer.canvastools#skimage.viewer.canvastools.ThickLineTool.on_scroll |
__init__(manager, on_move=None, on_enter=None, on_release=None, on_change=None, maxdist=10, line_props=None, handle_props=None) [source]
Initialize self. See help(type(self)) for accurate signature. | skimage.api.skimage.viewer.canvastools#skimage.viewer.canvastools.ThickLineTool.__init__ |
class skimage.viewer.CollectionViewer(image_collection, update_on='move', **kwargs) [source]
Bases: skimage.viewer.viewers.core.ImageViewer Viewer for displaying image collections. Select the displayed frame of the image collection using the slider or with the following keyboard shortcuts: left/right arrows
Previous/next image in collection. number keys, 0–9
0% to 90% of collection. For example, “5” goes to the image in the middle (i.e. 50%) of the collection. home/end keys
First/last image in collection. Parameters
image_collectionlist of images
List of images to be displayed.
update_on{‘move’ | ‘release’}
Control whether image is updated on slide or release of the image slider. Using ‘on_release’ will give smoother behavior when displaying large images or when writing a plugin/subclass that requires heavy computation.
__init__(image_collection, update_on='move', **kwargs) [source]
Initialize self. See help(type(self)) for accurate signature.
keyPressEvent(event) [source]
update_index(name, index) [source]
Select image on display using index into image collection. | skimage.api.skimage.viewer#skimage.viewer.CollectionViewer |
keyPressEvent(event) [source] | skimage.api.skimage.viewer#skimage.viewer.CollectionViewer.keyPressEvent |
update_index(name, index) [source]
Select image on display using index into image collection. | skimage.api.skimage.viewer#skimage.viewer.CollectionViewer.update_index |
__init__(image_collection, update_on='move', **kwargs) [source]
Initialize self. See help(type(self)) for accurate signature. | skimage.api.skimage.viewer#skimage.viewer.CollectionViewer.__init__ |
class skimage.viewer.ImageViewer(image, useblit=True) [source]
Bases: object Viewer for displaying images. This viewer is a simple container object that holds a Matplotlib axes for showing images. ImageViewer doesn’t subclass the Matplotlib axes (or figure) because of the high probability of name collisions. Subclasses and plugins will likely extend the update_image method to add custom overlays or filter the displayed image. Parameters
imagearray
Image being viewed. Examples >>> from skimage import data
>>> image = data.coins()
>>> viewer = ImageViewer(image)
>>> viewer.show()
Attributes
canvas, fig, axMatplotlib canvas, figure, and axes
Matplotlib canvas, figure, and axes used to display image.
imagearray
Image being viewed. Setting this value will update the displayed frame.
original_imagearray
Plugins typically operate on (but don’t change) the original image.
pluginslist
List of attached plugins.
__init__(image, useblit=True) [source]
Initialize self. See help(type(self)) for accurate signature.
add_tool(tool) [source]
closeEvent(event) [source]
connect_event(event, callback) [source]
Connect callback function to matplotlib event and return id.
disconnect_event(callback_id) [source]
Disconnect callback by its id (returned by connect_event).
dock_areas = {'bottom': None, 'left': None, 'right': None, 'top': None}
property image
open_file(filename=None) [source]
Open image file and display in viewer.
original_image_changed = None
redraw() [source]
remove_tool(tool) [source]
reset_image() [source]
save_to_file(filename=None) [source]
Save current image to file. The current behavior is not ideal: It saves the image displayed on screen, so all images will be converted to RGB, and the image size is not preserved (resizing the viewer window will alter the size of the saved image).
show(main_window=True) [source]
Show ImageViewer and attached plugins. This behaves much like matplotlib.pyplot.show and QWidget.show.
update_image(image) [source]
Update displayed image. This method can be overridden or extended in subclasses and plugins to react to image changes. | skimage.api.skimage.viewer#skimage.viewer.ImageViewer |
add_tool(tool) [source] | skimage.api.skimage.viewer#skimage.viewer.ImageViewer.add_tool |
closeEvent(event) [source] | skimage.api.skimage.viewer#skimage.viewer.ImageViewer.closeEvent |
connect_event(event, callback) [source]
Connect callback function to matplotlib event and return id. | skimage.api.skimage.viewer#skimage.viewer.ImageViewer.connect_event |
disconnect_event(callback_id) [source]
Disconnect callback by its id (returned by connect_event). | skimage.api.skimage.viewer#skimage.viewer.ImageViewer.disconnect_event |
dock_areas = {'bottom': None, 'left': None, 'right': None, 'top': None} | skimage.api.skimage.viewer#skimage.viewer.ImageViewer.dock_areas |
property image | skimage.api.skimage.viewer#skimage.viewer.ImageViewer.image |
open_file(filename=None) [source]
Open image file and display in viewer. | skimage.api.skimage.viewer#skimage.viewer.ImageViewer.open_file |
original_image_changed = None | skimage.api.skimage.viewer#skimage.viewer.ImageViewer.original_image_changed |
redraw() [source] | skimage.api.skimage.viewer#skimage.viewer.ImageViewer.redraw |
remove_tool(tool) [source] | skimage.api.skimage.viewer#skimage.viewer.ImageViewer.remove_tool |
reset_image() [source] | skimage.api.skimage.viewer#skimage.viewer.ImageViewer.reset_image |
save_to_file(filename=None) [source]
Save current image to file. The current behavior is not ideal: It saves the image displayed on screen, so all images will be converted to RGB, and the image size is not preserved (resizing the viewer window will alter the size of the saved image). | skimage.api.skimage.viewer#skimage.viewer.ImageViewer.save_to_file |
show(main_window=True) [source]
Show ImageViewer and attached plugins. This behaves much like matplotlib.pyplot.show and QWidget.show. | skimage.api.skimage.viewer#skimage.viewer.ImageViewer.show |
update_image(image) [source]
Update displayed image. This method can be overridden or extended in subclasses and plugins to react to image changes. | skimage.api.skimage.viewer#skimage.viewer.ImageViewer.update_image |
__init__(image, useblit=True) [source]
Initialize self. See help(type(self)) for accurate signature. | skimage.api.skimage.viewer#skimage.viewer.ImageViewer.__init__ |
Module: viewer.plugins
skimage.viewer.plugins.CannyPlugin(*args, …) Canny filter plugin to show edges of an image.
skimage.viewer.plugins.ColorHistogram([max_pct])
skimage.viewer.plugins.Crop([maxdist])
skimage.viewer.plugins.LabelPainter([max_radius])
skimage.viewer.plugins.LineProfile([…]) Plugin to compute interpolated intensity under a scan line on an image.
skimage.viewer.plugins.Measure([maxdist])
skimage.viewer.plugins.OverlayPlugin(**kwargs) Plugin for ImageViewer that displays an overlay on top of main image.
skimage.viewer.plugins.PlotPlugin([…]) Plugin for ImageViewer that contains a plot canvas.
skimage.viewer.plugins.Plugin([…]) Base class for plugins that interact with an ImageViewer.
skimage.viewer.plugins.base Base class for Plugins that interact with ImageViewer.
skimage.viewer.plugins.canny
skimage.viewer.plugins.color_histogram
skimage.viewer.plugins.crop
skimage.viewer.plugins.labelplugin
skimage.viewer.plugins.lineprofile
skimage.viewer.plugins.measure
skimage.viewer.plugins.overlayplugin
skimage.viewer.plugins.plotplugin CannyPlugin
class skimage.viewer.plugins.CannyPlugin(*args, **kwargs) [source]
Bases: skimage.viewer.plugins.overlayplugin.OverlayPlugin Canny filter plugin to show edges of an image.
__init__(*args, **kwargs) [source]
Initialize self. See help(type(self)) for accurate signature.
attach(image_viewer) [source]
Attach the plugin to an ImageViewer. Note that the ImageViewer will automatically call this method when the plugin is added to the ImageViewer. For example: viewer += Plugin(...)
Also note that attach automatically calls the filter function so that the image matches the filtered value specified by attached widgets.
name = 'Canny Filter'
ColorHistogram
class skimage.viewer.plugins.ColorHistogram(max_pct=0.99, **kwargs) [source]
Bases: skimage.viewer.plugins.plotplugin.PlotPlugin
__init__(max_pct=0.99, **kwargs) [source]
Initialize self. See help(type(self)) for accurate signature.
ab_selected(extents) [source]
attach(image_viewer) [source]
Attach the plugin to an ImageViewer. Note that the ImageViewer will automatically call this method when the plugin is added to the ImageViewer. For example: viewer += Plugin(...)
Also note that attach automatically calls the filter function so that the image matches the filtered value specified by attached widgets.
help() [source]
name = 'Color Histogram'
output() [source]
Return the image mask and the histogram data. Returns
maskarray of bool, same shape as image
The selected pixels.
datadict
The data describing the histogram and the selected region. The dictionary contains: ‘bins’ : array of float The bin boundaries for both a and b channels. ‘hist’ : 2D array of float The normalized histogram. ‘edges’ : tuple of array of float The bin edges along each dimension ‘extents’ : tuple of float The left and right and top and bottom of the selected region.
Crop
class skimage.viewer.plugins.Crop(maxdist=10, **kwargs) [source]
Bases: skimage.viewer.plugins.base.Plugin
__init__(maxdist=10, **kwargs) [source]
Initialize self. See help(type(self)) for accurate signature.
attach(image_viewer) [source]
Attach the plugin to an ImageViewer. Note that the ImageViewer will automatically call this method when the plugin is added to the ImageViewer. For example: viewer += Plugin(...)
Also note that attach automatically calls the filter function so that the image matches the filtered value specified by attached widgets.
crop(extents) [source]
help() [source]
name = 'Crop'
reset() [source]
LabelPainter
class skimage.viewer.plugins.LabelPainter(max_radius=20, **kwargs) [source]
Bases: skimage.viewer.plugins.base.Plugin
__init__(max_radius=20, **kwargs) [source]
Initialize self. See help(type(self)) for accurate signature.
attach(image_viewer) [source]
Attach the plugin to an ImageViewer. Note that the ImageViewer will automatically call this method when the plugin is added to the ImageViewer. For example: viewer += Plugin(...)
Also note that attach automatically calls the filter function so that the image matches the filtered value specified by attached widgets.
help() [source]
property label
name = 'LabelPainter'
on_enter(overlay) [source]
property radius
LineProfile
class skimage.viewer.plugins.LineProfile(maxdist=10, epsilon='deprecated', limits='image', **kwargs) [source]
Bases: skimage.viewer.plugins.plotplugin.PlotPlugin Plugin to compute interpolated intensity under a scan line on an image. See PlotPlugin and Plugin classes for additional details. Parameters
maxdistfloat
Maximum pixel distance allowed when selecting end point of scan line.
limitstuple or {None, ‘image’, ‘dtype’}
(minimum, maximum) intensity limits for plotted profile. The following special values are defined: None : rescale based on min/max intensity along selected scan line. ‘image’ : fixed scale based on min/max intensity in image. ‘dtype’ : fixed scale based on min/max intensity of image dtype.
__init__(maxdist=10, epsilon='deprecated', limits='image', **kwargs) [source]
Initialize self. See help(type(self)) for accurate signature.
attach(image_viewer) [source]
Attach the plugin to an ImageViewer. Note that the ImageViewer will automatically call this method when the plugin is added to the ImageViewer. For example: viewer += Plugin(...)
Also note that attach automatically calls the filter function so that the image matches the filtered value specified by attached widgets.
get_profiles() [source]
Return intensity profile of the selected line. Returns
end_points: (2, 2) array
The positions ((x1, y1), (x2, y2)) of the line ends. profile: list of 1d arrays
Profile of intensity values. Length 1 (grayscale) or 3 (rgb).
help() [source]
line_changed(end_points) [source]
name = 'Line Profile'
output() [source]
Return the drawn line and the resulting scan. Returns
line_image(M, N) uint8 array, same shape as image
An array of 0s with the scanned line set to 255. If the linewidth of the line tool is greater than 1, sets the values within the profiled polygon to 128.
scan(P,) or (P, 3) array of int or float
The line scan values across the image.
reset_axes(scan_data) [source]
Measure
class skimage.viewer.plugins.Measure(maxdist=10, **kwargs) [source]
Bases: skimage.viewer.plugins.base.Plugin
__init__(maxdist=10, **kwargs) [source]
Initialize self. See help(type(self)) for accurate signature.
attach(image_viewer) [source]
Attach the plugin to an ImageViewer. Note that the ImageViewer will automatically call this method when the plugin is added to the ImageViewer. For example: viewer += Plugin(...)
Also note that attach automatically calls the filter function so that the image matches the filtered value specified by attached widgets.
help() [source]
line_changed(end_points) [source]
name = 'Measure'
OverlayPlugin
class skimage.viewer.plugins.OverlayPlugin(**kwargs) [source]
Bases: skimage.viewer.plugins.base.Plugin Plugin for ImageViewer that displays an overlay on top of main image. The base Plugin class displays the filtered image directly on the viewer. OverlayPlugin will instead overlay an image with a transparent colormap. See base Plugin class for additional details. Attributes
overlayarray
Overlay displayed on top of image. This overlay defaults to a color map with alpha values varying linearly from 0 to 1.
colorint
Color of overlay.
__init__(**kwargs) [source]
Initialize self. See help(type(self)) for accurate signature.
attach(image_viewer) [source]
Attach the plugin to an ImageViewer. Note that the ImageViewer will automatically call this method when the plugin is added to the ImageViewer. For example: viewer += Plugin(...)
Also note that attach automatically calls the filter function so that the image matches the filtered value specified by attached widgets.
closeEvent(event) [source]
On close disconnect all artists and events from ImageViewer. Note that artists must be appended to self.artists.
property color
colors = {'cyan': (0, 1, 1), 'green': (0, 1, 0), 'red': (1, 0, 0), 'yellow': (1, 1, 0)}
display_filtered_image(image) [source]
Display filtered image as an overlay on top of image in viewer.
property filtered_image
Return filtered image. This “filtered image” is used when saving from the plugin.
output() [source]
Return the overlaid image. Returns
overlayarray, same shape as image
The overlay currently displayed.
dataNone
property overlay
PlotPlugin
class skimage.viewer.plugins.PlotPlugin(image_filter=None, height=150, width=400, **kwargs) [source]
Bases: skimage.viewer.plugins.base.Plugin Plugin for ImageViewer that contains a plot canvas. Base class for plugins that contain a Matplotlib plot canvas, which can, for example, display an image histogram. See base Plugin class for additional details.
__init__(image_filter=None, height=150, width=400, **kwargs) [source]
Initialize self. See help(type(self)) for accurate signature.
add_plot() [source]
add_tool(tool) [source]
attach(image_viewer) [source]
Attach the plugin to an ImageViewer. Note that the ImageViewer will automatically call this method when the plugin is added to the ImageViewer. For example: viewer += Plugin(...)
Also note that attach automatically calls the filter function so that the image matches the filtered value specified by attached widgets.
redraw() [source]
Redraw plot.
remove_tool(tool) [source]
Plugin
class skimage.viewer.plugins.Plugin(image_filter=None, height=0, width=400, useblit=True, dock='bottom') [source]
Bases: object Base class for plugins that interact with an ImageViewer. A plugin connects an image filter (or another function) to an image viewer. Note that a Plugin is initialized without an image viewer and attached in a later step. See example below for details. Parameters
image_viewerImageViewer
Window containing image used in measurement/manipulation.
image_filterfunction
Function that gets called to update image in image viewer. This value can be None if, for example, you have a plugin that extracts information from an image and doesn’t manipulate it. Alternatively, this function can be defined as a method in a Plugin subclass.
height, widthint
Size of plugin window in pixels. Note that Qt will automatically resize a window to fit components. So if you’re adding rows of components, you can leave height = 0 and just let Qt determine the final height.
useblitbool
If True, use blitting to speed up animation. Only available on some Matplotlib backends. If None, set to True when using Agg backend. This only has an effect if you draw on top of an image viewer. Examples >>> from skimage.viewer import ImageViewer
>>> from skimage.viewer.widgets import Slider
>>> from skimage import data
>>>
>>> plugin = Plugin(image_filter=lambda img,
... threshold: img > threshold)
>>> plugin += Slider('threshold', 0, 255)
>>>
>>> image = data.coins()
>>> viewer = ImageViewer(image)
>>> viewer += plugin
>>> thresholded = viewer.show()[0][0]
The plugin will automatically delegate parameters to image_filter based on its parameter type, i.e., ptype (widgets for required arguments must be added in the order they appear in the function). The image attached to the viewer is automatically passed as the first argument to the filter function. #TODO: Add flag so image is not passed to filter function by default. ptype = ‘kwarg’ is the default for most widgets so it’s unnecessary here. Attributes
image_viewerImageViewer
Window containing image used in measurement.
namestr
Name of plugin. This is displayed as the window title.
artistlist
List of Matplotlib artists and canvastools. Any artists created by the plugin should be added to this list so that it gets cleaned up on close.
__init__(image_filter=None, height=0, width=400, useblit=True, dock='bottom') [source]
Initialize self. See help(type(self)) for accurate signature.
add_widget(widget) [source]
Add widget to plugin. Alternatively, Plugin’s __add__ method is overloaded to add widgets: plugin += Widget(...)
Widgets can adjust required or optional arguments of filter function or parameters for the plugin. This is specified by the Widget’s ptype.
attach(image_viewer) [source]
Attach the plugin to an ImageViewer. Note that the ImageViewer will automatically call this method when the plugin is added to the ImageViewer. For example: viewer += Plugin(...)
Also note that attach automatically calls the filter function so that the image matches the filtered value specified by attached widgets.
clean_up() [source]
closeEvent(event) [source]
On close disconnect all artists and events from ImageViewer. Note that artists must be appended to self.artists.
display_filtered_image(image) [source]
Display the filtered image on image viewer. If you don’t want to simply replace the displayed image with the filtered image (e.g., you want to display a transparent overlay), you can override this method.
filter_image(*widget_arg) [source]
Call image_filter with widget args and kwargs Note: display_filtered_image is automatically called.
property filtered_image
Return filtered image.
image_changed = None
image_viewer = 'Plugin is not attached to ImageViewer'
name = 'Plugin'
output() [source]
Return the plugin’s representation and data. Returns
imagearray, same shape as self.image_viewer.image, or None
The filtered image.
dataNone
Any data associated with the plugin. Notes Derived classes should override this method to return a tuple containing an overlay of the same shape of the image, and a data object. Either of these is optional: return None if you don’t want to return a value.
remove_image_artists() [source]
Remove artists that are connected to the image viewer.
show(main_window=True) [source]
Show plugin.
update_plugin(name, value) [source]
Update keyword parameters of the plugin itself. These parameters will typically be implemented as class properties so that they update the image or some other component. | skimage.api.skimage.viewer.plugins |
class skimage.viewer.plugins.CannyPlugin(*args, **kwargs) [source]
Bases: skimage.viewer.plugins.overlayplugin.OverlayPlugin Canny filter plugin to show edges of an image.
__init__(*args, **kwargs) [source]
Initialize self. See help(type(self)) for accurate signature.
attach(image_viewer) [source]
Attach the plugin to an ImageViewer. Note that the ImageViewer will automatically call this method when the plugin is added to the ImageViewer. For example: viewer += Plugin(...)
Also note that attach automatically calls the filter function so that the image matches the filtered value specified by attached widgets.
name = 'Canny Filter' | skimage.api.skimage.viewer.plugins#skimage.viewer.plugins.CannyPlugin |
attach(image_viewer) [source]
Attach the plugin to an ImageViewer. Note that the ImageViewer will automatically call this method when the plugin is added to the ImageViewer. For example: viewer += Plugin(...)
Also note that attach automatically calls the filter function so that the image matches the filtered value specified by attached widgets. | skimage.api.skimage.viewer.plugins#skimage.viewer.plugins.CannyPlugin.attach |
name = 'Canny Filter' | skimage.api.skimage.viewer.plugins#skimage.viewer.plugins.CannyPlugin.name |
__init__(*args, **kwargs) [source]
Initialize self. See help(type(self)) for accurate signature. | skimage.api.skimage.viewer.plugins#skimage.viewer.plugins.CannyPlugin.__init__ |
class skimage.viewer.plugins.ColorHistogram(max_pct=0.99, **kwargs) [source]
Bases: skimage.viewer.plugins.plotplugin.PlotPlugin
__init__(max_pct=0.99, **kwargs) [source]
Initialize self. See help(type(self)) for accurate signature.
ab_selected(extents) [source]
attach(image_viewer) [source]
Attach the plugin to an ImageViewer. Note that the ImageViewer will automatically call this method when the plugin is added to the ImageViewer. For example: viewer += Plugin(...)
Also note that attach automatically calls the filter function so that the image matches the filtered value specified by attached widgets.
help() [source]
name = 'Color Histogram'
output() [source]
Return the image mask and the histogram data. Returns
maskarray of bool, same shape as image
The selected pixels.
datadict
The data describing the histogram and the selected region. The dictionary contains: ‘bins’ : array of float The bin boundaries for both a and b channels. ‘hist’ : 2D array of float The normalized histogram. ‘edges’ : tuple of array of float The bin edges along each dimension ‘extents’ : tuple of float The left and right and top and bottom of the selected region. | skimage.api.skimage.viewer.plugins#skimage.viewer.plugins.ColorHistogram |
ab_selected(extents) [source] | skimage.api.skimage.viewer.plugins#skimage.viewer.plugins.ColorHistogram.ab_selected |
attach(image_viewer) [source]
Attach the plugin to an ImageViewer. Note that the ImageViewer will automatically call this method when the plugin is added to the ImageViewer. For example: viewer += Plugin(...)
Also note that attach automatically calls the filter function so that the image matches the filtered value specified by attached widgets. | skimage.api.skimage.viewer.plugins#skimage.viewer.plugins.ColorHistogram.attach |
help() [source] | skimage.api.skimage.viewer.plugins#skimage.viewer.plugins.ColorHistogram.help |
name = 'Color Histogram' | skimage.api.skimage.viewer.plugins#skimage.viewer.plugins.ColorHistogram.name |
output() [source]
Return the image mask and the histogram data. Returns
maskarray of bool, same shape as image
The selected pixels.
datadict
The data describing the histogram and the selected region. The dictionary contains: ‘bins’ : array of float The bin boundaries for both a and b channels. ‘hist’ : 2D array of float The normalized histogram. ‘edges’ : tuple of array of float The bin edges along each dimension ‘extents’ : tuple of float The left and right and top and bottom of the selected region. | skimage.api.skimage.viewer.plugins#skimage.viewer.plugins.ColorHistogram.output |
__init__(max_pct=0.99, **kwargs) [source]
Initialize self. See help(type(self)) for accurate signature. | skimage.api.skimage.viewer.plugins#skimage.viewer.plugins.ColorHistogram.__init__ |
class skimage.viewer.plugins.Crop(maxdist=10, **kwargs) [source]
Bases: skimage.viewer.plugins.base.Plugin
__init__(maxdist=10, **kwargs) [source]
Initialize self. See help(type(self)) for accurate signature.
attach(image_viewer) [source]
Attach the plugin to an ImageViewer. Note that the ImageViewer will automatically call this method when the plugin is added to the ImageViewer. For example: viewer += Plugin(...)
Also note that attach automatically calls the filter function so that the image matches the filtered value specified by attached widgets.
crop(extents) [source]
help() [source]
name = 'Crop'
reset() [source] | skimage.api.skimage.viewer.plugins#skimage.viewer.plugins.Crop |
attach(image_viewer) [source]
Attach the plugin to an ImageViewer. Note that the ImageViewer will automatically call this method when the plugin is added to the ImageViewer. For example: viewer += Plugin(...)
Also note that attach automatically calls the filter function so that the image matches the filtered value specified by attached widgets. | skimage.api.skimage.viewer.plugins#skimage.viewer.plugins.Crop.attach |
crop(extents) [source] | skimage.api.skimage.viewer.plugins#skimage.viewer.plugins.Crop.crop |
help() [source] | skimage.api.skimage.viewer.plugins#skimage.viewer.plugins.Crop.help |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.