[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]

details Import/export of the TIFF format VIGRA

Functions

template<... >
void createRGBTiffImage (...)
 Create a 3-band TiffImage from the given RGB image. More...
 
template<... >
void createScalarTiffImage (...)
 Create a single-band TiffImage from the given scalar image. More...
 
template<... >
void createTiffImage (...)
 Create a TiffImage from the given iterator range. More...
 
template<... >
void importTiffImage (...)
 Read a given TIFF image. More...
 
template<... >
void tiffToRGBImage (...)
 Import a RGB (3-band or color-mapped) TiffImage into a RGB image. More...
 
template<... >
void tiffToScalarImage (...)
 Convert single-band TiffImage to scalar image. More...
 

Detailed Description

TIFF conversion and file export/import.

Normally, you need not call the TIFF functions directly. They are available much more conveniently via importImage() and exportImage()

TIFF (Tagged Image File Format) is a very versatile image format - one can store different pixel types (byte, integer, float, double) and color models (black and white, RGB, mapped RGB, other color systems). For more details and information on how to create a TIFF image, refer to the TIFF documentation at http://www.libtiff.org/ for details.

Function Documentation

void vigra::importTiffImage (   ...)

Read a given TIFF image.

This function calls tiffToScalarImage() or tiffToRGBImage(), depending on the destinations's value_type. Usually, it is better to use importImage(). importTiffImage() should only be used if explicit access to the TIFF object TiffImage is required.

Declarations:

pass 2D array views:

namespace vigra {
template <class T, class S>
void
importTiffImage(TiffImage * tiff, MultiArrayView<2, T, S> dest);
}

show deprecated declarations

Usage:

#include <vigra/tiff.hxx>
Namespace: vigra

uint32 w, h;
TiffImage * tiff = TIFFOpen("tiffimage.tiff", "r");
TIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &w);
TIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &h);
MultiArray<2, unsigned char> img(w,h);
importTiffImage(tiff, img);
TIFFClose(tiff);

Required Interface:

see tiffToScalarImage() and tiffToRGBImage()

Preconditions:

see tiffToScalarImage() and tiffToRGBImage()

void vigra::tiffToScalarImage (   ...)

Convert single-band TiffImage to scalar image.

Note that unexpected results can occur when the destination pixel type is weaker than the pixel type in the file (e.g. when a float file is imported into a unsigned char image).

Declarations:

pass 2D array views:

namespace vigra {
template <class ImageIterator, class Accessor>
void
tiffToScalarImage(TiffImage * tiff, ImageIterator iter, Accessor a)
}

show deprecated declarations

Usage:

#include <vigra/tiff.hxx>
Namespace: vigra

uint32 w, h;
uint16 photometric;
TiffImage * tiff = TIFFOpen("tiffimage.tiff", "r");
TIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &w);
TIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &h);
TIFFGetField(tiff_, TIFFTAG_PHOTOMETRIC, &photometric);
if(photometric != PHOTOMETRIC_MINISWHITE &&
photometric != PHOTOMETRIC_MINISBLACK)
{
// not a scalar image - handle error
}
MultiArray<2, unsigned char> img(w,h);
tiffToScalarImage(tiff, img);
TIFFClose(tiff);

show deprecated examples

Preconditions:

The output array must have the correct shape.

uint16 sampleFormat, samplesPerPixel, bitsPerSample, photometric;
TIFFGetField(tiff, TIFFTAG_SAMPLEFORMAT, &sampleFormat);
TIFFGetField(tiff, TIFFTAG_SAMPLESPERPIXEL, &samplesPerPixel);
TIFFGetField(tiff, TIFFTAG_BITSPERSAMPLE, &bitsPerSample);
TIFFGetField(tiff, TIFFTAG_PHOTOMETRIC, &photometric);
sampleFormat != SAMPLEFORMAT_VOID
samplesPerPixel == 1
photometric == PHOTOMETRIC_MINISWHITE || photometric == PHOTOMETRIC_MINISBLACK
bitsPerSample == 1 ||
bitsPerSample == 8 ||
bitsPerSample == 16 ||
bitsPerSample == 32 ||
bitsPerSample == 64
void vigra::tiffToRGBImage (   ...)

Import a RGB (3-band or color-mapped) TiffImage into a RGB image.

Note that unexpected results can occur when the destination pixel type is weaker than the pixel type in the file (e.g. when a float file is imported into a unsigned char image).

Declarations:

pass 2D array views:

