IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
Typedefs

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

Typedefs

typedef ShapeAnalysisOptParams< ipsdk::shape::segmentation::Shape3dCollipsdk::imaproc::shape::analysis::ShapeAnalysis3dOptParams
 optional parameter type for mono slice shape analysis
 
typedef ShapeAnalysisOptParams< ipsdk::shape::segmentation::PlanIndexedShape3dCollipsdk::imaproc::shape::analysis::ShapeAnalysis3dPIOptParams
 optional parameter type for mono slice shape analysis
 
IPSDKIPLSHAPEANALYSIS_API ipsdk::shape::analysis::MeasureSetPtr ipsdk::imaproc::shape::analysis::shapeAnalysis3d (const ipsdk::image::ImageConstPtr &pInOptGreyMsrImg3d1, const ipsdk::shape::segmentation::Shape3dCollConstPtr &pInLabelsShape3d, const ipsdk::shape::analysis::MeasureInfoSetConstPtr &pInMeasureInfoSet3d)
 wrapper function for Shape 3d analysis and measurement algorithm More...
 
IPSDKIPLSHAPEANALYSIS_API ipsdk::shape::analysis::MeasureSetPtr ipsdk::imaproc::shape::analysis::shapeAnalysis3d (const ipsdk::shape::analysis::MeasureInfoSetConstPtr &pInMeasureInfoSet3d, const ipsdk::shape::segmentation::Shape3dCollConstPtr &pInLabelsShape3d, const ipsdk::imaproc::shape::analysis::ShapeAnalysis3dOptParams &shapeAnalysis3dOptParams)
 wrapper function for Shape 3d analysis and measurement algorithm More...
 
IPSDKIPLSHAPEANALYSIS_API ipsdk::shape::analysis::PlanIndexedMeasureSetPtr ipsdk::imaproc::shape::analysis::multiSlice_shapeAnalysis3d (const ipsdk::image::ImageConstPtr &pInOptGreyMsrImg3d1, const ipsdk::shape::segmentation::PlanIndexedShape3dCollConstPtr &pInPILabelsShape3d, const ipsdk::shape::analysis::MeasureInfoSetConstPtr &pInMeasureInfoSet3d)
 wrapper function for Shape 3d analysis and measurement algorithm More...
 
IPSDKIPLSHAPEANALYSIS_API ipsdk::shape::analysis::PlanIndexedMeasureSetPtr ipsdk::imaproc::shape::analysis::multiSlice_shapeAnalysis3d (const ipsdk::shape::analysis::MeasureInfoSetConstPtr &pInMeasureInfoSet3d, const ipsdk::shape::segmentation::PlanIndexedShape3dCollConstPtr &pInPILabelsShape3d, const ipsdk::imaproc::shape::analysis::ShapeAnalysis3dPIOptParams &shapeAnalysis3dPIOptParams)
 wrapper function for Shape 3d analysis and measurement algorithm More...
 

Detailed Description

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 :

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 :

shapeAnalysis3d.png

Attributes description

Attribute description for algorithm :

Name ToolTip Default Initializer
ipsdk::imaproc::attr::InMeasureInfoSet3d [Input] shape analysis 3d measure information set X
ipsdk::imaproc::attr::InPILabelsShape3d [Input] Plan indexed collection of shape 3d associated to labels X
ipsdk::imaproc::shape::analysis::InOptPILabelsShape3d2 [Input Optional] second plan indexed collection of shape 3d associated to labels X
ipsdk::imaproc::shape::analysis::InOptPILabelsShape3d3 [Input Optional] third plan indexed collection of shape 3d associated to labels X
ipsdk::imaproc::shape::analysis::InOptPILabelsShape3d4 [Input Optional] fourth plan indexed collection of shape 3d associated to labels X
ipsdk::imaproc::shape::analysis::InOptGreyMsrImg3d1 [Input Optional] first grey image3d used for intensity measurements X
ipsdk::imaproc::shape::analysis::InOptGreyMsrImg3d2 [Input Optional] second grey image3d used for intensity measurements X
ipsdk::imaproc::shape::analysis::InOptGreyMsrImg3d3 [Input Optional] third grey image3d used for intensity measurements X
ipsdk::imaproc::shape::analysis::InOptGreyMsrImg3d4 [Input Optional] fourth grey image3d used for intensity measurements X
ipsdk::imaproc::attr::OutPIMeasureSet [Output] Plan indexed collection of shape analysis measure set fromOther (_pOutPIMeasureSet, _pInPILabelsShape3d, boost::function<OutPIMeasureSet::PlanStorageType()>(boost::bind(&ipsdk::imaproc::createMeasureSetFromInfo,_pInMeasureInfoSet3d)))

Global Rule description

Global rule description for algorithm :
ipsdk::imaproc::matchOther (_pInPILabelsShape3d,_pOutPIMeasureSet) && 
validateMeasureRequirements (_pInMeasureInfoSet3d,_pInPILabelsShape3d,_pInOptPILabelsShape3d2,_pInOptPILabelsShape3d3,_pInOptPILabelsShape3d4,_pInOptGreyMsrImg3d1,_pInOptGreyMsrImg3d2,_pInOptGreyMsrImg3d3,_pInOptGreyMsrImg3d4)

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
inLabelImg3d = advmorpho.connectedComponent3dImg(inBinImg)
# label contour extraction computation
inShape3dColl = shapesegmentation.labelShapeExtraction3d(inLabelImg3d, PyIPSDK.createSubSampledSurfaceExtractionSettings(0))
# definition of proceeded measure
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");
# shape analysis computation
outMeasureSet = shapeanalysis.shapeAnalysis3d(inGreyImg, inShape3dColl, inMeasureInfoSet3d)
# save results to csv format
PyIPSDK.saveCsvMeasureFile(os.path.join(utTmpPath, "shape_analysis_results.csv"), outMeasureSet)
# retrieve measure results
outVolumeMinusHolesMsr = outMeasureSet.getMeasure("VolumeMinusHoles")
outVolumeWithHolesMsr = outMeasureSet.getMeasure("VolumeWithHoles")
outAreaMinusHolesMsr = outMeasureSet.getMeasure("AreaMinusHoles")
outAreaWithHolesMsr = outMeasureSet.getMeasure("AreaWithHoles")
outEquivalentRayMsr = outMeasureSet.getMeasure("EquivalentRay")
outSumMsr = outMeasureSet.getMeasure("SumMsr")
# retrieve measure valus for area with holes measurement
outVolumeWithHolesValues = outVolumeWithHolesMsr.getMeasureResult().getColl(0)
print("First label volume with holes measurement equal " + str(outVolumeWithHolesValues[1]))

