IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit

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

IPSDKIPLINTENSITYTRANSFORM_API image::ImagePtr ipsdk::imaproc::itrans::compactIndexImg (const image::ImageConstPtr &pInImg)
 wrapper function for Re-indexes the labels (or class indices) in order to use a minimum range of values More...
 
IPSDKIPLINTENSITYTRANSFORM_API void ipsdk::imaproc::itrans::compactIndexImg (const image::ImageConstPtr &pInImg, const image::ImagePtr &pOutImg)
 wrapper function for Re-indexes the labels (or class indices) in order to use a minimum range of values More...
 

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

Attributes description

Attribute description for algorithm :

Name ToolTip Default Initializer
ipsdk::imaproc::attr::InLabClassImg [Input] Image containing labels or class indices X
ipsdk::imaproc::attr::OutLabClassImg [Output] Image containing labels or class indices ipsdk::imaproc::duplicateInOut (_pOutLabClassImg, _pInLabClassImg)

Global Rule description

Global rule description for algorithm :
ipsdk::imaproc::matchSizeAndType (_pInLabClassImg,_pOutLabClassImg)

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

Associated library

IPSDKIPLIntensityTransform

Header file

Code Example

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

Function Documentation

◆ compactIndexImg() [1/2]

IPSDKIPLINTENSITYTRANSFORM_API image::ImagePtr ipsdk::imaproc::itrans::compactIndexImg ( const image::ImageConstPtr pInImg)

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

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ compactIndexImg() [2/2]

IPSDKIPLINTENSITYTRANSFORM_API void ipsdk::imaproc::itrans::compactIndexImg ( const image::ImageConstPtr pInImg,
const image::ImagePtr pOutImg 
)

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

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure