ENVITiePointSet::Hydrate

Use the Hydrate static function method to create the object from its dehydrated form. The dehydrated form consists of a hash containing the object’s properties and values. The Hydrate and Dehydrate methods let you store the object state in memory and restore it later.

Representing an object as a hash is necessary for running ENVI analytics with the ENVI Task Engine.

See the ENVIHydrate function if you are creating a general IDL routine that will restore multiple object types.

For additional information, see What are Hydrate and Dehydrate routines used for?

Example

This example uses data files are available from our ENVI Tutorials web page. Click the Image Registration link to download the .zip file to your machine, then unzip the files.

; Start the application

e = ENVI(/HEADLESS)

 

; Open two input images

File1 = 'quickbird_2.4m.dat'

Raster1 = e.OpenRaster(File1)

File2 = 'ikonos_4.0m.dat'

Raster2 = e.OpenRaster(File2)

 

; Open an existing tie point file

tiePointFile = 'SampleTiePoints.pts'

tiePoints = ENVITiePointSet(tiePointFile, $

  INPUT_RASTER1=Raster1, INPUT_RASTER2=Raster2)

 

; Retrieve the dehydrated hash

dehydratedForm = tiePoints.Dehydrate()

tiePoints.close

 

; Restore the object

newTiePoints = ENVITiePointSet.Hydrate(dehydratedForm)

Print, newTiePoints, /IMPLIED_PRINT

Syntax

Result = ENVITiePointSet.Hydrate(DehydratedForm, ERROR=value)

Return Value

The result is a reference to a new object instance of this virtual raster class.

Arguments

DehydratedForm

The form of the hash depends on if you have created or updated the tiepoint set from raw data or if the tiepoint set has been loaded from a file.

Tiepoints loaded from a file:

Key

Description

factory

Required. A string value of URLTiePointSet indicating what object type the hash represents.

url

Required. A uniform resource locator (URL) identifying a tiepoint file for use in ENVI processing. Example:

"url" : "/usr/local/INSTALL_DIR/envi/mydata/tiepoints.pts"

input_raster1

Overrides the raster specified in the tie point file. Example:

"input_raster1": {
     "url": "/usr/local/INSTALL_DIR/envi/mydata/tiepoints/myfile.dat",
     "factory": "URLRaster"
}

input_raster2

Overrides the raster specified in the tiepoint file.

Tiepoints created or updated from an array:

Key

Description

factory

Required. A string value of TiePointSet indicating what object type the hash represents.

tiepoints

An array of tie point coordinates with an array size of [4, number of tie points]. Example:

"tiepoints": [295.48999023437500, 221.58000183105469, 543.38000488281250, 293.51998901367187],

input_raster1

Overrides the raster specified in the tie point file. Example:

"input_raster1": {
     "url": "/usr/local/INSTALL_DIR/envi/mydata/tiepoints/myfile.dat",
     "factory": "URLRaster"
}

input_raster2

Overrides the raster specified in the tie point file.

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.

API Version

4.2

Version History

ENVI 5.4

Introduced

See Also

ENVITiePointSet, ENVITiePointSet::Dehydrate, ENVIHydratable, ENVIHydrate