DIPlib Documentation - ©1995-2017 Quantitative Imaging Group, Delft University of Technology.

ImageReadTIFF

Read TIFF image from file (in dipIO)

SYNOPSIS

#include "dipio_tiff.h"

dip_Error dipio_ImageReadTIFF ( image, filename, imageNumber, photometric )

FUNCTION

This function reads an image from the TIFF file and puts it in image. image must be allocated before calling this function. imageNumber indicates which image from the multi-page TIFF file to read. 0 is the first image. photometric is set to match the photometric interpretation of the TIFF file. Colour images and multi-sample images are allocated as 3D images, with the different samples along the 3rd dimension.

Multi-page TIFF files in which all pages contain an image of the same size and type, can be read as a 3D or 4D (Colour along the 4th dimension) image by setting imageNumber to -1. If the images are not of the same size and type, an error will be generated.

ARGUMENTS

Data typeNameDescription
dip_ImageimageOutput image
dip_StringfilenameFile name
dip_intimageNumberImage number to read
dipio_PhotometricInterpretation *photometricPhotometric interpretation

The enumerator dipio_PhotometricInterpretation contains the following constants:

NameDescription
DIPIO_PHM_GREYVALUENo colour information present; it's a grey-value image.
DIPIO_PHM_RGBRGB image (the first three planes are red, green and blue)
DIPIO_PHM_RGB_NONLINEARNon-linear R'G'B' image (RGB channels to the power of 0.4)
DIPIO_PHM_CMYCMY image (the first three planes are cyan, magenta and yellow)
DIPIO_PHM_CMYKCMYK image (the first four planes are cyan, magenta, yellow and black)
DIPIO_PHM_CIELUVCIE L*u'v' image (the first three planes are luminosity, u* and v*)
DIPIO_PHM_CIELABCIE L*a*b* image (the first three planes are luminosity, a* and b*)
DIPIO_PHM_CIEXYZCIE XYZ (the first three planes are X, Y and Z)
DIPIO_PHM_CIEYXYCIE Yxy (the first three planes are Y, x and y)
DIPIO_PHM_HCVHCV image (the first three planes are hue, chroma and value)
DIPIO_PHM_HSVHSV image (the first three planes are hue, saturation and value)
DIPIO_PHM_DEFAULTSame as DIPIO_PHM_GREYVALUE
DIPIO_PHM_GENERICAnything can be coded in the channels; the same as DIPIO_PHM_CMYK

Most file formats support only some of these.

SOFTWARE

This function uses libtiff (version 3.6.1 or later), which supports the TIFF specification revision 6.0. Copyright (c)1988-1997 Sam Leffler and Copyright (c)1991-1997 Silicon Graphics, Inc.

This function uses zlib (version 1.1.4 or later). Copyright (c)1995-2002 Jean-loup Gailly and Mark Adler

KNOWN BUGS

TIFF is a very flexible file format. We have to limit the types of images that can be read to the more common ones, and to the ones dipIO writes. These are the most obvious limitations:

Tiled images are not supported.

Only 1, 4, 8, 16 and 32 bits per pixel integer grayvalues are read, as well as 32-bit and 64-bit floating point.

Only 4 and 8 bits per pixel colourmapped images are read. Colourmapped images contain 16-bit gray-values: stretching of the display will be necessary.

Class Y images (YCbCr) and Log-compressed images (LogLuv or LogL) are not supported.

SEE ALSO

ImageRead, ImageReadColour, ImageWriteTIFF, ImageIsTIFF, Colour2Gray