Scanimage 2017 : 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.

 

    1. 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.
    2. 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.
  1. 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.
  2. 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.

Number of Tags in the IFD

The number of tags is an unsigned 8-byte number stored at byte zero of the IFD header and contains the number of IFD Tags stored in the IFD Header. Below, the IFD Header starts at hex byte 0000 24AA and continues through hex byte 0000 24B0.

  • Convert the bytes to obtain the value in the example: 1200 0000 0000 0000 -> 0000 0000 0000 0012. This is the hex value that converts to the decimal number 18. Thus, there are 18 IFD Tags stored in the IFD Header.

IFD Tags

This section will list and illustrate all IFD Tags utilized by ScanImage, in the order they are placed in the IFD Header. There is one IFD Header defined for each image frame and each IFD Header contains the same Tags, whose values are filled with frame specific information. Each IFD Tag in a Big Tiff file contains 20 bytes. Refer to the Tiff Specification for more detailed information on each Tag.

Remember for these examples to convert the bytes to obtain the actual IFD Tag information. Each part of a Tag is written out to the Tiff as a separate byte segment.

  • For example, the bytes representing the IFD Tag value are contained in the first 2 bytes of the IFD Tag, followed by the Tag datatype, etc. In Tag 256 below, the 2-byte IFD Tag value is placed starting at hex byte 0000 24B2 and ending at hex byte 0000 24B3. To extract the IFD Tag value, convert to obtain the value: 0001 -> 0100, which converts to a decimal number 256.

This same technique is to be applied to each part of each IFD Tag in order to extract Tag specific information.

IFD Tag 256: Image Width

(Hex Value 0100, converted in the first 2 bytes of the IFD Tag section as 0001)

  • This is the first IFD Tag placed in the IFD Header and is stored immediately following the ‘Number of Tags in the IFD’ described above.

 

IFD Tag 257: Image Length

(Hex Value 0101, converted in the first 2 bytes of the IFD Tag section as 0101)

 

IFD Tag 258: Bits Per Sample Field

(Hex Value 0102, converted in the first 2 bytes of the IFD Tag section as 0201)

 

IFD Tag 259: Compression Field

(Hex Value 0103, converted in the first 2 bytes of the IFD Tag section as 0301)

 

IFD Tag 262: Photometric Interpretation Field

(Hex Value 0106, converted in the first 2 bytes of the IFD Tag section as 0601)

 

IFD Tag 270: Image Description Field

(Hex Value 010E, converted in the first 2 bytes of the IFD Tag section as 0E01)

  • The Image Description Field contains metadata that is specific to a frame. The length of this information is larger than 8 bytes and cannot be contained within the confines of the IFD Tag Value field. Instead, the offset to the actual start of description data from the beginning of the Tiff file, is placed in the Value portion of the IFD Tag (which is the final 8 bytes in the IFD Tag).
  • In this example, the Value portion contains “2226 0000 0000 0000”.  Translate into Little Endian (in this example) to obtain the start of the description, “0000 0000 0000 2622”. Thus, the image description begins at byte 0000 2622, outlined within a dashed box in the example.

 

  • The size of the description, in bytes, is store at byte 4 in the IFD Tag. This is the number of bytes stored for description starting at the offset shown above. For example, the description has a size of 1001 bytes. Remember to convert to Little Endian for these examples, then convert from hex to decimal. Convert “E903 0000 0000 0000” to Little Endian “0000 0000 0000 03E9”. Hex “03E9” equals 1001 decimal.

 

IFD Tag 273: Strip Offsets Field

(Hex Value 0111, converted in the first 2 bytes of the IFD Tag section as 1101)

 

IFD Tag 274: Orientation Field

(Hex Value 0112, converted in the first 2 bytes of the IFD Tag section as 1201)

 

IFD Tag 277: Samples Per Pixel Field

(Hex Value 0115, converted in the first 2 bytes of the IFD Tag section as 1501)


IFD Tag 278: Rows Per Strip Field

(Hex Value 0116, converted in the first 2 bytes of the IFD Tag section as 1601)

 

IFD Tag 279: Strip Byte Counts Field

(Hex Value 0117, converted in the first 2 bytes of the IFD Tag section as 1701)

 

IFD Tag 282: X Resolution Field

(Hex Value 011A, converted in the first 2 bytes of the IFD Tag section as 1A01)


IFD Tag 283: Y Resolution Field

(Hex Value 011B, converted in the first 2 bytes of the IFD Tag section as 1B01)


IFD Tag 284: Planar Configuration Field

(Hex Value 011C, converted in the first 2 bytes of the IFD Tag section as 1C01)


IFD Tag 296: Resolution Unit Field

