Jump to content
PDS Geosciences Node Community


  • Content count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About sestrell

  • Rank
  1. Having trouble reading the .img file

    Hi kathrynbottrell and future readers, I found a solution to my problem. I downloaded NASAView from https://pds.nasa.gov/tools/nasa-view.shtml. This lets you open the pds image and then export it as a jpg, pdf or other file extension types. Unfortunately, I was unable to code my own working binary reader for any general pds image file. Hopefully this helps, Samuel
  2. Having trouble reading the .img file

    Susie, Thank you so much! This is amazingly helpful. Two more questions: The last line of the ascii header is marked "END", correct? On the following line, there are some NUL then a long string that describes all the characteristics of the file and then some code that is unreadable (I assume the binary array.) 1. Does the image start on the unreadable code on that same line? If I skip to the next line, the image I get is incorrect. 2. When the binary array is read, does it read top left to bottom right (going across the top line of pixels first, and then the second, and so on)? Samuel
  3. Hello, Currently I'm working on a data analysis project using images from the Mars Opportunity Rover Pancam. I'm having trouble reading the .img files. I know the ascii detachable string contains all the information necessary. I'm trying to write a script to extract intensity of each pixel and place it into an array. Right now I'm thinking LINES is height, LINE_SAMPLES is width and SAMPLE_BITS is bit per pixel. The checksum for this specific image is 7231232, but if I use the dimensions given in the lines, line_samples and sample_bits I get 65536 (for 64 x 64 x 16). Here is the data from the header. Am I interpreting the dimensions wrong? /* IMAGE DATA ELEMENTS */ OBJECT = IMAGE INTERCHANGE_FORMAT = BINARY LINES = 64 LINE_SAMPLES = 64 SAMPLE_TYPE = MSB_INTEGER SAMPLE_BITS = 16 BANDS = 1 BAND_STORAGE_TYPE = BAND_SEQUENTIAL CHECKSUM = 7231232 FIRST_LINE = 1 FIRST_LINE_SAMPLE = 1 INVALID_CONSTANT = 4095 MAXIMUM = 2508 MEAN = 1765.437500000000 MEDIAN = 1767.000 MINIMUM = 801 MISSING_CONSTANT = 0 SAMPLE_BIT_MASK = 2#0000111111111111# STANDARD_DEVIATION = 199.9281 END_OBJECT = IMAGE /* IMAGE HEADER DATA ELEMENTS */ OBJECT = IMAGE_HEADER HEADER_TYPE = VICAR2 INTERCHANGE_FORMAT = ASCII BYTES = 12800 ^DESCRIPTION = "VICAR2.TXT" END_OBJECT = IMAGE_HEADER END Thank you, Samuel