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  >  ENVIRaster

ENVIRaster

ENVIRaster

This is a reference to a raster object.

Example


The following code opens a file which returns an ENVIRaster and then creates a new ENVIRaster with one band from the original raster.

; Start the application
e = ENVI()
 
; Select input data
file = FILEPATH('qb_boulder_msi', ROOT_DIR=e.ROOT_DIR, $
  SUBDIRECTORY = ['data'])
raster = e.OpenRaster(file)
 
; Print some property values                                                  
PRINT, raster
 
; Create an output raster
newFile = e.GetTemporaryFilename()
 
; Retrieve and process data from original raster
origData = EDGE_DOG(raster.GetData(BANDS=0))
 
; Create a raster and save it in newFile
newRaster = ENVIRaster(origData, URI=newFile, NBANDS=1)
newRaster.Save
 
; Display new raster
view = e.GetView()
layer = view.CreateLayer(newRaster)

 

The next example shows how to create a new classification raster and add classification metadata to it:

; Start the application
e = ENVI()
 
; Create an output raster
File = e.GetTemporaryFilename()
 
; Create data for the classification raster
data = Make_Array(500,500,value=0,/byte)
data[0:250,0:250] = 1
data[0:250,251:499] = 2
data[251:499,251:499] = 3
 
; Add classification metadata
Metadata = ENVIRasterMetadata()
Metadata.AddItem, 'classes', 4
Metadata.AddItem, 'class names', ['Unclassified', 'Water', 'Vegetation','Soil']
Metadata.AddItem, 'class lookup', $
  [[!Color.Black], [!Color.Blue], [!Color.Green],[!Color.Brown]]
 
; Create a raster and save it in newFile
Raster = ENVIRaster(data, URI=File, METADATA=Metadata)
Raster.Save
 
; Display new raster
View = e.GetView()
Layer = view.CreateLayer(Raster)

Syntax


Result = ENVIRaster([, Data] [, Keywords=value] [, Properties=value])

Return Value


This function returns a reference to an ENVIRaster object.

Arguments


Data

A 2D or 3D array of data. When the Data argument is a 3D array, use the INTERLEAVE keyword to specify the interleave of the raster.

If you specify the Data argument, the values for the NBANDS, NCOLUMNS, NROWS, and DATA_TYPE properties are taken from the Data raster object. INTERLEAVE is assumed to be 'bsq' if not set.

You cannot create or modify an ENVIRaster that contains complex data.

If you do not specify the Data argument:

  • An empty ENVIRaster object is created. You must specify (1) INHERITS_FROM or (2) NBANDS, NCOLUMNS, NROWS, and DATA_TYPE. You can then use ENVIRaster::SetData or ENVIRaster::SetTile to add data to the ENVIRaster.
  • The NBANDS, NCOLUMNS, NROWS, and DATA_TYPE properties have precedence over the values in the INHERITS_FROM raster, if you specify that raster.

Methods


Close

CreatePyramid

CreateTileIterator

Dehydrate

Export

ExportROIs

GetData

Hydrate

Save

SetData

SetTile

WriteMetadata

Keywords


DATA_IGNORE_VALUE

Set this keyword to a pixel value that will be ignored when the raster is displayed. This overrides any data ignore values set in the metadata.

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.

INHERITS_FROM

Set this keyword to an ENVIRaster from which all metadata and the following properties will be copied: DATA_TYPE, INTERLEAVE, NBANDS, NCOLUMNS, and NROWS.

Data acquisition time (from the ENVIRaster TIME property) will not be copied.

Since new rasters are often created as the output of processing an input raster, they typically have the same spatial and spectral dimensions, interleave, and data type as the input raster. The INHERITS_FROM keyword provides convenience in inheriting these properties.

If you do not specify the INHERITS_FROM keyword, you must either provide the Data argument and INTERLEAVE is assumed to be 'bsq' if not set, or specify the NBANDS, NCOLUMNS, NROWS, and DATA_TYPE properties.

The NBANDS, NCOLUMNS, NROWS, and DATA_TYPE properties have precedence over the values in the INHERITS_FROM raster.

See ENVIRasterMetadata for details on creating and modifying metadata.

