ome-files 0.2.2

Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
ome::files::tiff::TIFF Class Reference

Tagged Image File Format (TIFF). More...

`#include <ome/files/tiff/TIFF.h>`

Inheritance diagram for ome::files::tiff::TIFF:
[legend]
Collaboration diagram for ome::files::tiff::TIFF:
[legend]

## Classes
class | Impl
| Internal implementation details of TIFF. More...

## Public Types
typedef IFDIterator< IFD > | iterator
| IFD iterator.
typedef IFDIterator< const IFD > | const_iterator
| const IFD iterator.

## Public Member Functions
| ~TIFF ()
| Destructor.
void | close ()
| Close the TIFF file. More...
| operator bool ()
| Check if the TIFF file is valid. More...
directory_index_type | directoryCount () const
| Get the total number of IFDs. More...
ome::compat::shared_ptr< IFD > | getDirectoryByIndex (directory_index_type index) const
| Get an IFD by its index. More...
ome::compat::shared_ptr< IFD > | getDirectoryByOffset (offset_type offset) const
| Get an IFD by its offset in the file. More...
ome::compat::shared_ptr< IFD > | getCurrentDirectory () const
| Get the currently active IFD. More...
void | writeCurrentDirectory ()
| Write the currently active IFD. More...
wrapped_type * | getWrapped () const
| Get the underlying libtiff `::TIFF` instance. More...
iterator | begin ()
| Get the first image file directory. More...
const_iterator | begin () const
| Get the first image file directory. More...
iterator | end ()
| Get the last+1 image file directory. More...
const_iterator | end () const
| Get the last+1 image file directory. More...

## Static Public Member Functions
static ome::compat::shared_ptr< TIFF > | open (const boost::filesystem::path &filename, const std::string &mode)
| Open a TIFF file for reading or writing. More...

## Protected Member Functions
| TIFF (const boost::filesystem::path &filename, const std::string &mode)
| Constructor (non-public).

## Private Member Functions
| TIFF (const TIFF &)
| Copy constructor (deleted).
TIFF & | operator= (const TIFF &)
| Assignment operator (deleted).
void | registerImageJTags ()
| Register ImageJ tags with libtiff for this image.

## Private Attributes
ome::compat::shared_ptr< Impl > | impl
| Private implementation details.

## Friends
class | IFD

## Detailed Description

Tagged Image File Format (TIFF).

This class is the primary class for reading and writing TIFF files. Use the static open() method to get a working instance. This instance may be used to get IFD instances and then access to image metadata and pixel data.

## Member Function Documentation

## § begin() [1/2]

TIFF::iterator ome::files::tiff::TIFF::begin | ( |  | ) |

Get the first image file directory.

Returns
  an iterator referring to the first image file directory

References getDirectoryByIndex().

Referenced by directoryCount().

Here is the caller graph for this function:

## § begin() [2/2]

TIFF::const_iterator ome::files::tiff::TIFF::begin | ( |  | ) | const

Get the first image file directory.

Returns
  an iterator referring to the first image file directory

References getDirectoryByIndex().

## § close()

void ome::files::tiff::TIFF::close | ( |  | ) |

Close the TIFF file.

Note that this will be done automatically when the destructor runs. Any further method calls using this object or any child IFD will throw an Exception.

References impl.

## § directoryCount()

directory_index_type ome::files::tiff::TIFF::directoryCount | ( |  | ) | const

Get the total number of IFDs.

Returns
  the IFD count.

References begin(), end(), and impl.

## § end() [1/2]

TIFF::iterator ome::files::tiff::TIFF::end | ( |  | ) |

Get the last+1 image file directory.

Returns
  an iterator referring to the last+1 image file directory.

Referenced by directoryCount().

Here is the caller graph for this function:

## § end() [2/2]

TIFF::const_iterator ome::files::tiff::TIFF::end | ( |  | ) | const

Get the last+1 image file directory.

Returns
  an iterator referring to the last+1 image file directory.

## § getCurrentDirectory()

ome::compat::shared_ptr< IFD > ome::files::tiff::TIFF::getCurrentDirectory | ( |  | ) | const

Get the currently active IFD.

Returns
  the IFD.

Exceptions

  an | Exception if the IFD could not be accessed.

References ome::files::tiff::IFD::current().

Referenced by writeCurrentDirectory().

Here is the caller graph for this function:

## § getDirectoryByIndex()

ome::compat::shared_ptr< IFD > ome::files::tiff::TIFF::getDirectoryByIndex | ( | directory_index_type | index | ) | const

Get an IFD by its index.

Parameters

  index | the directory index.

Returns
  the IFD.

Exceptions

  an | Exception if the index is invalid or could not be accessed.

References ome::files::tiff::Sentry::error(), impl, and ome::files::tiff::IFD::openIndex().

Referenced by begin().

Here is the caller graph for this function:

## § getDirectoryByOffset()

ome::compat::shared_ptr< IFD > ome::files::tiff::TIFF::getDirectoryByOffset | ( | offset_type | offset | ) | const

Get an IFD by its offset in the file.

Parameters

  offset | the directory offset.

Returns
  the IFD.

Exceptions

  an | Exception if the offset is invalid or could not be accessed.

References ome::files::tiff::Sentry::error(), impl, and ome::files::tiff::IFD::openOffset().

## § getWrapped()

TIFF::wrapped_type * ome::files::tiff::TIFF::getWrapped | ( |  | ) | const

Get the underlying libtiff `::TIFF` instance.

If there is any need to use the libtiff C interface to access any functionality not exposed through these C++ wrapper classes, this will provide a pointer to the handle.

Note
  Due to not including the libtiff C headers the `::TIFF` type isn't available here. After including the main `<tiffio.h>` header, cast the return value to the correct type:

    * ::TIFF *tiff = reinterpret_cast< ::TIFF *>(myfile.getWrapped());
    *

Returns
  an opaque pointer to the wrapped `::TIFF` instance.

References impl.

Referenced by registerImageJTags().

Here is the caller graph for this function:

## § open()

ome::compat::shared_ptr< TIFF > ome::files::tiff::TIFF::open | ( | const boost::filesystem::path & | filename,
|  | const std::string & | mode
| ) |  |
| static

Open a TIFF file for reading or writing.

Note
  There are additional open flags, documented in TIFFOpen(3).

Parameters

  filename | the file to open.
  mode | the file open mode (`r` to read, `w` to write or `a` to append).

Returns
  the the open TIFF.

Exceptions

  an | Exception on failure.

Referenced by ome::files::in::OMETIFFReader::getTIFF(), and ome::files::out::OMETIFFWriter::setId().

Here is the caller graph for this function:

## § operator bool()

ome::files::tiff::TIFF::operator bool | ( |  | ) |

Check if the TIFF file is valid.

Returns
  `true` if the file is open and available for reading and writing, or `false` if closed or invalid.

References impl.

## § writeCurrentDirectory()

void ome::files::tiff::TIFF::writeCurrentDirectory | ( |  | ) |

Write the currently active IFD.

The pixel data accompanying this IFD must have been written using IFD::writeImage() prior to calling this method, or else the TIFF tags for strip and tile offsets will be incomplete and the file will fail to read.

References ome::files::tiff::Sentry::error(), getCurrentDirectory(), impl, and ome::files::tiff::SOFTWARE.

The documentation for this class was generated from the following files:

- ome/files/tiff/TIFF.h
- ome/files/tiff/TIFF.cpp