Jump to content
PDS Geosciences Node Community

Working with PDS data

  • entries
  • comments
  • views

Contributors to this blog

Getting ENVI to open your PDS image correctly

Tom Stein


Applies to ITT ENVI image processing software versions 4.8 and earlier.


PDS images do not always open correctly in ENVI because of a bug in ENVI's PDS image reader. A fix is promised with the ENVI 5.0 release. In the meantime, here is a workaround for the problem.


Step 1. Get the correct image information from the PDS label.


The PDS label describes the image data. You will need to determine the following values from the PDS label:

  • Image offset (in bytes)
  • Number of samples and lines
  • Number of bands
  • Data type
  • Band interleave

Step 2. Make corrections to errant values in ENVI's "Header Info" dialog.


Update the image header info within the ENVI program's "Edit ENVI Header" dialog. The detached ENVI header will be created with the correct values and the image will be displayed correctly.





As an example, let's use the Mars Express HRSC file H1183_0000_BL4.IMG, available from our PDS Geosciences Node archives at this URL.


This image has an attached label (there is a single file with the label information at the beginning and the image data at the end). The easiest way to get the needed values from the label is using the "more" command from the command line.


C:\home\me>more h1183_0000_bl4.img
PDS_VERSION_ID                    = PDS3


RECORD_TYPE                       = FIXED_LENGTH
RECORD_BYTES                      = 1986
FILE_RECORDS                      = 20475
LABEL_RECORDS                     = 6


In ENVI, the image offset value tells ENVI how many bytes to skip at the beginning of the PDS image file before reading the image. This is determined by multiplying the number of RECORD_BYTES by the number of records before the beginning of the image.


In this example, the label shows

RECORD_BYTES                      = 1986
^IMAGE                            = 12

Therefore the image offset is 1986 * 11 = 21846. (Note: we need the number of bytes before the image. The label indicates the image starts at record 12, so there are 11 records of 1986 bytes each before the image.)


The remaining values are in the label's IMAGE object:


OBJECT                            = IMAGE
 LINES                           = 20464
 LINE_SAMPLES                    = 1986
 SAMPLE_TYPE                     = UNSIGNED_INTEGER
 SAMPLE_BITS                     = 8
 BANDS                           = 1
END_OBJECT                        = IMAGE


Now, let's open the image in ENVI using File > Open Image File. The image is listed in the Available Bands List dialog, but an error message is displayed when we try to load the band.


ENVI Retrieve Data: An error has occurred during processing

Error: "READU: End of file encountered. Unit: 101, File: c:\work\me\h1183_0000_bl4.img"
The result may be invalid.


Close the error dialog. Let's edit the ENVI header using File > Edit ENVI Header. Choose the image in question from "Select Input File:" and click OK. Use the PDS label values to update those in the ENVI header and click OK. Now load click "Load Band" again in the Available Bands List. The image is now displays correctly in ENVI.


Note: the ENVI Data Type is determined be a combination of PDS SAMPLE_TYPE and SAMPLE_BITS. For example, an 8-bit UNSIGNED_INTEGER PDS image is a Byte image in ENVI, whereas a 16-bit UNSIGNED_INTEGER PDS image is an Unsigned Int in ENVI.

1 Comment

Recommended Comments

Hello Sir, 


I am not able to open lsz_06613_2cd_eku_44n005_v1 MiniRF data in ENVI. 


I am getting the following error after opening the file after attaching the respective product label file in the "Edit ENVI Header" dialog box. 




Kindly guide me! 




Kind Regards, 


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...