Editing function chain templates
A raster function template contains a chain of functions and a list of inputs, or pointers to the inputs, that can be applied to process raster data.
A raster function template (*.RFT.xml) can be created from any function chain and used as:
- A template describing a function chain to apply when adding raster data to a mosaic dataset
- A function chain to apply to a selection of rasters in a mosaic dataset
- A function chain to apply to a mosaic dataset
- A template used to add raster data to a mosaic dataset using the Table raster type
- A process to apply to an image service using REST that is processed on the server
Generally, you can use a function chain template
- When you are adding data to a mosaic dataset
- Open the raster type properties, click the Functions tab, then right-click a processing template and click Load.
- To edit the function chain in a mosaic dataset or its items using the Edit Raster Function tool or the Raster Function Editor Wizard
- To add server-side functions to an image service for both Desktop and web applications
Saving a function chain as a raster function template
There are several locations where you have access to a function chain, such as
- On the Function tab on the Layer Properties dialog box
- On the Raster Function Editor opened from the Image Analysis window
- On the mosaic dataset
- On each raster within the mosaic dataset
In all these locations (except on the mosaic dataset) you can export the function chain to a template.
- Access a function chain.
- Right-click the first item () under the Function Chain and click Export As Template.
The function chain is opened in the Raster Function Template Editor.
- This template must be edited so you can apply it using other raster data, because in its current state, it is set up to work with the data in the function chain from which it was exported. For example, you need to set or clear some variables, such as the input raster datasets.
- Right-click the function pointing to a raster dataset and click Properties.
- Click the Variable Manager tab, right-click the Raster variable row, and click Clear default value of Raster.
The TIFF file originally pointed to by this function is cleared.
- Next, you can save it or enter a variable name that applies to the data with which this template will be used.
For example, if you plan to use this template with a raster type, such as IKONOS, you can open the IKONOS raster type properties to see the variable names it uses and use them, such as MS, Dataset, or Pan.
If you plan to use this template with the Raster Dataset raster type, the raster dataset variable name is Dataset.
The variables that may be used include:
- Dataset
- Pan (short for pan-sharpened)
- MS (short for multispectral)
- Thermal
- DEM
- Pan-sharpened
If you plan to use this template with the Table raster type and an associate table, where the table contains the file name and path to each raster dataset, you can enter @field.<field name> as the Variable Name.
If this raster function template will be published with an image service with the purpose of using the image service as the input data, then the raster Variable Name must be Raster. For some functions, such as Slope or Hillshade, the default is DEM. You must change the Variable Name from DEM to Raster.
- You can also make changes to the other variables, such as (in the Stretch function) setting a Gamma value or pointing to a table field to define the value. Or you can modify these values on the Stretch tab so the same value is defined for every raster dataset.
- Right-click the function pointing to a raster dataset and click Properties.
- Click OK on the Raster Function Properties dialog box to save the changes to the variables.
- At the top of the chain, right-click Function Chain and click Set Help Info to add some useful information to this function chain to help you or others use it.
Close the Function Template Help dialog box when finished.
- Click File > Save to save the raster function template.
Creating a new raster function template
- Click the Raster Function Template Editor button (added to a toolbar from the Customize dialog box).
This opens a dialog box with a default function chain containing the Identity Function. As soon as you add a function, the default Identity Function will disappear.
- Right-click Function Chain and click Settings.
- Enter a default number of bands in the Value column and click OK.
- Right-click the Identity Function or the Raster item in the chain, click Insert, and select a function from the list.
The function is added above where you right-clicked.
You can double-click the function to reopen it to modify its properties.
- Continue inserting functions to build the function chain you require.
- To add information to this function chain to help you or others use it, right-click Function Chain at the top of the chain, and click Set Help Info.
Close the Function Template Help dialog box when finished.
- Click File > Save and navigate to a location to save the .rft.xml file, then click Save.
- The functions will be applied from bottom to top. In the example below, the Band Arithmetic Function is applied first, then the Shaded Relief Function is applied, and the Clip Function is applied last.
- The function chain will not be validated (as it is when you're editing it on a raster or mosaic dataset); therefore, you may chain together functions that will not work. For example, a chain can become invalid if one function requires a different number of bands than is output by the preceding function, such as applying the Grayscale function, which outputs 1 band, and following it with the NDVI function, which requires 2 bands. Therefore, the NDVI function cannot be applied, so the function chain cannot be applied, and the output image will be invalid.
Editing a raster function template
If you have an existing .rft.xml file, you can open it in the Raster Function Template Editor and make modifications.
- Click the Raster Function Template Editor button (added to a toolbar from the Customize dialog box).
This opens a dialog box with a default function chain.
- Click File > Open, navigate to and select a .rft.xml file, then click Open.
- Make the modifications.
- Click File > Save.