Editor: Digital Image Filters ()

 

Description:

This editor provides digital image filters for 3D image data sets, such as smoothing, unsharp masking, and morphological operations. Some filters operate in 3D while others are applied to two-dimensional slices. In the latter case, the orientation of the 2D slices can be selected via an option menu. Press the Apply button to start the computation.

Note All image filters are executed using multithreaded computation. See the Edit/Preferences to select the number of cores to be used.

Currently, the following filters are supported:

Edge-Detection:

Grayscale:

Sharpening:

Smoothing:

Morphological:

Figure 1: Editor for applying digital image filters.

Ports:

Filter
Specifies the filter and its domain. It allows you select whether the filter should be applied to the XY, XZ, or YZ slices or to the entire three-dimensional image. Depending on the selected filter, additional ports will be visible.

Action
The Undo button allows you to undo the last filter operation.

Laplacian edge detection filter (Laplacian zero-crossing)

This filter is a rotation invariant edge detection filter. The algorithm finds zero crossings of the second derivative, i.e., changes of the sign of the first derivative of the "image function" which may indicate an edge.

Moments filter (Statistical feature detection)

This filter calculates the -th centralized moment of the data in a gliding window. The centralized moments of order are defined by:

The second moment () is, therefore, the local variance in the data. For some data sets this can be used to mask out noisy regions or to detect edges.

Because of the -th power involved in the computation, you may want to use Convert Image Type to do a conversion of your data set to floats or doubles first.

Sobel edge detection filter

The Sobel-Filter is a rotation variant edge detection filter. It convolutes the image with 4 different filter kernels representing horizontal, vertical, and two diagonal orientations. Each kernel consists of a combination of Smoothing: Gaussian and the differentiation in the proper orientation.

Adaptive Histogram Equalization filter

This filter performs a so-called contrast limited adaptive histogram equalization (CLAHE) on the data set. The CLAHE algorithm partitions the images into contextual regions and applies the histogram equalization to each one. This evens out the distribution of used gray values and thus makes hidden features of the image more visible. Parameter Contrast Limit determines the contrast limit for the CLAHE algorithm.

Note: In 3D mode the computation is not multithreaded so it can take a rather long time if the data is large. A faster preview is always possible by switching to the 2D mode.

Brightness and contrast filter

This filter modifies the image brightness by adding an offset to the image values. The contrast is modified by multiplying the difference from the voxel values to the average image intensity.

where

Gamma Correction filter (Lighten/Darken)

A gamma characteristic is a power-law relationship that approximates the relationship between the encoded luminance in a display system and the actual desired image brightness. With this nonlinear relationship, equal steps in encoded luminance correspond to subjectively approximately equal steps in brightness. Computer graphics systems that require a linear relationship between these quantities use gamma correction.

Specifying a large value Gamma leads to darker images. The Range specifies the intensity values that correspond to black and white. Intensity values outside this range are clipped off.

Sigmoid Intensity Remapping filter

This filter operates on single voxels (kernel size 1) and is used to raise a specific intensity range. This is useful as a preprocessing step in image segmentation. The intensity range is described by its center and it width . The target image range is given by the interval [min, max].



Lanczos filter (Resampling/Low pass)

This filter can be used to sharpen images. It performs a convolution with a Lanczos kernel:



The kernel size in each dimension can be adjusted using the parameter inputs kernel size. A value of 3 denotes a 3x3x3 kernel. Odd values are required.

Parameter Sigma determines the effective size of the Lanczos function. For large values of sigma the effect of the filter will be a smoothing rather than a sharpening.

Unsharp Masking filter

This filter sharpens an image using an unsharp mask. The unsharp mask is computed by a Gaussian filter of size kernel size.

Then, the smoothed image is subtracted from the original image such that only high contrast remains. The weighted difference of the original image (weight: ) and the blurred image (weight: ) is calculated afterwards using the sharpness parameter c. It determines the relation between the original and blurred image, effectively controlling the amount of sharpness. The parameter can be adjusted via a text input field and should be in the range of 0.6 to 0.8. A value of 1 leaves the image unchanged.

