IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit

Connected component 3d analysis and measurement algorithm. More...

IPSDKIPLSHAPEANALYSIS_API ipsdk::shape::analysis::MeasureSetPtr ipsdk::imaproc::shape::analysis::labelAnalysis3d (const ipsdk::image::ImageConstPtr &pInGreyMsrImg3d, const ipsdk::image::ImageConstPtr &pInLabelImg3d, const ipsdk::shape::analysis::MeasureInfoSetConstPtr &pInMeasureInfoSet3d)
 wrapper function for Connected component 3d analysis and measurement algorithm More...
 
IPSDKIPLSHAPEANALYSIS_API ipsdk::shape::analysis::MeasureSetPtr ipsdk::imaproc::shape::analysis::labelAnalysis3d (const ipsdk::image::ImageConstPtr &pInGreyMsrImg3d, const ipsdk::image::ImageConstPtr &pInLabelImg3d, const ipsdk::imaproc::attr::SurfaceExtractionSettingsConstPtr &pInOptSurfaceExtractionSettings, const ipsdk::shape::analysis::MeasureInfoSetConstPtr &pInMeasureInfoSet3d)
 wrapper function for Connected component 3d analysis and measurement algorithm More...
 
IPSDKIPLSHAPEANALYSIS_API ipsdk::shape::analysis::PlanIndexedMeasureSetPtr ipsdk::imaproc::shape::analysis::multiSlice_labelAnalysis3d (const ipsdk::image::ImageConstPtr &pInGreyMsrImg3d, const ipsdk::image::ImageConstPtr &pInLabelImg3d, const ipsdk::shape::analysis::MeasureInfoSetConstPtr &pInMeasureInfoSet3d)
 wrapper function for Connected component 3d analysis and measurement algorithm More...
 
IPSDKIPLSHAPEANALYSIS_API ipsdk::shape::analysis::PlanIndexedMeasureSetPtr ipsdk::imaproc::shape::analysis::multiSlice_labelAnalysis3d (const ipsdk::image::ImageConstPtr &pInGreyMsrImg3d, const ipsdk::image::ImageConstPtr &pInLabelImg3d, const ipsdk::imaproc::attr::SurfaceExtractionSettingsConstPtr &pInOptSurfaceExtractionSettings, const ipsdk::shape::analysis::MeasureInfoSetConstPtr &pInMeasureInfoSet3d)
 wrapper function for Connected component 3d analysis and measurement algorithm More...
 

Detailed Description

Connected component 3d analysis and measurement algorithm.

This algorithm is a simple version of Shape Analysis 3d algorithm. It allows to process measurements and analysis using a label (connected components) image as input which will be proceeded to extract associated 3d shapes (see Label shape extraction 3d).

Note
Note that boundary approximation will only be computed on extracted shapes if input measure set requests it (ie if at least one mesure among measure set requests it, see Measure requirements). This can be a good way of optimization since boundary approximation can be sometimes computionally expensive 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 :

shapeAnalysis3d.png

Attributes description

Attribute description for algorithm :

Name ToolTip Default Initializer
ipsdk::imaproc::attr::InGreyMsrImg3d [Input] grey image 3d used for intensity measurements X
ipsdk::imaproc::attr::InLabelImg3d [Input] label image 3d for processing operation X
ipsdk::imaproc::attr::InOptSurfaceExtractionSettings [Input Optional] Settings used for surfaces extraction X
ipsdk::imaproc::attr::InMeasureInfoSet3d [Input] shape analysis 3d measure information set X
ipsdk::imaproc::attr::OutPIMeasureSet [Output] Plan indexed collection of shape analysis measure set fromImage (_pOutPIMeasureSet, _pInGreyMsrImg3d, eFromImagePlanIndexedPolicy::eFIPIP_T, boost::function<OutPIMeasureSet::PlanStorageType()>(boost::bind(&ipsdk::imaproc::createMeasureSetFromInfo,_pInMeasureInfoSet3d)))

Global Rule description

