The function AnalyseAndAppend analyzes a given layer of an image and segments it in order to detect particles. The layer to be analyzed is contained in the array ImgData. You can exclude specific pixels from the analysis by setting the corresponding cells in the array PixMask to TRUE. In order to prevent any masking you can set PixMask to NIL.
The parameters Thresh1 and Thresh2 control the thresholds which are used to detect particles. All pixels having an intensity greater equal than Thresh1 and less equal than Thresh2 are considered to be part of a particles. The parameter MinSize determines the minimum required size of a contiguous region to be recognized as a particle (in pixels).
The function AnalyseAndAppend assigns the found particles to a new class number which is returned in the variable parameter ClassIdx. The parameters ClassName and ClassID contain the name of the new particle class and its unique class identifier.
The function returns the following error codes:
≥0 ... everything is OK, the function returns the number of found particles
-1 .... the size of ImgData does not match the existing particle matrix
-2 .... the size of PixMask does not match the size of ImgData
-3 .... Thresh1 must not be greater than Thresh2