Anisotropic diffusion filter

Note: This filter requires and Avizo license.

This module implements an anisotropic diffusion filter for denoising scalar volume data. It works effectively to preserve strong edges and enhance the constrast of edges.

In order to determine the new value for the current voxel, the algorithm compares the value of the current voxel with the value of its 6 neighbors. If the difference doesn't exceed the diffusion stop criterion, there is diffusion.

This module implements a CPU and a GPU version of the anisotropic filter for 3D. The module can manage data partitioning so the data can be processed even if it does not fit entirely in GPU memory, and also in order to avoid system timeouts that may apply on GPU used for display. For more details, see the explanations about CUDA Device, Options and Partition size ports.

Note: The GPU-accelerated version of this filter requires a CUDA-enabled GPU. All compatible GPUs are listed here .

Aknowledgments

This module was developed in collaboration with Dominique Bernard, Research Director at ICMCB-CNRS (Pessac).

Theoretical details

This filter is based on the following continuous equation:


With a discretization in time of this equation, it becomes:


where

Finally, the equation for the voxel is:


where

G is function of the difference between the current voxel and its neighbors . G is defined by: if and otherwise where is the diffusion stop threshold.


Ports:

Diffusion stop threshold

The criterion of diffusion. If the difference between the current voxel and its neighborhood is smaller than this criterion, there is diffusion.

Nb iterations

Choose the number of iterations. This parameter determines the time of diffusion. Too big values will result in simple blurring of the image: Only the very clean contours will be conserved.

Device

Choose whether the CPU or the GPU (CUDA device) is used for calculation. On modern graphics cards, the GPU calculation is generally much faster than the CPU calculation, even if run on multi-core and multiprocessor systems.

CUDA device

This port shows the list of available CUDA devices. The amount of available memory is displayed for each device. The devices that have no kernel timeouts are first in the list. If several graphic cards are available, this port is dispayed as follows:

It allows selecting the graphic cards on which the filter will execute, since it can be split into blocks for very large data sets which do not hold in one graphic card memory.

Note that if there is only one CUDA device and no other graphics card, the computation time is limited to approximately 5 seconds if it uses hardware acceleration at the same time. On Windows this is generally the case; on Linux you can use SSH-tunneling and/or VNC on a machine not running any X server to use your local machine for graphics output. If the computation time exceeds 5 seconds, the module might terminate the computation raising a CUDA error. To avoid timeouts, please enable automatic partition size in the Options port.

Warning
This port is only visible if GPU version cannot be used. Three reasons are possible:

Options

If this option is selected, a sensible partition size will be automatically determined. Switching off this option might result in a CUDA error due to too large block sizes.

Partition size

This port is only visible if the selected device is GPU. This value allows the user to scale the blocks that are being sent to the graphics card. If this value is 1, the block size is chosen small enough to run the algorithm on the GPU. When computing anisotropic filter on a single GPU, however, it might be necessary to reduce the block size further to allow the computation for a single block to be finished within 5 seconds. This can be done with this parameter. A heuristic tries to find a good value for this parameter. If you think the parameter is too small, then you can manually tune it. This, however, may result in CUDA driver crashes which will require restarting the application.

Max. Block Size

This port displays the maximum block size currently used. This value is determined by the partition size and other constraints.

Edge-Preserving smoothing filter

This is a smoothing filter that models the physical process of diffusion. Similar to the Gaussian filter, it smoothes out the difference between gray levels of neighboring voxels. This can be interpreted as a diffusion process in which energy between voxels of high and low energy (gray value) is leveled. In contrast with the Gaussian filter, it does not smear out the edges because the diffusion is reduced or stopped in the vicinity of edges. Thus, edges are preserved.

Note: In 3D mode the computation is not multithreaded so it can take a rather long time if the data is large. A faster preview is always possible by switching to 2D mode.

Note: This filters consumes approximately five times more memory than size of the data on which it is applied. The reason for this is that this filter's mechanism is using five copies of data on which it is applied to make filtered data.