Global rule description for algorithm :
ipsdk::imaproc::matchSize (ipsdk::imaproc::eMatchImageSizeType::eMIST_XYZT,_pInGreyMsrImg3d,_pInLabelImg3d) && 
ipsdk::imaproc::matchImagePlans (_pOutPIMeasureSet,_pInGreyMsrImg3d,eImagePlansMatchPolicy::eIPMP_T) && 
matchLabelAnalysis (_pInMeasureInfoSet3d)

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLAdvancedMorphology as advmorpho
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)
# definition of proceeded measure
inMeasureInfoSet3d1 = PyIPSDK.createMeasureInfoSet3d();
PyIPSDK.createMeasureInfo(inMeasureInfoSet3d1, "VolumeMinusHoles", "MeshVolume3dMsr", shapeanalysis.createHolesBasicPolicyMsrParams(True));
PyIPSDK.createMeasureInfo(inMeasureInfoSet3d1, "VolumeWithHoles", "MeshVolume3dMsr", shapeanalysis.createHolesBasicPolicyMsrParams(False));
PyIPSDK.createMeasureInfo(inMeasureInfoSet3d1, "AreaMinusHoles", "Area3dMsr", shapeanalysis.createHolesBasicPolicyMsrParams(True));
PyIPSDK.createMeasureInfo(inMeasureInfoSet3d1, "AreaWithHoles", "Area3dMsr", shapeanalysis.createHolesBasicPolicyMsrParams(False));
PyIPSDK.createMeasureInfo(inMeasureInfoSet3d1, "EquivalentRay", "EquivalentRayMsr");
PyIPSDK.createMeasureInfo(inMeasureInfoSet3d1, "SumMsr");
# shape analysis computation
outMeasureSet1 = shapeanalysis.labelAnalysis3d(inGreyImg, inLabelImg3d, PyIPSDK.createSubSampledSurfaceExtractionSettings(0), inMeasureInfoSet3d1)
# save results to csv format
PyIPSDK.saveCsvMeasureFile(os.path.join(utTmpPath, "shape_analysis_results.csv"), outMeasureSet1)
# retrieve measure results
outVolumeMinusHolesMsr = outMeasureSet1.getMeasure("VolumeMinusHoles")
outVolumeWithHolesMsr = outMeasureSet1.getMeasure("VolumeWithHoles")
outAreaMinusHolesMsr = outMeasureSet1.getMeasure("AreaMinusHoles")
outAreaWithHolesMsr = outMeasureSet1.getMeasure("AreaWithHoles")
outEquivalentRayMsr = outMeasureSet1.getMeasure("EquivalentRay")
outSumMsr = outMeasureSet1.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]))
# define a second measure info set which do not implies boundary approximation of shapes
inMeasureInfoSet3d2 = PyIPSDK.createMeasureInfoSet3d()
PyIPSDK.createMeasureInfo(inMeasureInfoSet3d2, "HistogramQuantileMsr", shapeanalysis.createHistogramQuantileMsrParamsBinWidth(1.0, 25.0))
PyIPSDK.createMeasureInfo(inMeasureInfoSet3d2, "NbPixels3dMsr")
PyIPSDK.createMeasureInfo(inMeasureInfoSet3d2, "MeanMsr")
# in this case area measure request only row intersections of shapes with image so it will
# be automatically computed (boundary approximation are not)
outMeasureSet2 = shapeanalysis.labelAnalysis3d(inGreyImg, inLabelImg3d, PyIPSDK.createSubSampledSurfaceExtractionSettings(0), inMeasureInfoSet3d2)
# retrieve associated results
outHistogramQuantileMsr = outMeasureSet2.getMeasure("HistogramQuantileMsr")
outNbPixels3dMsr = outMeasureSet2.getMeasure("NbPixels3dMsr")
outMeanMsr = outMeasureSet2.getMeasure("MeanMsr")

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);
// define a measure info set
MeasureInfoSetPtr pMeasureInfoSet1 = MeasureInfoSet::create3dInstance();
createMeasureInfo(pMeasureInfoSet1, "VolumeMinusHoles", "MeshVolume3dMsr", createHolesBasicPolicyMsrParams(true));
createMeasureInfo(pMeasureInfoSet1, "VolumeWithHoles", "MeshVolume3dMsr", createHolesBasicPolicyMsrParams(false));
createMeasureInfo(pMeasureInfoSet1, "EquivalentRay", "EquivalentRayMsr");
createMeasureInfo(pMeasureInfoSet1, "SumMsr");
// compute measure on extracted data
// in this case area measure request boundary approximation of shapes so it will
// be automatically computed
MeasureSetPtr pOutMeasureSet1 = labelAnalysis3d(pInGreyImg3d, pInLabelImg3d, pMeasureInfoSet1);
// complete csv dump of results
saveCsvMeasureFile(csvOutputPath, *pOutMeasureSet1);
// retrieve associated results
const MeasureConstPtr& pAreaMinusHolesOutMsr = pOutMeasureSet1->getMeasure("VolumeMinusHoles");
const MeasureConstPtr& pAreaWithHolesOutMsr = pOutMeasureSet1->getMeasure("VolumeWithHoles");
const MeasureConstPtr& pEquivalentRayOutMsr = pOutMeasureSet1->getMeasure("EquivalentRay");
const MeasureConstPtr& pSumOutMsr = pOutMeasureSet1->getMeasure("SumMsr");
// define a second measure info set which do not implies boundary approximation of shapes
MeasureInfoSetPtr pMeasureInfoSet2 = MeasureInfoSet::create3dInstance();
createMeasureInfo(pMeasureInfoSet2, "HistogramQuantileMsr", createHistogramQuantileMsrParamsBinWidth(1.0, 25.0));
createMeasureInfo(pMeasureInfoSet2, "NbPixels3dMsr");
createMeasureInfo(pMeasureInfoSet2, "MeanMsr");
// compute measure on extracted data
// in this case area measure request only row intersections of shapes with image so it will
// be automatically computed (boundary approximation are not)
MeasureSetPtr pOutMeasureSet2 = labelAnalysis3d(pInGreyImg3d, pInLabelImg3d, createSubSampledSurfaceExtractionSettings(0), pMeasureInfoSet2);
// retrieve associated results
const MeasureConstPtr& pHistogramQuantileOutMsr = pOutMeasureSet2->getMeasure("HistogramQuantileMsr");
const MeasureConstPtr& pNbPixels3dOutMsr = pOutMeasureSet2->getMeasure("NbPixels3dMsr");
const MeasureConstPtr& pMeanOutMsr = pOutMeasureSet2->getMeasure("MeanMsr");
See also
LabelAnalysis3dLvl1

