Skip to main content

How to access height maps in TIFF data

Height maps created with point electronic BSE-Topography system are stored together with other acquired data in a TIFF file. TIFF files saved from DISS6 Topography extensions contain one or more data channels (pages) with 8 or 16 bits. In addition, all metadata including the scale information are stored in the TIFF header. For this purpose, the XMP tag is used. For a detailed documentation of all metadata stored in point electronic TIFF files see the complete file format description: DISS metadata

Each TIFF channel (page) has it's own XMP tag. This is important, because e.g., scaling information may differ for each data channel.

Finding the height map channel

Iterate through the TIFF channels (pages) and read the XMP entry with the ChannelInfo from namespace <d6ci>, which is part of the namespace <diss6>. Data channels with Device=32 contain data from the DISS6 topography system. In this channels, the height map is the channel with Source=1. The height map channel should have the DataType=F32.

<diss6:ChannelInfo rdf:parseType="Resource">
  <d6ci>Device=32</d6ci:Device>
  <d6ci>Source=1</d6ci:Source>
  <d6ci>DataType=F32</d6ci:DataType>
  ...
</diss6:ChannelInfo>

More information on DISS6 ChannelInfo namespace: DISS6 namespace.

Reading height values

Height values are stored in a single TIFF channel (page) as 16 bit greyvalues (in very rare cases as 8 bit). Therefore check the related TIFF tags (PhotometricInterpretation=0|1, BitsPerSample=8|16, SamplesPerPixel=1).

For the number of columns and rows of the height map use the TIFF tags 256 (ImageWidth) and 257 (ImageLength).

First step is the normalization of the greyvalues:

NormalizedValue = GreyValue/0xFFFF // 16 bit
NormalizedValue = GreyValue/0xFF // 8 bit

The normalized values are then converted to height values. This requires readout of the values for Scale, Offset and Unit from the <d6tr> namespace.

<diss6:Transformation rdf:parseType="Resource">
  <d6tr:Scale>2.02348497E-6</d6tr:Scale>
  <d6tr:Offset>-2.36788509E-7</d6tr:Offset>
  <d6tr:Unit>m</d6tr:Unit>
</diss6:Transformation>

Thus, heigt maps are processed as follows:

HeightValue = Scale * NormalizedValue + Offset

More information on DISS6 Transformation namespace: DISS6 namespace.

Reading grid width of the height map

The grid widths is identical with the pixel size of the data. Pixel size is always stored in the <image> namespace of the DISS6 metadata. Unit of pixel size is always meter [pixelsize] = m.

<image:PixelSizeX>5.0E-7</image:PixelSizeX>
<image:PixelSizeY>5.0E-7</image:PixelSizeY>

More information on DISS6 XMP Image namespace: Image namespace.

Getting more information

For detailed documentation for TIFF including tags see the documentation of LibTIFF.

For documentation of XMP see XMP standard and XMP SDK.

For a detailed documentation of all metadata stored in point electronic TIFF files see DISS metadata.