planetarypy / planetaryimage

Python PDS and Isis Cube file parser.
BSD 3-Clause "New" or "Revised" License
40 stars 20 forks source link

Handle LINE_SUFFIX and PREFIX data defined in external tables. #18

Open godber opened 9 years ago

godber commented 9 years ago

Our test Cassini image (W1782844276_1.IMG, W1782844276_1.LBL) has a LINE_PREFIX_TABLE which looks like this:

OBJECT = LINE_PREFIX_TABLE
      INTERCHANGE_FORMAT = BINARY
      ROWS = 1024
      COLUMNS = 10
      ROW_BYTES = 24
      ROW_SUFFIX_BYTES = 1024
      ^LINE_PREFIX_STRUCTURE = "../../label/prefix3.fmt"
END_OBJECT = LINE_PREFIX_TABLE

Without accounting for the line prefix data an image looks like this:

z8coln09flbpwaaaabjru5erkjggg

The PDS Spec has the following to say in section A.20:

In more complex images, each individual line may have some attached data
which are not part of the image itself (engineering data, checksums, time tags,
etc.). In this case the additional, non- image parameters are accounted for as
either LINE_PREFIX_BYTES or LINE_SUFFIX_BYTES, depending on whether
they occur before or after the image samples in the line. These keywords indicate
the total number of bytes used for the additional data, so that software processing
the image can clip these bytes before attempting to display or manipulate the
image. The structure of the prefix or suffix bytes is most often defined by a
TABLE object (in the same label), which will itself have ROW_SUFFIX_BYTES
or ROW_PREFIX_BYTES, to allow table-processing software to skip over the
image data. Figure A.1 illustrates the layout of prefix and suffix bytes around an
image.

As far as this Cassini data is concerned, there is not a simple LINE_PREFIX_BYTES label. There is an entire TABLE object that describes the suffix data. This implies that we need to be able to parse TABLE objects to handle these more complicated images.

godber commented 9 years ago

Wait until #22 is done as this is a special case.