The stop time determines how long the diffusion runs. The longer it runs, the smoother the image becomes. The time step determines how accurately this process is sampled.

The contrast parameter determines how much the diffusion process depends on the image gradient, i.e., how much the smoothing is stopped near edges. A value of 0 makes the diffusion independent of the image gradient and smoothes out the edges, a large value prevents smoothing in all edge-like regions.

In order to make the diffusion process more stable, the image is prefiltered by a Gaussian filter with parameter sigma. All features of size sigma are removed. This allows noise to be removed from the image. But a too large value may also remove relevant features.

Note: This filter implement the non-linear diffusion algorithm: J.Weickert, B. Haar, and R. Viergever. Efficient and reliable schemes for nonlinear diffusion filtering. IEEE Trans. Image Proc., 7(3):398-410, 1998.

Gaussian smoothing filter (Gauss)

The Gaussian filter smoothes or blurs an image by performing a convolution operation with a Gaussian filter kernel. The text fields labeled kernel size allow you to change the size of the convolution kernel in each dimension. A value of 3 denotes a 3x3 kernel (3x3x3 in 3D). The minimum kernel size is 1 which means that the image is not blurred at all in that direction. The text fields labeled sigma rel allow you to adjust the width of the Gauss function relative to the kernel size.

Non-local Means filter

Note: This filter requires and Avizo license.

This module implements the windowed non-local means algorithm for denoising scalar volume data. The original non-local means algorithm did not use a search window, but compared each voxel with every other voxel. Of course, this leads to very long run times which are unfeasible. Hence, in general a windowed version of the non-local means algorithm, as implemented in this module, is used.

In order to determine the new value for the current voxel, the algorithm compares the neighborhoods of all voxels in a given search window with the neighbors of the current voxel. The similarity between the neighbors determines the weight with which the value of a voxel in the search window will influence the new value of the current voxel. The final weights are determined by applying a Gauss kernel to the similarity values.

The non-local means algorithm works most effectively if the noise present in the data set is white noise. This is the assumption behind the algorithm. If this can be assumed, the non-local means algorithm will naturally preserve most features present in the image, even small and thin ones. However, the algorithm must not be confused with a feature enhancement algorithm, such as edge enhancement. If edge enhancement is required, it is suggested to run non-local means filtering first followed by edge enhancement. This should give the best results.

This module implements a CPU and a GPU version of the non-local means algorithm for 2D, that is in each slice, and for 3D. While the results of the 3D version are slightly better, the 2D version is much faster and gives similar results. The module can manage data partitioning so the data can be processed even if it does not fit entirely in GPU memory, and also in order to avoid system timeouts that may apply on GPU used for display. For more details, see the explanations about CUDA Device, Options and Partition size ports.

Note: The GPU-accelerated version of this filter requires a CUDA-enabled GPU. All compatible GPUs are listed here .

For more information about the algorithm itself see:

A. Buades, B. Coll., and J.M. Morel, A non local algorithm for image denoising, in Proc. Int. Conf. Computer Vision and Pattern Recognition (CVPR), 2005, vol. 2, pp. 60-65.

Ports:

Search Window

Search window size. The algorithm looks for matches within this area around each point. The value represents the diameter of the search window area in number of voxels. The larger the search window is, the better the results usually are. But the size of the search window also effects the run time significantly. The larger the search window, the longer the run time. This value has to be set to a large enough value so that similar structures can be found within the search window area. Too small values will result in simple blurring of the image because there is not enough structural information within the search window area. A search window size of 21 is usually a good choice.

Local Neighborhood

Size of the neighborhood window. The influence of the each point in the search window on the base point is weighted by comparing the neighborhood window of this point with the neighborhood window of the base point of the search window. The value represents the diameter of the neighborhood area in number of voxels, and affects the quality of the result as well as the run time. If this value is either much smaller or much larger than fine structures in the data the algorithm shows little or no effect at all. The larger the value, the longer the run time.

Similarity Value

