Fit curve to contour

Fit curve to contour

This option locates a contour passing through a user-specified point. The coordinates of this contour are then expressed in terms of the distance along the contour, s, and a least squares fit is generated for this data.

RETURN VALUES The following return values are available through the !!Rn mechanism (note that you will normally require a E, F or G modifier to return the floating point representation of these return variables):

           !!R0,...        Return the coefficients of the fit for the i
                           verses s fits
           !!Ra,...        Return the coefficients of the fit for the j
                           verses s fits
           !!Rn            Returns the number of points on the contour
           !!Rm            Returns 2*pi/!!Rn

Fit contour in which buffer ?

This entry specifies the buffer in which the contour will be located. This buffer will be displayed for use in specifying the start of the contour.

Cursor Positioning: Specify point on contour

The standard DigImage cursor is utilised to allow the specification of some point on the contour. For more information about the use of the cursor, refer to [H Help] once the cursor menu has started.

Threshold for contour ?

Specify the intensity level used to define the contour passing through the selected point. This threshold should not exceed the intensity of the point which has been selected.

Locate contour in Window or whole Screen ?

The extent of the contour may be limited to a window within the buffer (<W>), or it may extend throughout the buffer (<S>). If it is restricted to a window, then the DigImage Window Selection menu will be produced to define the window.

{If contour restricted to window}

Window Selection: Region to find contour in

    The DigImage window selection submenu is produced to enable interactive
    specification of the window within which the contour is restricted. For
    information about use of the window submenu, refer to [H Help] after the
    submenu has been started.

Contour found contains !!Rn points. The contour is !R0 Display the contour on which buffer ?

A contour was found with the specified number of points. The number of points is available in !!Rz. This contour will now be displayed on the buffer specified here.

Erase buffer first ?

The buffer in which the contour is plotted may be erased before the plotting process.

Plot with what intensity (-1 to suppress) ?

The contour will be plotted with the intensity specified here. If you do not want to plot the contour, then specify -1.

Plot i verses s and j verses s ?

To aid the choise of functions to be fitted to the curve, DigImage can plot the i and j data as a function of the fractional distance along the contour, s.

{If plotting i(s) and j(s) curves}

Plot the i vs s and j vs s curves where (-1 for computer monitor) ?

If requested by the previous prompt, the i=i(s) and j=j(s) data may be plotted on a frame grabber buffer or on the computer monitor (-1).

The curve described by the contour is fitted using i=G(s) and j=H(s) where s is the distance along the contour.

Enter the basis functions to be used for G(s). These functions should be
separated by colons (:). To suppress the fitting, enter a blank line.

The points on the contours are expressed as i=G(s) and j=H(s) where s is the fractional distance along the contour (0<=s<n). The fitting procedure approximates i and j as

       A(i) = c0 g0(s) + c1 g1(s) + ...

and

       B(j) = d0 h0(s) + d1 h1(s) + ...

where A(i), g0(s), g1(s), ... and B(j), h0(s), h1(s), ... are user-specified functions. The coefficients c0,c1,... and d0,d1,... are determined by a least squares procedure. These coefficients are available to the user through !!R0, !!R1, ... (for c0, c1, ...) and !!Ra, !!Rb, ... (for d0, d1, ...).

This entry specifies the set of functions g0(s), g1(s), ... These functions should be expressed in terms of the distance along the contour, s, and should be separated from eachother by a colon (:). For example, to fit a straight line to A(i), ie. A(i) = a0 + a1*s, you should specify

       1 : s

The following return variables contain values which may assist in specifying appropriate basis functions:

       !!Rn        n, the number of points in the contour
       !!Rp        =2*pi. To fit a circle to a closed contour, use
                   1 : COS(!!GRp*S) : SIN(!!GRp*S)

If you do not wish to fit any curve to the data, enter a blank line.

Enter the function A(i) transforming the i data

    This function should be expressed in terms of i. See the previous prompt
    for further details.

Enter the inverse transform I(a) for the i data

    This function is used to invert the A(i) transform. It should be
    specified in terms of a.

Enter the basis functions to be used for H(s). These functions should be separated by colons (:). To suppress the fitting, enter a blank line.

This entry specifies the set of functions h0(s), h1(s), ... These functions should be expressed in terms of the distance along the contour, s, and should be separated from eachother by a colon (:). See entry for previous prompt for further details.

Enter the function B(j) transforming the j data

    This function should be expressed in terms of j. See the prompt for A(i)
    for further details.

Enter the inverse transform J(b) for the j data

    This function is used to invert the B(j) transform. It should be
    specified in terms of b.

Plot fitted curve using what intensity (-1 to suppress) ?

    The curve fitted to the x,y data will be plotted on the output buffer
    using the intensity specified here. If you do not wish to plot this
    curve, specify the intensity as -1.

Errors, Warnings and Messages

Message:
Fitting curves to data...

Error Message: The chosen pixel can not lie on a contour

    The pixel chosen must have a neighbouring pixel of a lower intensity.
    This is necessary as the contour is is taken to be the pixel with the
    intensity greater than or equal to the threshold defining the contour.
    Thus if there is no neighbouring pixel with an intensity lower than the
    one selected, there can not be a contour passing through the selected
    point.

Error Message: Too many points on contour

There is a limit of 8192 (8K) points on a contour for this option. The contour found contains more than this number of points.

Parent menu

Main Menu

DigImage User Documentation


Stuart Dalziel, last page update: 19 February 1996