Patch-based bilateral filter used to denoise a 3d image.
Patch-based bilateral filter is an algorithm used for image denoising. Like the Bilateral smoothing 3d, each voxel value is replaced by a weighted average of the values of its neighbours, and the weight is a product of two gaussian functions, one depending on the spatial distance between the 2 voxels, and the other one depending on intensity similarities. But contrary to the original version of the bilateral filter, the intensity similarity is not computed between 2 voxels, but between their 2 cubic neighbourhoods.
In term of results, this algorithm outperforms the original bilateral filter(better preservation of details and structures in the image) and gives results similar to the non-local means filter when one of the parameters, the spatial sigma, is great enough.
On output image values are given by:
where:
is the weight function; 
is the space function; 
is the intensity similarity function; 
- P is the cube patch centered on voxel (x, y, z), of a given half-size, specified by the user through the parameter field PatchBasedBilateralParams::PatchHalfSize
- |.| is a L2 distance operator, used to compute an intensity distance between 2 patches
is a ball-shaped kernel of a given radius, specified by the user through the parameter field PatchBasedBilateralParams::KernelRadius
is defined by PatchBasedBilateralParams::PatchSimilaritySigma parameter field
is defined by PatchBasedBilateralParams::SpaceSigma parameter field
stands for the standard deviation of gaussian noise estimated in the image and is defined by PatchBasedBilateralParams::NoiseSigma parameter field
Input and output images must have same size.
- Note
- On a color image, the filter is applied independently to each channel of the image. There is no dedicated version of the filter for color images for the moment.
Adjusting the parameters of the filter requires some expertise. To simplify the user's task, it is possible to execute the filter in semi-automatic or in full-automatic mode:
- in full-automatic mode, the user doesn't need to initialize the PatchBasedBilateralParams parameters of the algorithm; then the filter computes internally the standard deviation of the gaussian noise in the input image, and automatically computes the parameters of the algoritm from this level of noise. To use this full-automatic mode, call the wrapper function patchBasedBilateral3dImg, that takes only input and output images as arguments, and that returns the automatically computed parameters.
- in semi-automatic mode, the user only needs to initialize the parameters by using the function createPatchBasedBilateralParams that takes a noise standard deviation as single argument, before passing them as input of the filter; then parameters are automatically computed from this noise standard deviation. This mode may be a good alternative to the full-automatic one, if the user is not satisfied by the result returned by this last one, but wants to adjust the behaviour of the filter by modifying only one parameter.
These 2 modes usually give satisfying results, provided the noise of the input image follows a gaussian distribution. If this is not the case, using one of the 2 automatic modes may be a good starting point, but it will be certainly necessary to adjust manually the parameters afterwards.
Example of Python code :
Example imports
import PyIPSDK
import PyIPSDK.IPSDKIPLFiltering as filter
import PyIPSDK.IPSDKIPLUtility as util
Code Example
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
inImg = util.convertImg(inImg, PyIPSDK.eImageBufferType.eIBT_Real32)
outImg, autoParams = filter.patchBasedBilateral3dImg(inImg)
Example of C++ code :
Example informations
Header file
#include <IPSDKIPL/IPSDKIPLFiltering/Processor/PatchBasedBilateral3dImg/PatchBasedBilateral3dImg.h>
Code Example
pInImg->getSizeX(),
pInImg->getSizeY(),
pInImg->getSizeZ());
boost::shared_ptr<MemoryImage> pOutImg = boost::make_shared<MemoryImage>();
pOutImg->init(*pOutImageGeometry);
pInImg,
pOutImg);