Use the Raster Color Slices tool to select data ranges and colors to highlight areas of an image. You can save the color slices visualization to a classification or to a shapefile.

Click on any of the following links for details:

You can also write a script to define color slices using the ColorSliceClassification task. Use the GetColorSlices task to open density slice range (DSR) files and to retrieve their data ranges and colors. Use the ExportColorSlices task to define your own color slices and ranges, and to export them to a DSR file.

Create a Raster Color Slice


  1. Generate raster color slices using one of the following:

    • In the Layer Manager, right-click the raster name and select New Raster Color Slice. In the Data Selection dialog, select the input file and band, then click OK.
    • From the Toolbox, select Classification > Raster Color Slices. In the Data Selection dialog, select the input file and band, then click OK.
    • In the Data Manager, right-click a band and select Load Raster Color Slice.

    The Edit Raster Color Slices dialog appears and a Raster Color Slices layer is added to the Layer Manager.

  2. By default, the histogram shows 16 slices using the Rainbow color table. The Histogram Min and Max settings are calculated from the input image. You can change these settings as described in Change Default Color Slices Settings.
  3. Click OK to create the raster color slices. ENVI adds a Raster Color Slice layer to the Layer Manager and loads the layer into the view. Click OK again to close the dialog.

From the Layer Manager, you can show or hide raster color slices in the view as follows:

  • Disable or enable the check box for one or more slices that appear under the Slices folder.
  • To hide all raster color slices, right-click the Slices folder (under the Raster Color Slice layer) and select Hide All Color Slices. To show all color slices again, right-click and select Show All Color Slices.
  • To hide all color slices, disable the check box for the Raster Color Slice layer. This leaves the show/hide state of the individual raster color slices unchanged (for example, the check box for a hidden class is not re-enabled). When you enable the check box to show the Raster Color Slices layer again, the previously hidden color slices remain hidden.

Edit Color Slices


To change the settings for raster color slices, right-click the Slices folder in the Layer Manager and select Edit Color Slices. The Edit Raster Color Slices dialog appears. To select a color slice to edit, click the table row to highlight it in the histogram, or click the color slice in the histogram to select it in the table row.

To edit the data ranges:

  • To resize the minimum or maximum data range for the selected slice, click and drag the right or left edges of the color in the histogram.
  • To redefine a slice's range, click and drag it in the histogram.
  • To change the Slice Min or Slice Max value for the slice, click in the corresponding field in the table and enter a new value. When data ranges are in floating-point data type, they can have overlap between the Slice Max of one range and the Slice Min of the next range, as shown below:

    When such overlap occurs, the data is included in the later range. In the image above, the data for pixel value 20.617036 will be contained in color slice 2 (the later range), the data for pixel value 21.538165 will be contained in color slice 3, and so on.

To change colors:

  • To reverse the order of the color gradient, click the Change Color Table button. In the Change Color Table dialog that appears, click the Reverse button .

  • To apply a different pre-defined IDL color table to all data ranges, click the Change Color Table button, then click the Edit Color Table button in the Change Color Table dialog that appears. In the Edit Table Color dialog, you can choose from the complete list of predefined IDL color tables, define a color gradient, or work with different color spaces. See Edit Color Tables for details.

To refine color slices:

  • To delete a color slice, select it in the histogram or from the table row and click the Remove Color Slices button. You can use Shift-click to select multiple sequential rows to delete.
  • To clear all color slices, click the Clear Color Slices button.
  • To manually define individual color slices, click the Add Color Slice button to add a data range to the table and the histogram. Unless you clicked Clear Color Slices before adding the color slice, the new slice is added to the end of the data ranges in the table and the histogram.
  • To edit a particular color, click the color in the table row and choose a different color from the Select color dialog that appears.

Plot controls:

  • Enable the Plot Controls check box, click in the histogram, and use the mouse wheel to zoom in and out. Disable the check box again to re-enable editing functions.
  • Enable the Plot Controls check box, then click and hold on a curve in the plot to show the X-Y line crosshair. As you move the cursor over the curve, the crosshair snaps to the closest data point. The X and Y values of the point appear below the plot.
  • Enter Histogram Min and Max values in the fields provided to zoom to a specific range.
  • To reset the plot range to its original settings, click the Reset button.

Change Default Color Slice Settings


To edit the settings for raster color slices, click the New Default Color Slices button in the Edit Raster Color Slices dialog. The Default Raster Color Slices dialog appears.

  • Num Slices: Sets the number of color slices to apply to the image.
  • Color Table: Click the Reverse button to reverse the order of the color gradient, or click the Edit Color Table button to edit the color table. See Edit Color Tables for details.
  • By Min/Max: Enable this check box to define the color slices with minimum and maximum data ranges in the Data Min and Data Max fields.
  • By Min/Slice Size: Enable this check box to define the minimum data range and slice size in the Data Min and Slice Size fields.

Save and Export Raster Color Slices


To save and restore raster color slices:

  • To save the raster color slices to a file, select Save Color Slices to File from the the Save/Export drop-down list . Enter a path and filename.
  • To open a saved raster color slices file, click the Restore Color Slices from File button and select the file .

To export the raster color slices to a classification image or to a shapefile:

  • To save a displayed color slices to a classification image, right-click the Slices folder for the layer to export and select Export Color Slices > Class Image. This option is also available from the Save/Export drop-down list in the Edit Raster Color Slices dialog. The saved file is added to the Data Manager for you to load. Once you create a classification image, you can Legend Annotation from the Annotations drop-down menu in the toolbar to display a classification legend.
  • To save the displayed color slices to a shapefile, right-click the Slices folder for the layer to export and select Export Color Slices > Shapefile. This option is also available from the Export drop-down list in the Edit Raster Color Slices dialog. The saved file is added to the Data Manager.

Calculate Class Statistics


You can calculate class statistics for the color slices, including:.

  • Pixel count and percentage per class.
  • Basic statistics (minimum, maximum, mean, and standard deviation) for single- or multi-band images.
  • Histograms (frequency distributions) for single- or multi-band images.

For details, see Class Statistics.

View Metadata


You can view the metadata associated with the raster color slices. Right-click on the layer name in the Layer Manager and select View Metadata to open the View Metadata dialog.

See Also


Classification, Classification Tools, View Metadata