Measure allowing to compute energy of intensities for shape.
This measure computes the energy, also known as angular second moment, of image pixel/voxel intensity values associated to a 2d/3d shape. Its value equals to one for a constant signal and decreases with its unpredictability.
The energy measure is based on the analysis of the shape histogram (see Histogram). Given the histogram parameters allowing to determine (among others) the number of classes
and a global range for the histogram, this measure computes shape energy as :
where
is the density of probability associated to bin
of histogram :
and :
is the population for the bin
of histogram,
is the intensity range (width) for the bin
of histogram.
Here is an example of energy measurement in 2d case :
We could have predicted the behaviour of the results : the shape 3 has homogeneous intensity, thus, its energy equals 1. Moreover, the shapes 5 and 6 are the most noisy features, therefore their energies have the lowest values. Then, the noise intensity of the shapes 2 and 4, is close to the intensity noise intensity of the shapes 5 and 6. As a consequence, their energy have the same range. Finally, the shape 1 is less noisy than the shapes 2, 4, 5 and 6, which results in a higher energy value.
Moreover, the results are correlated with the ones obtained by the Entropy measure.
Measure allowing to compute energy of intensities for shape
Measure synthesis :
Measure Type | Measure Unit Type | Parameter Type | Result Type | Shape Requirements |
Generic
|
None
|
EnergyMsrParams |
Value (ipsdk::ipReal64)
|
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, "EnergyMsr")
outMeasureSet = shapeanalysis.labelAnalysis2d(inGreyImg, inLabelImg2d, inMeasureInfoSet2d)
PyIPSDK.saveCsvMeasureFile(os.path.join(tmpPath, "shape_analysis_results.csv"), outMeasureSet)
outMsr = outMeasureSet.getMeasure("EnergyMsr")
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, "EnergyMsr")
outMeasureSet = shapeanalysis.labelAnalysis3d(inGreyImg, inLabelImg, inMeasureInfoSet3d)
PyIPSDK.saveCsvMeasureFile(os.path.join(tmpPath, "shape_analysis_results.csv"), outMeasureSet)
outMsr = outMeasureSet.getMeasure("EnergyMsr")
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>();
IPSDK_REQUIRE(readFromXmlFile(inputShape2dCollPath, *pShape2dColl) == true);
MeasureInfoSetPtr pMeasureInfoSet = MeasureInfoSet::create2dInstance();
createMeasureInfo(pMeasureInfoSet, "EnergyMsr");
MeasureSetPtr pOutMeasureSet =
shapeAnalysis2d(pInGreyImg2d, pShape2dColl, pMeasureInfoSet);
const MeasureConstPtr& pEnergyOutMsr = pOutMeasureSet->getMeasure("EnergyMsr");
const ipsdk::shape::analysis::ValueMeasureResult<ipsdk::ipReal64>& outResults = static_cast<const ipsdk::shape::analysis::ValueMeasureResult<ipsdk::ipReal64>&>(pEnergyOutMsr->getMeasureResult());