Provides a selection of spatial, separable and customizable filters in 1D and 2D, with OpenCL implementation if supported.
Institution: Institut Pasteur
Filtering is one of the most classical operation in image processing, and consists in adjusting (or replacing) pixel values depending on other pixel values in their local neighborhood. The extent of the neighborhood is defined in pixels by the size of the kernel. The size of the kernel should always be smaller than the size of the image! For instance, for a Gaussian blur (separable filter) of sigma x = 5, sigma y = 5 and sigma z = 2, the size of the kernel will be 25x25x4. Thus the image cannot be smaller than 25 in x and y and 4 in z. Filters can be used for instance to reduce image noise or enhance specific structures of interest.
This toolbox lets you apply a large range of filters on your image or sequence. The calculations run in multiple threads to maximize computation speed, and will also run on GPU on supported workstations and laptops via the OpenCL library. The filters are split in the following 3 categories: classic 2D filters, separable and 1D filters, and selection filters.
Classic 2D filters
These filters are applied by classical 2D convolution operation, i.e., for each pixel, a 2D neighborhood is computed and convolved with the chosen 2D filter via point-wise multiplication, followed by a final sum (and normalization if applicable) to compute the resulting pixel value.
Note that this process may be slow for large kernels, however computations are greatly accelerated thanks to the built-in OpenCL (GPU) capabilities.
Here is a list of available classic 2D filters:
- Prewitt (along X and Y)
- Sobel (along X and Y)
- Kirsch (along the 8 common directions)
- Custom (values can be manually set)
- From a template sequence (useful for filters imported from e.g. other software)
Separable and 1D filters
1D filters are a particular case of the previous 2D filters, in the sense that they are defined by a single line of values and therefore can be convolved along one specific direction of space (X, Y or Z).
Separable filters are a special optimized construction of 2D (actually nD) filters which can be applied by convolving the input with a 1D filter along each image dimension sequentially. The outcome is a much higher computational efficiency, since 1D convolution is faster to compute. Note however that not all 1D filters have the separability property, and not all nD filters can be split into a separable convolution
Here is a list of available separable and 1D filters:
- Gradient (this is not a separable operation, i.e. a different result is created for each selected direction)
- Gaussian (this is a separable operation)
- Custom (with user defined values, and an option to indicate if the filter is a separable one)
These filters are particular in the sense that they generally cannot be applied via a mathematical convolution. Their goal is to replace the current pixel value by computing various statistics from the local neighborhood.
Here is a list of available selection filters:
- Maximum: replaces each pixel by the maximum value in its neighborhood
- Local maxima: replaces each pixel by 1 if it is a maximum value in its neighborhood, and 0 otherwise (the output is binary)
- Mean: replaces each pixel by the average value in its neighborhood
- Median: replaces each pixel by the median value in its neighborhood
- Remove outliers: if a pixel is more than 2 standard deviations away from the neighborhood’s mean, it is replaced by the mean of the neighborhood without the current value, considered as an outlier according to Chauvenet’s rule.
- Standard deviation: replaces each pixel by the standard deviation of its neighborhood
- Variance: replaces each pixel by the variance of its neighborhood