IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit

removal of small connected component in binary or label 2d image More...

IPSDKIPLADVANCEDMORPHOLOGY_API image::ImagePtr ipsdk::imaproc::advmorpho::removeSmallShape2dImg (const image::ImageConstPtr &pInBinLabImg, const ipUInt64 inMinShapeSize)
 wrapper function for removal of small connected component in binary or label 2d image More...
 
IPSDKIPLADVANCEDMORPHOLOGY_API void ipsdk::imaproc::advmorpho::removeSmallShape2dImg (const image::ImageConstPtr &pInBinLabImg, const ipUInt64 inMinShapeSize, const image::ImagePtr &pOutImg)
 wrapper function for removal of small connected component in binary or label 2d image More...
 

Detailed Description

removal of small connected component in binary or label 2d image

This algorithm allows to remove connected components into a binary or label 2d input image associated to a number of pixels lower than a given input threshold value InMinShapeSize.

Output result image OutImg has same type as input image InBinLabImg. This means that an input binary image will produce an output binary image and that an input label image will produce an output label image. Note that in label case, input labels index are reordered to fill index list holes created by shape filtering.

Here is an example of small connected component removal on an image 2d :

removeSmallShape2dImg.png

Attributes description

Attribute description for algorithm :

Name ToolTip Default Initializer
ipsdk::imaproc::attr::InBinLabImg [Input] binary or label image for processing operation X
ipsdk::imaproc::attr::InMinShapeSize [Input] size of shape for processing operation X
ipsdk::imaproc::attr::OutOptWk1LabelImg [Output Optional] Temporary working image for algorithm X
ipsdk::imaproc::attr::OutImg [Output] image for processing operation duplicateInOut (_pOutImg, _pInBinLabImg)

Global Rule description

Global rule description for algorithm :
((ipsdk::imaproc::matchSizeAndType (_pInBinLabImg,_pOutImg)) && 
 (ipsdk::processor::ifIsSet (
   _pOutOptWk1LabelImg, (
    ipsdk::imaproc::matchSize (_pInBinLabImg,_pOutOptWk1LabelImg)))))

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLAdvancedMorphology as advmorpho

Code Example

# opening of input image
inBinImg = PyIPSDK.loadTiffImageFile(inputImgPath)
# connected component analysis
labImg = advmorpho.connectedComponent2dImg(inBinImg)
# compute small shape removal on input image
# note: algorithm can also be used with input binary image
outImg = advmorpho.removeSmallShape2dImg(labImg, 500)

Example of C++ code :

Example informations

Associated library

IPSDKIPLAdvancedMorphology

Header file

Code Example

// opening input image
ImagePtr pInBinImg = loadTiffImageFile(inputImgPath);
// compute small shape removal on input image
// note: algorithm can also be used with input label image
ImagePtr pOutImg = removeSmallShape2dImg(pInBinImg, 500);
See also
RemoveSmallShape2dImgLvl1
RemoveSmallShape2dImgLvl2

Function Documentation

◆ removeSmallShape2dImg() [1/2]

IPSDKIPLADVANCEDMORPHOLOGY_API image::ImagePtr ipsdk::imaproc::advmorpho::removeSmallShape2dImg ( const image::ImageConstPtr pInBinLabImg,
const ipUInt64  inMinShapeSize 
)

wrapper function for removal of small connected component in binary or label 2d image

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ removeSmallShape2dImg() [2/2]

IPSDKIPLADVANCEDMORPHOLOGY_API void ipsdk::imaproc::advmorpho::removeSmallShape2dImg ( const image::ImageConstPtr pInBinLabImg,
const ipUInt64  inMinShapeSize,
const image::ImagePtr pOutImg 
)

wrapper function for removal of small connected component in binary or label 2d image

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure