#### Previous topic

medpy.metric.histogram.relative_deviation

#### Next topic

medpy.filter.smoothing.anisotropic_diffusion

# Image filter and manipulation (medpy.filter)¶

This package contains various image filters and image manipulation functions.

## Smoothing medpy.filter.smoothing¶

Image smoothing / noise reduction in grayscale images.

 anisotropic_diffusion(img[, niter, kappa, …]) Edge-preserving, XD Anisotropic diffusion. gauss_xminus1d(img, sigma[, dim]) Applies a X-1D gauss to a copy of a XD image, slicing it along dim.

## Binary medpy.filter.binary¶

Binary image manipulation.

 size_threshold(img, thr[, comp, structure]) Removes binary objects from an image identified by a size threshold. largest_connected_component(img[, structure]) Select the largest connected binary component in an image. bounding_box(img) Return the bounding box incorporating all non-zero values in the image.

## Image medpy.filter.image¶

Grayscale image manipulation.

 sls(minuend, subtrahend[, metric, noise, …]) Computes the signed local similarity between two images. ssd(minuend, subtrahend[, normalized, …]) Computes the sum of squared difference (SSD) between patches of minuend and subtrahend. average_filter(input[, size, footprint, …]) Calculates a multi-dimensional average filter. sum_filter(input[, size, footprint, output, …]) Calculates a multi-dimensional sum filter. local_minima(img[, min_distance]) Returns all local minima from an image. otsu(img[, bins]) Otsu’s method to find the optimal threshold separating an image into fore- and background. resample(img, hdr, target_spacing[, …]) Re-sample an image to a new voxel-spacing.

## Label medpy.filter.label¶

Label map manipulation.

 relabel_map(label_image, mapping[, key]) Relabel an image using the supplied mapping. relabel(label_image[, start]) Relabel the regions of a label image. relabel_non_zero(label_image[, start]) Relabel the regions of a label image. fit_labels_to_mask(label_image, mask) Reduces a label images by overlaying it with a binary mask and assign the labels either to the mask or to the background.

## Noise medpy.filter.noise¶

Global and local noise estimation in grayscale images.

 immerkaer(input[, mode, cval]) Estimate the global noise. immerkaer_local(input, size[, output, mode, …]) Estimate the local noise. separable_convolution(input, weights[, …]) Calculate a n-dimensional convolution of a separable kernel to a n-dimensional input.

## Utilities medpy.filter.utilities¶

Utilities to apply filters selectively and create your own ones.

 xminus1d(img, fun, dim, *args, **kwargs) Applies the function fun along all X-1D dimensional volumes of the images img dimension dim. intersection(i1, h1, i2, h2) Returns the intersecting parts of two images in real world coordinates. pad(input[, size, footprint, output, mode, cval]) Returns a copy of the input, padded by the supplied structuring element.

## Hough transform medpy.filter.houghtransform¶

The hough transform shape detection algorithm.

 ght(img, template) Implementation of the general hough transform for all dimensions. ght_alternative(img, template, indices) Alternative implementation of the general hough transform, which uses iteration over indices rather than broadcasting rules like ght. template_ellipsoid(shape) Returns an ellipsoid binary structure of a of the supplied radius that can be used as template input to the generalized hough transform. template_sphere(radius, dimensions) Returns a spherical binary structure of a of the supplied radius that can be used as template input to the generalized hough transform.

## Intensity range standardization medpy.filter.IntensityRangeStandardization¶

A learning method to align the intensity ranges of images.

 IntensityRangeStandardization([cutoffp, …]) Class to standardize intensity ranges between a number of images.