(Hex Value 0128, converted in the first 2 bytes of the IFD Tag section as 2801)


IFD Tag 305: Software Package Field (Header Metadata Offset)

(Hex Value 0131, converted in the first 2 bytes of the IFD Tag section as 3101)

  • The IFD Tag Software Package Field is used in ScanImage, to point to the location within the Tiff file to the Static Non-Varying Frame metadata.

 

  • In this example, the Value portion contains “2000 0000 0000 0000”.  Translate to obtain the start of the Non-Varying Frame metadata, “0000 0000 0000 0020”. Thus, the Non-Varying Frame metadata begins at byte 0000 0020.  The follow is a recap of the example for bullet (5) Non-Varying Frame Data in the ScanImage Static Metadata section.

 

  • The size of the Non-Varying Frame metadata, in bytes, is store at byte 4 in the IFD Tag. This is the number of bytes stored for Non-Varying Frame metadata starting at the offset shown above. For example, the Non-Varying Frame metadata has a size of 8166 bytes. Remember to convert to obtain the values in these examples, then convert from hex to decimal. Convert “E61F 0000 0000 0000” to “0000 0000 0000 1FE6”. Hex “1FE6” equals the decimal number 8166.

 

IFD Tag 315: Artist Field (ROI Group Metadata Offset)

(Hex Value 013B, converted in the first 2 bytes of the IFD Tag section as 3B01)

  • The IFD Tag Artist Field is used in ScanImage, to point to the location within the Tiff file to the ROI Group metadata. In the case where the Tiff was created by the free version of ScanImage, the value stored within the IFD Tag will be zero.

 

  • In this example, the Value portion contains “0620 0000 0000 0000”.  Translate to obtain the start of the Non-Varying Frame metadata, “0000 0000 0000 2006”. Thus, the ROI Group Data begins at byte 0000 2006. Remember, the staring byte for the line is 0000 2000. Move over 6 bytes to the start of the address for the ROI Group data. The follow illustrates the start of the ROI Group Data at this address.

 

  • The size of the ROI Group data, in bytes, is store at byte 4 in the IFD Tag. This is the number of bytes stored for ROI Group starting at the offset shown above. For example, the ROI Group Data has a size of 1183 bytes. Remember to convert obtain the values for these examples, then convert from hex to decimal. Convert “9F04 0000 0000 0000” to “0000 0000 0000 049F”. Hex “049F” equals decimal number 1183.

 

IFD Tag 339: Sample Format Field

(Hex Value 0153, converted in the first 2 bytes of the IFD Tag section as 5301)

 

 

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.

 

Frame Specific Data

Attachments:

image2016-6-9 9:38:55.png (image/png)
HowToDecipherBigTiff.pdf (application/pdf)
HowToDecipherBigTiff.htm (text/html)
image2016-6-9 10:2:41.png (image/png)
image2016-6-9 10:15:42.png (image/png)
image2016-6-9 10:16:40.png (image/png)
image2016-6-9 10:20:27.png (image/png)
image2016-6-9 10:22:29.png (image/png)
image2016-6-9 10:32:9.png (image/png)
image2016-6-9 10:32:23.png (image/png)
image2016-6-9 10:35:47.png (image/png)
image2016-6-9 10:36:14.png (image/png)
image2016-6-9 10:36:50.png (image/png)
image2016-6-9 10:56:10.png (image/png)
image2016-6-9 11:5:47.png (image/png)
image2016-6-9 11:6:25.png (image/png)
image2016-6-9 11:6:56.png (image/png)
image2016-6-9 11:8:27.png (image/png)
image2016-6-9 11:8:58.png (image/png)
image2016-6-9 11:9:28.png (image/png)
image2016-6-9 11:10:19.png (image/png)
image2016-6-9 11:11:22.png (image/png)
image2016-6-9 11:12:19.png (image/png)
image2016-6-9 11:12:51.png (image/png)
image2016-6-9 11:13:34.png (image/png)
image2016-6-9 11:14:7.png (image/png)
image2016-6-9 11:14:36.png (image/png)
image2016-6-9 11:15:8.png (image/png)
image2016-6-9 11:15:41.png (image/png)
image2016-6-9 11:16:11.png (image/png)
image2016-6-9 11:16:38.png (image/png)
image2016-6-9 11:17:52.png (image/png)
image2016-6-9 11:18:11.png (image/png)
image2016-6-9 11:18:56.png (image/png)
image2016-6-9 11:19:24.png (image/png)
image2016-6-9 11:19:57.png (image/png)
image2016-6-9 11:20:25.png (image/png)
image2016-6-9 11:21:56.png (image/png)
image2016-6-9 11:22:56.png (image/png)
image2016-6-9 11:23:35.png (image/png)