#LyX 1.1 created this file. For more info see http://www.lyx.org/ \lyxformat 2.16 \textclass article \language default \inputencoding default \fontscheme default \graphics default \paperfontsize default \spacing single \papersize letterpaper \paperpackage a4 \use_geometry 1 \use_amsmath 0 \paperorientation portrait \leftmargin 1in \topmargin 1in \rightmargin 1in \bottommargin 1in \secnumdepth 3 \tocdepth 3 \paragraph_separation indent \defskip medskip \quotes_language english \quotes_times 2 \papercolumns 1 \papersides 1 \paperpagestyle default \layout Title IGB Image Format \layout Author Edward J. Vigmond \layout Date June 20, 2000 \layout Section Introduction \layout Standard IGB format is a file format which was developed at the Université de Montréal for their 4D data sets. Since it was developed at a French university, many of the key words are not misspelled English words; they are French words . The IGB format consists of 2 parts: 1) an ascii header describing the file followed by 2) the data written in binary format. \layout Section Image Header \layout Standard The header is usually 1024 bytes long and written in ascii. Furthermore, the header is divided into lines of maximum length 80 charactrers which are seperated with new line characters (' \backslash n'). Each line contains keyword and value pairs seperated from each other by a space. A colon seperates the keyword from its value. Keywords are described in the table below: \layout Standard \added_space_top 0.3cm \added_space_bottom 0.3cm \align center \LyXTable multicol5 42 5 1 0 -1 -1 -1 -1 1 1 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 1 0 0 8 1 0 "" "" 8 1 0 "" "" 2 1 1 "" "" 8 0 1 "" "" 2 0 1 "" "" 0 8 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 2 1 0 0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 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 2 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 2 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" 0 8 1 0 0 0 0 "" "" Keyword \newline Type \newline Description \newline Default \newline Notes \newline x \newline Int \newline number of pixels in x direction \newline 0 \newline mandatory \newline y \newline Int \newline number of pixels in y direction \newline 0 \newline mandatory \newline z \newline Int \newline number of pixels in z direction \newline 1 \newline Equals 1 for 2D data \newline t \newline int \newline number of time slices \newline 1 \newline \newline type \newline string \newline data type \newline - \newline Possible values: \emph on byte,char, short, long \emph default \newline \newline \newline \newline \newline \emph on float, double, complex, double_complex, \emph default \newline \newline \newline \newline \newline \emph on rgba, structure, int, uint \emph default \newline taille \newline int \newline structure size \newline 0 \newline For a data type of \emph on structure \emph default , this is its \newline \newline \newline \newline \newline size in bytes, otherwise ignored \newline struct \newline char[40] \newline structure description \newline \begin_inset Quotes eld \end_inset \begin_inset Quotes erd \end_inset \newline a 40 character long string describing the \newline \newline \newline \newline \newline structure \newline systeme \newline string \newline system type \newline - \newline Recommended values are \emph on big_endian \emph default , \newline \newline \newline \newline \newline and \emph on little_endian. \emph default Only important \newline \newline \newline \newline \newline for determining byte order. \newline dim_x \newline float \newline physical size in x \newline 1 \newline \newline dim_y \newline float \newline physical size in y \newline 1 \newline \newline dim_z \newline float \newline physical size in z \newline 1 \newline \newline dim_t \newline float \newline length of time \newline 1 \newline \newline fac_x \newline float \newline scaling factor in x \newline 1 \newline \newline fac_y \newline float \newline scaling factor in y \newline 1 \newline \newline fac_z \newline float \newline scaling factor in z \newline 1 \newline \newline fac_t \newline float \newline scaling factor for t \newline 1 \newline \newline org_x \newline float \newline x coordinate of first pixel \newline 1 \newline \newline org_y \newline float \newline y coordinate of first pixel \newline 1 \newline \newline org_z \newline float \newline z coordinate of first pixel \newline 1 \newline \newline org_t \newline float \newline time of first pixel \newline 0 \newline \newline inc_x \newline float \newline distance between pixels in x \newline 1 \newline actual x = org_x + pixel_x*inc_x \newline inc_y \newline float \newline distance between pixels in y \newline 1 \newline actual y = org_y + pixel_y*inc_y \newline inc_z \newline float \newline distance between pixels in z \newline 1 \newline actual z = org_z + pixel_z *inc_z \newline inc_t \newline float \newline time between slices \newline 1 \newline actual t = org_t + t*inc_t \newline facteur \newline float \newline scaling factor for data \newline 1 \newline data = zero + data_value*facteur \newline zero \newline float \newline origin for data scaling \newline 0 \newline \newline aut \newline char[40] \newline author \newline \begin_inset Quotes eld \end_inset \begin_inset Quotes erd \end_inset \newline a 40 character long string without spaces \newline unites \newline string \newline units for data \newline \begin_inset Quotes eld \end_inset \begin_inset Quotes erd \end_inset \newline \newline unites_x \newline string \newline units for x \newline \begin_inset Quotes eld \end_inset \begin_inset Quotes erd \end_inset \newline \newline unites_y \newline string \newline units for y \newline \begin_inset Quotes eld \end_inset \begin_inset Quotes erd \end_inset \newline \newline unites_z \newline string \newline units for z \newline \begin_inset Quotes eld \end_inset \begin_inset Quotes erd \end_inset \newline \newline unites_t \newline string \newline units for t \newline \begin_inset Quotes eld \end_inset \begin_inset Quotes erd \end_inset \newline \newline comment \newline string \newline comment \newline \begin_inset Quotes eld \end_inset \begin_inset Quotes erd \end_inset \newline \newline transparent \newline string \newline transparent pixel value \newline \begin_inset Quotes eld \end_inset \begin_inset Quotes erd \end_inset \newline hexadecimal representation of transparent \newline \newline \newline \newline \newline data value without leading 0x \layout Subsection Example \layout Standard The following is a sample from a header ignoring all the white space needed to pad it to 1024 characters: \layout Standard x:50 y:25 t:200 unites:volts type:float transparent:000a30ff \layout Standard \noindent Note that the transparent value is a string whose length is twice the size of the data type. Leading zeros are necessary. \layout Section Data \layout Standard Data is written in binary format using, for example in C, the function fwrite(). The data can be of any type which is specified by the \emph on type \emph default keyword in the header. The data may be linearly transformed before writing to the IGB file using a transform of the form \layout Standard \align center data = ( actual_data - zero ) * facteur \layout Standard \noindent where facteur and zero are written to the header. The number of bytes written should be equal to x*y*z*t*sizeof(data type). The transparent value refers to the actual data. \layout Section Routines \layout Standard To aid in reading and writing IGB headers, C functions and a C++ class are provided. \layout Subsection C routines \layout Standard These routines are located in the C subdirectory. One must include \begin_inset Quotes eld \end_inset igb.h \begin_inset Quotes erd \end_inset to use these functions. \layout LyX-Code int Header_Read_gz( gzFile file, Header *head, Bool_Header *bool_head ) \layout Standard Read from the previously opened file and place the header in head and the boolean header in bool_head. Bool_Header is a structure with the same field names as the header but all of type boolean. An entry is true if the corresponding header field is NOT the default value, otherwise it is false. The function returns a 0 iff no error occurred. \layout LyX-Code int Header_Write_gz( gzFile file, Header *head, Bool_Header *bool_head ) \layout Standard Write a header to a previously opened file. One must set any fields of head and then set the corresponding field true in bool_head. Any fields which are not set in header should have the corresponding bool_head field set false. This function returns a 0 iff no error occurred. \layout Subsection C++ Class \layout Standard The C++ class \emph on IGBheader \emph default is provided. Refer to the file \emph on IGBheader.h \emph default for a list of methods which allow setting and querying of the header fields. To set the transparent value, call the transparent method with a pointer to a variable of the same type as the data which is set to the data value to be ignored: \layout LyX-Code float a=1000; \layout LyX-Code header->transparent(&a); \layout Section igbhead \layout Standard A utility program to aid in creating and modifying IGB files is provided. It is called \emph on igbhead. \emph default Only values which differ from the default are stored in the header. To query a header, simply run \emph on igbhead \emph default on the IGB file: \emph on \layout LyX-Code igbhead file.igb \layout Standard Individual fields may be set in the header by specifying the appropriate option. To add a header to the data file \emph on data \emph default , the simplest way is something of the form \layout LyX-Code igbhead -xX -yY -zZ --data-type=type --output-file=data.igb data \layout Standard To put an existing header from aa.igb on the file data, add a comment saying we are doing so, and put the result in a new compressed file \emph on bb.igb.gz \emph default : \layout LyX-Code igbhead aa.igb --frankenstein=data -f bb.igb,gz --comment= \begin_inset Quotes erd \end_inset stolen head \begin_inset Quotes erd \end_inset \layout Standard \emph on igbhead \emph default recognizes the \begin_inset Quotes eld \end_inset .gz \begin_inset Quotes erd \end_inset suffix and gzips accordingly. The placement of \emph on aa.igb \emph default is free. Also note that the comment option adds one line of comment to the existing lines. The decapitation option will remove the header, leaving just the data. Therefore, to recover data from \emph on bb.igb.gz \emph default : \layout LyX-Code igbhead --output-file=data -decapitate bb.igb.gz \layout Standard The \emph on systeme \emph default keyword is important in that it determines whether the data is treated as big endian or little endian. To this end, use of any systems other than \emph on big_endian \emph default and \emph on little_endian \emph default is deprecated. If there is a problem with word order when displaying an IGB file, use the swap bytes function under image in the menu bar of flounder to correct the problem. \the_end