ParticleDiscrimination Method

NI Vision for Visual Basic

ParticleDiscrimination Method

Syntax

CWIMAQVision.ParticleDiscrimination SourceImage, DiscriminationData, ParticlesReport

Return Type

Long

On success, this method returns 0. On failure, this method returns a negative number.

Purpose

Obsolete—Use SelectParticles instead. Filters an array of particle reports based on criteria ranges. Call the Particle method before calling this method.

Remarks

Use this method with U8 images.

This method does not modify the image. ParticleDiscrimination works only on the particle report array, removing particle reports that do not match the selection criteria.

Parameters

SourceImage As CWIMAQImage

The image previously used in CWIMAQVision.Particle. The function needs this image to get the calibration values.

DiscriminationData As CWIMAQDiscriminationData

A report that describes the criteria for the particles you want to keep.

Only the particles with a parameter matching the ranges given by the report elements are not removed from ParticlesReport.

ParticlesReport As CWIMAQFullParticleReport

A CWIMAQFullParticleReport object containing the particles reports from Particle . The report is processed and returned with only the matching particle elements.

Example

Private Sub Run_Click()
    Dim report1 As New CWIMAQFullParticleReport
    Dim report2 As New CWIMAQDiscriminationData

    'Generate Particle Report
    CWIMAQVision1.Particle CWIMAQViewer1.Image, report1

    ' Filter the report so that it only contains particles with an
    ' area between 100 and 200 pixels

    report2.Count = 1      ' Discriminate one parameter
    report2.Parameter(1) = cwimaqParticleArea  ' Discriminate area
    report2.MaxValue(1) = 200                  ' 200 is the max area
    report2.MinValue(1) = 100                  ' 100 is the min area
    CWIMAQVision1.ParticleDiscrimination CWIMAQViewer1.Image, report2, report1  ' Filter report1 report
End Sub

See Also

SelectParticles