Using the Image Algebra process
The Image Algebra process allows you to perform algebra on the spatially overlapping pixels from two raster bands or two raster datasets with up to four bands. For example, you can add two spatially overlapping, single-band raster datasets to form one output single-band raster, and the pixel values of the output would be combined values from pixels in each band: band 1 + band 2. Calculations such as the Normalized Difference Vegetation Index (NDVI) are actually an implementation of image algebra, and many other similar calculations can be executed using this process. You can perform equations, such as vegetation indexes, by chaining together two or more Image Algebra processes.
There are three rasters involved in this process: primary, auxiliary, and output. The primary and auxiliary rasters are the processed inputs, and the result is the output raster. The primary and auxiliary rasters must overlap spatially and must have the same bit depth and bands per pixel. The Convert Pixel Type and Stack Bands processes should be used prior to the Image Algebra process if the bit depth and bands are not in the required format. The output will be truncated to the limits of the bit depth. Note that float values are scaled by 214 when read into ArcGIS Image Server and handled as signed, 32-bit long values.
The methods in this process can also be affected by setting offset and scale values for the input data. The scale value is always applied first, then the scaled value is shifted using the defined offset value. The output can also be scaled and offset. These scale and offset values are often used to normalize pixel values or bring them into a suitable range, as shown in the following example:
Output Value = (((Primary * Scale) + Offset) [function]
((Auxiliary * Scale) + Offset) * Scale) + Offset
The Resample option on the Auxiliary tab specifies whether to resample the auxiliary image. Resampling ensures that the auxiliary image is in the same spatial dimension. Checking the Resample check box is required if the auxiliary image is from a different image and its pixels are not aligned with the primary image.
The Auxiliary raster ID is a combination of two identifier values: "<RasterID>.<RasterIDinRPDef>". The RasterID value is listed in the RasterID column of the service table. The RasterIDinRPDef value appears on the Raster Properties dialog box. When you open this dialog box, click the Rasters node and identify the correct ID value from the displayed table.
There are six algebra methods that can be applied to the raster datasets:
- Subtract—Outputs the difference between the corresponding pixel values for each raster. This can be used to calculate change detection.
- Add—Outputs the sum of all the corresponding pixel values for each raster. A general example is shown below.You can use the Add method to calculate orthometric elevations by using the following formula:
Ellipsoid Elevation + Geoid = Orthometric elevations
- Multiply—Outputs the product of the corresponding pixel values for each raster. This can be used to perform some cost functions. If the inputs and outputs are integer values, they may need to be scaled using Convert Pixel Type before and after this process to maintain their accuracy.
- Divide—Outputs the divisible result between the corresponding pixel values for each raster. If the inputs and outputs are integer values, they may need to be scaled using Convert Pixel Type before and after this process to maintain their accuracy.
- Apply Mask—This method uses a three-band image as a primary raster and a one-band image as an auxiliary raster. It takes a fill color and a fill value, which is a pixel value in the auxiliary raster. The output image is created so that for every pixel value matching the fill value in the auxiliary raster, the output image is filled with the fill color. The rest of the output is the same as the primary raster. Apply Mask is often used to mask an image based on the output for a classification.
- Max. Absolute Difference—This method computes the maximum absolute difference between each pixel in the primary raster and the corresponding pixel in the auxiliary raster. This method is similar to the Subtract method; however, the result is the absolute value and a single band. Below is a basic illustration of this function.