Implementing an algorithm using functions in a mosaic dataset

Complexity: Intermediate Data Requirement: ArcGIS.com

This workflow will describe how to combine functions in a mosaic dataset to create an NDVI. There is an NDVI function available that will apply a scale and offset to allow it to be visualized; however, if you want the raw NDVI values, which range between -1.0 and 1.0, you will have to implement the steps below.

You will apply the function on the mosaic dataset, not on the individual rasters within the mosaic dataset.

The algorithm for NDVI is as follows:

NDVI = ((IR - R)/(IR+R))
where
IR = infrared band
R = red band

This will result in the following layout on the Function tab.

NDVI function chain

The workflow is broken up according to each input and action. The following lists the order you would use to calculate the algorithm, but when you chain the functions together, you will start with the result and work toward the inputs, as you can see in the diagram above.

  1. Define the band inputs: IR and R
  2. Subtract one from the other: IR - R
  3. Add them together: IR + R
  4. Divide them: (IR - R) / (IR + R)

Set up the mosaic dataset

You will be applying the functions on a mosaic dataset. Therefore, you need to create a mosaic dataset and add all your raster data. It is assumed that the data has the same bands for the infrared and red bands. In this example, assume that the infrared band is band 1, and the red band is band 2.

Steps:
  1. Create a mosaic dataset.
  2. Add your raster data to the mosaic dataset.

    Be sure to build the overviews.

Chain the arithmetic functions

Steps:
  1. Add your mosaic dataset to the ArcMap display.

    You can add the mosaic dataset now or at the very end. You add it to ArcMap to view the result in the Image layer. Your mosaic dataset may already be open in ArcMap if you've just finished creating it.

  2. Open the Catalog Window Catalog Window and navigate to the mosaic dataset.
  3. Right-click the mosaic dataset and click Properties.
  4. Click the Functions tab.

    You see the following function chain with the single Mosaic function listed. The Mosaic function is listed by default because this is a mosaic dataset and all rasters are being mosaicked. It is after the mosaicking that you will be applying your algorithm.

    Mosaic function default

  5. Right-click the Mosaic Function and click Insert > Arithmetic Function.

    When you insert a function, it is inserted above the function you've clicked.

    Insert Arithmetic function

    This opens the Raster Functions Properties dialog box, which allows you to set the options for this function.

  6. Click the Operation drop-down arrow and click Divide.

    The inputs will remain as they are. The input is added to the function chain when you close this dialog box.

  7. Click the General tab.
  8. Type Divide in the Function Name text box.
  9. Click the Output Pixel Type drop-down arrow and click 32 Bit Float.

    The output of this algorithm is values ranging from -1 to 1. You need to specify the pixel type; otherwise, you may end up with pixel values that equal the inputs, such as 8-bit.

  10. Click OK.

    The Divide function is added to the top of the function chain, and another Mosaic function is added, since this arithmetic function requires two inputs.

    Divide function

  11. Right-click the top Mosaic Function in the function chain and click Insert > Arithmetic Function.
  12. Click the Operation drop-down arrow and click Minus.

    The inputs remain as they are. The input will be added to the function chain when you close this dialog box.

  13. Click the General tab.
  14. Type Minus in the Function Name text box.
  15. Click the Output Pixel Type drop-down arrow and click 32 Bit Float.
  16. Click OK.

    The Minus function is added after the Divide function, and two inputs are added underneath named Mosaic Function.

    Minus function

  17. Right-click the bottom Mosaic Function in the function chain and click Insert > Arithmetic Function.
  18. Click the Operation drop-down arrow and click Plus.

    The inputs remain as they are. The input is added to the function chain when you close this dialog box.

  19. Click the General tab.
  20. Type Plus in the Function Name text box.
  21. Click the Output Pixel Type drop-down arrow and click 32 Bit Float.
  22. Click OK.

    The Plus function is added to the bottom at the same level as the Minus function, and two inputs are added underneath named Mosaic Function.

Define the inputs to the arithmetic functions

The functions that will be used to do the arithmetic have been added; next, you have to identify the inputs. These are the IR and R bands—bands 1 and 2, consecutively (as defined earlier). To do this, use the Extract Bands function.

Steps:
  1. Right-click the top Mosaic Function under the Minus function and click Insert > Extract Band Function.

    Insert Extract Band function

  2. Type 1 in the Band IDs text box.
  3. Click the General tab.
  4. Type Extract IR in the Function Name text box.
  5. Click OK.

    The Extract IR function is added to the function chain, and a Mosaic Function is added to it as an input.

  6. Right-click the other Mosaic Function under the Minus function and click Insert > Extract Band Function.
  7. Type 2 in the Band IDs text box.
  8. Click the General tab.
  9. Type Extract Red in the Function Name text box.
  10. Click OK.

    The Extract Red function is added to the function chain, and a Mosaic Function is added to it as an input.

    Extract Bands functions added
  11. Repeat these steps for the inputs under the Plus function.

    You end up with a function chain that looks like the one at the top of this topic.

  12. Click OK to close the Mosaic Dataset Properties dialog box.

Once you've finished adding these functions, you can preview the mosaicked image. You many need to calculate the statistics of the mosaic dataset, since it's been altered to contain a 32-bit output. You can use the Calculate Statistics tool.

You can examine the pixel values using the Identify tool or the Pixel Inspector.

Related Topics


8/21/2013