User's Guide

CANAL

Performs canonical analysis/transformation on a multiband image

Function:

Computes a linear transformation that will "emphasize" the differences between classes. The class means and covariances obtained from the input statistics file INSTAT are used to estimate within and between class covariances, which are then used to compute a transformation matrix. The transformation is then used to transform the mean and covariance statistics, which are written to the output statistics file along with the transformation matrix. If desired, the transformation may be applied to an input image to obtain a transformed output image.

The statistics file output by CANAL in an earlier run may also be used to directly provide the transformation matrix to transform an input image; in this case, however, no output statistics file is produced. Thus, the statistics output by CANAL for different classifications may be examined by the user before the final transformation is performed on the image.

Parameters:

INSTAT
Input statistics file. It may contain the mean and covariance information needed to create the transformation matrix, or it may contain the previously created transformation matrix (from an earlier run of CANAL).

IN(--)
Input image. The input image to which the transformation is applied. It must contain the same number of bands as in INSTAT. Acceptable data types are BYTE, INTEGER*2, INTEGER*4, and REAL*4.

OUT(--)
Output image. The output image created by applying the canonical transformation to the input image. The number of bands in OUT is determined by OUTBANDS, but the maximum number of output bands will depend on the results of Bartlett's test. The size of OUT is the same as IN and its data type is specified using ODTYPE.

OUTSTAT(--)
Output statistics file. It will contain the transformed statistics and the computed transformation. It must be specified if MATRXOPT=COMPUT is specified; ignored otherwise.

PRINT(TERM)
Output destination. Output destination for the computed transformation matrix and the within and between class covariance matrices.


  = --:    No Report
  = TERM:  Terminal. 
  = LP:    Line printer. 
  = File:  User supplied
           filename

OUTBANDS(0)
The number of components (bands) in the output image. It must be less than or equal to the number of bands found in INSTAT. The number of components actually output will, however, depend on Bartlett's test (see Description/ Algorithm). If specified as zero, no image is output.

MATRXOPT(COMPUT)
Transformation matrix. Specifies whether or not the transformation matrix currently exists.


  = EXIST:   Available in INSTAT. 
  = COMPUT:  To be computed. The transformation is 
             computed from the mean and variance-
             covariance information contained in 
             INSTAT.

If the matrix does exist in INSTAT and MATRXOPT=EXIST is specified, the output statistics file is not created, and the parameter OUTSTAT is ignored.

ODTYPE("R*4")
Data type of the output image. If the specified data type is not large enough to contain the computed values, truncation of the data values will occur.

The following may be specified for ODTYPE:


  = BYTE:  BYTE  
  = R*4:  REAL*4

Examples:

  1. LAS> canal instat=balt;stats outstat=balt.canal;stats

    CANAL computes the transformation matrix, using the input statistics file BALT.STATS. The transformation matrix is used to transform the class mean, covariance, and correlation matrices, which are then stored in the output statistics file BALT.CANAL.STATS along with the transformation matrix.

  2. LAS> canal instat=balt.canal;stats in="balt(1,1,300,300)" out=canal.out outbands=3 matrxopt=exist odtype=byte

    CANAL obtains the transformation matrix from the input statistics file BALT.CANAL;STATS and applies the transformation to a 300 x 300 window of the input image, BALT. The number of components in the output image CANAL.OUT may be equal to or less than three, depending on Bartlett's test (see Description/Algorithm). The output data type is BYTE.

  3. LAS> canal instat=balt.canal;stats in=balt outstat=balt.canal.out;stats out=balt.canal outbands=4

    CANAL computes and applies the transformation on the input image BALT and produces the output image BALT.CANAL. The number of components in the output image may be equal to or less than four, depending on Bartlett's test (see Description/Algorithm). The output image data type is REAL*4.

Description/Algorithm:

The transformation matrix is computed as follows:

Let the desired linear transformation be

               -    -           
               y = Ax

      - 
where x is the input image pixel vector, A is the linear 
                           -    
transformation matrix, and y is the output image pixel 
vector.  Let p be the number of components in the input 
multiband image and r the number of classes in the image.  
    -
Let m ,k=1,...,r be the p-component mean vector and C , 
     k                                               k
the covariance matrix of class k, determined from the n  
                                                       k
samples of that class.  The total number of samples (n) 
in all the classes is

           r
      n =     n
          k=1  k

Let W be the "pooled within-class" covariance matrix. W is defined as

                  r      
            1           
      W =  ---       (n -1) C
           n-r         k     k
                 k=1

Let P be the "between-class" covariance matrix.  P is 
defined as

           ---                                          --- 
           |                 --         -- --          -- | 
         1 |  r     - -'   1 |   r     - | |   r     -' | |
    P = ---| SUM  n m m  - - | SUM   n m | | SUM   n m  | | 
        r-1|  k=1  k k k   n |  k=1   k k| |  k=1   k k | | 
           |                 --         -- --          -- | 
           ---                                          ---

