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

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

#include <ome/bioformats/tiff/TIFF.h>

+ Inheritance diagram for ome::bioformats::tiff::TIFF:
+ Collaboration diagram for ome::bioformats::tiff::TIFF:

Classes

class  Impl
 Internal implementation details of TIFF. More...
 

Public Types

typedef IFDIterator< IFDiterator
 IFD iterator.
 
typedef IFDIterator< const IFDconst_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< IFDgetDirectoryByIndex (directory_index_type index) const
 Get an IFD by its index. More...
 
ome::compat::shared_ptr< IFDgetDirectoryByOffset (offset_type offset) const
 Get an IFD by its offset in the file. More...
 
ome::compat::shared_ptr< IFDgetCurrentDirectory () 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< TIFFopen (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).
 
TIFFoperator= (const TIFF &)
 Assignment operator (deleted).
 
void registerImageJTags ()
 Register ImageJ tags with libtiff for this image.
 

Private Attributes

ome::compat::shared_ptr< Implimpl
 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

TIFF::iterator ome::bioformats::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:

TIFF::const_iterator ome::bioformats::tiff::TIFF::begin ( ) const

Get the first image file directory.

Returns
an iterator referring to the first image file directory

References getDirectoryByIndex().

void ome::bioformats::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.

directory_index_type ome::bioformats::tiff::TIFF::directoryCount ( ) const

Get the total number of IFDs.

Returns
the IFD count.

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

TIFF::iterator ome::bioformats::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:

TIFF::const_iterator ome::bioformats::tiff::TIFF::end ( ) const

Get the last+1 image file directory.

Returns
an iterator referring to the last+1 image file directory.
ome::compat::shared_ptr< IFD > ome::bioformats::tiff::TIFF::getCurrentDirectory ( ) const

Get the currently active IFD.

Returns
the IFD.
Exceptions
anException if the IFD could not be accessed.

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

Referenced by writeCurrentDirectory().

+ Here is the caller graph for this function:

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

Get an IFD by its index.

Parameters
indexthe directory index.
Returns
the IFD.
Exceptions
anException if the index is invalid or could not be accessed.

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

Referenced by begin().

+ Here is the caller graph for this function:

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

Get an IFD by its offset in the file.

Parameters
offsetthe directory offset.
Returns
the IFD.
Exceptions
anException if the offset is invalid or could not be accessed.

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

TIFF::wrapped_type * ome::bioformats::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:

ome::compat::shared_ptr< TIFF > ome::bioformats::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
filenamethe file to open.
modethe file open mode (r to read, w to write or a to append).
Returns
the the open TIFF.
Exceptions
anException on failure.

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

+ Here is the caller graph for this function:

ome::bioformats::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.
void ome::bioformats::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::bioformats::tiff::Sentry::error(), getCurrentDirectory(), impl, and ome::bioformats::tiff::SOFTWARE.


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