ome-files
0.5.0
|
Tagged Image File Format (TIFF). More...
#include <ome/files/tiff/TIFF.h>
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... | |
std::shared_ptr< IFD > | getDirectoryByIndex (directory_index_type index) const |
Get an IFD by its index. More... | |
std::shared_ptr< IFD > | getDirectoryByOffset (offset_type offset) const |
Get an IFD by its offset in the file. More... | |
std::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 std::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). More... | |
Private Member Functions | |
void | registerImageJTags () |
Register ImageJ tags with libtiff for this image. | |
Private Attributes | |
std::shared_ptr< Impl > | impl |
Private implementation details. | |
Friends | |
class | IFD |
IFD uses internal TIFF state. | |
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.
|
protected |
Constructor (non-public).
filename | the file to open. |
mode | the file open mode (r to read, w to write or a to append). |
an | Exception on failure. |
References impl, and registerImageJTags().
TIFF::iterator ome::files::tiff::TIFF::begin | ( | ) |
Get the first image file directory.
References getDirectoryByIndex().
TIFF::const_iterator ome::files::tiff::TIFF::begin | ( | ) | const |
Get the first image file directory.
References getDirectoryByIndex().
void ome::files::tiff::TIFF::close | ( | ) |
directory_index_type ome::files::tiff::TIFF::directoryCount | ( | ) | const |
TIFF::iterator ome::files::tiff::TIFF::end | ( | ) |
Get the last+1 image file directory.
TIFF::const_iterator ome::files::tiff::TIFF::end | ( | ) | const |
Get the last+1 image file directory.
std::shared_ptr< IFD > ome::files::tiff::TIFF::getCurrentDirectory | ( | ) | const |
Get the currently active IFD.
References ome::files::tiff::IFD::current().
Referenced by writeCurrentDirectory().
std::shared_ptr< IFD > ome::files::tiff::TIFF::getDirectoryByIndex | ( | directory_index_type | index | ) | const |
std::shared_ptr< IFD > ome::files::tiff::TIFF::getDirectoryByOffset | ( | offset_type | offset | ) | const |
Get an IFD by its offset in the file.
offset | the directory offset. |
an | Exception if the offset is invalid or could not be accessed. |
References ome::files::tiff::IFD::openOffset().
Referenced by getDirectoryByIndex().
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.
::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()); *
::TIFF
instance. References impl.
Referenced by registerImageJTags().
|
static |
Open a TIFF file for reading or writing.
filename | the file to open. |
mode | the file open mode (r to read, w to write or a to append). |
an | Exception on failure. |
Referenced by ome::files::in::OMETIFFReader::getTIFF(), and ome::files::out::OMETIFFWriter::setId().
ome::files::tiff::TIFF::operator bool | ( | ) |
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.