MSH Format

Version 0.1
1 October 2000

General Information:
This is a file format for volumetric datasets. Multiple datasets can be stored in a single file. Each dataset has a header which defines the dataset's attributes like voxel spacing, field layout, etc. The order that the fields are defined in the header is the order they must be in the file. For example if the mesh contains red, green, blue and alpha in that order, that is the order they will be written into the file. Likewise, if the header lists the dimensions of the grid as XYZ (Z increasing the most rapidly), that is the order in which the data will be read from the file.

This format is in binary. You move though the file from the table of contents by seeking to the correct file offset of what you want to read.

This format is also meant to be extensible by the addition of extra opcodes.

Datatypes:

  • Byte 8 bits
  • Short 16 bits
  • Int 32 bits
  • Float 32 bits (IEEE)
  • Double 64 bits (IEEE)
  • Long 64 bits

    All data in MSB

    Grammar:
    File Begin: ‹Magic Number (10 bytes)› ‹Version Number (4 bytes)› ‹File offset to table of contents (long)›
    Table of Contents ‹Number of datasets (integer)› ‹Dataset 0 header offset (long)› ‹Dataset 0 data offset (long)› ‹DataSet 1 header offset (long)› ‹DataSet 1 data offset (long)› ‹etc›
    Header: ‹Op-Code (int)› ‹Length of Record in Bytes(int)› ‹Op-Code Specific Data›
    Magic Number: "NPACI_MESH"
    Version Number: "V" ‹Major # (1 byte)› "." ‹Minor # (2bytes)›

    Op-Codes:
    0-99: Reserved   
    100-199: Mesh Field Information   
     100: Total Field Count<Op-code (int)> <Length of field (int)> <Field count (int)>
     101: Name<Op-code (int)> <Length of field (int)> <Field Number (int)> <Number of bytes in string (int)> <Raw bytes for string>
     102: Type<Op-code (int)> <Length of field (int)> <Field Number (int)> <Number of bytes in string (int)> <Raw bytes for string>
     103: Significant Bits<Op-code (int)> <Length of field (int)> <Field Number (int)> <Number of significant bits (int)>
     104-199: Reserved 
    200-299: Grid Dimension Information   
     200: Total Dimension Count<Op-code (int)> <Length of field (int)> <Dimension Count>
     201: Name<Op-code (int)> <Length of field (int)> <Dimension Number (int)> <Number of bytes in string (int)> <Raw bytes for string>
     202: Size<Op-code (int)> <Length of field (int)> <Dimension Number (int)> <Dimension Size >
     204-299: Reserved 
    300-399: Mesh Dimension Information   
     300: Total Dimension Count<Op-code (int)> <Length of field (int)> <Dimension Count>
     301: Name<Op-code (int)> <Length of field (int)> <Dimension Number (int)> <Number of bytes in string (int)> <Raw bytes for string>
     302: Size<Op-code (int)> <Length of field (int)> <Dimension Number (int)> <Dimension Size >
     304-399: Reserved 
    400-499: Irregular Spacing Information   
     400: Number of Dimensions<Op-code (int)> <Length of field (int)> <Number of Dimensions (int)>
     401: Spacing<Op-code (int)> <Length of field (int)> <Dimension Number(int)> <Spacing (double)>
     402-499: Reserved 
    500-599: Regular Spacing Information   
     500: Number of Dimensions<Op-code (int)> <Length of field (int)> <Number of Dimensions (int)>
     501: Spacings<Op-code (int)> <Length of field (int)> <Dimension Number(int)> <Spacings (double)>
     502-599: Reserved