Note: If both the SPATIALREF and INHERITS_FROM keywords are specified, the spatial reference information from SPATIALREF takes precedence.

Properties


Properties marked as (Init) are applied only during the initial creation of the object. Properties marked as (Get) can be retrieved but not set. All other properties can be set during the creation of the object, or retrieved or changed after creation.

AUXILIARY_SPATIALREF (Get)

This property retrieves a reference to an ENVIGLTRasterSpatialRef, ENVIPseudoRasterSpatialRef, ENVIRPCRasterSpatialRef, or ENVIStandardRasterSpatialRef object, depending on what secondary map information the raster object uses for spatial reference (if any). This property provides a simple way to view secondary map information without having to query the metadata in the file header.

  • If the raster object only has one spatial reference, this property returns a !NULL value.
  • If the raster object contains standard map information plus RPC or pseudo information, the standard map information will be used as the primary spatial reference (returned by the SPATIALREF property) and the RPC or pseudo information will be the auxiliary spatial reference (returned by the AUXILIARY_SPATIALREF property). RPC information will be written to the header file (for ENVI-format files) if you call ENVIRaster::WriteMetadata.
  • If the raster object contains RPC and pseudo map information, the RPC information will be used as the primary spatial reference (returned by the SPATIALREF property).

AUXILIARY_URI (Get)

This property retrieves a string array containing the URIs for any auxiliary files associated with the raster file. Auxiliary files are files that ENVI creates, specifically header and pyramid files. If there are no associated files, !NULL is returned.

DATA_TYPE (Init, Get)

An integer or string specifying the raster data type (strings are not case-sensitive). When retrieving the property, a string is returned.

String Value Data Type
byte 1 Byte (8 bits)
double 5 Double-precision floating point (64 bits)
float 4 Floating point (32 bits)
int 2 Integer (16 bits)
long 3 Long integer (32 bits)
uint 12 Unsigned integer (16 bits)
ulong 13 Unsigned long integer (32 bits)

You cannot create or modify an ENVIRaster that contains complex data.

INTERLEAVE (Init, Get)

A string specifying the interleave of the raster.

String Interleave Data Array
bil Band interleaved by line [ncolumns, nbands, nrows]
bip Band interleaved by pixel [nbands, ncolumns, nrows]
bsq Band sequential [ncolumns, nrows, nbands]

METADATA (Init, Get)

This property retrieves a reference to the ENVIRasterMetadata object. If METADATA and INHERITS_FROM are both set, the new raster will have the union of both sets of metadata. The METADATA values override those from INHERITS_FROM if there is a conflict.

NBANDS (Init, Get)

The number of bands in the raster.

NCOLUMNS (Init, Get)

The number of columns in the raster.

NROWS (Init, Get)

The number of rows in the raster.

PYRAMID_EXISTS (Get)

Returns 1 (TRUE) if a pyramid file exists for the raster, and 0 (FALSE) if not.

READ_ONLY (Get)

Returns 1 (TRUE) if ENVIRaster is read-only, and 0 (FALSE) if not. If the value is 0, the SetData and Save methods are available.

SPATIALREF (Init, Get)

This property retrieves a reference to an ENVIGLTRasterSpatialRef, ENVIPseudoRasterSpatialRef, ENVIRPCRasterSpatialRef, or ENVIStandardRasterSpatialRef object.

TIME (Init, Get)

This property retrieves a reference to the ENVITime object.

URI (Init, Get)

A string that is a fully qualified raster file path. If not set on initialization, a temporary file will be generated.

Version History


ENVI 5

Introduced

ENVI 5, Service Pack 2

Added TIME property

ENVI 5.1

Added ability for ENVIRaster to serve as a constructor function for creating new raster objects. Added INHERITS_FROM keyword. Added Subset and Export methods.

ENVI 5.2

Deprecated Subset method. See ENVISubsetRaster.

ENVI 5.3

Added DATA_IGNORE_VALUE keyword

ENVI 5.4

Added Hydrate method

API Version


3.2

See Also


ENVI::OpenRaster, ENVIView::CreateLayer, ENVISubsetRaster



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