home *** CD-ROM | disk | FTP | other *** search
/ Encyclopedia of Graphics File Formats Companion / GFF_CD.ISO / formats / vicar / spec / vicar.txt
Text File  |  1994-06-01  |  32KB  |  671 lines

  1. The VICAR file format
  2.  
  3. This document describes the format of VICAR files. It applies to
  4. files created with version 8.0 or later of VICAR. Files created
  5. earlier may not have some sections (like property labels) or some
  6. system label items (like the various HOST-related items), but
  7. they still conform to this specification. The proper application
  8. of defaults given below will ensure that all VICAR files may be
  9. read using this spec. Any VICAR files written out must include
  10. all the system label items defined below.
  11.  
  12.  
  13. Overview
  14.  
  15. The basic structure of a VICAR file is shown below.
  16.  
  17.  
  18.                     <------------------RECSIZE---------------->                 
  19.        
  20.        ^            |-----------------------------------------|
  21.        |            |                                         | 
  22. LBLSIZE/RECSIZE     |                  Labels                 | 
  23.        |            |                                         |
  24.        V            |-----------------------------------------|
  25.          ^          |                                         |
  26.          |          |                                         |
  27.          |          |                                         |
  28. NLB+(N2*N3)         |                Image area               |
  29.          |          |                                         |
  30.          |          |                                         |
  31.          V          |-----------------------------------------|
  32.   ^                 |                                         |
  33.   |                 |                                         |
  34. (EOL)LBLSIZE/       |                EOL labels               |
  35.   RECSIZE           |                                         |
  36.   |                 |-----------------------------------------|
  37.   V
  38.  
  39.  
  40. A VICAR file consists of two major parts: the labels, which
  41. describe what the file is, and the image area, which contains the
  42. actual image. The labels are potentially split into two parts,
  43. one at the beginning of the file, and one at the end. Normally,
  44. only the labels at the front of the file will be present.
  45. However, of the EOL keyword in the system label (described below)
  46. is equal to 1, then the EOL labels (End Of file Labels) are
  47. present. This happens if the labels expand beyond the space
  48. allocated for them.
  49.  
  50. The VICAR file is treated as a series of fixed-length records, of
  51. size RECSIZE (see below). The image area always starts at a
  52. record boundary, so there may be unused space at the end of the
  53. label, before the actual image data starts.
  54.  
  55.  
  56. Labels
  57.  
  58. The label consists of a sequence of "keyword=value" pairs that
  59. describe the image, and is made up entirely of ASCII characters.
  60. Each keyword-value pair is separated by spaces. Keywords are
  61. strings, up to 32 characters in length, and consist of uppercase
  62. characters, underscores (_), and numbers (but should start with a
  63. letter). Values may be integer, real, or strings, and may be
  64. multiple (e.g. an array of 5 integers, but types cannot be mixed
  65. in a single value). Spaces may appear on either side of the
  66. equals character (=), but are not normally present.
  67.  
  68. The first keyword is always LBLSIZE, which specifies the size of
  69. the label area in bytes. LBLSIZE is always a multiple of RECSIZE,
  70. even if the labels don't fill up the record. If the labels end
  71. before LBLSIZE is reached (the normal case), then a 0 byte
  72. terminates the label string. If the labels are exactly LBLSIZE
  73. bytes long, a null terminator is not necessarily present. The
  74. size of the label string is determined by the occurrence of the
  75. first 0 byte, or LBLSIZE bytes, whichever is smaller.
  76.  
  77. If the system keyword EOL has the value 1, then End-Of-file
  78. Labels exist at the end of the image area (see above). The EOL
  79. labels, if present, start with another LBLSIZE keyword, which is
  80. treated exactly the same as the main LBLSIZE keyword. The length
  81. of the EOL labels is the smaller of the length to the first 0
  82. byte or the EOL's LBLSIZE. Note that the main LBLSIZE does not
  83. include the size of the EOL labels. In order to read in the full
  84. label string, simply read in the EOL labels, strip off the
  85. LBLSIZE keyword, and append the rest to the end of the main label
  86. string.
  87.  
  88. The label is divided into three logical parts: System labels,
  89. Property labels, and History labels, in that order. These parts
  90. are described later in this section.
  91.  
  92.      Label Values
  93.  
  94. The label values may be of three types: integer, real, or string.
  95.  
  96. * Integer: A sequence of digits (0-9), with an optional sign
  97. (+/-). There must be no embedded blanks in the integer, including
  98. between the sign and the number. In C, an integer should be
  99. created with the "%d" format in sprintf().
  100.  
  101. * Real: A sequence of digits (0-9) including a decimal point (.),
  102. an optional sign(+/-), and an optional exponent (one of the
  103. letters "EeDd" followed by a base-10 exponent in integer format).
  104. The letter "E" is greatly preferred for indicating the exponent.
  105. There must be no embedded blanks in the real number. The number
  106. must contain either a decimal point or an exponent, or else it
  107. will be considered an integer. The number of significant digits
  108. is variable, so the number may be read as either single or double
  109. precision. In C, a real number should be created with the "%g"
  110. format in sprintf().
  111.  
  112. * String: A string is a sequence of ASCII characters enclosed in
  113. single quotes ('). A single quote may be included in the string
  114. by doubling it (i.e. 'can"t'). The quotes enclosing the string
  115. value may be discarded if the string contains no blanks or
  116. special characters, and contains at least one letter that cannot
  117. be interpreted as a number (i.e. it does not consist entirely of
  118. the letters E and D). However, this is rarely done, and any
  119. labels written should enclose strings in quotes.
  120.  
  121. A keyword may have more than one value by enclosing the values in
  122. parentheses and separating the values with commas. The collection
  123. of values is treated like an array for that keyword. All values
  124. in a multi-valued label item must be of the same type. Spaces may
  125. exist around the parentheses or the commas, but are not normally
  126. present.
  127.  
  128.      Examples
  129.  
  130. LBLSIZE=1024
  131. FORMAT='BYTE'
  132. LATITUDE=45.3
  133. COORDS=(5.7,-3.2E+2)
  134. COMMENTS=('Wow, this is a comment!','This can"t be real')
  135. EXTRA_SPACES = ( 1,  2,3,    4   ,  -5 )
  136.  
  137.  
  138.      System Labels
  139.  
  140. System labels describe the format of the image and how to access
  141. it. They are always the first labels in the file. The system
  142. labels extend from the beginning of the file until the first
  143. PROPERTY or TASK keyword, or until the end of the label (if there
  144. are no property or history labels).
  145.  
  146. Any program attempting to read a VICAR file should be able to
  147. accept (and ignore) system label items it doesn't understand, as
  148. new system label items are added from time to time.
  149.  
  150. Some system label items are mandatory, while others are optional.
  151. The mandatory ones are mentioned in the descriptions below.
  152. However, when writing a new file, all system label items should
  153. normally be included.
  154.  
  155. The currently defined system label items are listed below. They
  156. generally appear in the order listed, but there is no guarantee
  157. that the items will be in any particular order, except that
  158. LBLSIZE must always be first. So, any program that reads the
  159. label must be able to handle any order of label items.
  160.  
  161. * LBLSIZE, integer, mandatory: The size of the label storage
  162.      area, in bytes. It is always the first thing in the file.
  163.      This label will appear twice if EOL labels are present; once
  164.      at the beginning of the file and once at the beginning of
  165.      the EOL labels. The size specified applies only to the
  166.      section (main or EOL) that the LBLSIZE item is in.
  167.  
  168. * FORMAT, string, mandatory: The data type of the pixels in the
  169.      image. Valid values are:
  170.       * BYTE: one byte unsigned integer, range 0 to 255.
  171.       * HALF: two byte signed integer, range -32768 to 32767.
  172.       * FULL: four byte signed integer.
  173.       * REAL: single-precision floating point number.
  174.       * DOUB: double-precision floating point number.
  175.       * COMP: complex number, composed of two REALs in the order
  176.         (real, imaginary).
  177. The following values are obsolete, but may appear in some older
  178.      images:
  179.       * WORD: same as HALF
  180.       * LONG: same as FULL
  181.       * COMPLEX: same as COMP
  182.  
  183. * TYPE, string: The kind of file this is. TYPE defaults to IMAGE.
  184.      The valid values may very well be expanded in the future,
  185.      but currently they are:
  186.       * IMAGE: standard VICAR image file. This is the only type
  187.         fully described in this document.
  188.       * PARMS: very old-style parameter file.
  189.       * PARM: old-style parameter file.
  190.       * PARAM: current parameter file, used to hold input
  191.         parameters for one VICAR program that were generated by
  192.         another. Created by the x/zvpopen and x/zvpout routines
  193.         in the VICAR Run-Time Library.
  194.       * GRAPHL: IBIS Graphics-1 file.
  195.       * GRAPH2: IBIS Graphics-2 file.
  196.       * GRAPH3: IBIS Graphics-3 file.
  197.       * TABULAR: IBIS Tabular file.
  198.  
  199. * BUFSIZ, integer, mandatory: This label item is obsolete. It
  200.           formerly defined the size of the internal buffer to use
  201.           when reading the image, but it is no longer used. It
  202.           still must be present for historical reasons, however.
  203.           When creating a new file, just set BUFSIZ equal to
  204.           RECSIZE.
  205.  
  206. * DIM, integer: The number of dimensions in the file, which is
  207.        always equal to 3. Some older images may have a DIM of 2,
  208.        in which case some labels will not be present. Note that
  209.        the dimension is 3 even if N3=1 (e.g. there is only one
  210.        band in a BSQ file). The default is 3.
  211.  
  212. * EOL, integer: A flag indicating the existence of EOL labels
  213.        (see above). If EOL=1, the labels are present. If EOL=0
  214.        (or is absent), no EOL labels are present, and the entire
  215.        label string is at the front of the file.
  216.  
  217. * RECSIZE, integer, mandatory: The size in bytes of each record
  218.            in the VICAR file. It may be calculated with the
  219.            formula NBB + N1*pixel_size, where pixel_size is the
  220.            size of each pixel computed using FORMAT (for the
  221.            pixel type) and the INTFMT or REALFMT (for the host
  222.            representation) labels.
  223.  
  224. * ORG, string: The organization of the file. While N1 is always
  225.        the fastest-varying dimension, and N3 is the slowest, the
  226.        terms Samples, Lines, and Bands may be interpreted in
  227.        different ways. ORG specifies which interpretation to use,
  228.        and defaults to BSQ.
  229.   The valid values are:
  230.      * BSQ: Band SeQuential. The file is a sequence of bands.
  231.        Each band is made up of lines, which are in turn made up
  232.        of samples. So, N1=Samples, N2=Lines, and N3=Bands. This
  233.        is the most common case.
  234.      * BIL: Band Interleaved by Line. The file is a sequence of
  235.        lines. Each line is made up of bands, which are in turn
  236.        made up of samples. So, N1=Samples, N2=Bands, and
  237.        N3=Lines.
  238.      * BIP: Band Interleaved by Pixel. The file is a sequence of
  239.        lines. Each line is made up of samples, which are in turn
  240.        made up of bands. So, N1=Bands, N2=Samples, and N3=Lines.
  241.  
  242. The three organizations are depicted graphically below.
  243.  
  244.            BSQ                    BIL                    BIP
  245.  
  246.      |---------------|      |---------------|      |---------------|   
  247.      |   ^           |      |   ^           |      |   ^           |
  248.      |   |           |      |   |           |      |   |           |
  249.      |<--|--Samples->|      |<--|--Samples->|      |<--|--Bands--->|
  250.      |   |           |      |   |           |      |   |           |
  251. Band1|   |           | Line1|   |           | Line1|   |           |   
  252.      |   |           |      |   |           |      |   |           |
  253.      |  Lines        |      |  Bands        |      |  Samples      |
  254.      |   |           |      |   |           |      |   |           |
  255.      |   V           |      |   V           |      |   V           |
  256.      |---------------|      |---------------|      |---------------|
  257.   
  258.           .                      .                      .
  259.           .                      .                      .
  260.           .                      .                      .
  261.  
  262.      |---------------|      |---------------|      |---------------|   
  263.      |   ^           |      |   ^           |      |   ^           |
  264.      |   |           |      |   |           |      |   |           |
  265.      |<--|--Samples->|      |<--|--Samples->|      |<--|--Bands--->|
  266.      |   |           |      |   |           |      |   |           |
  267. Bandn|   |           | Linen|   |           | Linen|   |           |   
  268.      |   |           |      |   |           |      |   |           |
  269.      |  Lines        |      |  Bands        |      |  Samples      |
  270.      |   |           |      |   |           |      |   |           |
  271.      |   V           |      |   V           |      |   V           |
  272.      |---------------|      |---------------|      |---------------|
  273.   
  274.  
  275. * NL, integer, mandatory: The number of lines in the image (same
  276.       as N2 for BSQ or N3 for BIL and BIP).
  277.  
  278. * NS, integer, mandatory: The number of samples in the image
  279.       (same as N1 for BSQ and BIL or N2 for BIP).
  280.  
  281. * NB, integer, mandatory: The number of bands in the image (same
  282.       as N3 for BSQ, N2 for BIL, or N1 for BIP).
  283.  
  284. * N1, integer: The size (in pixels) of the first
  285.       (fastest-varying) dimension. If not present, it defaults to
  286.       NS or NB, as appropriate.
  287.  
  288. * N2, integer: The size of the second dimension. If not present,
  289.       it defaults to NL, NS, or NB, as appropriate.
  290.  
  291. * N3, integer: The size of the third (slowest-varying) dimension.
  292.       If not present, it defaults to NL or NB, as appropriate.
  293.  
  294. * N4, integer: This item was to have been used for
  295.       four-dimensional files, but this has not yet been
  296.       implemented. It defaults to 0.
  297.  
  298. * NBB, integer: The number of bytes of binary prefix before each
  299.       record. Each and every record consists of the pixels of the
  300.       fastest-varying dimension, optionally preceded by a binary
  301.       prefix. The size (in bytes, not pixels) of this binary
  302.       prefix is given by NBB, which defaults to 0. The binary
  303.       prefix and the binary header (see NLB) together make up the
  304.       binary label. The format of data in the binary label is
  305.       application-defined. The BLTYPE label is intended to
  306.       identify the format of the binary label, but it is new and
  307.       not widely used. Generally, the binary label should be
  308.       ignored unless the format of the data is known beforehand.
  309.  
  310. * NLB, integer: The number of "lines" (records) of binary header at
  311.       the top of the file. The optional binary header occurs once
  312.       in the file, between the main labels and the image data. It
  313.       is not repeated per third dimension. The size of the binary
  314.       header in bytes is given by NLB * RECSIZE, since NLB is a
  315.       line count. NLB defaults to 0. Note that the binary header
  316.       also includes space reserved for the binary prefix (NBB),
  317.       since NBB goes into RECSIZE. The binary header and the
  318.       binary prefix (see NBB) together make up the binary label.
  319.       The format of data in the binary label is
  320.       application-defined. The BLTYPE label is intended to
  321.       identify the format of the binary label, but it is new and
  322.       not widely used. Generally, the binary label should be
  323.       ignored unless the format of the data is known beforehand.
  324.  
  325. * HOST, string: The type of computer used to generate the image.
  326.        It is used only for documentation; the INTFMT and REALFMT
  327.        labels are used to determine the format of the pixels.
  328.        Nevertheless, it should be kept consistent with INTFMT and
  329.        REALFMT. HOST defaults to VAX-VMS. The value may be
  330.        anything, as new computer types are occasionally added,
  331.        but as of this writing, the possible values are:
  332.       * ALLIANT: Alliant FX series computer.
  333.       * CRAY: Cray (port is incomplete, and Cray format is not
  334.         yet supported).
  335.       * DECSTATN: DECstation (any DEC MIPS-based RISC machine)
  336.         running Ultrix.
  337.       * HP-700: HP 9000 Series 700 workstation.
  338.       * MAC-AUX: Macintosh running A/UX.
  339.       * MAC-MPW: Macintosh running native mode with Mac
  340.         Programmers Workbench.
  341.       * SGI: Silicon Graphics workstation.
  342.       * SUN-3: Sun 3, any model.
  343.       * SUN-4: Sun 4 or SPARCstation, or clone such as Solbourne.
  344.       * TEK: Tektronix workstation.
  345.       * VAX-VMS: VAX running VMS.
  346.  
  347. * INTFMT, string: The format used to represent integer pixels
  348.       (BYTE, HALF, and FULL) in the file. If INTFMT is not
  349.       present, it defaults to LOW. Note that INTFMT should be
  350.       present even if the pixels are a floating-point type. The
  351.       valid values are:
  352.       * HIGH: High byte first, "big endian". Used for all other
  353.         hosts (except for Cray, which is unimplemented).
  354.       * LOW: Low byte first, "little endian". Used for hosts
  355.         VAX-VMS and DECSTATN.
  356.  
  357. * REALFMT, string: The format used to represent floating-point
  358.       pixels (REAL, DOUB, and COMP) in the file. If REALFMT is
  359.       not present, it defaults to VAX. Note that REALFMT should
  360.       be present even if the pixels are an integral type. The
  361.       valid values are:
  362.       * IEEE: IEEE 754 format, with the high-order bytes
  363.         (containing the exponent) first. Used for all other hosts
  364.         (except for Cray, which is unimplemented).
  365.       * RIEEE: Reverse IEEE format. Just like IEEE, except the
  366.         bytes are reversed, with the exponent last. Used for host
  367.         DECSTATN only.
  368.       * VAX: VAX format. Single precision is in VAX F format,
  369.         double precision is in VAX D format. Used for host
  370.         VAX-VMS only.
  371.  
  372. * BHOST, string: The type of computer used to generate the binary
  373.       label. It can take the same values with the same meanings
  374.       as HOST. The reason BHOST is separate is that the data in
  375.       the binary label may be in a different host representation
  376.       than the pixels.
  377.  
  378. * BINTFMT, string: The format used to represent integers in the
  379.       binary label. It can take the same values with the same
  380.       meanings as INTFMT. The reason BINTFMT is separate is that
  381.       the data in the binary label may be in a different host
  382.       representation than the pixels.
  383.  
  384. * BREALFMT, string: The format used to represent floating-point
  385.       data in the binary label. It can take the same values with
  386.       the same meanings as REALFMT. The reason BREALFMT is
  387.       separate is that the data in the binary label may be in a
  388.       different host representation than the pixels.
  389.  
  390. * BLTYPE, string: The type of the binary label. This is not a
  391.       data type, but is a string identifying the kind of binary
  392.       label in the file. It is used for documentation, and so
  393.       application programs can process the binary label
  394.       correctly, without having to be told what kind it is.
  395.       BLTYPE is new, and is not yet used by any applications. It
  396.       defaults to a null string. The valid values are maintained
  397.       in a name registry by the VICAR system programmer, which
  398.       will document the actual data layout for each BLTYPE. As of
  399.       this writing, there are no names yet registered.
  400.  
  401.      Example
  402.  
  403. The system label for a typical file is shown below. Although
  404. carriage returns have been inserted for clarity, none actually
  405. exist in the file.
  406.  
  407. LBLSIZE=1024 FORMAT='BYTE' TYPE='IMAGE' BUFSIZ=20480 DIM=3 EOL=0
  408. RECSIZE=512 ORG='BSQ' NL=512 NS=512 NB=1 N1=512 N2=512 N3=1 N4=0
  409. NBB=0 NLB=0 HOST='VAX-VMS' INTFMT='LOW' REALFMT='VAX'
  410. BHOST='VAX-VMS' BINTFMT='LOW' BREALFMT='VAX' BLTYPE="
  411.  
  412.  
  413. Property Labels
  414.  
  415. Property labels describe properties of the image in the image
  416. domain. Property labels do not describe the physical layout of
  417. the image; that is handled by the system labels. They do contain
  418. other current information about the file, such as the map
  419. projection used, a lookup table, or latitude/longitude
  420. information for the image.
  421.  
  422. Property labels are divided into named sets called properties.
  423. Each property is made up of zero or more label items that contain
  424. the actual property information. The name space for each property
  425. is independent, so the same label item keyword may be used in
  426. more than one property. Only one property of a given name may
  427. exist.
  428.  
  429. Property labels are located between the system and the history
  430. labels. They start with the first occurrence of the keyword
  431. PROPERTY, and end with the first occurrence of the keyword TASK
  432. or the end of the labels (if there are no history labels). It is
  433. quite possible that no property labels exist in a file, in which
  434. case there would be no PROPERTY keywords.
  435.  
  436. Each property begins with a PROPERTY keyword, which has a string
  437. value. This value is the name of the property set. The PROPERTY
  438. keyword is followed by the label items that make up the property.
  439. The set continues until the next PROPERTY keyword, or the end of
  440. the property labels.
  441.  
  442. Label items within a property must not use the keywords DAT-TIM,
  443. LBLSIZE, PROPERTY, TASK, or USER.
  444.  
  445. Any program attempting to read a VICAR file should be able to
  446. accept (and ignore) properties or property label items it doesn't
  447. understand, as new properties and label items are added from time
  448. to time. A simple display program could ignore the property
  449. labels completely.
  450.  
  451. The valid property names, and the keywords that make up each
  452. property, are defined in a name registry maintained by the VICAR
  453. system programmer. As of this writing, no names have been
  454. registered, as property labels are a recent addition to VICAR
  455. files.
  456.  
  457.  
  458.      Example
  459.  
  460. Below is an example of what a property label with two properties
  461. might look like. IMPORTANT: This is not a real property label!
  462. The property names and items shown below have not been
  463. standardized. This is an example only! Also, carriage returns
  464. have been inserted for clarity, and do not exist in the label.
  465.  
  466. PROPERTY='MAP' PROJECTION='mercator' LAT=34.2 LON=177.221
  467. PROPERTY='LUT' RED=(1,2,3,4,5,6,7,8) GREEN=(8,7,6,5,4,3,2,1)
  468. BLUE=(1,1,1,3,5,7,8,8)
  469.  
  470.      History Labels
  471.  
  472. History labels describe the processing history of the image. Each
  473. processing step has an entry (called a "task") in the history
  474. label. Each task can optionally have label items further
  475. describing the task (such as parameters to the program). History
  476. labels do not describe the physical layout of the image; that is
  477. handled by the system labels. They should contain only historical
  478. information; however, they often contain current state
  479. information that should be in a property label, since property
  480. labels are new and not yet well utilized.
  481.  
  482. History labels are divided into sets called tasks. Each task is
  483. made up of three mandatory label items, and zero or more label
  484. items that contain additional history information. The name space
  485. for each task is independent, so the same label item keyword may
  486. be used in more than one task. Each task has a task name
  487. associated with it, which is the name of the program that created
  488. that part of the history label. However, the task names are not
  489. unique. Several tasks may have the same name. Each occurrence of
  490. the task name is called an "instance", so the task name and the
  491. instance combine to uniquely identify the task set.
  492.  
  493. History labels are located after the system and the property
  494. labels. They start with the first occurrence of the keyword TASK,
  495. and end with the end of the labels. It is possible, although
  496. highly unlikely, that no history labels exist in a file, in which
  497. case there would be no TASK keywords.
  498.  
  499. Each history task begins with a TASK keyword, which has a string
  500. value. This value is the name of the task. The instance is
  501. derived by counting the number of previous TASK keywords with the
  502. same task name; it is not stored explicitly in the label. The
  503. TASK keyword is followed by a USER and a DAT_TIM keyword. USER is
  504. a string specifying the username of the account that ran the
  505. program. The machine the program was run on is not available; it
  506. is assumed that the username is enough to identify the user.
  507. DAT_TIM is a string specifying the date the program was run, in
  508. the format "Www Mmm dd hh:mm:ss yyyy", where Www is the
  509. three-letter day of the week, Mmm is the three-letter month, and
  510. the rest are digits. Time is in 24-hour format, and day of the
  511. month (dd) must be two digits
  512. (although the first may be a blank instead of a zero).
  513.  
  514. Following the USER and DAT_TIM keywords are the optional label
  515. items with further history information. The task set continues
  516. until the next TASK keyword, or until the end of the labels. The
  517. actual contents of the additional keywords are
  518. application-defined.
  519.  
  520. Label items within a task must not use the keywords DAT-TIM,
  521. LBLSIZE, PROPERTY, TASK, or USER.
  522.  
  523. Any program attempting to read a VICAR file should be able to
  524. accept (and ignore) tasks or task label items it doesn't
  525. understand, as new tasks and label items are added frequently. A
  526. simple display program could ignore the history labels
  527. completely.
  528.  
  529.  
  530.      Example
  531.  
  532. Below is an example of a typical history label with several tasks
  533. in it. Although carriage returns have been inserted for clarity,
  534. none actually exist in the file.
  535.  
  536. TASK='GEN' USER='RGD059' DAT_TIM='Thu Sep 24 17:31:50 1992'
  537.  IVAL=0.0
  538. SINC=1.0 LINC=1.0 BINC=1.0 MODULO=0.0 TASK='COPY' USER='RGD059'
  539. DAT_TIM='Thu Sep 24 17:31:54 1992' TASK='LABEL' USER='RGD059'
  540. DAT_TIM='Thu Sep 24 17:32:54 1992' TASK='F2' USER='RGD059'
  541. DAT_TIM='Thu Sep 24 17:33:07 1992' FUNCTION='in1+10'
  542. TASK='STRETCH'
  543. USER='RGD059' DAT_TIM='Thu Sep 24 17:33:55 1992'
  544. PARMS='AUTO-STRETCH: 0 to    0 and    138 to  255'
  545.  
  546.  
  547. Image area
  548.  
  549. Following the labels (or between the label parts if there are EOL
  550. labels) is the image area. The structure and content of the image
  551. area are described in this section.
  552.  
  553.      Image Organization
  554.  
  555. The image area is made up of records RECSIZE in length. Each
  556. record contains one "line" of data (for BSQ), i.e. one set of N1
  557. pixels, plus the binary prefix, if any. If NBB=0, the binary
  558. prefix does not exist. A set of N2 records comprises a "band"
  559. (for BSQ), and a set of N3 "bands" makes up the image. The image
  560. is optionally preceded by NLB records of binary header. If NLB=0,
  561. the binary header does not exist.
  562.  
  563.  
  564. The structure of the image area is shown below.
  565.  
  566.  
  567.                     <-----------------RECSIZE----------------->                 
  568.  
  569.                     <----NBB---><---N1*pixel size------------->                 
  570.  
  571.  ^                  |-----------------------------------------|
  572.  |                  |                                         | 
  573. NLB                 |                  Binary header          | 
  574.  |                  |                                         |
  575.  V                  |-----------------------------------------|
  576.          ^          |            |                            |
  577.          |          |            |                            |
  578.          |          |  Binary    |                            |
  579.          |          |  prefix    |      Image pixels          |
  580.        N2*N3        |            |                            |
  581.          |          |            |                            |
  582.          |          |            |                            |
  583.          |          |            |                            | 
  584.          |          |            |                            | 
  585.          |          |-----------------------------------------|
  586.          V
  587.  
  588.     Pixel Types
  589.  
  590.  
  591. Image pixels are always represented in a binary format, not in
  592. ASCII. This makes reading and writing the image more efficient,
  593. but makes it harder to transfer images between different machines.
  594. The pixel representation is determined by two factors: the data
  595. type (FORMAT label), and the host representation (INTFMT and
  596. REALFMT labels). For binary labels, the data type is application-
  597. defined, while the host representation is specified in
  598. the BINTFMT and BREALFMT labels (which may be different than
  599. INTFMT and REALFMT).
  600.  
  601. Data is typically stored in the native host representation for
  602. whatever machine the image was created on. Any program that reads
  603. a VICAR file must be able to translate that representation into the
  604. one used by the machine the program is running on. A program that
  605. writes a VICAR file does not need to do translation; it can write
  606. out in the native format (although it can translate if desired).
  607. The VICAR Run-Time Library typically performs the input
  608. translation automatically.
  609.  
  610. The integer data types are BYTE, HALF, and FULL. In both
  611. currently supported INTFMTs (HIGH and LOW), BYTE is a 
  612. single-byte, unsigned
  613. value in the range 0-255. HALF is a two-byte, two's-complement
  614. signed value in the range -32768 - +32767, while FULL is a
  615. four-byte, two's-complement signed value in the range -2147483648
  616. - +2147483647. For INTFMT=HIGH, the high-order byte is first for
  617. HALF and FULL, while for INTFMT=LOW the low-order byte is first
  618. and all the bytes are swapped (i.e. 4321 instead of 1234). The
  619. representations for BYTE are identical in HIGH and LOW.
  620.  
  621. The floating-point data types are REAL, DOUB, and COMP. Type COMP
  622. is for complex numbers, and consists of two REAL numbers in the
  623. order (real, imaginary). There are three currently supported
  624. REALFMTS, IEEE, RIEEE, and VAX. IEEE is the IEEE-754 standard
  625. floating point format. REAL is a single-precision value, while
  626. DOUB is a double-precision value. See the IEEE-754 documentation 
  627. for a definition of the standard. RIEEE is exactly like IEEE, 
  628. except the bytes are stored in reverse order (as in HIGH vs. 
  629. LOW, so they are in the order 4321 or 87654321 instead 
  630. of 1234 or 12345678). VAX is the floating-point format 
  631. used by Digital Equipment Corp.'s VAX series of 
  632. computers. REAL is stored in VAX F floating-point format,
  633. while DOUB is stored in VAX D floating-point format. See the
  634. documentation provided by DEC for a definition of the
  635. floating-point formats.
  636.  
  637.  
  638.      Binary Labels
  639.  
  640. Binary labels are the least well-defined part of the VICAR file
  641. format. Binary labels consist of two parts: binary headers, which
  642. occurrence at the top of the file, and binary prefixes, which
  643. occur before every image record. For most purposes, especially for
  644. simple display programs, binary labels can be ignored. Most of 
  645. the time, they are not even present.
  646.  
  647. The data types and semantics of information in the binary label are
  648. defined by the application programs that use them. The user has
  649. to know what kind of binary label is present in order to use the
  650. correct application to make use of it. An attempt has been made to
  651. solve this problem through the addition of the BLTYPE system label
  652. item, but it is new and not yet in use at the time of this
  653. writing.
  654.  
  655. No attempt in this document is made to describe the various kinds
  656. of binary label. The documentation for the individual programs
  657. involved will describe the format used.
  658.  
  659. The data in a binary label is usually stored in a binary format,
  660. although an application could, of course, decide to store it in
  661. ASCII. All the binary label data must be in a single host
  662. representation, given by the BINTFMT and BREALFMT system labels.
  663. it is important to realize that the host for the pixels is not
  664. necessarily the same as the host for the binary labels, so make
  665. sure BINTFMT and BREALFMT are used instead of INTFMT and REALFMT
  666. for interpreting binary labels. As with pixels, any program that
  667. reads a binary label must be able to do host translation, while a
  668. program that writes a binary label does not have to translate
  669. (although some kinds of binary labels may be defined to be in VAX
  670. format for backwards compatibility).
  671.