SciPy

Multi-dimensional image processing (scipy.ndimage)

This package contains various functions for multi-dimensional image processing.

Filters

convolve(input, weights[, output, mode, ...]) Multidimensional convolution.
convolve1d(input, weights[, axis, output, ...]) Calculate a one-dimensional convolution along the given axis.
correlate(input, weights[, output, mode, ...]) Multi-dimensional correlation.
correlate1d(input, weights[, axis, output, ...]) Calculate a one-dimensional correlation along the given axis.
gaussian_filter(input, sigma[, order, ...]) Multidimensional Gaussian filter.
gaussian_filter1d(input, sigma[, axis, ...]) One-dimensional Gaussian filter.
gaussian_gradient_magnitude(input, sigma[, ...]) Multidimensional gradient magnitude using Gaussian derivatives.
gaussian_laplace(input, sigma[, output, ...]) Multidimensional Laplace filter using gaussian second derivatives.
generic_filter(input, function[, size, ...]) Calculates a multi-dimensional filter using the given function.
generic_filter1d(input, function, filter_size) Calculate a one-dimensional filter along the given axis.
generic_gradient_magnitude(input, derivative) Gradient magnitude using a provided gradient function.
generic_laplace(input, derivative2[, ...]) N-dimensional Laplace filter using a provided second derivative function
laplace(input[, output, mode, cval]) N-dimensional Laplace filter based on approximate second derivatives.
maximum_filter(input[, size, footprint, ...]) Calculates a multi-dimensional maximum filter.
maximum_filter1d(input, size[, axis, ...]) Calculate a one-dimensional maximum filter along the given axis.
median_filter(input[, size, footprint, ...]) Calculates a multidimensional median filter.
minimum_filter(input[, size, footprint, ...]) Calculates a multi-dimensional minimum filter.
minimum_filter1d(input, size[, axis, ...]) Calculate a one-dimensional minimum filter along the given axis.
percentile_filter(input, percentile[, size, ...]) Calculates a multi-dimensional percentile filter.
prewitt(input[, axis, output, mode, cval]) Calculate a Prewitt filter.
rank_filter(input, rank[, size, footprint, ...]) Calculates a multi-dimensional rank filter.
sobel(input[, axis, output, mode, cval]) Calculate a Sobel filter.
uniform_filter(input[, size, output, mode, ...]) Multi-dimensional uniform filter.
uniform_filter1d(input, size[, axis, ...]) Calculate a one-dimensional uniform filter along the given axis.

Fourier filters

fourier_ellipsoid(input, size[, n, axis, output]) Multi-dimensional ellipsoid fourier filter.
fourier_gaussian(input, sigma[, n, axis, output]) Multi-dimensional Gaussian fourier filter.
fourier_shift(input, shift[, n, axis, output]) Multi-dimensional fourier shift filter.
fourier_uniform(input, size[, n, axis, output]) Multi-dimensional uniform fourier filter.

Interpolation

affine_transform(input, matrix[, offset, ...]) Apply an affine transformation.
geometric_transform(input, mapping[, ...]) Apply an arbritrary geometric transform.
map_coordinates(input, coordinates[, ...]) Map the input array to new coordinates by interpolation.
rotate(input, angle[, axes, reshape, ...]) Rotate an array.
shift(input, shift[, output, order, mode, ...]) Shift an array.
spline_filter(input[, order, output]) Multi-dimensional spline filter.
spline_filter1d(input[, order, axis, output]) Calculates a one-dimensional spline filter along the given axis.
zoom(input, zoom[, output, order, mode, ...]) Zoom an array.

Measurements

center_of_mass(input[, labels, index]) Calculate the center of mass of the values of an array at labels.
extrema(input[, labels, index]) Calculate the minimums and maximums of the values of an array at labels, along with their positions.
find_objects(input[, max_label]) Find objects in a labeled array.
histogram(input, min, max, bins[, labels, index]) Calculate the histogram of the values of an array, optionally at labels.
label(input[, structure, output]) Label features in an array.
labeled_comprehension(input, labels, index, ...) Roughly equivalent to [func(input[labels == i]) for i in index].
maximum(input[, labels, index]) Calculate the maximum of the values of an array over labeled regions.
maximum_position(input[, labels, index]) Find the positions of the maximums of the values of an array at labels.
mean(input[, labels, index]) Calculate the mean of the values of an array at labels.
median(input[, labels, index]) Calculate the median of the values of an array over labeled regions.
minimum(input[, labels, index]) Calculate the minimum of the values of an array over labeled regions.
minimum_position(input[, labels, index]) Find the positions of the minimums of the values of an array at labels.
standard_deviation(input[, labels, index]) Calculate the standard deviation of the values of an n-D image array, optionally at specified sub-regions.
sum(input[, labels, index]) Calculate the sum of the values of the array.
variance(input[, labels, index]) Calculate the variance of the values of an n-D image array, optionally at specified sub-regions.
watershed_ift(input, markers[, structure, ...]) Apply watershed from markers using image foresting transform algorithm.

Morphology

binary_closing(input[, structure, ...]) Multi-dimensional binary closing with the given structuring element.
binary_dilation(input[, structure, ...]) Multi-dimensional binary dilation with the given structuring element.
binary_erosion(input[, structure, ...]) Multi-dimensional binary erosion with a given structuring element.
binary_fill_holes(input[, structure, ...]) Fill the holes in binary objects.
binary_hit_or_miss(input[, structure1, ...]) Multi-dimensional binary hit-or-miss transform.
binary_opening(input[, structure, ...]) Multi-dimensional binary opening with the given structuring element.
binary_propagation(input[, structure, mask, ...]) Multi-dimensional binary propagation with the given structuring element.
black_tophat(input[, size, footprint, ...]) Multi-dimensional black tophat filter.
distance_transform_bf(input[, metric, ...]) Distance transform function by a brute force algorithm.
distance_transform_cdt(input[, metric, ...]) Distance transform for chamfer type of transforms.
distance_transform_edt(input[, sampling, ...]) Exact euclidean distance transform.
generate_binary_structure(rank, connectivity) Generate a binary structure for binary morphological operations.
grey_closing(input[, size, footprint, ...]) Multi-dimensional greyscale closing.
grey_dilation(input[, size, footprint, ...]) Calculate a greyscale dilation, using either a structuring element, or a footprint corresponding to a flat structuring element.
grey_erosion(input[, size, footprint, ...]) Calculate a greyscale erosion, using either a structuring element, or a footprint corresponding to a flat structuring element.
grey_opening(input[, size, footprint, ...]) Multi-dimensional greyscale opening.
iterate_structure(structure, iterations[, ...]) Iterate a structure by dilating it with itself.
morphological_gradient(input[, size, ...]) Multi-dimensional morphological gradient.
morphological_laplace(input[, size, ...]) Multi-dimensional morphological laplace.
white_tophat(input[, size, footprint, ...]) Multi-dimensional white tophat filter.

Utility

imread(fname[, flatten, mode]) Read an image from a file as an array.