>  Docs Center  >  ENVI API  >  Task Template for ENVI 5.4, Service Pack 1
ENVI

Task Template for ENVI 5.4, Service Pack 1

Task Template for ENVI 5.4, Service Pack 1

This topic describes the fields (also called keys) in a task template for use with ENVI 5.4, Service Pack 1.

Task Keys


The following table describes the keys that provide an overview of the task.

Key

Required

Description

name

Yes

A string with name of the task, excluding the prefix ENVI and the suffix Task.

base_class

Yes

A string with the name of the class to use; the most common is ENVITaskFromProcedure.

Use ENVIMetatask if you are creating a metatask. See Metatasks for details.

Use ENVIAbortableTaskFromProcedure to allow your custom task to have a progress dialog with an option to cancel the process. See Messaging for details.

You can also write your own base class to simplify the process of writing custom tasks that use a common set of parameters and application behavior. See Custom Base Classes for more information.

routine

Yes

The routine that is called when Task.Execute is invoked.

display_name

No

A string with the name of the task as it appears to the end user. Spaces and special characters are allowed. This key is used by tasks that display a dynamic user interface for entering parameters. See ENVIUI::SelectTaskParameters for details.

description

Yes

A string with a description of the task.

commute_on_downsample

No

A string that indicates if raster processing is affected by downsampling before program execution. A value of Yes indicates that the raster can be downsampled before execution, yielding the same result as downsampling the output raster. A value of No means that downsampling the raster before execution will result in different results than downsampling the results from the original raster.

This key is used by the dynamic UI to determine Preview accuracy.

commute_on_subset

No

A string that indicates if raster processing is affected by subsetting before program execution. For example, your algorithm may rely on statistics of the entire dataset to get accurate results. A value of Yes indicates that the raster can be subsetted before execution. A value of No means that the raster should not be subsetted before execution.

This key is used by the dynamic task UI to determine Preview accuracy.

schema

Yes

A string listing the version of ENVITask JSON schema that was used to write this task. The valid values are envitask_3.1 or envitask_3.0.

parameters

No

A container of key/value pairs, described in the Parameter Keys section next.

Parameter Keys

The following table describes the keys that belong to the parameters group in a task template. These are repeated for each parameter.

Key

Required

Description

name

Yes

The name of the parameter as it appears to the end user.

keyword

No

The internal keyword that the parameter should map to. If it is the same as the NAME key, then you do not need to set keyword.

display_name

No

The name of the task as it appears to the end user. This key is used by tasks that display a dynamic user interface for entering parameters. See ENVIUI::SelectTaskParameters for details.

type

Yes

A scalar string with one of the following:

  • IDL data type: Byte, Int, Long, Float, Double, Complex, String, DComplex, UInt, ULong, Long64, or ULong64
  • The required class for the parameter (for example, ENVIRaster, ENVIVector, ENVIROI, or ENVIMetataskDAG).
  • Boolean type (Bool)
  • ENVIURI: Indicates that a uniform resource indicator (URI) is required. For a local file, specify a scalar string that is a fully qualified file path. For a remote file, specify a string with the direct URL of the dataset.
  • List (scalar only; no arrays)
  • OrderedList (scalar only; no arrays)
  • Hash (scalar only; no arrays)
  • OrderedHash (scalar only; no arrays)

If a specified data type requires more than one scalar, use the dimensions parameter below to indicate the array dimensions. Append Array to the data type, for example: floatArray.

dimensions

No

Specify the array dimensions if the type parameter requires more than one scalar.

  • Example of a three-element array declaration:
    "type": "floatArray",
    "dimensions": "[3]"
  • Example of a 1D array with any number of elements:
    "type": "intArray",
    "dimensions": "[*]"
  • Example of a 2D array with any number of columns or rows:
    "type": "intArray",
    "dimensions": "[*,*]"
  • Example of a 2D array with a specific number of elements:
    "type": "byteArray",
    "dimensions": "[3,256]"
  • Example of a 2D array with any number of columns and 3 rows:
    "type": "intArray",
    "dimensions": "[*,3]"

