ImageDev

CustomMeasurement

This class allows the creation of a new label analysis measurement, based on a user-defined formula.

A custom measurement is defined by a string formula that can invoke other measurements. It can be used by most of the individual analysis algorithms. It must have a unique name.

The formula defining a custom measurement must be written in accordance with the custom formula syntax. The validity of the formula can be verified with the checkMeasurementFormula method.

Notes
See also

AnalysisMsr* analysis = new AnalysisMsr();
// Create a circularity factor between 0 and 1
std::string circularityFormula = "1.0/InverseCircularity";
if ( checkMeasurementFormula( circularityFormula ) )
{
    auto customMeasurementInfo =
        AnalysisMsr::registerCustomMeasurement( "Circularity", circularityFormula, "This is my circularity factor." );
    auto circularity = analysis->select( customMeasurementInfo );
}
      
analysis = imagedev.AnalysisMsr()
# Create a circularity factor between 0 and 1
circularity_formula = "1.0/InverseCircularity";
if (imagedev.check_measurement_formula(circularity_formula)):
  customMeasurementInfo = imagedev.registerCustomMeasurement("Circularity", circularityFormula, "This is my circularity factor.")
  circularity = analysis.select(customMeasurementInfo)
      
AnalysisMsr analysis = new AnalysisMsr();
// Create a circularity factor between 0 and 1
String circularityFormula = "1.0/InverseCircularity";
if (Processing.CheckMeasurementFormula(circularityFormula))
{
    var customMeasurementInfo =
        AnalysisMsr.RegisterCustomMeasurement("Circularity", circularityFormula, "This is my circularity factor.");
    var circularity = analysis.Select(customMeasurementInfo);
}