image = | connectedComponent3dImg (inBinLabImg3d) |
image = | connectedComponent3dImg (inBinLabImg3d,inOptNeighborhood3d) |
scalar = | connectedComponent3dImg (inBinLabImg3d,inOptNeighborhood3d,outLabelImg3d) |
Connected component image 3d labeling algorithm.
Connected component labeling algorithm allows to uniquely labeled subsets of connected components with respect to a given neighborhood policy.
Output labels start with 1 and are consecutive with respect to scanning order (from lower x then y then z to higher).
For more informations on used neighborhood 3d types report to 3d neighborhood models.
Resulting image buffer type must be one of the following :
- ipsdk::image::eImageBufferType::eIBT_Label16
- ipsdk::image::eImageBufferType::eIBT_Label32
Here is an example of connected component extraction operation applied to a binary input image (with 26 connexity neighborhood type) :
The algorithm also allows to relabel a label image. This way all connected component will be assigned to a unique label.
Please, see Connected Component 2d for an illustration of relabeling in a 2d case.
- Note
- Last wrapper function returns number of extracted connected components (unique labels).
-
If number of extracted connected components exceed output image data type capacity (case of a number of connected components greater than 65535 and an output image associated to a ipsdk::image::eImageBufferType::eIBT_Label16 data type), output image data type is automatically upgraded to ipsdk::image::eImageBufferType::eIBT_Label32.
- See also
- http://en.wikipedia.org/wiki/Connected-component_labeling
Example of Python code :
Example imports
import PyIPSDK
import PyIPSDK.IPSDKIPLAdvancedMorphology as advmorpho
Code Example
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
outImg = advmorpho.connectedComponent3dImg(inImg)
Example of C++ code :
Example informations
Header file
#include <IPSDKIPL/IPSDKIPLAdvancedMorphology/Processor/ConnectedComponent3dImg/ConnectedComponent3dImg.h>
Code Example
ImagePtr pOutLabelImg3d = connectedComponent3dImg(pInBinLabImg3d);