Use the Calculate Zone Metrics with Spectral Index tool to calculate statistics for management zones from an image and a zones object created from the Create Zones tool. It creates a classification image showing the relative statistics of the zones, or a grayscale image showing the actual statistical values of the zones. This tool accepts a multispectral image as input and calculates statistics from a specified spectral index (for example, Normalized Difference Vegetation Index).

This tool requires a separate license for the ENVI Crop Science Module; contact your sales representative for more information.

You can also write a script to create management zones using AgCalculateAndRasterizeZoneMetricsWithSpectralIndex Task.

See the following sections:

Before You Begin


Before calculating zone metrics, run the Create Zones tool and specify an Output Zones file (in .sav format).

Calculate Zone Metrics


Follow these steps:

  1. From the Toolbox, select Crop Science > Calculate Zone Metrics with Spectral Index. The Data Selection dialog appears.
  2. Select a multispectral input image and click OK. The Calculate and Rasterize Zone Metrics with Spectral Index dialog appears.
  3. Data should be in units of reflectance before creating spectral indices. See Spectral Indices for more information.

  4. Choose an option from the Spectral Index drop-down list:

  5. Select an Input Zones object (.sav) that was created from the Create Zones tool.
  6. Optional: Select an Input Zone Raster if it is available. This is a classification image that corresponds to the input zones. This allows zone metrics to be calculated faster for large images.
  7. Select the metric to calculate from the Output Metric drop-down list. The choices are:
    • Zone Minimum
    • Zone Maximum
    • Zone Mean (default)
    • Zone Standard Deviation
  8. Set Create Classification Raster to Yes if you want to create a classification raster where zones are colored according to relative metrics. If you set Create Classification Raster to No, the result is a grayscale image of mean values for each zone. See the Example below.
  9. Select an output filename and location for the Output Zones Raster.
  10. Select an output filename and location for the Output Zones. This will be a new zones object in IDL save format (.sav) with the metric added.
  11. Enable the Display result check box to display the output in the view when processing is complete. Otherwise, if the check box is disabled, the result can be loaded from the Data Manager.

  12. To see a model-based version of this tool that shows how the tool is constructed from individual tasks, click Open in Modeler.

  13. To reuse these task settings in future ENVI sessions, save them to a file. Click the down arrow next to the OK button and select Save Parameter Values, then specify the location and filename to save to. Note that some parameter types, such as rasters, vectors, and ROIs, will not be saved with the file. To apply the saved task settings, click the down arrow and select Restore Parameter Values, then select the file where you previously stored your settings.

  14. To run the process in the background, click the down arrow next to the OK button and select Run Task in the Background. If an ENVI Server has been set up on the network, the Run Task on remote ENVI Server name is also available. The ENVI Server Job Console will show the progress of the job and will provide a link to display the result when processing is complete. See ENVI Servers for more information.

  15. Click OK.

Example


A common scenario is to define zones from one image, then calculate statistics for each zone from a different image. The following example uses a Moisture Stress Index (MSI) image as input to the Create Zones tool. Then it calculates the mean NDVI value for each zone, based on input from a hyperspectral image.

The following figure shows a hyperspectral image of an agricultural field. The source data were provided by the National Ecological Observatory Network (NEON), collected from the NEON imaging spectrometer, 16 July 2016, at 1-meter resolution. A region of interest (ROI) was drawn around a field of interest. The hyperspectral image was masked and subsetted using the ROI boundary, so that the image only contained pixels within the field.

Tip: This image (NEONHyperspectral1m.dat) is available in the ENVI installation path under INSTALL_DIR\ENVIxx\data\crop_science\.

This image contains bands in the visible/near-infrared and shortwave-infrared wavelength regions, so it can be used to create spectral indices of water deficiency in vegetation. The ENVI Spectral Indices tool was used to create a Moisture Stress Index (MSI) image, shown below. Bright pixels indicate dry areas, and dark pixels indicate crops that contain an abundance of water in their leaves.

The Create Zones tool was run with the following parameters:

  • Input Raster: MSI image
  • Number of Application Categories: 5
  • Minimum Area: 1000 square meters
  • Maximum Area: Not specified
  • Primary Angle: 0 degrees
  • Output Classification Raster: AgCreateZones.dat
  • Output Zones: AgCreateZones.sav

The following figure shows the resulting zone vectors overlaid on the MSI image.

Next, the Calculate Zone Metrics with Spectral Index tool was run with the following parameters:

  • Input Raster: AgCreateZones.dat
  • Spectral Index: Normalized Difference Vegetation Index
  • Input Zones: AgCreateZones.sav
  • Output Metric: Mean
  • Create Classification Raster: Yes
  • Output Zones Raster: NDVIZoneMetricsRelativeClasses.dat
  • Output Zones: Not specified

The resulting classification raster shows the relative health of the crops in each of the five zones. The zone associated with the red class is the least healthy (based on NDVI), as indicated by the "--" label in the Layer Manager. The zone associated with the dark green class is the most healthy, as indicated by the "++" label.

Comparing this image with the MSI image shows that the least healthy zones (red and orange) roughly correspond to the driest regions in the MSI image.

The next image shows the grayscale image that results from re-running the Calculate Zone Metrics with Spectral Index tool with the Create Classification Raster option set to No. An Optimized Linear stretch was applied to the image to show the different zones.

You can view the actual pixel values of each zone by using the Cursor Value tool , or by setting any Status Bar segment to Raster Data Values (as this example shows).

As you move the cursor over a zone, the Status Bar shows the mean value (or whatever statistic you choose in the Output Metric drop-down list). In the above figure, the mean NDVI value in the white zone is 0.7.

To see the range of zone values in the entire image, right-click on the zone metrics image in the Layer Manager and select Quick Stats. Look for the Min and Max values under the Basic Stats column; for example:

See Also


Create Zones, Calculate Zone Metrics, Convert Zones to Shapefile