IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
Typedefs

Shape 2d analysis and measurement algorithm. More...

Typedefs

typedef ShapeAnalysisOptParams< ipsdk::shape::segmentation::Shape2dCollipsdk::imaproc::shape::analysis::ShapeAnalysis2dOptParams
 optional parameter type for mono slice shape analysis
 
typedef ShapeAnalysisOptParams< ipsdk::shape::segmentation::PlanIndexedShape2dCollipsdk::imaproc::shape::analysis::ShapeAnalysis2dPIOptParams
 optional parameter type for mono slice shape analysis
 
IPSDKIPLSHAPEANALYSIS_API ipsdk::shape::analysis::MeasureSetPtr ipsdk::imaproc::shape::analysis::shapeAnalysis2d (const ipsdk::image::ImageConstPtr &pInOptGreyMsrImg1, const ipsdk::shape::segmentation::Shape2dCollConstPtr &pInLabelsShape2d, const ipsdk::shape::analysis::MeasureInfoSetConstPtr &pInMeasureInfoSet2d)
 wrapper function for Shape 2d analysis and measurement algorithm More...
 
IPSDKIPLSHAPEANALYSIS_API ipsdk::shape::analysis::MeasureSetPtr ipsdk::imaproc::shape::analysis::shapeAnalysis2d (const ipsdk::shape::analysis::MeasureInfoSetConstPtr &pInMeasureInfoSet2d, const ipsdk::shape::segmentation::Shape2dCollConstPtr &pInLabelsShape2d, const ipsdk::imaproc::shape::analysis::ShapeAnalysis2dOptParams &shapeAnalysis2dOptParams)
 wrapper function for Shape 2d analysis and measurement algorithm More...
 
IPSDKIPLSHAPEANALYSIS_API ipsdk::shape::analysis::PlanIndexedMeasureSetPtr ipsdk::imaproc::shape::analysis::multiSlice_shapeAnalysis2d (const ipsdk::image::ImageConstPtr &pInOptGreyMsrImg1, const ipsdk::shape::segmentation::PlanIndexedShape2dCollConstPtr &pInPILabelsShape2d, const ipsdk::shape::analysis::MeasureInfoSetConstPtr &pInMeasureInfoSet2d)
 wrapper function for Shape 2d analysis and measurement algorithm More...
 
IPSDKIPLSHAPEANALYSIS_API ipsdk::shape::analysis::PlanIndexedMeasureSetPtr ipsdk::imaproc::shape::analysis::multiSlice_shapeAnalysis2d (const ipsdk::shape::analysis::MeasureInfoSetConstPtr &pInMeasureInfoSet2d, const ipsdk::shape::segmentation::PlanIndexedShape2dCollConstPtr &pInPILabelsShape2d, const ipsdk::imaproc::shape::analysis::ShapeAnalysis2dPIOptParams &shapeAnalysis2dPIOptParams)
 wrapper function for Shape 2d analysis and measurement algorithm More...
 

Detailed Description

Shape 2d analysis and measurement algorithm.

This algorithm allows to process measurements and analysis on shape 2d connected components.

User should first extract contours on a connected component label image (see Label shape extraction 2d).

For more information on shape analysis and measurement framework, please refers to Shape Analysis and Measurement.

Shape 2d measurements and analysis can be decomposed in three main groups :

Here is an example of shape 2d measurement and analysis :

shapeAnalysis2d.png

Attributes description

Attribute description for algorithm :

