CC Localization
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
Tiff Class Reference

TIFF file processor. More...

#include <tiff.hh>

Classes

struct  DEntry
 Directory Entry. More...
 

Public Types

enum  Tag {
  Tag_ImageWidth = 0x100, Tag_ImageLength = 0x101, Tag_BitsPerSample = 0x102, Tag_Compression = 0x103,
  Tag_PhotometricInterpretation = 0x106, Tag_FillOrder = 0x10a, Tag_ImageDescription = 0x10e, Tag_StripOffsets = 0x111,
  Tag_Orientation = 0x112, Tag_SamplesPerPixel = 0x115, Tag_RowsPerStrip = 0x116, Tag_StripByteCounts = 0x117,
  Tag_XResolution = 0x11a, Tag_YResolution = 0x11b, Tag_PlanarConfiguration = 0x11c, Tag_ResolutionUnit = 0x128,
  Tag_Software = 0x131, Tag_SampleFormat = 0x153, Tag_ImageID = 0x800d
}
 Directory entry ID tags.
 
enum  Compression { Cmp_None = 1, Cmp_CCITT = 2, Cmp_PackBits = 32773 }
 Compression methods.
 
enum  Photometric {
  Ptm_WhiteIsZero = 0, Ptm_BlackIsZero = 1, Ptm_RGB = 2, Ptm_Palette = 3,
  Ptm_TransparencyMask = 4
}
 Photometric formats.
 
enum  Unit { Unt_None = 1, Unt_Inch = 2, Unt_Centimeter = 3 }
 Units for image.
 
enum  SampleFormat { Fmt_Unsigned = 1, Fmt_TwoComplement = 2, Fmt_IEEEFloat = 3, Fmt_Undefined = 4 }
 Sample formats.
 

Public Member Functions

 Tiff (std::shared_ptr< std::ifstream > s)
 Construct TIFF processor from an input stream.
 
void start ()
 
uint32_t parse_ifd (uint32_t i=0)
 Parse image file directory (IFD) More...
 
std::vector< char > read_image ()
 

Public Attributes

std::map< Compression, std::string > const compress_name
 String names for compression methods. More...
 
std::map< Photometric, std::string > const photom_name
 String names for photometric formats. More...
 
std::map< Unit, std::string > const unit_name
 String names for units. More...
 
std::map< SampleFormat, std::string > const format_name
 String names for sample formats. More...
 
uint32_t image_width
 width of image
 
uint32_t image_length
 length of image
 
std::vector< uint16_t > bits_per_sample
 bits per sample
 
Compression compression
 compression method
 
Photometric photometric
 photometric format
 
uint16_t fill_order
 fill order
 
std::string image_description
 image description
 
std::vector< uint32_t > strip_offsets
 strip offsets
 
uint16_t orientation
 orientation of image
 
uint16_t samples_per_pixel
 samples per pixel
 
uint32_t rows_per_strip
 rows per strip
 
std::vector< uint32_t > strip_byte_counts
 strip byte counots
 
std::tuple< uint32_t, uint32_t > xresolution
 x resolution
 
std::tuple< uint32_t, uint32_t > yresolution
 y resolution
 
uint16_t planar_configuration
 planar configuration
 
Unit resolution_unit
 unit for image resolution
 
std::string software
 software used
 
std::vector< SampleFormatsample_formats
 sample formats
 
std::string image_id
 image ID
 

Detailed Description

TIFF file processor.

Definition at line 13 of file tiff.hh.

Member Function Documentation

◆ parse_ifd()

uint32_t Tiff::parse_ifd ( uint32_t  i = 0)

Parse image file directory (IFD)

Returns
offset position for next IFD, 0 if there is no more
Parameters
ioffset position for the IFD

Definition at line 127 of file tiff.cc.

◆ read_image()

std::vector< char > Tiff::read_image ( )

read image data

Definition at line 168 of file tiff.cc.

◆ start()

void Tiff::start ( )

start with TIFF file header

Definition at line 113 of file tiff.cc.

Member Data Documentation

◆ compress_name

std::map<Compression,std::string> const Tiff::compress_name
Initial value:
{
{Cmp_None,"None"},
{Cmp_CCITT,"CCITT"},
{Cmp_PackBits,"PackBits"}
}

String names for compression methods.

Definition at line 78 of file tiff.hh.

◆ format_name

std::map<SampleFormat,std::string> const Tiff::format_name
Initial value:
{
{Fmt_Unsigned,"Unsigned"},
{Fmt_TwoComplement,"TwoComplement"},
{Fmt_IEEEFloat,"IEEEFloat"},
{Fmt_Undefined,"Undefined"}
}

String names for sample formats.

Definition at line 119 of file tiff.hh.

◆ photom_name

std::map<Photometric,std::string> const Tiff::photom_name
Initial value:
{
{Ptm_WhiteIsZero,"WhiteIsZero"},
{Ptm_BlackIsZero,"BlackIsZero"},
{Ptm_RGB,"RGB"},
{Ptm_Palette,"Palette"},
{Ptm_TransparencyMask,"TransparencyMask"}
}

String names for photometric formats.

Definition at line 92 of file tiff.hh.

◆ unit_name

std::map<Unit,std::string> const Tiff::unit_name
Initial value:
{
{Unt_None,"None"},
{Unt_Inch,"Inch"},
{Unt_Centimeter,"Centimeter"}
}

String names for units.

Definition at line 106 of file tiff.hh.


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