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
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
Yuri