IPSDK 4.1.0.2
IPSDK : Image Processing Software Development Kit
Image dimensionality reduction using PCA
outImg,eigenValues,eigenVectors,matrixRankpcaReductionImg (inSeqImg)
outImg,eigenValues,eigenVectors,matrixRankpcaReductionImg (inSeqImg,params)
outImg,eigenValues,eigenVectors,matrixRankpcaReductionImg (inSeqImg,outImg)
outImg,eigenValues,eigenVectors,matrixRankpcaReductionMaskImg (inSeqImg,inOptSingleGreyMaskImg)
outImg,eigenValues,eigenVectors,matrixRankpcaReductionMaskImg (inSeqImg,params,inOptSingleGreyMaskImg)
outImg,eigenValues,eigenVectors,matrixRankpcaReductionMaskImg (inSeqImg,inOptSingleGreyMaskImg,outImg)

Detailed Description

Applies PCA to a sequence image to reduce its dimensionality.

The primary function of this algorithm is to reduce the temporal dimensionality of an input image (whose sequence elements are assumed to be 0-meaned and have a standard deviation of 1), while preserving the most significant part of information of it. To do that, first the image is reinterpreted as a matrix M with imgSizeC*imgSizeT rows and imgSizeX*imgSizeY*imgSizeZ columns. Each row is made of the pixel values of a sequence element of the input sequence of images.

A principal component analysis is then applied on this matrix M. It consists in:

The number of largest eigen values retained cannot exceed the number of rows of the matrix, ie. the temporal size multiplied by the number of color channels of the input image. There are several ways for the user to choose the number of the largest eigen values retained (ie. the temporal dimensionality of the output image), depending on the value of InOptPCAReductionParams attribute:

The different signatures of the $ pcaReductionImg $ wrapper functions all return the results in a PCAReductionResults structure, that contains:

Note
It is possible to use only a subet of data, this is done by providing an additional mask image to the algorithm. In this case, the data where the mask equals True are used.

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLClassification as classif

Code Example

# opening of input image
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
outImg, outEigenValues, outEigenVectors, outMatrixRank = classif.pcaReductionImg(inImg)

Example of C++ code :

Example informations

Header file

#include <IPSDKIPL/IPSDKIPLClassification/Processor/PCAReductionImg/PCAReductionImg.h>

Code Example

// load input image from file
ImagePtr pInImg = loadTiffImageFile(inputImgPath);
// apply PCA reduction algorithm on input image; we only keep the first principal
// sequence elements, that satisfy the variance threshold criterion, with a variance
// threshold that equals to 0.9
PCAReductionResults res = pcaReductionImg(pInImg, attr::createVarianceThresholdForPCAReduction(0.9f));
// retrieve resulting reduced image
ImagePtr pOutImg = res._pOutImg;