The problem is to maximize APA' subject to the constraint AWA'=1. This is equivalent to maximizing FQF' subject to the constraint FF'=1, where

                     1/2         -1/2  -1/2  
               F = AW   and Q = W    PW

which is solvable as an eigenvalue problem. The solution, F, is given by the eigenvectors of Q.

         -1/2
To find W    , find G and L such that L is a diagonal 
matrix of eigenvalues of W and G is a matrix of 
corresponding eigenvectors. 
Thus
                         
                          1/2    1/2        -1/2    -1/2
               W = GLG', W   = GL   G' and W    = GL    G' 

F is obtained by finding the eigenvalues {g }and 
eigenvectors of                            i
                    -1/2  -1/2
               Q = W    PW

It may be noted, however, that the p eigenvalues of Q are only distinguishable when p<r-1. In the case of p>r-1, there are (p-r+1) zero eigenvalues and (r-1) distinguishable nonzero eigenvalues. Bartlett's test (see References) is used to determine whether all the eigenvalues after the qth can be ignored. It is based on the fact that

                                   s        

                (n-1)-(p+r)/2  ln  PROD   (1+g )
                                              j 
                                 j=q+1      


is approximately a chi-square variable with (p-q) times 
(r-q-1) degrees of freedom when g   = ...= g =0, where s 
                                 q+1        s
is the smaller of (r-1) and p.

The transformation matrix A is computed as


                     -1/2
               A = FW 

where F now contains the first q eigenvectors of Q.

The computed matrix is used to transform the mean, covariance, and correlation statistics, which are written to the output statistics file along with the transformation matrix. If desired, the transformation may be applied to a specified input image to obtain a transformed output image.

The output image is normally output as a REAL*4 image. It may be scaled to BYTE. Only the specified number of components are output. However, the maximum number of components that can be output will depend on Bartlett's test (see References).


References:

1.  M. S. Bartlett, Further Aspects of the Theory of 
    Multiple Regression," Proc. Cambridge Philanthropic 
    Society, 34, 1938.

2.  H. L. Seal, Multivariate Statistical Analysis for 
    Biologists, Methuer and Co. Ltd., London, 1964.

3.  D. F. Morrison, Multivariate Statistical Methods, 
    McGraw-Hill, New York, N.Y., 1967.

4.  M. S. Bartlett, "Multivariate Analysis," Journal Royal
    Statistical Society, Supplement 9.

Nonfatal Error Messages:

  1. [canal-obands] OUTBANDS exceeds no. of input bands; reset to XXX

    The number of output bands cannot exceed the number of input bands. It is reset to the number of input bands.

  2. [canal-zerodet] Determinant of Covariance matrix <= 0 for Class: XXX Site: YYY

    Check the statistics in the input statistics file using EDITSTAT.

  3. [canal-diag] Diagonal element <= 0 in Covariance matrix for Class: XXX Site: YYY; correlation matrix not computed.

    Check the statistics in the input statistics file using EDITSTAT.

Fatal Error Messages:

  1. [canal-ibands] No. of input bands should be greater than 1

    Input image must be a multi-band image.

  2. [canal-nobands] Zero number of output bands specified for transformation

    If the user specifies MATRXOPT=EXIST, OUTBANDS must be greater than 0.

  3. [canal-sfdim] Stats file dimension = XXX; does not match number of bands in input image

    Check statistics file. Specify the same file as the one obtained from the image.

  4. [canal-sfout] Error getting output statistics file name

    The user has specified MATRXOPT=COMPUT and did not give an output statistics file in OUTSTAT parameter.

  5. [canal-in] Error getting input image name

    The parameter OUTBANDS is nonzero, but no input image is specified.

  6. [canal-out] Error getting output image name

    The parameter OUTBANDS is nonzero, but no output image is specified.

  7. [canal-matrix] Error getting transformation matrix

    Regenerate transformation matrix.

  8. [canal-nosamp] No. of samples for class <XXX> not found in statistics file

    Regenerate statistics file (run STATS).

  9. [canal-nomean] Mean vector for class <XXX> not found in statistics file

    Regenerate statistics file (run STATS).

  10. [canal-mean] Mean vector for class <XXX> does not have correct no. of elements

    Regenerate statistics file (run STATS).

  11. [canal-nocov] Covariance matrix for class <XXX> not found in statistics file

    Regenerate statistics file (run STATS).

  12. [canal-cov] Covariance matrix for class <XXX> does not have correct no. of elements

    Regenerate statistics file (run STATS).

  13. [canal-trans] Transformation not possible; regenerate statistics file defining different set of classes

    Bartlett's test resulted in zero number of output components.

User Notes:

  1. The input statistics file is usually obtained by running the program STATS on the same image.

  2. CANAL uses the same scale factor for all the output image components to convert them into BYTE data. Hence, if output REAL*4 images are scaled by the user using SCALE with default values, it will result in incorrect interpretation, since each component will be scaled with a different scale factor.