IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit

Smooth an input 3d image computing local mean of pixels. More...

IPSDKIPLFILTERING_API image::ImagePtr ipsdk::imaproc::filter::meanSmoothing3dImg (const image::ImageConstPtr &pInImg3d, const ipUInt32 inHalfKnlSizeX, const ipUInt32 inHalfKnlSizeY, const ipUInt32 inHalfKnlSizeZ)
 wrapper function for Mean filter used to blur a 3d image More...
 
IPSDKIPLFILTERING_API void ipsdk::imaproc::filter::meanSmoothing3dImg (const image::ImageConstPtr &pInImg3d, const ipUInt32 inHalfKnlSizeX, const ipUInt32 inHalfKnlSizeY, const ipUInt32 inHalfKnlSizeZ, const image::ImagePtr &pOutImg)
 wrapper function for Mean filter used to blur a 3d image More...
 

Detailed Description

Smooth an input 3d image computing local mean of pixels.

This low-pass 3d filter, also none as "box blur filter" or "box linear filter", computes for each pixel the average value of its neighboring pixels.

On output image values are given by:

\[ OutImg[x, y, z] = \dfrac{\sum_{o_z=-n_z}^{n_z}{\sum_{o_y=-n_y}^{n_y}{\sum_{o_x=-n_x}^{n_x}{InImg[x+o_x, y+o_y, z+o_z]}}}}{(2n_x+1)(2n_y+1)(2n_z+1)} \]

where :

Input and output images must have same size.

Here is an example of a Mean smoothing operation applied to an 8-bits grey levels input image (with $InHalfKnlSizeX=InHalfKnlSizeY=InHalfKnlSizeZ=7$) :

meanSmoothing3d.png
See also
http://en.wikipedia.org/wiki/Box_blur

Attributes description

Attribute description for algorithm :

Name ToolTip Default Initializer
ipsdk::imaproc::attr::InImg3d [Input] 3d image for operation X
ipsdk::imaproc::attr::InHalfKnlSizeX [Input] half kernel size along X axis for operation X
ipsdk::imaproc::attr::InHalfKnlSizeY [Input] half kernel size along Y axis for operation X
ipsdk::imaproc::attr::InHalfKnlSizeZ [Input] half kernel size along Z axis for operation X
ipsdk::imaproc::attr::OutImg [Output] image for processing operation ipsdk::imaproc::duplicateInOut (_pOutImg, _pInImg3d)

Global Rule description

Global rule description for algorithm :
ipsdk::imaproc::matchSize (_pInImg3d,_pOutImg)

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLFiltering as filter

Code Example

# opening of input images
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
# mean smoothing filter 3d computation
outImg = filter.meanSmoothing3dImg(inImg, 3, 3, 3)

Example of C++ code :

Example informations

Associated library

IPSDKIPLFiltering

Header file

Code Example

// opening input image
ImageGeometryPtr pImageGeometry = geometry3d(imageBufferType, sizeX, sizeY, sizeZ);
boost::shared_ptr<MemoryImage> pInImg(boost::make_shared<MemoryImage>());
pInImg->init(*pImageGeometry);
// we use a customized randomImg function, instead of the IPSDK randomImg algorithm that
// can be found in IPSDKIPLUtility, because we want that the content of the generated random image
// is always the same each time the application is executed
randomImg(0, 0, 150, pInImg);
// compute gaussian smoothing on input image
ImagePtr pOutImg = meanSmoothing3dImg(pInImg, inHalfKnlSizeX, inHalfKnlSizeY, inHalfKnlSizeZ);
See also
MeanSmoothing3dImgLvl1
MeanSmoothing3dImgLvl2

Function Documentation

◆ meanSmoothing3dImg() [1/2]

IPSDKIPLFILTERING_API image::ImagePtr ipsdk::imaproc::filter::meanSmoothing3dImg ( const image::ImageConstPtr pInImg3d,
const ipUInt32  inHalfKnlSizeX,
const ipUInt32  inHalfKnlSizeY,
const ipUInt32  inHalfKnlSizeZ 
)

wrapper function for Mean filter used to blur a 3d image

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ meanSmoothing3dImg() [2/2]

IPSDKIPLFILTERING_API void ipsdk::imaproc::filter::meanSmoothing3dImg ( const image::ImageConstPtr pInImg3d,
const ipUInt32  inHalfKnlSizeX,
const ipUInt32  inHalfKnlSizeY,
const ipUInt32  inHalfKnlSizeZ,
const image::ImagePtr pOutImg 
)

wrapper function for Mean filter used to blur a 3d image

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure