Quantify Method
Syntax
CWIMAQVision.Quantify SourceImage, GlobalReport, RegionReport [, MaskImage]
Return Type
On success, this method returns 0. On failure, this method returns a negative number.
Purpose
Quantifies the contents of an image or the regions within an image. The region definition is performed with a labeled image mask. Each region of the mask has a single unique value.
Remarks
Use this method with U8, I16, and SGL images.
Parameters
SourceImage As CWIMAQImage
The image to quantify.
GlobalReport As CWIMAQQuantifyReport
On return, a report containing the quantification data relative to all the regions within an image, or to the entire image if the MaskImage is not supplied.
RegionReport As CWIMAQQuantifyReport
On return, a report containing the quantification data relative to each region within an image, or the entire image if MaskImage is not supplied. The nth item in this report contains the data regarding the nth region. The size of this report is equal to the largest pixel value in MaskImage. See the MaskImage parameter for more information on the regions.
MaskImage As Variant
[Optional] An 8-bit or 16-bit image specifying the regions to quantify in the image. Only the pixels in the original image that correspond to an equivalent pixel in the mask different from 0 are used for the quantification. Each pixel in this image (mask) indicates, by its value, which region belongs to the corresponding pixel in Image. Up to 255 regions for a U8, or 65,535 regions for an I16, can be quantified directly from the Image. A quantification is performed on the complete image if you do not supply this parameter.
Example
Private Sub Run_Click() Dim maskImage As New CWIMAQImage Dim numParticles Dim globalReport As New CWIMAQQuantifyReport Dim regionsReport As New CWIMAQQuantifyReport ' If there are regions on Viewer1 If CWIMAQViewer1.Regions.Count > 0 Then ' Create the mask from the regions you selected on Viewer1 CWIMAQVision1.RegionsToMask maskImage, CWIMAQViewer1.Regions ' Label the maskImage CWIMAQVision1.Label maskImage, maskImage, numParticles ' Quantify the image based on the regions CWIMAQVision1.Quantify CWIMAQViewer1.Image, globalReport, _ regionsReport, maskImage Else ' Quantify the entire image CWIMAQVision1.Quantify CWIMAQViewer1.Image, globalReport, _ regionsReport End If End Sub