IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit

shape extraction from label 2d image algorithm More...

IPSDKIPLSHAPESEGMENTATION_API ipsdk::shape::segmentation::Shape2dCollPtr ipsdk::imaproc::shape::segmentation::labelShapeExtraction2d (const ipsdk::image::ImageConstPtr &pInLabelImg)
 wrapper function for shape extraction from label 2d image algorithm More...
 
IPSDKIPLSHAPESEGMENTATION_API ipsdk::shape::segmentation::Shape2dCollPtr ipsdk::imaproc::shape::segmentation::labelShapeExtraction2d (const ipsdk::image::ImageConstPtr &pInLabelImg, const ipsdk::imaproc::attr::ContourExtractionSettingsConstPtr &pInOptContourExtractionSettings)
 wrapper function for shape extraction from label 2d image algorithm More...
 
IPSDKIPLSHAPESEGMENTATION_API ipsdk::shape::segmentation::PlanIndexedShape2dCollPtr ipsdk::imaproc::shape::segmentation::multiSlice_labelShapeExtraction2d (const ipsdk::image::ImageConstPtr &pInLabelImg)
 wrapper function for shape extraction from label 2d image algorithm More...
 
IPSDKIPLSHAPESEGMENTATION_API ipsdk::shape::segmentation::PlanIndexedShape2dCollPtr ipsdk::imaproc::shape::segmentation::multiSlice_labelShapeExtraction2d (const ipsdk::image::ImageConstPtr &pInLabelImg, const ipsdk::imaproc::attr::ContourExtractionSettingsConstPtr &pInOptContourExtractionSettings)
 wrapper function for shape extraction from label 2d image algorithm More...
 

Detailed Description

shape extraction from label 2d image algorithm

This algorithm allows to extract shapes from a label (Connected Component 2d) input 2d image. These contours are stored into a collection of shape 2d objets (ipsdk::geom::Shape2d) indexed by their label.

Each shape is define with respect to a neighborhood 2d policy and can be optionally simplified by a polygonal approximation algorithm.

Four options allow to control processing (See ContourExtractionSettings) :

In a standard case where input label image is obtained using IPSDK connected component 2d algorithm, a given label index will be associated to a single shape (used neighborhood 2d type should be the same for connected component 2d and for label shape extraction 2d operations).

In some other cases a given label index may be associated to several "unconnected" components. In this case a label index may be associated to several shapes.

Here is an example of a label shape extraction 2d operation applied to a label input image composed of a single connected component :

Here is an other example of a label shape extraction 2d operation applied to a label input image composed of a single connected component with a hole :

labelShapeExtraction2d3.png

Attributes description

Attribute description for algorithm :

Name ToolTip Default Initializer
ipsdk::imaproc::attr::InLabelImg [Input] label image for processing operation X
ipsdk::imaproc::attr::InOptContourExtractionSettings [Input Optional] Settings used for contours extraction X
ipsdk::imaproc::attr::OutPILabelsShape2d [Output] Plan indexed collection of shape 2d associated to labels ipsdk::imaproc::fromImage (_pOutPILabelsShape2d, _pInLabelImg)

Global Rule description

Global rule description for algorithm :
ipsdk::imaproc::matchImagePlans (_pOutPILabelsShape2d,_pInLabelImg)

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLAdvancedMorphology as advmorpho
import PyIPSDK.IPSDKIPLShapeSegmentation as shapesegmentation

Code Example

# opening of input image
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
# connected components analysis
inLabelImg2d = advmorpho.connectedComponent2dImg(inImg)
# label contour extraction computation
outShape2dColl = shapesegmentation.labelShapeExtraction2d(inLabelImg2d)

Example of C++ code :

Example informations

Associated library

IPSDKIPLShapeSegmentation

Header file

Code Example

// opening input image
ImagePtr pInBinImg2d = loadTiffImageFile(inputBinImgPath);
// connected components analysis
ImagePtr pInLabelImg2d = connectedComponent2dImg(pInBinImg2d, pContourExtractionSettings->getValue<ContourExtractionSettings::Neighborhood2dType>());
// extract contours from connected component (label) image
Shape2dCollPtr pShape2dColl = labelShapeExtraction2d(pInLabelImg2d, pContourExtractionSettings);
See also
LabelShapeExtraction2dLvl1
LabelShapeExtraction2dLvl2

Function Documentation

◆ labelShapeExtraction2d() [1/2]

IPSDKIPLSHAPESEGMENTATION_API ipsdk::shape::segmentation::Shape2dCollPtr ipsdk::imaproc::shape::segmentation::labelShapeExtraction2d ( const ipsdk::image::ImageConstPtr pInLabelImg)

wrapper function for shape extraction from label 2d image algorithm

Note
This wrapper must be used with mono slice (sizeZ=sizeC=sizeT=1) input images
Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ multiSlice_labelShapeExtraction2d() [1/2]

IPSDKIPLSHAPESEGMENTATION_API ipsdk::shape::segmentation::PlanIndexedShape2dCollPtr ipsdk::imaproc::shape::segmentation::multiSlice_labelShapeExtraction2d ( const ipsdk::image::ImageConstPtr pInLabelImg)

wrapper function for shape extraction from label 2d image algorithm

Note
This wrapper can be used with multi slice input images
Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ labelShapeExtraction2d() [2/2]

IPSDKIPLSHAPESEGMENTATION_API ipsdk::shape::segmentation::Shape2dCollPtr ipsdk::imaproc::shape::segmentation::labelShapeExtraction2d ( const ipsdk::image::ImageConstPtr pInLabelImg,
const ipsdk::imaproc::attr::ContourExtractionSettingsConstPtr pInOptContourExtractionSettings 
)

wrapper function for shape extraction from label 2d image algorithm

Note
This wrapper must be used with mono slice (sizeZ=sizeC=sizeT=1) input images
Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ multiSlice_labelShapeExtraction2d() [2/2]

IPSDKIPLSHAPESEGMENTATION_API ipsdk::shape::segmentation::PlanIndexedShape2dCollPtr ipsdk::imaproc::shape::segmentation::multiSlice_labelShapeExtraction2d ( const ipsdk::image::ImageConstPtr pInLabelImg,
const ipsdk::imaproc::attr::ContourExtractionSettingsConstPtr pInOptContourExtractionSettings 
)

wrapper function for shape extraction from label 2d image algorithm

Note
This wrapper can be used with multi slice input images
Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure