IPSDK 0.2
IPSDK : Image Processing Software Development Kit
Index CompactingSee full documentation
imagecompactIndexImg (inImg)

Detailed Description

Re-indexes the labels (or class indices) in order to use a minimum range of values.

The CompactIndexImg algorithm can be used when some values are missing in a label or a class image. Its purpose is to assign new values to each pixel/voxel in order to reduce the image range.

The figure below shows the result of the algorithm on a label image where the shapes 3 and 4 have been removed (top-left). The result is a label image with reindexed labels : the shapes 5 becomes 3 and the new index of the shape 6 is 4. The bottom line displays the corresponding histograms.

compactIndexImg.png

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLIntensityTransform as itrans

Code Example

# opening of input image
inLabClassImg = PyIPSDK.loadTiffImageFile(inputImgPath)
# reindexation
outImg = itrans.compactIndexImg(inLabClassImg)

Example of C++ code :

Example informations

Header file

#include <IPSDKIPL/IPSDKIPLIntensityTransform/Processor/CompactIndexImg/CompactIndexImg.h>

Code Example

// opening input image
ImagePtr pInImg = loadTiffImageFile(inputImgPath);
// Reindex the labels/classes
ImagePtr pOutImg = compactIndexImg(pInImg);