In ENVI, you can assign map information to a PDS image based on values from the PDS label.
1. Download an image and corresponding PDS label file (.lbl extension) to the same directory.
2. Open the image in ENVI. It will not be map projected.
3. Select File > Edit ENVI Header and select the image. Click OK.
4. From Edit Attributes, choose Map Info...
5. Click Change Proj.
6. Unless you already have the correct lunar projection, create a new one (steps below assume projection does not exist).
7. Click New... on the Projection Selection dialog box.
8. Enter values based on label. For example, sphere radius 1738000 (notice in meters), projection type sinusoidal, 0 false
easting and northing, 74 central meridian longitude. (False easting/northing not in the label.)
9. Save projection and map_proj file. Select newly created projection.
10. In the Edit Map Information dialog, enter values from the label. For example, image coordinate x,y of 1.5,1.5 (the upper left
corner) might be 0,50 with pixel size of 400 m/pixel. Click OK to save map information and OK to save header.
Due to a technical issue, the original comments on this blog post were lost. A transcription of the comments can be found below.
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
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.
PDS_VERSION_ID = PDS3
/* FILE DATA ELEMENTS */
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
BAND_STORAGE_TYPE = BAND_SEQUENTIAL
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.