CFwhm:Calc


The Calc method computes the FWHM, Peak, Background and, optionally, the x and y centroid coordinates in the image. The starting coordinate (x,y) is passed as arguments of this method. The other parameters are stored in the CFwhm class.

Syntax

nFwhm, bSuccess = CFwhm:Calc( CImage, nX0, nY0 )

where

    CImage is the image object to measure.

    nX0 and nY0 are initial guesses for the centroid coordinate (x,y), measured in pixels coordinates.

    FWHM is the returned value of the FWHM. On failure, nFwhm=0.

    bSuccess is the returned success code. On success it is true, otherwise false.

  

This method returns a boolean success flag, followed by the FWHM value. Since the success flag is returned first, you can test for successful return value by testing the first return value as shown in the example below. Upon a successful calculation, the FWHM, Peak, Background, X, and Y values are stored in class properties that can be retrieved using various class methods.

Example

Assume that an image exists as the CImage objectI. The example below shows calculation of the FWHM. The results returned by the functional call and those saved in class members should be identical.

 

F = CFwhm:new()

-- create a CFwhm object

x0 = 192 ; y0 = 440

-- point near the centroid position

F.bPositive = true

-- calculate using peaks, not valleys

F, bSuccess = F:Calc( I, x0, y0 )

-- calculate the FWHM and optional success

if bSuccess then

-- if successful, print the result

 Printf("returned %lg", F )

-- returned by the method

 Printf("FWHM = %lg", F:Fwhm())

-- stored in the class, should be same

end

 

F:delete()

-- clean up memory

Related Topics

Fwhm

Peak

Bg

X

Y

CFwhm class

CCentroid class

Image Coordinate System

Subpixel Coordinate Definition