Median filter#
Description
Median filter is a part of the module httomolibgpu.misc.corr for data correction. Median filter is a non-linear noise removing technique with edge-preserving properties, see more on it here. Mathematically, one can express the median filter as:
Where \(\mathrm{N}_{i}\) is the symmetric neighbourhood (e.g. 3 x 3) of the pixel \(j\).
Where and how to use it:
Median filter can be used in post-processing, e.g., after the reconstruction to remove the noise and prepare the image for further analysis. Applying edge-preserving noise correction can simplify segmentation.
What are the adjustable parameters:
kernel_size
defines the neighborhood size, see \(\mathrm{N}_{i}\) in the equations above. For instance, for 2D imagekernel_size = 3
defines the neighborhood of 3 by 3 pixels (one needs to use only odd numbers). Increasingkernel_size
results in more smoothing applied, it is recommended to use the higher values when the level of noise is high. As a rule of thumb, keepingkernel_size
within 3-5 range is a good trade-off to avoid destroying important data features.
Practical example:
In this example we demonstrate how to apply median filter to projection data to demonstrate its noise removing properties.
Warning
It is not recommended to apply median filter to projection data as any modification of the data itself can result in further problems, e.g., the loss of the resolution and the presence of artifacts in the reconstruction step.