Compute the population of the most populated class.
HistogramPopulationMax computes, for given histogram parameters (bin width or number of classes, and the way to determine histogram minimal and maximal intensities), the population of the most populated class in the histogram computed on the shape.
Here is an example of histogram population maximum measurement in 2d case :
Compute the population of the most populated class
Measure synthesis :
Measure Type | Measure Unit Type | Parameter Type | Result Type | Shape Requirements |
Generic
|
None
|
HistogramPopulationMaxMsrParams |
Value (ipsdk::ipUInt64)
|
Row Intersections
|
See Shape measurement for additional information on these pictograms Example of Python code :
Generic example in 2d case :
import PyIPSDK
import PyIPSDK.IPSDKIPLShapeAnalysis as shapeanalysis
inMeasureInfoSet2d = PyIPSDK.createMeasureInfoSet2d()
PyIPSDK.createMeasureInfo(inMeasureInfoSet2d, "HistogramPopulationMaxMsr")
outMeasureSet = shapeanalysis.labelAnalysis2d(inGreyImg, inLabelImg2d, inMeasureInfoSet2d)
PyIPSDK.saveCsvMeasureFile(os.path.join(tmpPath, "shape_analysis_results.csv"), outMeasureSet)
outMsr = outMeasureSet.getMeasure("HistogramPopulationMaxMsr")
outMsrValues = outMsr.getMeasureResult().getColl(0)
print("First label measurement equal " + str(outMsrValues[1]))
Generic example in 3d case :
import PyIPSDK
import PyIPSDK.IPSDKIPLShapeAnalysis as shapeanalysis
inMeasureInfoSet3d = PyIPSDK.createMeasureInfoSet3d()
PyIPSDK.createMeasureInfo(inMeasureInfoSet3d, "HistogramPopulationMaxMsr")
outMeasureSet = shapeanalysis.labelAnalysis3d(inGreyImg, inLabelImg, inMeasureInfoSet3d)
PyIPSDK.saveCsvMeasureFile(os.path.join(tmpPath, "shape_analysis_results.csv"), outMeasureSet)
outMsr = outMeasureSet.getMeasure("HistogramPopulationMaxMsr")
outMsrValues = outMsr.getMeasureResult().getColl(0)
print("First label measurement equal " + str(outMsrValues[1]))
Example of C++ code :
Example informations
Associated library
IPSDKIPLShapeAnalysis
Code Example
Shape2dCollPtr pShape2dColl = boost::make_shared<Shape2dColl>();
readFromXmlFile(inputShape2dCollPath, *pShape2dColl);
MeasureInfoSetPtr pMeasureInfoSet = MeasureInfoSet::create2dInstance();
HistogramPopulationMaxMsrParamsPtr pParams;
switch(minMaxDef.value()) {
case eMinMaxDefinition::eMMD_ShapeMinMax:
pParams = createHistogramPopulationMaxMsrParamsBinWidth(1.0);
break;
pParams = createHistogramPopulationMaxMsrParamsBinWidth(1.0, fMin.get(), fMax.get());
break;
}
createMeasureInfo(pMeasureInfoSet, "HistogramPopulationMaxMsr", pParams);
MeasureSetPtr pOutMeasureSet =
shapeAnalysis2d(pInGreyImg2d, pShape2dColl, pMeasureInfoSet);
const MeasureConstPtr& pHistogramPopulationMaxOutMsr = pOutMeasureSet->getMeasure("HistogramPopulationMaxMsr");
const ipsdk::shape::analysis::ValueMeasureResult<ipsdk::ipUInt64>& outResults = static_cast<const ipsdk::shape::analysis::ValueMeasureResult<ipsdk::ipUInt64>&>(pHistogramPopulationMaxOutMsr->getMeasureResult());