Name ToolTip Default Initializer
ipsdk::imaproc::attr::InMeasureInfoSet2d [Input] shape analysis 2d measure information set X
ipsdk::imaproc::attr::InPILabelsShape2d [Input] Plan indexed collection of shape 2d associated to labels X
ipsdk::imaproc::shape::analysis::InOptPILabelsShape2d2 [Input Optional] second plan indexed collection of shape 2d associated to labels X
ipsdk::imaproc::shape::analysis::InOptPILabelsShape2d3 [Input Optional] third plan indexed collection of shape 2d associated to labels X
ipsdk::imaproc::shape::analysis::InOptPILabelsShape2d4 [Input Optional] fourth plan indexed collection of shape 2d associated to labels X
ipsdk::imaproc::shape::analysis::InOptGreyMsrImg1 [Input Optional] first grey image used for intensity measurements X
ipsdk::imaproc::shape::analysis::InOptGreyMsrImg2 [Input Optional] second grey image used for intensity measurements X
ipsdk::imaproc::shape::analysis::InOptGreyMsrImg3 [Input Optional] thirid grey image used for intensity measurements X
ipsdk::imaproc::shape::analysis::InOptGreyMsrImg4 [Input Optional] fourth grey image used for intensity measurements X
ipsdk::imaproc::attr::OutPIMeasureSet [Output] Plan indexed collection of shape analysis measure set fromOther (_pOutPIMeasureSet, _pInPILabelsShape2d, boost::function<OutPIMeasureSet::PlanStorageType()>(boost::bind(&ipsdk::imaproc::createMeasureSetFromInfo,_pInMeasureInfoSet2d)))

Global Rule description

Global rule description for algorithm :
ipsdk::imaproc::matchOther (_pInPILabelsShape2d,_pOutPIMeasureSet) && 
validateMeasureRequirements (_pInMeasureInfoSet2d,_pInPILabelsShape2d,_pInOptPILabelsShape2d2,_pInOptPILabelsShape2d3,_pInOptPILabelsShape2d4,_pInOptGreyMsrImg1,_pInOptGreyMsrImg2,_pInOptGreyMsrImg3,_pInOptGreyMsrImg4)

Example of Python code :

Example imports

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

Code Example

# opening of input images
inGreyImg = PyIPSDK.loadTiffImageFile(inputGreyImgPath)
inBinImg = PyIPSDK.loadTiffImageFile(inputBinImgPath)
# connected components analysis of binary image
inLabelImg2d = advmorpho.connectedComponent2dImg(inBinImg)
# label contour extraction computation
inShape2dColl = shapesegmentation.labelShapeExtraction2d(inLabelImg2d)
# definition of proceeded measure
inMeasureInfoSet2d = PyIPSDK.createMeasureInfoSet2d()
PyIPSDK.createMeasureInfo(inMeasureInfoSet2d, "AreaMinusHoles", "PolygonArea2dMsr", shapeanalysis.createHolesBasicPolicyMsrParams(True))
PyIPSDK.createMeasureInfo(inMeasureInfoSet2d, "AreaWithHoles", "PolygonArea2dMsr", shapeanalysis.createHolesBasicPolicyMsrParams(False))
PyIPSDK.createMeasureInfo(inMeasureInfoSet2d, "EquivalentRay", "EquivalentRayMsr")
PyIPSDK.createMeasureInfo(inMeasureInfoSet2d, "SumMsr")
# shape analysis computation
outMeasureSet = shapeanalysis.shapeAnalysis2d(inGreyImg, inShape2dColl, inMeasureInfoSet2d)
# save results to csv format
PyIPSDK.saveCsvMeasureFile(os.path.join(utTmpPath, "shape_analysis_results.csv"), outMeasureSet)
# retrieve measure results
outAreaMinusHolesMsr = outMeasureSet.getMeasure("AreaMinusHoles")
outAreaWithHolesMsr = outMeasureSet.getMeasure("AreaWithHoles")
outEquivalentRayMsr = outMeasureSet.getMeasure("EquivalentRay")
outSumMsr = outMeasureSet.getMeasure("SumMsr")
# retrieve measure valus for area with holes measurement
outAreaWithHolesValues = outAreaWithHolesMsr.getMeasureResult().getColl(0)
print("First label area with holes measurement equal " + str(outAreaWithHolesValues[1]))

Example of C++ code :

Example informations

Associated library

IPSDKIPLShapeAnalysis

Header file

Code Example

