IPSDK 4.1
IPSDK : Image Processing Software Development Kit
Variance 3d
imagevariance3dImg (inImg3d,inHalfKnlSizeX,inHalfKnlSizeY,inHalfKnlSizeZ)

Detailed Description

local 3d image variance computation

This algorithm computes for each pixel of output image associated local variance on a parallelepipedic neighbourhood of input image.

Given an input image $InImg$ and parallelepipedic kernel half sizes $ N_x = InHalfKnlSizeX$, $ N_y = InHalfKnlSizeY $ and $ N_z = InHalfKnlSizeZ $, output image values are given by :

\[ OutImg[x, y, z] = \dfrac{1}{(2 N_z + 1)(2 N_y + 1)(2 N_x + 1)} \sum_{o_{z}=-N_z}^{N_z}{\sum_{o_{y}=-N_y}^{N_y}{\sum_{o_{x}=N_x}^{N_x}{(InImg[x, y, z]-\bar{M}[x, y, z])^2}}} \]

where

\[ \bar{M}[x, y, z] = \dfrac{1}{(2 N_z + 1)(2 N_y + 1)(2 N_x + 1)}\sum_{o_{z}=-N_z}^{N_z}{\sum_{o_{y}=-N_y}^{N_y}{\sum_{o_{x}=N_x}^{N_x}{InImg[x, y, z]}}} \]

See also
http://en.wikipedia.org/wiki/Variance

Here is an example of a Variance computation applied on a 8 bits grey level image with $InHalfKnlSizeX = InHalfKnlSizeY = InHalfKnlSizeZ = 7$:

variance3dImg.png

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLStats as stats

Code Example

# opening of input image
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
# variance 3d image computation
outImg = stats.variance3dImg(inImg, 3, 3, 3)

Example of C++ code :

Example informations

Header file

#include <IPSDKIPL/IPSDKIPLStats/Processor/Variance3dImg/Variance3dImg.h>

Code Example

// compute variance on input image
ImagePtr pOutImg = variance3dImg(pInImg, inHalfKnlSizeX, inHalfKnlSizeY, inHalfKnlSizeZ);