i.maxlik(1grass)

πŸ’– i.maxlik β€” the GRASS User's Manual glow-up πŸ’–

okay bestie, sit down, hydrate, and let me tell you about i.maxlik(1grass) because this one is literally the moment your satellite pixels find out who they really are πŸ›°οΈβœ¨


✨ NAME ✨

i.maxlik β€” it classifies the cell spectral reflectances in imagery data. Like, it looks at every lil pixel and is like "hmm, who are you, bestie?" 🌈

The classification is based on the spectral signature information generated by either i.cluster, g.gui.iclass, or i.gensig. Those three are the ones making the signature file, and i.maxlik is the one using it. Teamwork fr fr 🫢


πŸŽ€ KEYWORDS πŸŽ€

imagery, classification, Maximum Likelihood Classification, MLC

(yeah, MLC = Maximum Likelihood Classification, iykyk πŸ’…)


🌸 SYNOPSIS 🌸

i.maxlik
i.maxlik --help
i.maxlik group=name subgroup=name signaturefile=name output=name
[reject=name]   [--overwrite]  [--help]  [--verbose]  [--quiet]  [--ui]

πŸ¦‹ Flags:

  • --overwrite β€” lets output files just. bulldoze over existing files. chaotic but sometimes necessary πŸ’€
  • --help β€” prints the usage summary, aka the cheat sheet
  • --verbose β€” verbose module output, it will NOT stop talking (relatable)
  • --quiet β€” quiet module output, the introvert mode
  • --ui β€” force launches the GUI dialog, for when you want buttons instead of typing

πŸ“ Parameters:

  • group=name [required] β€” name of input imagery group
  • subgroup=name [required] β€” name of input imagery subgroup
  • signaturefile=name [required] β€” name of input file containing signatures. Generated by either i.cluster, g.gui.iclass, or i.gensig
  • output=name [required] β€” name for output raster map holding classification results
  • reject=name β€” name for output raster map holding reject threshold results

πŸ‘‘ DESCRIPTION πŸ‘‘

i.maxlik is a maximum-likelihood discriminant analysis classifier. periodt. It's the ✨second step✨ in either an unsupervised or a supervised image classification.

Okay so both image classification methods happen in two steps, no skipping:

  • The first step in an unsupervised image classification is performed by i.cluster.
  • The first step in a supervised classification is executed by the GRASS program g.gui.iclass (or by providing any other raster map with already existing training areas).
  • Either way, the second step in the image classification procedure is performed by i.maxlik. That's us. We're the closer 🫑

In an unsupervised classification, the maximum-likelihood classifier uses the cluster means and covariance matrices from the i.cluster signature file to determine to which category (spectral class) each cell in the image has the highest probability of belonging.

In a supervised image classification, the maximum-likelihood classifier uses the region means and covariance matrices from the spectral signature file generated by g.gui.iclass, based on regions (groups of image pixels) chosen by the user, to determine to which category each cell in the image has the highest probability of belonging.

In either case, the raster map output by i.maxlik is a classified image in which each cell has been assigned to a spectral class (i.e., a category). And then the plot twist: those spectral classes (categories) can be related to specific land cover types on the ground. slay 🌍


πŸ’… NOTES πŸ’…

The maximum-likelihood classifier assumes that the spectral signatures for each class (category) in each band file are normally distributed (i.e., Gaussian in nature). It's giving bell curve. πŸ””

Algorithms, such as i.cluster, g.gui.iclass, or i.gensig, however, can create signatures that are not valid distributed (more likely with g.gui.iclass). If this occurs, i.maxlik will reject them and display a warning message. not me getting rejected πŸ₯² totally valid of it though, it has standards.

The signature file (signaturefile) contains the cluster and covariance matrices that were calculated by the GRASS program i.cluster (or the region means and covariance matrices generated by g.gui.iclass, if the user runs a supervised classification). These spectral signatures are what determine the categories (classes) to which image pixels will be assigned during the classification process. so. much. power. in one file. πŸ”₯

The optional name of a reject raster map holds the reject threshold results. This is the result of a chi square test on each discriminant result at various threshold levels of confidence to determine at what confidence level each cell classified (categorized). It is the reject threshold map layer, and it contains the index to one calculated confidence level for each classified cell in the classified image.

16 confidence intervals are predefined, and the reject map is to be interpreted as 1 = keep and 16 = reject.

One of the possible uses for this map layer is as a mask, to identify cells in the classified image that have a low probability (high reject index) of being assigned to the correct class. chef's kiss use case honestly πŸ§‘β€πŸ³πŸ˜˜


🧚 EXAMPLE 🧚

Second part of the unsupervised classification of a LANDSAT subscene (VIZ, NIR, MIR channels) in North Carolina β€” see the i.cluster manual page for the first part of the example, bestie, don't start mid-story πŸ“–

# using here the signaturefile created by i.cluster
i.maxlik group=lsat7_2002 subgroup=res_30m \
  signaturefile=cluster_lsat2002 \
  output=lsat7_2002_cluster_classes reject=lsat7_2002_cluster_reject
# visually check result
d.mon wx0
d.rast.leg lsat7_2002_cluster_classes
d.rast.leg lsat7_2002_cluster_reject
# see how many pixels were rejected at given levels
r.report lsat7_2002_cluster_reject units=k,p
# optionally, filter out pixels with high level of rejection
# here we remove pixels of at least 90% of rejection probability, i.e. categories 12-16
r.mapcalc "lsat7_2002_cluster_classes_filtered = \
           if(lsat7_2002_cluster_reject <= 12, lsat7_2002_cluster_classes, null())"

RGB composite of input data 🌈

Output raster map with pixels classified (10 classes) πŸŽ‰

Output raster map with rejection probability values (pixel classification confidence levels) 🫣


🌟 SEE ALSO 🌟

Image processing and Image classification wiki pages β€” and for historical reference also the GRASS GIS 4 Image Processing manual πŸ“š (yes we're honoring the ancestors, respect)

g.gui.iclass, i.cluster, i.gensig, i.group, i.segment, i.smap, r.kappa


πŸ’œ AUTHORS πŸ’œ

  • Michael Shapiro, U.S.Army Construction Engineering Research Laboratory
  • Tao Wen, University of Illinois at Urbana-Champaign, Illinois
  • Semantic label support: Maris Nartiss, University of Latvia

legends, all of them πŸ‘‘


πŸ› οΈ SOURCE CODE πŸ› οΈ

Available at: i.maxlik source code (history)

Latest change: Monday Feb 09 18:47:00 2026 in commit: 8cec756bc3c21c1086ba7c09dfda94b6a0e82f04

Main index | Imagery index | Topics index | Keywords index | Graphical index | Full index


okay and that's the whole page, no skips, no summaries, every flag accounted for, we ATE and left no crumbs πŸ’…βœ¨

this has been i.maxlik from the GRASS 8.5.0 Reference Manual, Β© 2003-2026 GRASS Development Team, running on GRASS 8.5.0 β€” go classify something gorgeous, bestie, you got this πŸ¦‹πŸ’–πŸŽ€

πŸ“¦ where this page comes from