## NAME

i.class - An imagery function that generates spectral signatures for an image by allowing the user to outline regions of interest. The resulting signature file can be used as input for i.maxlik or as a seed signature file for i.cluster.
(GRASS Image Processing Program)

## SYNOPSIS

i.class

## DESCRIPTION

i.class performs the first pass in the GRASS two-pass supervised image classification process; the GRASS program i.maxlik executes the second pass. Both programs must be run to generate a classified map in GRASS raster format.

i.class is an interactive program that allows the user to outline a region on the screen and calculate the spectral signature based on the cells that are within that region. During this process the user will be shown a histogram of the region for each image band. The user can also display the cells of the image bands which fall within a user-specified number of standard deviations from the means in the spectral signature. By doing this, the user can see how much of the image is likely to be put into the class associated with the current signature.

The spectral signatures that result are composed of region means and covariance matrices. These region means and covariance matrices are used in the second pass (i.maxlik) to classify the image.

Alternatively, the spectral signatures generated by i.class can be used for seed means for the clusters in the i.cluster program.

## USER INPUTS

The first screen in the program i.class asks the user for the imagery group and subgroup to be analyzed:

    LOCATION: location    SUPERVISED CLASSIFIER     MAPSET: demo

         Please select the group and subgroup to be analyzed

    GROUP:      spot_______   (list will show available groups)
    SUBGROUP:   123________   (list will show available subgroups)

         AFTER COMPLETING ALL ANSWERS, HIT <ESC> TO CONTINUE
                       (OR <Ctrl-C> TO CANCEL)

The group should contain the imagery bands that the user wishes to classify. The subgroup is a subset of this group. The user must create a group and a subgroup by running the GRASS program i.group before running i.class. The subgroup should contain only the image bands that the user wishes to classify. Note that this subgroup must contain more than one band.

After the first screen, the program asks the user for the name of the resulting signature file. The signature file is both the output file for i.class and the required input file for the GRASS program i.maxlik. It contains the region means and covariance matrices that are used to classify an image in i.maxlik.

After entering the resulting signature file name, the user is asked to enter the name of a seed signature file. This is optional. A "seed" signature file is a previously created signature file. Such a seed signature file may be the result of an earlier run of i.class. The seed signature file is copied into the new resulting signature file before any new signatures are added by i.class. In this way, you can collect the work from several sessions with i.class into one signature file.

Next, the user is asked to enter the name of the raster map to be displayed during the process of outlining regions. Typically, the user will want to enter the name of a color composite previously created by i.composite. However, the user can enter the name of any existing raster map. This leaves the potential for using a raster map not directly derived from the image as a backdrop on which the user can outline the classes of interest.

At this point the i.class graphics screen will be drawn on the graphics monitor and the user will be directed to use the mouse. From this point on the user will primarily work with the mouse, selecting options from the menus and outlining regions on the screen. The only time that the user will need to return to the text terminal is to enter names for the signatures created.

## THE DISPLAY FRAMES

The display frame layout that i.class uses is represented below for reference.

    +-----------------------+---------------------------+
    |                       |                           |
    |                       |    Map Display Frame      |
    |                       |                           |
    |                       |                           |
    |   Histogram Display   |                           |
    |        Frame          |                           |
    |                       |                           |
    |                       |                           |
    |                       |                           |
    |                       +---------------------------+
    |                       |                           |
    |                       |    Zoom Display Frame     |
    |                       |                           |
    |                       |                           |
    |                       |                           |
    |                       |                           |
    |                       |                           |
    |                       |                           |
    +-----------------------+---------------------------+
    |        Menu Frame                                 |
    +---------------------------------------------------+

## THE MENUS

All of the menus in the i.class program are displayed across the bottom of the graphics monitor in the Menu Frame. To select an option from one of these menus, simply place the cursor over your selection and press any button on the mouse. Each of the menus is discussed in the following paragraphs.

### The Command Menu

The Command Menu includes the following selections:

Zoom
  This command allows the user to outline a rectangular region in either the Map or Zoom Display Frames and the region is displayed, magnified, to fit in the Zoom Display Frame. A red rectangle is drawn in the Map Display Frame, indicating what area the Zoom Display Frame shows.

  To outline the rectangular region simply use any mouse button to anchor the first corner of the border and then use any button to choose the other corner.

Define region
  This selection takes the user to the Region Menu. This menu includes the options that allow the user to outline a region of interest on the displayed raster map.
Redisplay map
  This selection takes the user to the Redisplay Menu. The Redisplay Menu allows the user to redraw map display frames.
Analyze region
  This selection starts the process of analyzing the currently defined region. A histogram of the defined region will be displayed for each band. On the histogram for each band, the mean, standard deviation, minimum cell value and maximum cell value are marked. The histograms are automatically scaled in an attempt to fit the data into the space available, but it is possible that all of the data will not fit. In this case, as much of the data as possible, centered around the mean, will be displayed. After the histograms are displayed, the user will be given the Signature Menu.
Quit
  The user should make this selection to end the session with i.class.

### The Region Menu

The Region Menu contains the following selections:

Erase region
  This selection erases any currently defined region.
Draw region
  This selection allows the user to use the mouse to draw a region on either the Map or Zoom Display Frame. An explanation of which mouse buttons to use is displayed in the Menu Frame. The user does not need to try to complete the region boundary. The last line of the region will be added when the user selects the Complete region option on the Region Menu.
Restore last region
  This selection restores the last region that was drawn. After a region is completed, it will be saved to be restored later. Only one previous region is saved.
Complete region
  This selection completes the region that is currently being drawn. As noted above, it saves the complete region to be restored later, if needed. Once the user has made a complete region, it can be analyzed with the Analyze Region selection on the Command Menu.
Done
  Use this selection to return to the Command Menu.

## The Redisplay Map Menu

The Redisplay Map Menu has the following selections, which are useful to redraw the raster maps displayed in the Map and Zoom Display Frames.

Map geographic region
  This selection causes the raster map in the Map Display Frame to be redrawn.
Zoom region
  This selection causes the Zoom Display Frame to be redrawn.
Both
  This selection causes both the Map and Zoom Display Frames to be redrawn.
Cancel
  Use this selection if you do not want to redisplay either of the above regions. The user will be returned to the Command Menu.

### The Analyze Region Menu

The Analyze Region Menu contains the Signature Menu, which allows the user to set the number of standard deviations and the display color, and then to display (as an overlay) the cells that match the signature within the number of standard deviations specified. Note that once the matching cells are displayed, the Map Display Frame must be redisplayed to see only the original raster map again. The following selections are available on the Signature Menu:

Set std dev's
  This selection allows the user to set the number of standard deviations from the mean for the maximum and minimum range. The maximum and minimum range is used when finding the cells that "match" the signature. The user is presented with a menu of typical choices and an "Other" option. If the "Other" option is selected, enter the number of standard deviations from the keyboard on the text terminal. Otherwise, the selected option will be used. When the number of standard deviations is set, the histograms for each band will be redrawn with the maximum and minimum range marked.

  Note that the number in parentheses on this selection is the current number of standard deviations.

Set color
  This selection allows the user to set the color for the display of cells that "match" the current signature. The user is presented with a menu of color choices. The color selected will be used when the Display Matches Menu selection is made.

  Note that the color in parentheses on this selection is the current color for display.

Display matches
  This selection displays the cells that "match" the current signature in the current color. A cell "matches" the current signature if the cell value in each band is between the minimum range and maximum range for that band defined by the number of standard deviations currently set.
Done
  When this selection is chosen, the user will be asked whether or not he/she would like to save the current signature. If the user answers with the "Yes" selection, he/she will be asked to enter a description for the resultant signature file on the text terminal keyboard. The saved signature file description will be used by i.maxlik to name the category that is created from the current signature. After either a "No" answer or the signature description is entered, the user is returned to the Command Menu.

## NOTES

i.class uses the current MASK to generate the overlay for cells that match a signature. As a result, if a MASK already exists it will be removed during the execution of this program.

The cell values in the image bands cannot fall outside of the range of 0 to 255. i.class will report an error if they do.

i.class, like some of the other imagery programs, does not use the standard GRASS display frames. After running i.class, you will need to create a display frame (e.g., using d.frame or d.erase) before you can use most of the GRASS display (d.) commands.

i.group must be run before i.class to create an imagery group and a subgroup containing the image bands to be classified.

The user can perform a supervised image classification by running i.class followed by i.maxlik. The user can perform an unsupervised classification by running i.cluster followed by i.maxlik.

i.class is interactive and requires no command line arguments. The user must be running a graphics display monitor (see d.mon) to run this program.

## SEE ALSO

GRASS Tutorial: Image Processing

d.frame, d.mon, g.region, i.cca, i.cluster, i.composite, i.group, i.maxlik, r.mapcalc, r.mask

## AUTHOR

David Satnik, Central Washington University

Last changed: $Date: 2002/01/25 05:45:33 $