// opening grey level input image
ImagePtr pInGreyImg2d = loadTiffImageFile(inputGreyImgPath);
// opening binary input image
ImagePtr pInBinImg2d = loadTiffImageFile(inputBinImgPath);
// connected components analysis
ImagePtr pInLabelImg2d = connectedComponent2dImg(pInBinImg2d);
// extract contours from connected component (label) image
Shape2dCollPtr pShape2dColl = labelShapeExtraction2d(pInLabelImg2d);
// define a measure info set
MeasureInfoSetPtr pMeasureInfoSet = MeasureInfoSet::create2dInstance();
createMeasureInfo(pMeasureInfoSet, "AreaMinusHoles", "PolygonArea2dMsr", createHolesBasicPolicyMsrParams(true));
createMeasureInfo(pMeasureInfoSet, "AreaWithHoles", "PolygonArea2dMsr", createHolesBasicPolicyMsrParams(false));
createMeasureInfo(pMeasureInfoSet, "EquivalentRay", "EquivalentRayMsr");
createMeasureInfo(pMeasureInfoSet, "SumMsr");
// compute measure on extracted data
MeasureSetPtr pOutMeasureSet = shapeAnalysis2d(pInGreyImg2d, pShape2dColl, pMeasureInfoSet);
// complete csv dump of results
saveCsvMeasureFile(csvOutputPath, *pOutMeasureSet);
// retrieve associated results
const MeasureConstPtr& pAreaMinusHolesOutMsr = pOutMeasureSet->getMeasure("AreaMinusHoles");
const MeasureConstPtr& pAreaWithHolesOutMsr = pOutMeasureSet->getMeasure("AreaWithHoles");
const MeasureConstPtr& pEquivalentRayOutMsr = pOutMeasureSet->getMeasure("EquivalentRay");
const MeasureConstPtr& pSumOutMsr = pOutMeasureSet->getMeasure("SumMsr");
See also
ShapeAnalysis2dLvl1
ShapeAnalysis2dLvl2

Function Documentation

◆ shapeAnalysis2d() [1/2]

IPSDKIPLSHAPEANALYSIS_API ipsdk::shape::analysis::MeasureSetPtr ipsdk::imaproc::shape::analysis::shapeAnalysis2d ( const ipsdk::image::ImageConstPtr pInOptGreyMsrImg1,
const ipsdk::shape::segmentation::Shape2dCollConstPtr pInLabelsShape2d,
const ipsdk::shape::analysis::MeasureInfoSetConstPtr pInMeasureInfoSet2d 
)

wrapper function for Shape 2d analysis and measurement algorithm

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

◆ multiSlice_shapeAnalysis2d() [1/2]

IPSDKIPLSHAPEANALYSIS_API ipsdk::shape::analysis::PlanIndexedMeasureSetPtr ipsdk::imaproc::shape::analysis::multiSlice_shapeAnalysis2d ( const ipsdk::image::ImageConstPtr pInOptGreyMsrImg1,
const ipsdk::shape::segmentation::PlanIndexedShape2dCollConstPtr pInPILabelsShape2d,
const ipsdk::shape::analysis::MeasureInfoSetConstPtr pInMeasureInfoSet2d 
)

wrapper function for Shape 2d analysis and measurement algorithm

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

◆ shapeAnalysis2d() [2/2]

IPSDKIPLSHAPEANALYSIS_API ipsdk::shape::analysis::MeasureSetPtr ipsdk::imaproc::shape::analysis::shapeAnalysis2d ( const ipsdk::shape::analysis::MeasureInfoSetConstPtr pInMeasureInfoSet2d,
const ipsdk::shape::segmentation::Shape2dCollConstPtr pInLabelsShape2d,
const ipsdk::imaproc::shape::analysis::ShapeAnalysis2dOptParams shapeAnalysis2dOptParams 
)

wrapper function for Shape 2d analysis and measurement algorithm

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

◆ multiSlice_shapeAnalysis2d() [2/2]

IPSDKIPLSHAPEANALYSIS_API ipsdk::shape::analysis::PlanIndexedMeasureSetPtr ipsdk::imaproc::shape::analysis::multiSlice_shapeAnalysis2d ( const ipsdk::shape::analysis::MeasureInfoSetConstPtr pInMeasureInfoSet2d,
const ipsdk::shape::segmentation::PlanIndexedShape2dCollConstPtr pInPILabelsShape2d,
const ipsdk::imaproc::shape::analysis::ShapeAnalysis2dPIOptParams shapeAnalysis2dPIOptParams 
)

wrapper function for Shape 2d analysis and measurement algorithm

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