Fetch Data (simple)
Hi,
Again a beginner's question but I had to give up:
Can't get a value for StDevIntIM, what is wrong?
Public Function Convert8bitGrey() As SimpleScript Convert8bitGrey = New SimpleScript Dim doc1, image1, doc2, StDevIntIM
'....a set of functions before such as conversion, measurement definition etc....
'.
'.
With Application.DocumentCommands.Active(Convert8bitGrey) .Run(doc2) End With With Measure.MeasurementsCommands.ExecuteCount(Convert8bitGrey) .Run(doc2) End With With Automate.ScriptingCommands.FetchData(Convert8bitGrey) .Expression = "<McMMData>.Statistics(eMeasures.RgnStdDevIntensity).Mean" If .Run(doc2) Then StDevIntIM = doc2.Statistics(eMeasures.RgnStdDevIntensity).Mean MsgBox("")&StDevIntIM 'is never displayed End If End With MsgBox("")&StDevIntIM ' this is empty End Function
The if .Run(doc2) also not .run() statement or whatever I tried does not work.
The first Msgbox is never displayed, which means to me that ...FetchData().run does not exist?
How do I get the value into the variable?
Thx Daniel
0
Best Answer
-
Hi Daniel,
Here is a macro with the required syntax to count objects and access measurements statistics.
PierrePublic Sub GetStatistics() Dim doc1, mdata, stdevInt Dim stats As StatsClass With Application.DocumentCommands.Active(Nothing) .Run(doc1) End With With Measure.MeasurementsCommands.ExecuteCount(Nothing) .Run(doc1) End With With Measure.MeasurementsCommands.GetData(Nothing) .Run(doc1, mdata) End With With Automate.ScriptingCommands.FetchData(Nothing) .Expression = "<McMMData>.Statistics(eMeasures.RgnStdDevIntensity)" If .Run(mdata, stats) Then stats = mdata.Statistics(eMeasures.RgnStdDevIntensity) MsgBox stats.Mean End If End With End Sub
0
Answers
That's it.:-)
For completeness:
Here the sub solution: