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


The example uses sample images that are available from our ENVI Tutorials web page. Click the Mosaic link to download the .zip file to your machine, then unzip the files. Update the file location with your own directory.

; Start the application
e = ENVI(/HEADLESS)
   
; Open two aerial photos
File1 = '2002apr01.dat'
Raster1 = e.OpenRaster(File1)
File2 = '2004apr13_warp.dat'
Raster2 = e.OpenRaster(File2)
 
; Create a mosaic
mosaicRaster = ENVIMosaicRaster([Raster1, Raster2], $
  COLOR_MATCHING_ACTIONS = ['Reference', 'Adjust'], $
  COLOR_MATCHING_METHOD = 'Histogram Matching', $
  COLOR_MATCHING_STATS = 'Entire Scene', $
  FEATHERING_METHOD = 'Edge', $
  FEATHERING_DISTANCE = 15, $
  DATA_IGNORE_VALUE = 0)
   
; Retrieve the dehydrated hash
dehydratedForm = mosaicRaster.Dehydrate()
mosaicRaster.Close
 
; Restore the object
newImage = ENVIMosaicRaster.Hydrate(dehydratedForm)
Print, newImage, /IMPLIED_PRINT

Syntax


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

Return Value


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

Arguments


DehydratedForm

Key

Description

factory

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

scenes

Required. An array of ENVIRaster that comprise the mosaic raster. Each file must have the same number of bands and the same data type. You must define at least one raster with the SCENES property to create the mosaic. Input files can be georeferenced to different coordinate systems; the first scene in the SCENES array defines the output projection for the mosaic raster. Example:

"scenes": [
{
"url": "/usr/local/INSTALL_DIR/envi/mydata/2002apr01.dat",
"factory": "URLRaster"
},
{
"url": "/usr/local/INSTALL_DIR/envi/mydata/2004apr13_warp.dat",
"factory": "URLRaster"
}
]

color_matching_actions

An array of strings that indicates how each element of the Scenes array should be treated with regard to color matching: as a reference image, an adjusted image, or no color matching. The number of elements in this array must match the number of input scenes in the Scenes array. Valid strings are adjust, none, or reference. Example:

"color_matching_actions": ["none","adjust","none","reference","adjust","adjust"]

color_matching_method

A string that indicates the color matching method. Set to histogram matching or none. Example:

"color_matching_method": "none"

color_matching_stats

A string that indicates what parts of the reference and adjusted images are used to compute statistics for color matching. Set to entire scene or overlapping area. Example:

"color_matching_stats": "entire scene"

data_ignore_value

A pixel value that will be used to fill areas where no valid data appear in the output raster. This value may be different than the input data-ignore value. The value must be within the range of the input scenes' data type (e.g., floating-point, byte, integer, etc.) Example:

"data_ignore_value": 255.0

feathering_distance

An integer number of pixels used for edge or seamline feathering. Example:

"feathering_distance": [99, 99, 99, 99, 99, 99]

feathering_method

A string that indicates the feathering method to use. Set to edge, none, seamline. Example:

"feathering_method": "seamline"

name

A string that identifies the raster.

resampling

A string that indicates the resampling method. Set to nearest neighbor, bilinear, or cubic convolution. Example:

"resampling": "nearest neighbor"

seam_polygons

An ENVIVector containing seam polygons that you want to restore. Example:

"seam_polygons": {
   "url": "/usr/local/INSTALL_DIR/envi/mydata/myseamlines.shp"
   "factory": "URLVector"
 }

seamline_method

A string that indicates the method used to automatically generate seamlines. Set to geometry or none. Example:

"seamline_method": "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.4

Introduced

ENVI 5.4.1

Renamed the background key to data_ignore_value

API Version


4.2

See Also


ENVIMosaicRaster, ENVIMosaicRaster::Dehydrate, ENVIHydratable, ENVIHydrate