SelectParticles Method

NI Vision for Visual Basic

SelectParticles Method

Syntax

CWIMAQVision.SelectParticles ParticleSelectionData, ParticleReport [, SourceImage] [, RejectBorderParticles]

Return Type

Long

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

Purpose

Obsolete Returns a selection of particle measurements in reports from BasicParticle or Particle based on a minimum and maximum criteria. SelectParticles allows you to choose which measurements you want to obtain from a particle-detection process.

Remarks

Use this method with U8 images.

Parameters

ParticleSelectionData As CWIMAQParticleSelectionData

The criteria used to select the particles you want to keep. Any particle not meeting the criteria is removed from the ParticleReport. The actual parameters that you can specify in the ParticleSelectionData parameter are determined based on whether you pass a CWIMAQBasicParticleReport object or a CWIMAQFullParticleReport object for the ParticleReport parameter.

ParticleReport As Object

Either a CWIMAQBasicParticleReport object or a CWIMAQFullParticleReport object. CWIMAQBasicParticleReport is the output of measurements from CWIMAQVision.BasicParticle. CWIMAQFullParticleReport is the output of measurements from CWIMAQVision.Particle.

SourceImage As Variant

[Optional] The reference to the same source image used to measure the particle coefficients by BasicParticle or Particle. This input is required when RejectBorderParticles is set to True, a case in which particles touching the border are discarded for measurement calculations. This input is not required and is ignored when RejectBorder is set to False.

RejectBorderParticles As Variant

[Optional] Determines whether particles touching the border should be measured. If True, the measurements for particles touching the border are rejected. In this case, you must supply the SourceImage.

Example

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

    '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.Add                                
    report2(1).Parameter = cwimaqParticleArea  ' area parameter
    report2(1).Range.Min = 100                 ' 100 is the min area
    report2(1).Range.Max = 200                 ' 200 is the max area
    CWIMAQVision1.SelectParticles report2, report1
End Sub

See Also

BasicParticle

Particle

CWIMAQBasicParticleReport

CWIMAQFullParticleReport