direction

Yes

Specify if the parameter is input or output.

Note: Older versions of ENVI use a different task schema; for example:

     "version": "5.x",

In these cases, ENVI automatically creates an OUTPUT_RASTER_URI property if youy define the OUTPUT_RASTER property of an ENVIRaster and set the direction parameter to output.

required

No

Set this key to true or false (default) to indicate if it is required for the task to execute or not.

description

Yes

A description of the parameter.

choice_list

No

A string array that lists the possible values for the property. Any IDL data type is supported. You can also map from user-friendly strings to an internal lookup table of values if desired.

This property is not present for all values of TYPE. Use QueryProperty to learn if it is available.

default

No

The default value of the parameter if the end user does not provide a value.

auto_extension

No

This property only applies when:

  • The type key is set to ENVIURI or ENVIURIArray, and:
  • The direction key is set to input

Set this property to a scalar string to use as a file extension for input ENVIURI parameters where VALUE=!NULL. When the parent ENVITask is executed, input ENVIURI parameters without a value can be populated by values generated by ENVI::GetTemporaryFilename. If this property is not set, or if it is set to !NULL, then no filenames will be generated and the task will likely fail. An empty string value will generate filenames without an extension.

is_temporary

No

This property only applies when:

  • The type key is set to ENVIURI or ENVIURIArray, and
  • The direction key is set to input, and
  • The auto_extension key is not !NULL

Set this property to true to indicate if input ENVIURI parameters with filenames automatically generated by the ENVITask framework will be deleted when ENVI closes.

When the parent ENVITask is executed, input ENVIURI parameters that had VALUE=!NULL and had their values populated according to the auto_extension property can be marked for deletion when ENVI closes.

is_directory

No

Set this property to true to indicate if the VALUE of an ENVIURI parameter should be treated as a directory or a URI to a file. When the parent ENVITask is executed and the VALUE property is set to !NULL and the is_directory key is set to true, then a subdirectory will be created under the ENVI Output Directory preference location. The base name will consist of the parameter's NAME, and the parameter's VALUE will be set to that new directory.

min

No

A value that is greater than or equal to the minimum value allowed for the parameter.

This property is not present for all values of TYPE. Use QueryProperty to learn if it is available.

max

No

A value that is less than or equal to the maximum value allowed for the parameter.

This property is not present for all values of TYPE. Use QueryProperty to learn if it is available.

hidden

No

Set this key to true if the parameter is required for the task but you do not want to expose it to the end user. You must also set the default key to the desired value for the parameter to be set internally.

uri_param

No

This property only applies when:

Set this key to a parameter name (in the same task) that it is associated with. That other parameter must adhere to the following constraints:

  • The type key is set to ENVIURI if the parameter is a scalar type, or ENVIURIArray if the parameter is an array type.
  • The dimensions key must match the parameter's dimension key if this is an array type.
  • The direction key is set to input.

For example, the uri_param key for OUTPUT_RASTER below is set to OUTPUT_URI, which is the name of the associated input parameter of type ENVIURI. That input parameter specifies what file to use to export the raster.

{
  "name": "OUTPUT_RASTER",
  "display_name": "Output Raster",
  "type": "ENVIRASTER",
  "direction": "output",
  "required": true,

  "uri_param": "OUTPUT_URI",

  "description": "This is a reference to the output raster."
},
{
  "name": "OUTPUT_URI",
  "display_name": "Output Raster URI",
  "type": "ENVIURI",
  "direction": "input",
  "required": false,
  "description": "Specify a string with the fully-qualified path and filename for OUTPUT_RASTER."
  "fold_case": true,
  "auto_extension": ".dat",
  "is_temporary": true
}

Revision History


This section summarizes the updates to task templates, compared to the previous release:

  • The following keys were introduced: auto_extension, is_temporary, is_directory, and uri_param.

See Also


Task Schema History, Sample Task Template, Custom Tasks



© 2019 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us