IPSDK 0.2
IPSDK : Image Processing Software Development Kit
Mean Smoothing 3dSee full documentation
imagemeanSmoothing3dImg (inImg3d,inHalfKnlSizeX,inHalfKnlSizeY,inHalfKnlSizeZ)

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

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

Header file

#include <IPSDKIPL/IPSDKIPLFiltering/Processor/MeanSmoothing3dImg/MeanSmoothing3dImg.h>

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);