image = | shapeToLabel2dImg (inLabelsShape2d) |
image = | shapeToLabel2dImg (inPILabelsShape2d) |
algorithm allowing to create a label 2d image from a collection of shape
This algorithm allows to re-create a label image (Connected Component 2d) from a shape 2d image. Shape intersection with image rows are set with respect to shape label.
- Note
- if some shape intersect, intersection pixels are set to highest label value.
Here is an example of a shape to label 2d image operation :
Example of Python code :
Example imports
import PyIPSDK
import PyIPSDK.IPSDKIPLAdvancedMorphology as advmorpho
import PyIPSDK.IPSDKIPLShapeSegmentation as shapesegmentation
Code Example
inImg = PyIPSDK.loadTiffImageFile(inputImgPath,
PyIPSDK.eTiffDirectoryMode.eTDM_Volume,
PyIPSDK.eTiffBufferMode.eTBM_Binary)
inLabelImg2d = advmorpho.connectedComponent2dImg(inImg)
outShape2dColl = shapesegmentation.labelShapeExtraction2d(inLabelImg2d)
outLabelImg = shapesegmentation.shapeToLabel2dImg(outShape2dColl);
Example of C++ code :
Example informations
Header file
#include <IPSDKIPL/IPSDKIPLShapeSegmentation/Processor/ShapeToLabel2dImg/ShapeToLabel2dImg.h>
Code Example
eTiffDirectoryMode::eTDM_Volume,
eTiffBufferMode::eTBM_Binary);
ImagePtr pOutLabelImg = shapeToLabel2dImg(pShape2dColl);