Use a Filter Iterator node to apply a conditional statement so that an operation executes only when the statement is true. Using a Filter Iterator node is similar to using an IF...THEN statement in IDL programming. A Filter Iterator node iterates through a collection of data while also applying the specified condition.

Click the button in a Filter Iterator node to display the Iterator dialog. In the Filter Expression field, enter an IDL expression to be evaluated each iteration. Use any of the following reserved variables in the expression:

  • %e: The element being considered in the iteration
  • %i: The iteration number, starting with 0
  • %c: The collection, or the variable containing all of the items that the iteration will traverse. This variable is rarely used.

For example, the expression %e.Data_Type eq 'byte' will execute an operation only if the input raster contains byte data. The variable %e represents the element to operate on, which is the raster data in this case. The Data_Type property is a standard property available in rasters that are in ENVI format. (See the list of available properties in the ENVIRaster help topic.)

If you are not sure what expression to enter, click the Examples drop-down dialog in the Iterator dialog to see examples of commonly used conditions.

Tip: Note: Use the Band Math task node if you want to apply conditional operators to raster data values. That concept is different than the conditional statements described here.

Expressions can contain conditional operators such as AND, OR, and NOT.

To apply an IF...THEN...ELSE condition, add one Filter Iterator node to execute an operation if the condition is true. Then add a second Filter Iterator node with the opposite condition to execute a different operation.

Examples


Here is an example of when a Filter Iterator node would be useful: Suppose that you import dozens of rasters into a model and you want to create a time series from the rasters. Tasks such as Build Time Series require input rasters to have Acquisition Time metadata defined in their header files. You could write an expression to check that the input files have acquisiton time metadata, in which case the resulting files will be added to a time series. Files that do not contain this metadata field will be ignored. Because the Build Time Series node requires an array of input rasters, an Aggregator node is placed before it to collect the results of the Filter Iterator.

Another example is checking that input rasters contain a valid spatial reference before passing them to a georeferencing task. Or, if an input raster is determined to have an RPC spatial reference, then it could be passed to an RPC Orthorectification task. Expressions for these scenarios are available in the Examples drop-down menu of the Iterator dialog.

See Also


Batch-Process Data Using Iterator Nodes, Specify Input Datasets and Task Parameters, Validate and Run Models