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


  >  Docs Center  >  ENVI API  >  Data Control  >  ENVIResampleRaster::Hydrate

ENVIResampleRaster::Hydrate

ENVIResampleRaster::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 and the ENVI Services Engine.

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

Example


; Start the application
e = ENVI()
 
; Open an input file
file = FILEPATH('qb_boulder_msi', ROOT_DIR=e.ROOT_DIR, $
  SUBDIRECTORY = ['data'])
raster = e.OpenRaster(file)
 
; Perform resampling
NewRaster = ENVIResampleRaster(raster, $
  DIMENSIONS=[256,256], $
  METHOD='Nearest Neighbor')
 
; Retrieve the dehydrated hash
dehydratedForm = NewRaster.Dehydrate()
NewRaster.close
 
; Restore the object
newImage = ENVIResampleRaster.Hydrate(dehydratedForm)
Print, newImage, /IMPLIED_PRINT

Syntax


Result = ENVIResampleRaster.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 ResampleRaster indicating what object type the hash represents.

input_raster

Required. The input ENVIRaster for use in ENVI processing. Example:

"input_raster": {
   "url": "/usr/local/harris/envi/data/qb_boulder_msi",
   "factory": "URLRaster"
}

method

The resampling method:

  • Nearest Neighbor: Uses the nearest pixel without any interpolation
  • Bilinear (default): Performs a linear interpolation using four pixels to resample
  • Cubic Convolution: Uses 16 pixels to approximate the sinc function using cubic polynomials to resample the image

Example:

"method""Nearest Neighbor",

name

A string that identifies the raster.

pixel_scale

A positive number or two-element array of positive numbers that define how each pixel will be resized. If you specify a single value, then the resizing is the same in the x- and y-directions. Setting pixel_scale can result in the resampled raster having slightly different geographic extents than the source raster. Scaled pixels may not exactly cover the same geographic area as the original pixels. The upper-left corners will coincide while the right and bottom edges will be scaled by a sub-pixel amount. Example:

"pixel_scale": [1, 1]

dimensions

A two-element array of positive integers that indicate the pixel dimensions of the resampled raster. This provides exact geographic coverage as the source raster. Example:

"dimensions": [256, 256]

column_mapping

An array of numbers that indicate the column index locations in the resampled raster, for each column of pixels in the source raster. The array must have the same number of elements as the source raster's number of columns (ENVIRaster.NCOLUMNS). If you set column_mapping but not ROWS_MAPPING, then no horizontal scaling will occur. Example:

"column_mapping": [0, 1, 2, 3, 4, 5, 6, 7, 
8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]

row_mapping

An array of numbers that indicate the row index locations in the resampled raster, for each row of pixels in the source raster. The array must have the same number of elements as the source raster's number of rows (ENVIRaster.NROWS). If you set this row_mapping but not COLUMN_MAPPING, then no vertical scaling will occur. Example:

"row_mapping": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 
10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]

Keywords


ERROR (optional)

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

API Version


3.2

See Also


ENVIResampleRaster, ENVIResampleRaster::Dehydrate, ENVIHydratable, ENVIHydrate



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