Populating functions with values from the attribute table
Functions added to the rasters in a mosaic dataset can contain unique parameter values that are obtained from fields in the attribute table. There are three main things you will do to do this:
- Create a text-type field in the attribute table.
- Select the rasters in the mosaic dataset to which you will be adding the function.
- Use the Raster Functions Editor Wizard to insert the function.
Stretch function
These steps will walk you through using the field in the attribute table to populate the minimum, maximum, mean, and standard deviation values used by the stretch function.
Only one field from the mosaic dataset's attribute table is used to input the statistics values into the Stretch function. You must use the following syntax to specify these values for each band:
B1_Min|B1_Max|B1Mean|B1_SDev;…;Bn_Min|Bn_Max|Bn_Mean|Bn_SDev
Also, make sure statistics are specified for all bands of the rasters where this function is being added. For example, if you have a four-band raster and you only add information for three bands in the field, this will not work correctly.
- Add the mosaic dataset to ArcMap.
- Right-click the mosaic dataset and click Open > Attribute Table.
- Add a field.
Set the field type to Text.
- Enter the minimum, maximum, mean, and standard deviation for each band using the format described above.
For example, for a four-band image, you may enter:
0|2047|279.5|96.5;0|2047|306.4|148.7;0|2047|279.8|96.1;0|2047|352|122.6;
- Select the rasters whose function chains will be edited by adding the Stretch function.
Select the rasters either in the attribute table using the Select tool in ArcMap or using one of the options on the Selection menu, such as Select By Location.
- Right-click the mosaic dataset footprint in the table of contents and click Selection > Batch Edit Raster Functions.
The Raster Function Editor Wizard is opened.
- Click Next since you want to insert a function.
- If this function will be inserted between two other functions, click Search and select the function that will be processed before the Stretch Function; otherwise, check Insert above the top-most function to apply the function last.
- Click Next.
- By default, this function editor assumes that the mosaic dataset supports a three-band output. If you are working with more than three bands, such as four bands, right-click Function Chain and click Settings. Then enter the number of bands in the Value field and click OK.
- Right-click the Identity Function and click Insert > Stretch Function.
- Click the Stretch tab.
- Choose the type of stretch, such as Minimum-Maximum, and enter the associated parameters. Leave the Statistics blank.
- Optionally, click the Gamma tab, check Use Gamma, and enter the gamma values.
- Click the Variable Manager tab.
- Click the field next to the Statistics field and enter the name of the field you created to hold the statistics values using the following format: @Field.<FieldName>
The values in this field will be used as if you were entering unique values in the Stretch section on the Stretch tab for each band of each raster in the mosaic dataset.
- Click OK to close the function.
- Click Next.
- Click Finish.
The Stretch function is added to each raster using the values you set in the dialog and pulling the values for the statistics from the attribute table for each raster.
Arithmetic function
The Arithmetic function performs an arithmetic operation between two rasters or a raster and a scalar and vice versa. If you need to define a scalar (constant value) that is unique to each raster in the mosaic dataset, you can use the following steps:
- Add the mosaic dataset to ArcMap.
- Right-click the mosaic dataset and click Open > Attribute Table.
- Add a field.
Set the field type to Text.
- Enter the scalar value that will be used in this function for each raster.
- Select the rasters whose function chains will be edited by adding the Stretch function.
Select the rasters either in the attribute table using the Select tool in ArcMap or using one of the options on the Selection menu, such as Select By Location.
- Right-click the mosaic dataset footprint in the table of contents and click Selection > Batch Edit Raster Functions.
The Raster Function Editor Wizard is opened.
- Click Next since you will be inserting a function.
- If this function will be inserted between two other functions, click Search and select the function that will be processed before the Arithmetic Function; otherwise, check Insert above the top-most function to apply the function last.
- Click Next.
- Right-click the Identity Function and click Insert > Arithmetic Function.
- Click the Arithmetic tab.
- Click the Operation drop-down arrow and click the arithmetic operator.
- Click the Raster drop-down arrow and click Raster 2.
- Click the Variable Manager tab.
- Click the field next to the Raster2 field and enter the name of the field you created to hold the statistics values, using the following format: @Field.<FieldName>
The values in this field will be used as if you were entering unique values in the Constant parameter on the Arithmetic tab for each raster in the mosaic dataset.
- Click OK to close the function.
- Click Next.
- Click Finish.
The Arithmetic function is added to each raster using the values you set by pulling the Constant values from the attribute table for each raster.