ENVITask::Dehydrate
The Dehydrate function method returns a hash describing this object. You can use this information in a later ENVI session to restore the object using the object’s static ::Hydrate method or the ENVIHydrate function. For additional information, see What are Hydrate and Dehydrate routines used for?
Example
This example shows a scenario where you may want to use the Dehydrate method. The NUMBER_OF_CLASSES parameter in the ISODATA classification task accepts any number of classes; however, let's say that you want it to accept only 3, 5, 7, or 9 classes (with a default value of 5). You can modify the parameter to be a choice list instead. To do this requires accessing and editing the hash representation of the task.
; Start the application
e = ENVI(/HEADLESS)
; Get the task that will be modified
task = ENVITask('ISODATAClassification')
; Retrieve the dehydrated hash
dehydratedForm = task.Dehydrate()
; Add a new CHOICE_LIST property value to the
; NUMBER_OF_CLASSES parameter. This parameter is
; the second one in the list of parameters, so its
; zero-based index is 1
dehydratedform['parameters', 1, 'choice_list'] = [3,5,7,9]
; Restore a new task from the updated hash
task2 = ENVITask.Hydrate(dehydratedForm)
; Verify that the modified parameter has the new
; property value
param = task2.Parameter('NUMBER_OF_CLASSES')
Print, param, /IMPLIED_PRINT
Result:
IDLPARAMETERUINT <3066971>
NAME = 'NUMBER_OF_CLASSES'
DISPLAY_NAME = 'Number of Classes'
TYPE = 'UINT'
DESCRIPTION = 'The requested number of classes to generate.'
DIRECTION = 'INPUT'
REQUIRED = false
DEFAULT = 5
VALUE = 5
CHOICE_LIST = 3,5,7,9
INCLUSIVE_MAX = true
INCLUSIVE_MIN = true
MAX = !NULL
MIN = !NULL
TEST_EXACT = false
TEST_OVERFLOW = true
Syntax
Result = ENVITask.Dehydrate(ERROR=value)
Return Value
This function method returns a hash containing the key/value pairs representing the current object state.
Arguments
None
Keywords
ERROR
Set this keyword to a named variable that will contain any error message issued during execution of this routine. If no error occurs, the ERROR variable will be set to a null string (''
). If an error occurs and the routine is a function, then the function result will be undefined.
When this keyword is not set and an error occurs, ENVI returns to the caller and execution halts. In this case, the error message is contained within !ERROR_STATE and can be caught using IDL's CATCH routine. See IDL Help for more information on !ERROR_STATE and CATCH.
See Manage Errors for more information on error handling in ENVI programming.
Version History
ENVI 5.5 |
Introduced |
API Version
4.2