namespace vigra {
template <class RGBImageIterator, class RGBAccessor>
void
tiffToRGBImage(TiffImage * tiff, RGBImageIterator iter, RGBAccessor a)
}

show deprecated declarations

Usage:

#include <vigra/tiff.hxx>
Namespace: vigra

uint32 w, h;
uint16 photometric
TiffImage * tiff = TIFFOpen("tiffimage.tiff", "r");
TIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &w);
TIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &h);
TIFFGetField(tiff_, TIFFTAG_PHOTOMETRIC, &photometric);
if(photometric != PHOTOMETRIC_RGB &&
photometric != PHOTOMETRIC_PALETTE)
{
// not an RGB image - handle error
}
MultiArray<2, RGBValue<unsigned char> > img(w, h);
tiffToRGBImage(tiff, img);
TIFFClose(tiff);

show deprecated examples

Preconditions:

The destination image must have the appropriate size.

uint16 sampleFormat, samplesPerPixel, bitsPerSample, photometric;
TIFFGetField(tiff, TIFFTAG_SAMPLEFORMAT, &sampleFormat);
TIFFGetField(tiff, TIFFTAG_SAMPLESPERPIXEL, &samplesPerPixel);
TIFFGetField(tiff, TIFFTAG_BITSPERSAMPLE, &bitsPerSample);
TIFFGetField(tiff, TIFFTAG_PHOTOMETRIC, &photometric);
sampleFormat != SAMPLEFORMAT_VOID
samplesPerPixel == 3 // unless photometric == PHOTOMETRIC_PALETTE
photometric == PHOTOMETRIC_RGB ||
photometric == PHOTOMETRIC_PALETTE
bitsPerSample == 1 ||
bitsPerSample == 8 ||
bitsPerSample == 16 ||
bitsPerSample == 32 ||
bitsPerSample == 64
void vigra::createTiffImage (   ...)

Create a TiffImage from the given iterator range.

Type and size of the TiffImage are determined by the input image. Currently, the function can create scalar images and RGB images of type unsigned char, short, int, float, and double.

Usually, it is better to use exportImage(). createTiffImage() should only be used if explicit access to the TIFF object TiffImage is required.

Declarations:

pass 2D array views:

namespace vigra {
template <class T, class S>
void
createTiffImage(MultiArrayView<2, T, S> const & src, TiffImage * tiff);
}

show deprecated declarations

Usage:

#include <vigra/tiff.hxx>
Namespace: vigra

MultiArray<2, float> img(width, height);
...
TiffImage * tiff = TIFFOpen(("tiffimage.tiff", "w");
createTiffImage(img, tiff);
TIFFClose(tiff); // implicitly writes the image to the disk

show deprecated examples

void vigra::createScalarTiffImage (   ...)

Create a single-band TiffImage from the given scalar image.

Type and size of the TiffImage are determined by the input image (may be one of unsigned char, short, int, float, or double).

Declarations:

pass 2D array views:

namespace vigra {
template <class ImageIterator, class Accessor>
TiffImage *
createScalarTiffImage(ImageIterator upperleft, ImageIterator lowerright,
Accessor a)
}

show deprecated declarations

Usage:

#include <vigra/tiff.hxx>
Namespace: vigra

MultiArray<2, float> img(width, height);
...
TiffImage * tiff = TIFFOpen(("tiffimage.tiff", "w");
TIFFClose(tiff); // implicitly writes the image to the disk

show deprecated examples

void vigra::createRGBTiffImage (   ...)

Create a 3-band TiffImage from the given RGB image.

Type and size of the TiffImage are determined by the input image (may be one of unsigned char, int, float, or double).

Declarations:

pass 2D array views:

namespace vigra {
template <class RGBImageIterator, class RGBAccessor>
TiffImage *
createRGBTiffImage(RGBImageIterator upperleft, RGBImageIterator lowerright,
RGBAccessor a)
}

show deprecated declarations

Usage:

#include <vigra/tiff.hxx>
Namespace: vigra

MultiArray<2, RGBValue<unsigned char> > img(width, height);
...
TiffImage * tiff = TIFFOpen(("tiffimage.tiff", "w");
createRGBTiffImage(img, tiff);
TIFFClose(tiff); // implicitly writes the image to the disk

show deprecated examples

© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de)
Heidelberg Collaboratory for Image Processing, University of Heidelberg, Germany

html generated using doxygen and Python
vigra 1.11.1 (Fri May 19 2017)