IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit

Patch-based bilateral filter used to denoise a 3d image. More...

IPSDKIPLFILTERING_API PatchBasedBilateralResult ipsdk::imaproc::filter::patchBasedBilateral3dImg (const image::ImageConstPtr &pInImg)
 wrapper function for patch-based bilateral filter used to denoise a 3d image More...
 
IPSDKIPLFILTERING_API attr::PatchBasedBilateralParamsPtr ipsdk::imaproc::filter::patchBasedBilateral3dImg (const image::ImageConstPtr &pInImg, const image::ImagePtr &pOutImg)
 wrapper function for patch-based bilateral filter used to denoise a 3d image More...
 
IPSDKIPLFILTERING_API PatchBasedBilateralResult ipsdk::imaproc::filter::patchBasedBilateral3dImg (const image::ImageConstPtr &pInImg, const ipsdk::imaproc::attr::PatchBasedBilateralParamsConstPtr &pParams)
 wrapper function for patch-based bilateral filter used to denoise a 3d image More...
 
IPSDKIPLFILTERING_API attr::PatchBasedBilateralParamsPtr ipsdk::imaproc::filter::patchBasedBilateral3dImg (const image::ImageConstPtr &pInImg, const ipsdk::imaproc::attr::PatchBasedBilateralParamsConstPtr &pParams, const image::ImagePtr &pOutImg)
 wrapper function for patch-based bilateral filter used to denoise a 3d image More...
 
IPSDKIPLFILTERING_API attr::PlanIndexedPatchBasedBilateralParamsPtr ipsdk::imaproc::filter::multiSlice_patchBasedBilateral3dImg (const image::ImageConstPtr &pInImg, const image::ImagePtr &pOutImg)
 wrapper function for patch-based bilateral filter used to denoise a 3d image More...
 
IPSDKIPLFILTERING_API attr::PlanIndexedPatchBasedBilateralParamsPtr ipsdk::imaproc::filter::multiSlice_patchBasedBilateral3dImg (const image::ImageConstPtr &pInImg, const attr::PlanIndexedPatchBasedBilateralParamsConstPtr &pPIParams, const image::ImagePtr &pOutImg)
 wrapper function for patch-based bilateral filter used to denoise a 3d image More...
 
IPSDKIPLFILTERING_API attr::PlanIndexedPatchBasedBilateralParamsPtr ipsdk::imaproc::filter::multiSlice_patchBasedBilateral3dImg (const image::ImageConstPtr &pInImg, const ipsdk::ipReal64 noiseSigma, const image::ImagePtr &pOutImg)
 wrapper function for patch-based bilateral filter used to denoise a 3d image More...
 
IPSDKIPLFILTERING_API attr::PlanIndexedPatchBasedBilateralParamsPtr ipsdk::imaproc::filter::multiSlice_patchBasedBilateral3dImg (const image::ImageConstPtr &pInImg, const ipsdk::ipReal64 noiseSigma, const ipsdk::ipReal64 minRange, const ipsdk::ipReal64 maxRange, const image::ImagePtr &pOutImg)
 wrapper function for patch-based bilateral filter used to denoise a 3d image More...
 

Detailed Description

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:

\[ OutImg[x, y, z] = \dfrac { \sum_{(o_x, o_y, o_z) \in K}{W(x, y, z, o_x, o_y, o_z)*InImg[x+o_x, y+o_y, z+o_z]} } { \sum_{(o_x, o_y, o_z) \in K}{W(x, y, z, o_x, o_y, o_z)} } \]

where:

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:

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.

Attributes description

Attribute description for algorithm :

Name ToolTip Default Initializer
ipsdk::imaproc::attr::InImg3d [Input] 3d image for operation X
ipsdk::imaproc::attr::InOptPIPatchBasedBilateralParams [In Optional] Plan indexed collection of parameters for patch-based bilateral filter X
ipsdk::imaproc::attr::OutPIPatchBasedBilateralParams [Output] Plan indexed collection of parameters for patch-based bilateral filter ipsdk::imaproc::fromImageButVolume (_pOutPIPatchBasedBilateralParams, _pInImg3d)
ipsdk::imaproc::attr::OutOptWk1RealImg [Output Optional] Temporary working image for algorithm (data contained in image buffer are reals) X
ipsdk::imaproc::attr::OutOptWk2RealImg [Output Optional] Temporary working image for algorithm (data contained in image buffer are reals) X
ipsdk::imaproc::attr::OutRealImg [Output] image for processing operation (data contained in image buffer are reals) ipsdk::imaproc::duplicateInOut (_pOutRealImg, _pInImg3d, ipsdk::image::eImageBufferType::eIBT_Real32)

Global Rule description

Global rule description for algorithm :
ipsdk::imaproc::matchSize (_pInImg3d,_pOutRealImg) && 
ipsdk::imaproc::matchImagePlans (_pOutPIPatchBasedBilateralParams,_pInImg3d,eImagePlansMatchPolicy::eIPMP_CT) && 
ipsdk::processor::ifIsSet (_pInOptPIPatchBasedBilateralParams,
 ipsdk::imaproc::matchImagePlans (_pInOptPIPatchBasedBilateralParams,_pInImg3d,eImagePlansMatchPolicy::eIPMP_CT)) && 
