>  Docs Center  >  ENVI API  >  Data Control  >  ENVIMosaicRaster::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?" in the ENVI API Programming Guide.


The example uses sample images from the ENVI Resource DVD (in the mosaic folder). The images are also available from the ENVI Tutorials web page. Click the "ENVI Tutorial Data" hyperlink. Copy the images to your local drive, and update the file location with your own directory.

; Start the application
; 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', $
; Retrieve the dehydrated hash
dehydratedForm = mosaicRaster.Dehydrate()
; Restore the object
newImage = ENVIMosaicRaster.Hydrate(dehydratedForm)
Print, newImage, /IMPLIED_PRINT


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

Return Value

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






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


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/harris/envi/mydata/2002apr01.dat",
"factory": "URLRaster"
"url": "/usr/local/harris/envi/mydata/2004apr13_warp.dat",
"factory": "URLRaster"


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"]


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

"color_matching_method": "none"


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"


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


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

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


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

"feathering_method": "seamline"


A string that identifies the raster.


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

"resampling": "nearest neighbor"


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

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


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

"seamline_method": "none"



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


ENVI 5.4.1

Renamed the background key to data_ignore_value

API Version


See Also

ENVIMosaicRaster, ENVIMosaicRaster::Dehydrate, ENVIHydratable, ENVIHydrate

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