This function constructs a lightweight ENVIDeepLearningRaster subclass from a file that can be used with ENVITasks in ENVI Deep Learning. The raster metadata must contain certain values to be considered a valid ENVIDeepLearningLabelRaster.

This routine is part of ENVI Deep Learning, which requires a separate license and installation.

This is not a virtual raster. It offers the same interface that a base ENVIRaster would for the same file. For normal use in the Deep Learning API, it avoids the persistent use of file descriptors, so creating many of these objects will avoid running into operating system limits that the base ENVIRaster encounters.

The ENVIDeepLearningRaster will open a file descriptor during certain operations, so that you can use it like a base ENVIRaster anywhere in ENVI:

  • ENVIDeepLearningRaster::CreateTileIterator()
  • ENVIDeepLearningRaster::GetData()
  • ENVIDeepLearningRaster::WriteMetadata
  • ENVIDataCollection::Add
  • ENVIRasterToFID()
  • ENVIView::CreateLayer()


Sample data files are available on our ENVI Tutorials web page. Click the "Deep Learning" link in the ENVI Tutorial Data section to download a .zip file containing the data. Extract the contents to a local directory.

; Launch the application
; Update the following line with the correct path
; to the tutorial data files
File = 'C:\MyTutorialFiles\LabelRasterContainers.dat'
Raster = ENVIDeepLearningLabelRaster(File)
Print, Raster


Result = ENVIDeepLearningLabelRaster([, URI] [, Properties=value])

Return Value

This function returns a reference to an ENVIDeepLearningLabelRaster object.



Specify a scalar string that is a fully-qualified file path to a raster on disk. The file must be in the ENVI raster format.


The ENVIDeepLearningLabelRaster class inherits the methods and properties of ENVIRaster, including:


Save (not used with ENVIDeepLearningLabelRaster)

SetData (not used with ENVIDeepLearningLabelRaster)

SetTile (not used with ENVIDeepLearningLabelRaster)

The following ENVIDeepLearningLabelRaster methods will override these inherited ENVIRaster methods:

CreatePyramid (not used with ENVIDeepLearningLabelRaster)










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 the Manage Errors topic in ENVI Help for more information on error handling.


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.


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 the WriteMetadata method.
  • 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).


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.


This property retrieves a reference to the ENVICoordSys associated with the raster.


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 ENVIDeepLearningLabelRaster that contains complex data.


This property retrieves the image format of the file. ENVI is the supported format.


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]


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.


The number of bands in the raster.


The number of columns in the raster.


The number of rows in the raster.


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


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


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

TIME (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

Deep Learning 1.0


See Also

ENVIRaster in ENVI Help, ENVIDeepLearningRaster