how to export histogram statistics in a macro
I can copy the histogram itself to excel or i can export the entire data into excel and calculate relevant stats. in excel. Is there an easier way to extract the statistics only (Gmean, area, stdev etc)?
0
Comments
-
You can get all histogram stats using McHistogram object:
Sub PrintHistStats Dim hist As MediaCy.IQL.Operations.McHistogram=ThisApplication.ActiveImage.Histogram Debug.Print "Red mean = " & hist.Mean(0) Debug.Print "Green mean = " & hist.Mean(1) Debug.Print "Red deviation = " & hist.StdDev(0) End Sub
Check Automation help on McHistogram for other properties:Yuri0 -
I am unable to find "automation help on McHistogram" . I am having difficulty finding help in general and hence posting questions of dubious challenge
. Where should i be looking?
0 -
The help file itself is located atC:\Program Files\Media Cybernetics\Image-Pro Premier 9.1\Help\Image-Pro Premier Automation Help.chmyou can open it directly from the folder. Also you can open it from Premier using the "Automation reference" menu item in the Help button drop-down in the Scripting workbench window (Question mark blue icon on the top-right side of the window).0
-
When i run the code on a BINARY image the debug.print output does NOT match the stats triggered by histogram command. Snapshots attached. Please explain. I thought the mean = (sum/area) but that does not appear to be the case. Please explain or give definitions for SUM &/or Mean. Thx.0
-
Histogram panel uses HistogramSampled, which is faster for large images. You can compare the results using this macro:
Sub PrintHistStats2 Dim hist As MediaCy.IQL.Operations.McHistogram=ThisApplication.ActiveImage.Histogram Debug.Clear Debug.Print "Histogram" Debug.Print "Stdev = " & hist.StdDev(0) Debug.Print "Mean = " & hist.Mean(0) Debug.Print "Sum = " & hist.Sum(0) hist =ThisApplication.ActiveImage.HistogramSampled Debug.Print "HistogramSampled" Debug.Print "Stdev = " & hist.StdDev(0) Debug.Print "Mean = " & hist.Mean(0) Debug.Print "Sum = " & hist.Sum(0) End Sub
The definitions from the help:The calibrated (depending on Mode) Sum of all the bin counts where calibrated bin counts (Values) are multiplied by their x value (calibrated intensity), and accumulated.Parameters
- Channel (Int32)
Remarks
The Compute method is called automatically (on the parent IMcImage) whenever it is necessary. In order to compute the Histogram on another image than the parent, one has to call Compute explicitly. This property returns an array of NumberOfChannels values if Channel=-1, or otherwise a single double precision floating point value for the specified channel. Note that since most property viewers (including the VBA Immediate window) will only display single (scalar) values, the channel must be specified when the property is used in this way, for instance, ? ThisApplication.ActiveImage.Histogram.Sum 0The calibrated (depending on Mode) Mean of all the bin counts.Parameters
- Channel (Int32)
Remarks
The Compute method is called automatically (on the parent IMcImage) whenever it is necessary. In order to compute the Histogram on another image than the parent, one has to call Compute explicitly. This property returns an array of NumberOfChannels values if Channel=-1, or otherwise a single double precision floating point value for the specified channel. Note that since most property viewers (including the VBA Immediate window) will only display single (scalar) values, the channel must be specified when the property is used in this way, for instance, ?ActiveImage.Histogram.Sum 0 The property is exposed as an array of NumberOfChannels values if Channel=-1, or a single double precision floating point value.Yuri0
Categories
- All Categories
- 961 Image-Pro v9 and higher
- 9 Image-Pro FAQs
- 18 Image-Pro Download & Install
- 448 Image-Pro General Discussions
- 486 Image-Pro Automation (Macros, Apps, Reports)
- 20 AutoQuant Deconvolution
- 2 AutoQuant Download & Install
- 18 AutoQuant General Discussions
- 195 Image-Pro Plus v7 and lower
- 3 Image-Pro Plus Download & Install
- 106 Image-Pro Plus General Discussions
- 86 Image-Pro Plus Automation with Macros
- 19 Legacy Products
- 16 Image-Pro Premier 3D General Discussions
- 26 Image-Pro Insight General Discussions