IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit

Computes the Normalized Cross Correlation between a volume and a 3d kernel. More...

IPSDKIPLFILTERING_API image::ImagePtr ipsdk::imaproc::filter::normalizedCrossCorrelation3dImg (const image::ImageConstPtr &pInImg3d, const KernelXYZConstPtr &pInKnlXYZ)
 wrapper function for Computes the Normalized Cross Correlation between a volume and a 3d kernel More...
 
IPSDKIPLFILTERING_API void ipsdk::imaproc::filter::normalizedCrossCorrelation3dImg (const image::ImageConstPtr &pInImg3d, const KernelXYZConstPtr &pInKnlXYZ, const image::ImagePtr &pOutRealImg)
 wrapper function for Computes the Normalized Cross Correlation between a volume and a 3d kernel More...
 
IPSDKIPLFILTERING_API image::ImagePtr ipsdk::imaproc::filter::normalizedCrossCorrelation3dImg (const image::ImageConstPtr &pInImg3d, const image::ImageConstPtr &pInKnlImg3d)
 wrapper function for Computes the Normalized Cross Correlation between a volume and a 3d kernel More...
 
IPSDKIPLFILTERING_API void ipsdk::imaproc::filter::normalizedCrossCorrelation3dImg (const image::ImageConstPtr &pInImg3d, const image::ImageConstPtr &pInKnlImg3d, const image::ImagePtr &pOutRealImg)
 wrapper function for Computes the Normalized Cross Correlation between a volume and a 3d kernel More...
 

Detailed Description

Computes the Normalized Cross Correlation between a volume and a 3d kernel.

The three dimensional Normalized Cross-Correlation (NCC) between a volume $ InImg3d $ and a template $ InKnlXYZ $ is the 3d extension of the 2d Normalized Cross-Correlation. It is defined in spatial domain as follows :

\[ NCC(InImg3d(\textbf{x}), InKnlXYZ) = \frac{\sum \limits_{\textbf{i $ \in \aleph_{\textbf{x}}$}}{ \left( InImg3d(\textbf{x}) - \overline{InImg3d} \right) \left( InKnlXYZ(\textbf{x}+\textbf{i}) - \overline{InKnlXYZ} \right) }} {\sqrt{ \sum \limits_{\textbf{i $ \in \aleph_{\textbf{x}}$}} { \left( InImg3d(\textbf{x}) - \overline{InImg3d} \right)^2} \sum \limits_{\textbf{i $ \in \aleph_{\textbf{x}}$}} { \left( InKnlXYZ(\textbf{x}+\textbf{i}) - \overline{InKnlXYZ} \right)^2}}} \]

Where $ \textbf{x} = \left[ x, y, z \right]^T $ represents the coordinates of a voxel, $ \overline{InImg3d} $ is the mean of $ InImg3d $ in the neighbourhood defined by the kernel and $ \overline{InKnlXYZ} $ is the mean of $ InKnlXYZ $.

See Normalized Cross-Correlation 2d for an illustration of a 2d normalized cross-correlation result.

See also
http://en.wikipedia.org/wiki/Cross-correlation
Note
It is possible to call the NCC with an image provided as a template, nevertheless the algorithm still internally calculates and uses a kernel. These functions are ment to simplify the use of the function but it means that the data are copied in memory.

Attributes description

Attribute description for algorithm :

Name ToolTip Default Initializer
ipsdk::imaproc::attr::InImg3d [Input] 3d image for operation X
ipsdk::imaproc::attr::InKnlXYZ [Input] kernel xyz for processing operation 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)

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLFiltering as filter

Code Example

# opening of input images
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
# create a processing kernel
inKnl = PyIPSDK.rectangularKernelXYZ(1, 2, 1, [1, 1, 1,
1, 1, 1,
1, 1, 1,
1, 1, 1,
1, 1, 1,
1, 1, 1,
1, 1, 1,
1, 0, 1,
1, 1, 1,
1, 1, 1,
1, 1, 1,
1, 1, 1,
1, 1, 1,
1, 1, 1,
1, 1, 1],
True)
# normalized cross correlation 3d computation
outImg = filter.normalizedCrossCorrelation3dImg(inImg, inKnl)

Example of C++ code :

Example informations

Associated library

IPSDKIPLFiltering

Header file

Code Example

// Compute the NCC
ImagePtr pOutNCCImg = normalizedCrossCorrelation3dImg(pImg, pKernel);
See also
NormalizedCrossCorrelation3dImgLvl1
NormalizedCrossCorrelation3dImgLvl2
NormalizedCrossCorrelation3dImgLvl3

Function Documentation

◆ normalizedCrossCorrelation3dImg() [1/4]

IPSDKIPLFILTERING_API image::ImagePtr ipsdk::imaproc::filter::normalizedCrossCorrelation3dImg ( const image::ImageConstPtr pInImg3d,
const KernelXYZConstPtr pInKnlXYZ 
)

wrapper function for Computes the Normalized Cross Correlation between a volume and a 3d kernel

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ normalizedCrossCorrelation3dImg() [2/4]

IPSDKIPLFILTERING_API void ipsdk::imaproc::filter::normalizedCrossCorrelation3dImg ( const image::ImageConstPtr pInImg3d,
const KernelXYZConstPtr pInKnlXYZ,
const image::ImagePtr pOutRealImg 
)

wrapper function for Computes the Normalized Cross Correlation between a volume and a 3d kernel

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ normalizedCrossCorrelation3dImg() [3/4]

IPSDKIPLFILTERING_API image::ImagePtr ipsdk::imaproc::filter::normalizedCrossCorrelation3dImg ( const image::ImageConstPtr pInImg3d,
const image::ImageConstPtr pInKnlImg3d 
)

wrapper function for Computes the Normalized Cross Correlation between a volume and a 3d kernel

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ normalizedCrossCorrelation3dImg() [4/4]

IPSDKIPLFILTERING_API void ipsdk::imaproc::filter::normalizedCrossCorrelation3dImg ( const image::ImageConstPtr pInImg3d,
const image::ImageConstPtr pInKnlImg3d,
const image::ImagePtr pOutRealImg 
)

wrapper function for Computes the Normalized Cross Correlation between a volume and a 3d kernel

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure