1 CORRELATE
        CORRELATE

    Computes correlation of two images or data  cubes.   The  result  is  an
    image (data cube) containing

          Out(i,j) = < In1(k-i,l-j)*In2(k,l) >         averaged over k,l
          For mode correlation (MODE$ = YES)
    or
          Out(i,j) = < In1(k-i,l-j)**2 + In2(k,l)**2
                       - 2 * In1(k-i,l-j)*In2(k,l) >   averaged over k,l
          For mode square (MODE$ = NO)

    Actually, linear conversion formulas are used to  keep  the  correlation
    image meaningful in user coordinates.  The input images must match.

    When used for example to  recenter   images,   the   position   of   the
    maximum  of the correlation image (or equivalently of the minimum of the
    sum of squares  image)  yields  the  required  recentering.   MODE$  YES
    (Correlation)  is  to  be  used when the input distribution has a finite
    extent, while MODE$ NO (Square) can be used in any case, but is somewhat
    slower of course.
2 IN_NAME1$
        TASK\FILE "First input map" IN_NAME1$

    This is the name of the first input map.
2 IN_NAME2$
        TASK\FILE "Second input map" IN_NAME2$

    This is the name of the second input map.
2 IN_NAME1$
        TASK\FILE "Output map" OUT_NAME$

    This is the name of the output map.
2 OUT_SIZE$
        TASK\INTEGER "Number of pixels in the correlation" OUT_SIZE$[2]

    Number of pixels (i,j) to keep in the correlation.  If set to  0,0,  the
    complete  correlation  image  is  computed, otherwise only the specified
    portion (around the center 0,0) is computed.
2 MODE$
        TASK\LOGICAL "Mode CORRELATION (answer YES) or SQUARE  (answer  NO)"
    MODE$

    Select  the  correlation  mode   :    simple   correlation   (YES)    or
    least-square distribution (NO).
1 END



