Function Documentation

◆ labelAnalysis3d() [1/2]

IPSDKIPLSHAPEANALYSIS_API ipsdk::shape::analysis::MeasureSetPtr ipsdk::imaproc::shape::analysis::labelAnalysis3d ( const ipsdk::image::ImageConstPtr pInGreyMsrImg3d,
const ipsdk::image::ImageConstPtr pInLabelImg3d,
const ipsdk::shape::analysis::MeasureInfoSetConstPtr pInMeasureInfoSet3d 
)

wrapper function for Connected component 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_labelAnalysis3d() [1/2]

IPSDKIPLSHAPEANALYSIS_API ipsdk::shape::analysis::PlanIndexedMeasureSetPtr ipsdk::imaproc::shape::analysis::multiSlice_labelAnalysis3d ( const ipsdk::image::ImageConstPtr pInGreyMsrImg3d,
const ipsdk::image::ImageConstPtr pInLabelImg3d,
const ipsdk::shape::analysis::MeasureInfoSetConstPtr pInMeasureInfoSet3d 
)

wrapper function for Connected component 3d analysis and measurement algorithm

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

◆ labelAnalysis3d() [2/2]

IPSDKIPLSHAPEANALYSIS_API ipsdk::shape::analysis::MeasureSetPtr ipsdk::imaproc::shape::analysis::labelAnalysis3d ( const ipsdk::image::ImageConstPtr pInGreyMsrImg3d,
const ipsdk::image::ImageConstPtr pInLabelImg3d,
const ipsdk::imaproc::attr::SurfaceExtractionSettingsConstPtr pInOptSurfaceExtractionSettings,
const ipsdk::shape::analysis::MeasureInfoSetConstPtr pInMeasureInfoSet3d 
)

wrapper function for Connected component 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_labelAnalysis3d() [2/2]

IPSDKIPLSHAPEANALYSIS_API ipsdk::shape::analysis::PlanIndexedMeasureSetPtr ipsdk::imaproc::shape::analysis::multiSlice_labelAnalysis3d ( const ipsdk::image::ImageConstPtr pInGreyMsrImg3d,
const ipsdk::image::ImageConstPtr pInLabelImg3d,
const ipsdk::imaproc::attr::SurfaceExtractionSettingsConstPtr pInOptSurfaceExtractionSettings,
const ipsdk::shape::analysis::MeasureInfoSetConstPtr pInMeasureInfoSet3d 
)

wrapper function for Connected component 3d analysis and measurement algorithm

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