How to access measurement data in your App
Many Apps take advantage of the powerful measurement capabilities of Image-Pro Premier, whether it is Count/Size or simple Manual Measurements but what if your App needs to do more with the measurement data than what the built-in feature does? The following macro illustrates how a simple macro can have full access to the measurement results and statistics. A reference to MediaCy.Addins.Measurements.dll will be needed.
Imports MediaCy.Addins.Measurements
Public Module Macros
Public Sub GetData()
Dim data As McMMData
Dim stats(8) As Double
ThisApplication.Output.show
With measure.MeasurementsCommands.GetData(Nothing)
.Run(ThisApplication.ActiveDocument, data)
End With
' Statistics '
Dim measure As New MeasEntry
measure.Measurement=eMeasures.RgnArea
data.CalcStatistics(measure,stats)
ThisApplication.Output.PrintMessage("Mean Area = " & stats(0))
ThisApplication.Output.PrintMessage("SD Area = " & stats(1))
ThisApplication.Output.PrintMessage("Min Area = " & stats(2))
ThisApplication.Output.PrintMessage("Max Area = " & stats(3))
' Values '
For i As Integer = 0 To data.Rows-1
Dim feature As McMMSubFeature = data.SubFeature(i)
ThisApplication.Output.PrintMessage(String.Format("Area({0}) = {1}",i,feature.Value(eMeasures.RgnArea)))
Next
End Sub
End Module
0
Comments