-
Notifications
You must be signed in to change notification settings - Fork 15
ImageFiles
This page describes the format of image files, used to record regular graphical representations of the state of the simulation.
These files should have a .dat extension.
Image files are currently unversioned. This may change in the future. They are encoded using XDR.
The file begins with a header section which includes information on the creation of the image, the size of the image and the number of non-blank pixels in the image.
The second section contains data for each non-blank pixel. These are of fixed length. No ordering of pixels is guaranteed, but it is guaranteed that each non-blank pixel will appear exactly once. Blank pixels, i.e. those corresponding to areas of the image with no data do not have entries in this section of the file.
Here, the format of the file is described in sufficient detail to write a parser.
The header section is 32 bytes long. This is composed of:
- 1 int for the visualisation mode
- 2 floats for the minimal and maximal pressure thresholds (mmHg)
- 1 float for the maximal velocity threshold (m/s)
- 1 float for the maximal stress threshold (Pa)
- 2 ints for the size of the image in pixels (x then y)
- 1 int for the total number of non-blank pixels in the image
Notes:
- The mode can be 0 for 'Isosurfaces' (pressure and stress only), 1 for 'Isosurface and Glyphs' or 2 for 'Wall and Streaklines', which ensures that streaklines are drawn when not using the 'shear stress' stress type (streaklines are always drawn when using 'shear stress'). The mode affects production of the image but should not affect its display.
- The pressure, velocity and stress thresholds correspond to the values in these fields that correspond to extremely-coloured pixels. Hence, they provide a means of translating colours into values. For velocity and stress, a value of 0 should be assumed for the minimum threshold
- The number of non-blank pixels will not necessarily equal the product of the dimensions of the image, as some pixels will have no data.
Each non-blank pixel has 16 contiguous bytes in this section. These are:
- 1 unsigned int for the pixel index
- 1 unsigned int for the red field-components
- 1 unsigned int for the green field-components
- 1 unsigned int for the blue field-components
Notes:
- The two most significant bytes of the pixel index give the x coordinate of the pixel. The two least significant bytes hold the y coordinate. Hence from the index, the coordinates can be recovered by:
(index / 65536, index % 65536) - Each of the red, green and blue components holds data for each of four fields in its unsigned int:
- The most significant byte is the velocity field
- The second most significant byte is for the stress field (either shear stress or von Mises)
- The third and fourth MSBs represent pressure and stress fields respectively, but with some details dependant on the visualisation settings. The stress field here is a second representation of the same stress field described by the second MSB, with additional data.
- If the mode is not 'Wall and Streaklines' and the stress type being used is not shear stress, these bytes have the pressure and von Mises stress fields. If the mode is 'Isosurfaces and Glyphs', pixels that coincide with glyphs are white-shifted.
- Otherwise, if there is a streakline present at the pixel, both bytes contain identical data relating to the velocity of the streakline particle.
- Otherwise, the third byte has a grayscale pixel representing the pressure field and the fourth byte represents the stress.
- So, to recover the RGB data for, e.g., the second field (i.e. the field in the second MSB) for a pixel:
(R,G,B) = ((red-component / 2^16) % 2^8, (green-component / 2^16) % 2^8, (blue-component / 2^16) % 2^8)