Welcome to the Harris Geospatial product documentation center. Here you will find reference guides, help documents, and product libraries.


  >  Docs Center  >  ENVI API  >  Processing  >  ENVIImageThresholdToROITask

ENVIImageThresholdToROITask

ENVIImageThresholdToROITask

This task creates ROIs from band thresholds. You can specify one or more thresholds for one or more ROIs.

Example


This example creates two ROIs using two different band thresholds. See More Examples.

; Start the application
e = ENVI()
 
; Open an input file
File = Filepath('qb_boulder_msi', Subdir=['data'], $
  Root_Dir=e.Root_Dir)
Raster = e.OpenRaster(File)
 
; Get the task from the catalog of ENVITasks
Task=ENVITask('ImageThresholdToROI')
 
; Define inputs
Task.INPUT_RASTER = Raster
Task.ROI_COLOR = [[!color.blue], [!color.green]]
Task.ROI_NAME = ['Water', 'Land']
Task.THRESHOLD = [[138,221,0],[222,306,0]]
 
; Define outputs
Task.OUTPUT_ROI_URI= e.GetTemporaryFilename('.xml')
 
; Run the task
Task.Execute
 
; Display the result
View1 = e.GetView()
Layer1 = View1.CreateLayer(Raster)
VisRois = !NULL
Foreach Roi, Task.OUTPUT_ROI do $
  VisRois = [VisRois, Layer1.AddRoi(Roi)]

Syntax


Result = ENVITask('ImageThresholdToROI')

Input properties (Set, Get): INPUT_RASTER, OUTPUT_ROI_URI, ROI_COLOR, ROI_NAME, THRESHOLD

Output properties (Get only): OUTPUT_ROI

Properties marked as "Set" are those that you can set to specific values. You can also retrieve their current values any time. Properties marked as "Get" are those whose values you can retrieve but not set.

Methods


This task inherits the following methods from ENVITask:

AddParameter

Execute

Parameter

ParameterNames

RemoveParameter

Properties


This task inherits the following properties from ENVITask:

COMMUTE_ON_DOWNSAMPLE

COMMUTE_ON_SUBSET

DESCRIPTION

DISPLAY_NAME

NAME

REVISION

TAGS

This task also contains the following properties:

INPUT_RASTER (required)

Specify an input raster for applying the thresholds.

OUTPUT_ROI

This is a reference to the output ROI.

OUTPUT_ROI_URI (optional)

Specify a string with the fully-qualified path and filename for OUTPUT_ROI.

ROI_COLOR (required)

Specify a (3,n) byte array with the RGB colors for each ROI, where n is the number of ROIs specified by ROI_NAME.

ROI_NAME (required)

Specify a string or array of strings with the names of each ROI.

THRESHOLD (required)

Specify an array that represents a threshold: [minimum, maximum, zero-based band number]. You can apply one or more thresholds to one or more ROIs.

More Examples


These code examples demonstrate how to define any number of ROIs and thresholds. They should be included within the full example above.

One ROI from one threshold:

Task.INPUT_RASTER = raster
Task.THRESHOLD = [138,221,0]
Task.OUTPUT_ROI_URI=out_name
Task.ROI_NAME='Water'
Task.ROI_COLOR=[0,127,0]
Task.Execute

One ROI from two thresholds:

Task.INPUT_RASTER = raster
Task.THRESHOLD = [[138,221,0],[138,221,1]]
Task.OUTPUT_ROI_URI=out_name
Task.ROI_NAME=['Water','Water']
Task.ROI_COLOR=[[!color.blue],[!color.blue]]
Task.Execute

Two ROIs from one threshold:

Task.INPUT_RASTER = raster
Task.THRESHOLD = [[138,221,0],[222,306,0]]
Task.OUTPUT_ROI_URI=out_name
Task.ROI_NAME=['Water', 'Land']
Task.ROI_COLOR=[[!color.blue], [!color.green]]
Task.Execute

One ROI from two thresholds, and another ROI from one threshold:

Task.INPUT_RASTER = raster
Task.THRESHOLD = [[138,221,0],[222,306,0],[138,221,1]]
Task.OUTPUT_ROI_URI=out_name
Task.ROI_NAME=['Water','Land','Water']
Task.ROI_COLOR=[[!color.blue], [!color.green], [!color.blue]]
Task.Execute

Version History


ENVI 5.2

Introduced

API Version


3.2

See Also


ENVITask, ENVITask::Parameter, ENVISubsetRaster, ENVIROI



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