Use Cast Raster Data Type to change, or cast, the pixel values of a raster to a different data type; for example, unsigned integer or double-precision floating-point.

You can also write a script to cast raster data types using the CastRaster task.

  1. From the Toolbox, select Raster Management > Cast Raster Data Type.
  2. Select an Input Raster and perform optional spatial or spectral subsetting, and/or masking.
  3. From the Data Type drop-down list, select the data type to cast the pixel values to. The choices are:

    • byte: An 8-bit unsigned integer ranging in value from 0 to 255.
    • int: A 16-bit signed integer ranging from -32,768 to +32,767.
    • long: A 32-bit signed integer ranging in value from -2,147,483,648 to +2,147,483,647.
    • float: A 32-bit, single-precision, floating-point number in the range of ±1038, with approximately six or seven significant digits.
    • double: A 64-bit, double-precision, floating-point number in the range of ±10308 with approximately 15 or 16 significant digits.
    • uint: A 16-bit unsigned integer ranging from 0 to 65,535.
    • ulong: A 32-bit unsigned integer ranging in value from 0 to 4,294,967,295.

    Note: Casting a floating-point raster to integer will truncate the data values. Overflow will occur when the original value is greater than the maximum value for the output data type.

  4. Optional: In the Data Ignore Value field, specify a numeric pixel value that will be ignored upon export. The pixel state of the output raster will be the same as that of the input raster, regardless of whether or not it was set. The data ignore value should be different from any other pixel value in the input raster, in order to avoid masking out good pixels during export.
  5. To write the output to disk, select the File radio button and specify a filename and location. To produce output in memory only, select the Virtual radio button.

  6. 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.
  7. To reuse these task settings in future ENVI sessions, save them to a file. Click the down arrow 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.

  8. To run the process in the background, click the down arrow 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.

  9. Click OK.