IPSDK 4.1.0.2
IPSDK : Image Processing Software Development Kit
Kernel Density Estimator 3d
KDEDataSetkernelDensityEstimator3d (inImg3d)
KDEDataSetkernelDensityEstimator3d (inImg3d,inOptKDENbSamples,inOptKDEBandwidthPolicy)

Detailed Description

algorithm allowing to estimate probability density function of a 3d image

This algorithm allows to estimate the probability density function associated to the grey level population of a 3d image. This algorithm is also known as Parzen Rosenblatt window method.

Given an input 3d image InImg3d, the algorithm samples InOptKDENbSamples image values and build an ouput 'by plan' kernel density estimator object OutPIKDEDataSet.

The kernel density estimator bandwidth parameter value is computed with respect to the InOptKDEBandwidthPolicy parameter value.

Given a collection of image samples ${x_i}, i\in [0, N[$ and $h$ a bandwith for density estimation, image density $\hat{f}_h(x)$ is estimated for a given grey level $x$ as :

\[ \hat{f}_h(x)=\frac{1}{N\times h}\sum_{i=0}^{N}{K\left (\frac{x-x_i}{h}\right)} \]

where kernel function $K()$ is the zero mean and unit standard deviation gaussian function given by :

\[ K(x)=\frac{1}{\sqrt{2\pi}}e^{-\frac{1}{2}x^2} \]

See Kernel Density Estimator 2d for an example of kernel density estimation computation in 2d case.

See also
https://en.wikipedia.org/wiki/Kernel_density_estimation

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLGlobalMeasure as glbmsr

Code Example

# opening of input image
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
nbTotPixels = inImg.getGeometry().getNbPixels()
# computation of kernel density estimation
kdeDataSet = glbmsr.kernelDensityEstimator3d(inImg)
# extraction of associated histogram
binMin = 0
binMax = 65535
binWidth = 512
estimHisto = PyIPSDK.generateHistogram(kdeDataSet,
binMin, binMax, binWidth,
nbTotPixels)

Example of C++ code :

Example informations

Header file

#include <IPSDKIPL/IPSDKIPLGlobalMeasure/Processor/KernelDensityEstimator3d/KernelDensityEstimator3d.h>

Code Example

// Load the input image
ImagePtr pInImg = loadTiffImageFile(inImgFilePath);
const ipUInt64 nbTotPixels = pInImg->getGeometry().getNbPixels();
// computation of kernel density estimation
KDEDataSetPtr pKDEDataSet = kernelDensityEstimator3d(pInImg);
// extraction of associated histogram
const ipReal64 binMin = 0;
const ipReal64 binMax = 65535;
const ipReal64 binWidth = 512;
HistogramDataPtr pEstimHisto = generateHistogram(*pKDEDataSet,
binMin, binMax, binWidth,
nbTotPixels);