Image Data
This group contains functions to load and save images that can be processed or returned by any ImageDev algorithm.
- ReadVipImage: Loads an image that has been generated and saved with ImageDev.
- WriteVipImage: Saves any image that has been generated with ImageDev on disk.
VIP file format
The VIP format is an image file format, especially designed for managing any ImageDev data. It is a raw file format organized as follows: \begin{array}{|l|l|l|l|} \hline \textbf{Field} & \textbf{Size (bytes)} & \textbf{Type} & \textbf{Description} \\ \hline \text{Magic Number} & 4 & \text{4 character string} & \text{The VIP format identifier: "VIPI"} \\ \hline \text{Version} & 4 & \text{Unsigned long} & \text{The VIP format version (generally 2)} \\ \hline \text{Header Size} & 4 & \text{Unsigned long} & \text{The header size HS, in bytes} \\ \hline \text{Header} & \text{HS} & \text{Header structure} & \text{The header structure (more information below)} \\ \hline \text{Data} & \text{} & \text{} & \text{The image data (more information below)} \\ \hline \end{array}VIP header organization
The VIP header contains the following information: \begin{array}{|l|l|l|l|} \hline \textbf{Field} & \textbf{Size (bytes)} & \textbf{Type} & \textbf{Description} \\ \hline \text{Data Type} & 4 & \text{Unsigned long} & \text{Flag indicating the pixel data type} \\ \hline \text{Element Type} & 4 & \text{Unsigned long} & \text{Flag indicating the element type; from version 2} \\ \hline \text{Is Binary} & 1 & \text{Unsigned char} & \text{The image is binary if not equal to 0} \\ \hline \text{Is Label} & 1 & \text{Unsigned char} & \text{The image is label if not equal to 0} \\ \hline \text{Size X} & 4 & \text{Unsigned long} & \text{Number of elements of the X dimension} \\ \hline \text{Size Y} & 4 & \text{Unsigned long} & \text{Number of elements of the Y dimension} \\ \hline \text{Size C} & 4 & \text{Unsigned long} & \text{Number of spectral channels} \\ \hline \text{Size Z} & 4 & \text{Unsigned long} & \text{Number of elements of the Z dimension} \\ \hline \text{Size T} & 4 & \text{Unsigned long} & \text{Number of elements for image sequence}\\ \hline \text{Calibration X} & 60 & \text{Calibration structure} & \text{The calibration information of the X dimension (spacing, unit) } \\ \hline \text{Calibration Y} & 60 & \text{Calibration structure} & \text{The calibration information of the Y dimension (spacing, unit) } \\ \hline \text{Calibration C} & 60 & \text{Calibration structure} & \text{The calibration information of the spectral dimension (spacing, unit) } \\ \hline \text{Calibration Z} & 60 & \text{Calibration structure} & \text{The calibration information of the X dimension (spacing, unit) } \\ \hline \text{Calibration T} & 60 & \text{Calibration structure} & \text{The calibration information of the sequence dimension (spacing, unit) } \\ \hline \text{Color interpretation} & 4 & \text{Unsigned long} & \text{Flag indicating the color interpretation; from version 3} \\ \hline \text{Origin X} & 8 & \text{Double} & \text{Origin of the X dimension; from version 4} \\ \hline \text{Origin Y} & 8 & \text{Double} & \text{Origin of the Y dimension; from version 4} \\ \hline \text{Origin C} & 8 & \text{Double} & \text{Origin of spectral channels; from version 4} \\ \hline \text{Origin Z} & 8 & \text{Double} & \text{Origin of the Z dimension; from version 4} \\ \hline \text{Origin T} & 8 & \text{Double} & \text{Origin for image sequence; from version 4}\\ \hline \text{Spatial directions} & 72 & \text{Double[3]} & \text{Spatial directions of the spatial axis system; from version 5} \\ \hline \end{array}Data type
This flag indicates the data type of all image element (pixels or voxels). \begin{array}{|l|l|l|} \hline \textbf{Name} & \textbf{Value} & \textbf{Description} \\ \hline \text{UINT8} & 0 & \text{8-bit unsigned integer} \\ \hline \text{UINT16} & 1 & \text{16-bit unsigned integer} \\ \hline \text{UINT32} & 2 & \text{32-bit unsigned integer} \\ \hline \text{INT8} & 4 & \text{8-bit signed integer} \\ \hline \text{INT16} & 5 & \text{16-bit signed integer} \\ \hline \text{INT32} & 6 & \text{32-bit signed integer} \\ \hline \text{FLOAT32} & 8 & \text{32-bit real floating-point} \\ \hline \text{FLOAT64} & 9 & \text{64-bit real floating-point} \\ \hline \text{COMPLEX_FLOAT32} & 10 & \text{32-bit complex floating-point} \\ \hline \text{COMPLEX_FLOAT64} & 11 & \text{64-bit complex floating-point} \\ \hline \end{array}Element type
The element type flag indicates the type of mathematical dimension associated with each image element. \begin{array}{|l|l|l|} \hline \textbf{Name} & \textbf{Value} & \textbf{Description} \\ \hline \text{SINGLE} & 0 & \text{Single scalar value} \\ \hline \text{VECTOR_2} & 16 & \text{2D vector, generally representing X and Y coordinates of a vector field} \\ \hline \text{VECTOR_3} & 32 & \text{3D vector, generally representing X, Y, and Z coordinates of a vector field} \\ \hline \text{MATRIX_2X2_SYM} & 256 & \text{2x2 symmetric matrix, i.e., 3 elements, generally representing a 2D tensor field} \\ \hline \text{MATRIX_3X3_SYM} & 512 & \text{3x3 symmetric matrix, i.e., 6 elements, generally representing a 3D tensor field} \\ \hline \end{array}Dimensional calibration
Each dimension of a VIP image has a calibration representing the data in world coordinates along this dimension. This information is set in a calibration structure organized as follows: \begin{array}{|l|l|l|l|} \hline \textbf{Field} & \textbf{Size (bytes)} & \textbf{Type} & \textbf{Description} \\ \hline \text{Image Size} & 4 & \text{Unsigned long} & \text{A known length along the related dimension in image units; for example, pixels} \\ \hline \text{WCS Size} & 8 & \text{Double} & \text{The size corresponding to the image size in the world coordinate system} \\ \hline \text{Unit} & 48 & \text{48 character string} & \text{The unit of the world coordinate system, until 48 characters} \\ \hline \end{array} For instance, if the calibration attached to the X axis of a 2D image gives:- Image Size = 120
- WCS Size = 240
- Unit = "nm"
Color interpretation
The color interpretation flag indicates how to interpret the color images. \begin{array}{|l|l|l|} \hline \textbf{Name} & \textbf{Value} & \textbf{Description} \\ \hline \text{UNKNOWN} & 0 & \text{Unknown} \\ \hline \text{RGB} & 1 & \text{Red, Green, Blue} \\ \hline \text{HSL} & 2 & \text{Hue, Saturation, Lightness} \\ \hline \text{YIQ} & 3 & \text{Brightness, In-phase, Quadrature (NTSC)} \\ \hline \text{NRGB} & 4 & \text{RGB color with chromaticity coordinates} \\ \hline \end{array}Spatial directions
Describes a spatial axis system, with direction vectors describing the three axes.Axes are defined in a right hand system, so the third direction can be computed from the first two. This information is set in a calibration structure organized as follows: \begin{array}{|l|l|l|l|} \hline \textbf{Field} & \textbf{Size (bytes)} & \textbf{Type} & \textbf{Description} \\ \hline \text{Column direction} & 24 & \text{Double[3]} & \text{The direction vector following the column dimension (X)} \\ \hline \text{Row direction} & 24 & \text{Double[3]} & \text{The direction vector following the row dimension (Y)} \\ \hline \text{Slice direction} & 24 & \text{Double[3]} & \text{The direction vector following the slice dimension (Z)} \\ \hline \end{array}
VIP data organization
The VIP format theoritically supports up to 6 dimensions: the X, Y, and Z axis of a volume, channels of a spectral image, time steps of an image sequence, and the vectoriel information given by the element type. The last dimension, managing vector or matrix fields, is interlaced in the data format. Other information is non-interlaced and hierarchized as follows:- For each time step of a sequence, a 3D image is saved. A 3D image is stored by saving all XY slices.
- For each slice, a spectral image is saved. A spectral image is stored by saving all channels.
- For each channel, an XY grayscale slice is saved.