Get area size based on histogram
Hi there,
I can get any values by program code (e.g. intensity mean) from the histogram based on ROI. Also it works fine with the XOR ROIs functionality to read out correct values.
Public Sub ShowROIArea Dim histo As MediaCy.IQL.Operations.McHistogram=ThisApplication.ActiveImage.Histogram histo.Mode = MediaCy.IQL.Operations.mcHistogramMode.mchmApplySpatialCalibration histo.Interpretation = mcInterpretation.mciMonochrome histo.Mode = histo.Mode And (Not MediaCy.IQL.Operations.mcHistogramMode.mchmIgnoreAoi) 'use ROI MsgBox histo.Mean(0).ToString End Sub
How can I read out the Area shown in the histogram?
Thank in advance
fsup
0
Comments
-
Hi fsup,
You can get area directly from ROI (ActiveImage.Aoi) or you can get it from the histogram by summarizing the values of all bins. Here is the macro:Public Sub ShowROIArea Dim histo As MediaCy.IQL.Operations.McHistogram=ThisApplication.ActiveImage.Histogram histo.Mode = MediaCy.IQL.Operations.mcHistogramMode.mchmApplySpatialCalibration histo.Interpretation = mcInterpretation.mciMonochrome histo.Mode = histo.Mode And (Not MediaCy.IQL.Operations.mcHistogramMode.mchmIgnoreAoi) 'use ROI 'ensure that we count all pixels in ROI histo.SamplingCoverage=100 'calculate area as the sum of all bins Dim area As Double=0 Dim nBins As Integer=histo.BinCount For i As Integer=0 To nBins-1 area+=histo.Values(i,0) Next 'show area in calibrated units MsgBox "ROI area = " & area.ToString() 'MsgBox histo.Mean(0).ToString End Sub
Yuri0 -
Hallo Yuri,thank you for your prompt reply. It works finefsup0
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