The similarity value determines the similarity weight assigned to each voxel in the search window. The larger the value, the higher the weight assigned to a voxel. As result, the larger the value, the more the resulting image will be smoothed. In mathematical terms, the squared similarity value is proportional to the standard deviation of the assumed Gaussian noise of the image. The similarity value does not affect the calculation time. To achieve similar results with the 2D and 3D implementations, the similarity value must be larger when using the 2D implementation.

Adaptive

Adaptive choice of lambda. If adaptive is set to true, lambda will be adjusted for each voxel using the standard deviation of each search window. This accounts for different contrast levels across the data set. It is generally recommended to use the adaptive mode.

Device

Choose whether the CPU or the GPU (CUDA device) is used for calculation. On modern graphics cards, the GPU calculation is generally much faster than the CPU calculation, even for multi-core and multiprocessor systems.

CUDA device

This port shows the list of available CUDA devices. The amount of available memory is displayed for each device. The devices that have no kernel timeouts are first in the list. Note that if there is only one CUDA device and no other graphics card, the computation time is limited to approximately 5 seconds if it uses hardware acceleration at the same time. On Windows this is generally the case; on Linux you can use SSH-tunneling and/or VNC on a machine not running any X server to use your local machine for graphics output. If the computation time exceeds 5 seconds, the module might terminate the computation raising a CUDA error. To avoid timeouts, please enable automatic partition size in the Options port.

Warning
This port is only visible if GPU version cannot be used. Three reasons are possible:

Options

If this option is selected, a sensible partition size will be automatically determined. Switching off this option might result in a CUDA error due to too large block sizes.

Partition size

This port is only visible if the selected device is GPU. This value allows the user to scale the blocks that are being sent to the graphics card. If this value is 1, the block size is chosen small enough to run the algorithm on the GPU. When computing NLM on a single GPU, however, it might be necessary to reduce the block size further to allow the computation for a single block to be finished within 5 seconds. This can be done with this parameter. A heuristic tries to find a good value for this parameter. If you think the parameter is too small, then you can manually tune it. This, however, may result in CUDA driver crashes which will require restarting the application.

Max. Block Size

This port displays the maximum block size currently used. This value is determined by the partition size and other constraints.

Median filter (Noise reduction)

This filter is a simple edge-preserving smoothing filter. It may be applied prior to segmentation in order to reduce the amount of noise in an image. The filter works by sorting pixels covered by an NxN mask according to their gray value. The center pixel is then replaced by the median of these pixels, i.e., the middle entry of the sorted list. The size of the pixel mask may be adjusted via the text field labeled kernel size. A value of 3 denotes a 3x3 or mask (3x3x3 in 3D). An odd value is required.

Erosion filter (Noise reduction minimum)

This filter replaces the value of a pixel by the smallest value of neighboring pixels. The Shape of the neighborhood can be defined via the input field Neighborhood and the size via Size. If applied to a binary Label Field, the minimum filter reduces the size of a segmented region by removing pixels from its boundary.

Dilation filter (Noise reduction maximum)

This filter replaces the value of a pixel by the largest value of neighboring pixels. The Shape of the neighborhood can be defined via the input field Neighborhood and the size via Size. If applied to a binary Label Field, the minimum filter enlarges the size of a segmented region by adding pixels to its boundary.

Closing filter

The idea behind the morphological closing is to build an operator tending to recover the initial image that has been dilated. This is achieved by eroding the dilated image. The Shape of the neighborhood can be defined via the input field Neighborhood and the size via Size.

Closing filters remove small holes that cannot contain the structured element defined by the neighborhood and the size.

Opening filter

The idea behind the morphological opening is to build an operator tending to recover the initial shape of the image that has been eroded. This is achieved by dilating the eroded image. The Shape of the neighborhood can be defined via the input field Neighborhood and the size via Size.

Opening filters remove small objects that cannot contain the structured element defined by the neighborhood and the size.

Commands:

parallelCompute
Specify if filters must use parallel computing. Only Erosion and Dilation filters can be parallelized. By default, filters are parallelized.