(ipsdk::processor::ifIsSet (
  _pOutOptWk1RealImg, (
   ipsdk::imaproc::matchSize (_pInImg3d,_pOutOptWk1RealImg)) && 
  (ipsdk::imaproc::noInSitu (_pInImg3d,_pOutOptWk1RealImg)) && 
  (ipsdk::imaproc::noInSitu (_pOutRealImg,_pOutOptWk1RealImg)))) && 
(ipsdk::processor::ifIsSet (
  _pOutOptWk2RealImg, (
   ipsdk::imaproc::matchSize (_pInImg3d,_pOutOptWk2RealImg)) && 
  (ipsdk::imaproc::noInSitu (_pInImg3d,_pOutOptWk2RealImg)) && 
  (ipsdk::imaproc::noInSitu (_pOutRealImg,_pOutOptWk2RealImg))))

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLFiltering as filter
import PyIPSDK.IPSDKIPLUtility as util

Code Example

# opening of input images
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
inImg = util.convertImg(inImg, PyIPSDK.eImageBufferType.eIBT_Real32)
# patch-based bilateral filter 3d computation
outImg, autoParams = filter.patchBasedBilateral3dImg(inImg)

Example of C++ code :

Example informations

Associated library

IPSDKIPLFiltering

Header file

Code Example

// definition of a custom output geometry
ImageGeometryPtr pOutImageGeometry =
geometry3d(eImageBufferType::eIBT_Real32,
pInImg->getSizeX(),
pInImg->getSizeY(),
pInImg->getSizeZ());
// creation of output image
boost::shared_ptr<MemoryImage> pOutImg = boost::make_shared<MemoryImage>();
pOutImg->init(*pOutImageGeometry);
// compute patch-based bilateral filter on input image (output image was allocated by the user)
pInImg,
createPatchBasedBilateralParams(inPatchHalfSize, inKernelRadius, inPatchSimilaritySigma, inSpaceSigma, inNoiseSigma),
pOutImg);
See also
PatchBasedBilateral3dImgLvl1
PatchBasedBilateral3dImgLvl2
PatchBasedBilateral3dImgLvl3

Function Documentation

◆ patchBasedBilateral3dImg() [1/4]

IPSDKIPLFILTERING_API PatchBasedBilateralResult ipsdk::imaproc::filter::patchBasedBilateral3dImg ( const image::ImageConstPtr pInImg)

wrapper function for patch-based bilateral filter used to denoise a 3d image

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ patchBasedBilateral3dImg() [2/4]

IPSDKIPLFILTERING_API attr::PatchBasedBilateralParamsPtr ipsdk::imaproc::filter::patchBasedBilateral3dImg ( const image::ImageConstPtr pInImg,
const image::ImagePtr pOutImg 
)

wrapper function for patch-based bilateral filter used to denoise a 3d image

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ patchBasedBilateral3dImg() [3/4]

IPSDKIPLFILTERING_API PatchBasedBilateralResult ipsdk::imaproc::filter::patchBasedBilateral3dImg ( const image::ImageConstPtr pInImg,
const ipsdk::imaproc::attr::PatchBasedBilateralParamsConstPtr pParams 
)

wrapper function for patch-based bilateral filter used to denoise a 3d image

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ patchBasedBilateral3dImg() [4/4]

IPSDKIPLFILTERING_API attr::PatchBasedBilateralParamsPtr ipsdk::imaproc::filter::patchBasedBilateral3dImg ( const image::ImageConstPtr pInImg,
const ipsdk::imaproc::attr::PatchBasedBilateralParamsConstPtr pParams,
const image::ImagePtr pOutImg 
)

wrapper function for patch-based bilateral filter used to denoise a 3d image

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ multiSlice_patchBasedBilateral3dImg() [1/4]

IPSDKIPLFILTERING_API attr::PlanIndexedPatchBasedBilateralParamsPtr ipsdk::imaproc::filter::multiSlice_patchBasedBilateral3dImg ( const image::ImageConstPtr pInImg,
const image::ImagePtr pOutImg 
)

wrapper function for patch-based bilateral filter used to denoise a 3d image

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ multiSlice_patchBasedBilateral3dImg() [2/4]

IPSDKIPLFILTERING_API attr::PlanIndexedPatchBasedBilateralParamsPtr ipsdk::imaproc::filter::multiSlice_patchBasedBilateral3dImg ( const image::ImageConstPtr pInImg,
const attr::PlanIndexedPatchBasedBilateralParamsConstPtr pPIParams,
const image::ImagePtr pOutImg 
)

wrapper function for patch-based bilateral filter used to denoise a 3d image

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ multiSlice_patchBasedBilateral3dImg() [3/4]

IPSDKIPLFILTERING_API attr::PlanIndexedPatchBasedBilateralParamsPtr ipsdk::imaproc::filter::multiSlice_patchBasedBilateral3dImg ( const image::ImageConstPtr pInImg,
const ipsdk::ipReal64  noiseSigma,
const image::ImagePtr pOutImg 
)

wrapper function for patch-based bilateral filter used to denoise a 3d image

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ multiSlice_patchBasedBilateral3dImg() [4/4]

IPSDKIPLFILTERING_API attr::PlanIndexedPatchBasedBilateralParamsPtr ipsdk::imaproc::filter::multiSlice_patchBasedBilateral3dImg ( const image::ImageConstPtr pInImg,
const ipsdk::ipReal64  noiseSigma,
const ipsdk::ipReal64  minRange,
const ipsdk::ipReal64  maxRange,
const image::ImagePtr pOutImg 
)

wrapper function for patch-based bilateral filter used to denoise a 3d image

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure