ScanImage® BigTiff Specification¶
Glossary
Frame Specific Data
Data recorded in a Tiff that is specific to a Frame, such as timestamps and I2C data.
This data is stored with each frame.
IFD
Tiff Standard terminology, Image File Directory
Non-Varying Frame Data
Microscope configuration that pertains to all frames in a Tiff file.
This data is stored once in the Tiff file following the Tiff Header section.
ROI Group Data
Defined Regions of Interest.
This data is stored once in the Tiff file following the Non-Varying Frame Data.
This document describes how to decipher a Tiff file created using the new Big Tiff format in ScanImage. The hex editor used in the examples displays the bytes as they appear in the Tiff file. Byte swapping needs to occur to decipher Tiff information and is presented in the examples.
Tiff Header Section¶
The Tiff Header Section contains Tiff Header information as defined in the Big Tiff Specification.
The first 2 bytes of the Tiff file defines whether Little Endian or Big Endian byte order is used. ScanImage® uses Little Endian: Below, at byte address 0 and 1 you will find ‘I’ and ‘I’. 49 is the hex value for ‘I’. ‘II’ is the Tiff standard for Little Endian byte order.
The next 2 bytes (byte address 2 and 3) contain the Tiff Version. The Tiff standard value defined for Big Tiff is 43. Reverse the next 2 bytes ‘2B 00’ to convert to the desired value, ’00 2B’, decimal value 43. The ASCII character represented by this value is ‘+’.
The next set of bytes are defined as static values in the Big Tiff Specification at the time of this writing.
Bytes 5 and 6 represent the unsigned number ‘8’ in 2 bytes. This is defined in the specification as the Big Tiff bit size offset. Convert to obtain the value in this example, 0800 -> 0008.
Bytes 7 and 8 are a static place holder assigned the decimal value of unsigned zero.
The offset, in bytes, from the beginning of the Big Tiff file to the first IFD header is placed in the next 8 bytes, bytes 9 through 16. The IFD Header will always start on a WORD boundary.
Convert to correct byte order to obtain the value in this example: AA24 0000 0000 0000 => 0000 0000 0000 24AA. The first byte of the first IFD resides at hex byte 24AA (ignore leading zeros.
Scroll down to the beginning of the line that contains address 24AA (000024A0 represents the first byte on the associated line. Move over 10 bytes from the first byte, 0, to reach byte A). This is the address location of the first IFD Header.
ScanImage® Static Metadata Section¶
This section contains static metadata collected from ScanImage® at the time the Tiff file was created. Static metadata is data defining the state of the ScanImage® system (determined by Machine Data File configuration and user selections made within ScanImage) that is relevant and unchanging for all the images in the Tiff file. Thus, this information applies to all images in the same Tiff file.
The static metadata section starts on the first byte directly following the Tiff Header section, which is at byte 16, and contains the following sections:
Magic Number¶
The Magic Number is a 4-byte unsigned number that identifies the file as a Tiff file created by ScanImage® and is currently set to the decimal value, 117637889. This value is placed in the first four bytes of the Static Metadata section.
Convert the bytes to obtain the value in the example: 0103 0307 -> 0703 0301. This is the hex value that converts to the decimal number 117637889.
ScanImage® Tiff Version Number¶
The ScanImage® Tiff Version Number for the release of ScanImage® 2016 is set to 3. This is stored as a 4-byte unsigned number following the Magic Number, starting at byte 4 and continuing through byte 7, of the static metadata section.
Convert the bytes to obtain the value in the example: 0300 0000 -> 0000 0003. This is the hex value that converts to the decimal number 3.
Non-Varying Frame Data Length¶
The Non-Varying Frame Data Length section is a 4-byte unsigned number that contains the size in bytes, including a NULL terminator, of the Non-Varying Frame data. The actual Non-Varying frame data starts at byte 16 from the beginning of the Static Metadata section and is discussed in bullet item (5) Non-Varying Frame Data.
Convert the bytes to obtain the value in the example: E61F 0000 -> 0000 1FE6. This is the hex value that converts to the decimal number 8166. Thus, the size of the Non-Varying Frame Data is 8166 bytes.
ROI Group Data Length¶
The ROI Group Data Length section is a 4-byte unsigned number that contains the size in bytes, including a NULL terminator of the ROI Group data. The actual ROI Group data starts immediately following the Non-Varying Frame Data and is discussed in bullet item (5) Non-Varying Frame Data.
The free version of ScanImage® does not have the MROI (Multiple Regions of Interest) feature accessible to the user. For the free version, a size value of zero will be placed in this section.
Convert the bytes to obtain the value in the example: 9F04 0000 -> 0000 049F. This is the hex value that converts to the decimal number 1183. Thus, the size of the ROI Group Data is 1183 bytes.
Non-Varying Frame Data¶
The Non-Varying Frame Data section contains the actual, unchanging data (excluding ROI Group data) including a NULL terminator, that pertains to all images in the Tiff file. The Non-Varying frame data starts at byte 16 from the beginning of the Static Metadata section.
Each Tiff Frame contains an IFD tag, called the ‘Software’ tag, that points to the start of the Non-Varying Frame data. This will be discussed as part of the Frame Specification later in this document.
ROI Group Data¶
The ROI Group Data section contains the actual ROI Group Data, including a NULL terminator. The ROI Group data starts at byte immediately following the Non-Varying Frame Data. Thus the start of the ROI Group Data can be found at the offset of byte 16 plus the size of the Non-Varying Frame Data from the beginning of the Static Metadata section.
The free version of ScanImage® does not have the MROI (Multiple Regions of Interest) feature accessible to the user, and will not contain any data in this section.
Each Tiff Frame contains a tag, called the ‘Artist’ tag, that points to the start of the ROI Group Data. This will be discussed as part of the Frame Specification later in this document.
Frame Section¶
There is one frame section existent per image frame. Each Frame section consists of an IFD (Image File Directory) Header, followed by a section containing supplemental header information and finally the bytes that makeup the actual image.
IFD Header Section¶
The IFD Header Section contains all the IFD Tags used by ScanImage® in the Tiff file. Each IFD Tag utilized by ScanImage® is defined within the Tiff Specification. Each frame in the Tiff file contains the same set of IFD Tags filled with frame specific information.
To begin, the IFD Header Section of the first IFD Frame starts at the location indicated in the Tiff Header section. See bullet 4 in the “Tiff Header Section” at the beginning of this document.
Subsequent IFD Header sections start at the location indicated in the ‘Next IFD Header’ offset field in the IFD Header. This will be covered later in this section.
Next IFD Location¶
The final section of the IFD Header contains the byte offset, from the start of the Tiff file, to the Next IFD Header.
The Next IFD Location is an unsigned 8-byte number.
The last IFD Header will contain a zero value in this section.
For example, extract the Next IFD Header value, “122A 0800 0000 0000”. Convert to obtain the value, “0000 0000 0008 2A12”. Thus, the start of the Next IFD Header can be found at this hex address, as shown below. The starting address for the line is 0008 2A10. Remember to add 2 bytes to this address to point to the start of the Next IFD Header value.
Image Section¶
This section illustrates how to determine where an image starts. The offset byte for the start of an image from the beginning of the Tiff file, can be located in the Value field of the IFD Strip Offsets Field Tag (273, Hex 0111, converted to 1101). The following recaps a prior illustration of the IFD Strip Offsets Field.
The last 8 bytes of this IFD Tag contains the image offset value “122A 0000 0000 0000”. Convert to obtain the value “0000 0000 0000 2A12”. This is the starting byte for the associated Image.
For further information on how to extract additional information about an image from the IFD Tags, please refer to the Tiff Specification.