typedef ShapeAnalysisOptParams< ipsdk::shape::segmentation::Shape3dColl > | ipsdk::imaproc::shape::analysis::ShapeAnalysis3dOptParams |
typedef ShapeAnalysisOptParams< ipsdk::shape::segmentation::PlanIndexedShape3dColl > | ipsdk::imaproc::shape::analysis::ShapeAnalysis3dPIOptParams |
MeasureSet = | shapeAnalysis3d (inOptGreyMsrImg3d1,inLabelsShape3d,inMeasureInfoSet3d) |
MeasureSet = | shapeAnalysis3d (inMeasureInfoSet3d,inLabelsShape3d,shapeAnalysis3dOptParams) |
Shape 3d analysis and measurement algorithm.
This algorithm allows to process measurements and analysis on shape 3d connected components.
User should first extract surface on a connected component label image (see Label shape extraction 3d).
Shape 3d measurements and analysis can be decomposed in three main groups :
- Intensity measurement which allows to analyse intensity data covered by each shape. This kind of measure aggregates for example : mean, variance, grey moments, ... analysis of particules.
- Geometry measurements which use polyhedral approximation of shape contours. This kind of measure aggregates for example : area, axis aligned bounding box computation (min by axis, size by axis), ...
- Generic measurements which allows to combinate other measurements to obtain new values. This kind of measure aggregates for example : EquivalentRay which is defined using Volume3d measurement (in 3d case).
For more information on shape analysis and measurement framework, please refers to Shape Analysis and Measurement.
Here is an example of shape 3d measurement and analysis :
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
inGreyImg = PyIPSDK.loadTiffImageFile(inputGreyImgPath)
inBinImg = PyIPSDK.loadTiffImageFile(inputBinImgPath)
inLabelImg3d = advmorpho.connectedComponent3dImg(inBinImg)
inShape3dColl = shapesegmentation.labelShapeExtraction3d(inLabelImg3d, PyIPSDK.createSubSampledSurfaceExtractionSettings(0))
inMeasureInfoSet3d = PyIPSDK.createMeasureInfoSet3d();
PyIPSDK.createMeasureInfo(inMeasureInfoSet3d, "VolumeMinusHoles", "MeshVolume3dMsr", shapeanalysis.createHolesBasicPolicyMsrParams(True));
PyIPSDK.createMeasureInfo(inMeasureInfoSet3d, "VolumeWithHoles", "MeshVolume3dMsr", shapeanalysis.createHolesBasicPolicyMsrParams(False));
PyIPSDK.createMeasureInfo(inMeasureInfoSet3d, "AreaMinusHoles", "Area3dMsr", shapeanalysis.createHolesBasicPolicyMsrParams(True));
PyIPSDK.createMeasureInfo(inMeasureInfoSet3d, "AreaWithHoles", "Area3dMsr", shapeanalysis.createHolesBasicPolicyMsrParams(False));
PyIPSDK.createMeasureInfo(inMeasureInfoSet3d, "EquivalentRay", "EquivalentRayMsr");
PyIPSDK.createMeasureInfo(inMeasureInfoSet3d, "SumMsr");
outMeasureSet = shapeanalysis.shapeAnalysis3d(inGreyImg, inShape3dColl, inMeasureInfoSet3d)
PyIPSDK.saveCsvMeasureFile(os.path.join(utTmpPath, "shape_analysis_results.csv"), outMeasureSet)
outVolumeMinusHolesMsr = outMeasureSet.getMeasure("VolumeMinusHoles")
outVolumeWithHolesMsr = outMeasureSet.getMeasure("VolumeWithHoles")
outAreaMinusHolesMsr = outMeasureSet.getMeasure("AreaMinusHoles")
outAreaWithHolesMsr = outMeasureSet.getMeasure("AreaWithHoles")
outEquivalentRayMsr = outMeasureSet.getMeasure("EquivalentRay")
outSumMsr = outMeasureSet.getMeasure("SumMsr")
outVolumeWithHolesValues = outVolumeWithHolesMsr.getMeasureResult().getColl(0)
print("First label volume with holes measurement equal " + str(outVolumeWithHolesValues[1]))
Example of C++ code :
Example informations
Header file
#include <IPSDKIPL/IPSDKIPLShapeAnalysis/Processor/ShapeAnalysis3d/ShapeAnalysis3d.h>
Code Example
ImagePtr pInGreyImg3d =
loadTiffImageFile(inputGreyImgPath, eTiffDirectoryMode::eTDM_Volume);
ImagePtr pInBinImg3d =
loadTiffImageFile(inputBinImgPath, eTiffDirectoryMode::eTDM_Volume);
MeasureInfoSetPtr pMeasureInfoSet = MeasureInfoSet::create3dInstance();
createMeasureInfo(pMeasureInfoSet, "VolumeMinusHoles", "Volume3dMsr", createHolesBasicPolicyMsrParams(true));
createMeasureInfo(pMeasureInfoSet, "VolumeWithHoles", "Volume3dMsr", createHolesBasicPolicyMsrParams(false));
createMeasureInfo(pMeasureInfoSet, "EquivalentRay", "EquivalentRayMsr");
createMeasureInfo(pMeasureInfoSet, "SumMsr");
MeasureSetPtr pOutMeasureSet = shapeAnalysis3d(pInGreyImg3d, pShape3dColl, pMeasureInfoSet);
saveCsvMeasureFile(csvOutputPath, *pOutMeasureSet);
const MeasureConstPtr& pAreaMinusHolesOutMsr = pOutMeasureSet->getMeasure("VolumeMinusHoles");
const MeasureConstPtr& pAreaWithHolesOutMsr = pOutMeasureSet->getMeasure("VolumeWithHoles");
const MeasureConstPtr& pEquivalentRayOutMsr = pOutMeasureSet->getMeasure("EquivalentRay");
const MeasureConstPtr& pSumOutMsr = pOutMeasureSet->getMeasure("SumMsr");