Example of C++ code :

Example informations

Associated library

IPSDKIPLShapeAnalysis

Header file

Code Example

// opening grey level input image
ImagePtr pInGreyImg3d = loadTiffImageFile(inputGreyImgPath, eTiffDirectoryMode::eTDM_Volume);
// opening binary input image
ImagePtr pInBinImg3d = loadTiffImageFile(inputBinImgPath, eTiffDirectoryMode::eTDM_Volume);
// connected components analysis
ImagePtr pInLabelImg3d = connectedComponent3dImg(pInBinImg3d);
// extract contours from connected component (label) image
Shape3dCollPtr pShape3dColl = labelShapeExtraction3d(pInLabelImg3d);
// define a measure info set
MeasureInfoSetPtr pMeasureInfoSet = MeasureInfoSet::create3dInstance();
createMeasureInfo(pMeasureInfoSet, "VolumeMinusHoles", "Volume3dMsr", createHolesBasicPolicyMsrParams(true));
createMeasureInfo(pMeasureInfoSet, "VolumeWithHoles", "Volume3dMsr", createHolesBasicPolicyMsrParams(false));
createMeasureInfo(pMeasureInfoSet, "EquivalentRay", "EquivalentRayMsr");
createMeasureInfo(pMeasureInfoSet, "SumMsr");
// compute measure on extracted data
MeasureSetPtr pOutMeasureSet = shapeAnalysis3d(pInGreyImg3d, pShape3dColl, pMeasureInfoSet);
// complete csv dump of results
saveCsvMeasureFile(csvOutputPath, *pOutMeasureSet);
// retrieve associated results
const MeasureConstPtr& pAreaMinusHolesOutMsr = pOutMeasureSet->getMeasure("VolumeMinusHoles");
const MeasureConstPtr& pAreaWithHolesOutMsr = pOutMeasureSet->getMeasure("VolumeWithHoles");
const MeasureConstPtr& pEquivalentRayOutMsr = pOutMeasureSet->getMeasure("EquivalentRay");
const MeasureConstPtr& pSumOutMsr = pOutMeasureSet->getMeasure("SumMsr");
See also
ShapeAnalysis3dLvl1
ShapeAnalysis3dLvl2

Function Documentation

◆ shapeAnalysis3d() [1/2]

IPSDKIPLSHAPEANALYSIS_API ipsdk::shape::analysis::MeasureSetPtr ipsdk::imaproc::shape::analysis::shapeAnalysis3d ( const ipsdk::image::ImageConstPtr pInOptGreyMsrImg3d1,
const ipsdk::shape::segmentation::Shape3dCollConstPtr pInLabelsShape3d,
const ipsdk::shape::analysis::MeasureInfoSetConstPtr pInMeasureInfoSet3d 
)

wrapper function for Shape 3d analysis and measurement algorithm

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

◆ multiSlice_shapeAnalysis3d() [1/2]

IPSDKIPLSHAPEANALYSIS_API ipsdk::shape::analysis::PlanIndexedMeasureSetPtr ipsdk::imaproc::shape::analysis::multiSlice_shapeAnalysis3d ( const ipsdk::image::ImageConstPtr pInOptGreyMsrImg3d1,
const ipsdk::shape::segmentation::PlanIndexedShape3dCollConstPtr pInPILabelsShape3d,
const ipsdk::shape::analysis::MeasureInfoSetConstPtr pInMeasureInfoSet3d 
)

wrapper function for Shape 3d analysis and measurement algorithm

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

◆ shapeAnalysis3d() [2/2]

IPSDKIPLSHAPEANALYSIS_API ipsdk::shape::analysis::MeasureSetPtr ipsdk::imaproc::shape::analysis::shapeAnalysis3d ( const ipsdk::shape::analysis::MeasureInfoSetConstPtr pInMeasureInfoSet3d,
const ipsdk::shape::segmentation::Shape3dCollConstPtr pInLabelsShape3d,
const ipsdk::imaproc::shape::analysis::ShapeAnalysis3dOptParams shapeAnalysis3dOptParams 
)

wrapper function for Shape 3d analysis and measurement algorithm

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

◆ multiSlice_shapeAnalysis3d() [2/2]

IPSDKIPLSHAPEANALYSIS_API ipsdk::shape::analysis::PlanIndexedMeasureSetPtr ipsdk::imaproc::shape::analysis::multiSlice_shapeAnalysis3d ( const ipsdk::shape::analysis::MeasureInfoSetConstPtr pInMeasureInfoSet3d,
const ipsdk::shape::segmentation::PlanIndexedShape3dCollConstPtr pInPILabelsShape3d,
const ipsdk::imaproc::shape::analysis::ShapeAnalysis3dPIOptParams shapeAnalysis3dPIOptParams 
)

wrapper function for Shape 3d analysis and measurement algorithm

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