libpniio
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends
pni::io::tiff::strip_reader Class Reference

reader for strip data in a TIFF file

#include <strip_reader.hpp>

Collaboration diagram for pni::io::tiff::strip_reader:
Collaboration graph
[legend]

Public Member Functions

 strip_reader ()
 default constructor More...
 
 strip_reader (const strip_reader &r)
 copy constructor More...
 
 strip_reader (strip_reader &&r)
 move constructor More...
 
 strip_reader (const std::vector< size_t > &offsets, const std::vector< size_t > &byte_counts, const std::vector< size_t > &bits_per_channel, const std::vector< pni::core::type_id_t > &channel_types)
 standard constructor More...
 
 ~strip_reader ()
 destructor More...
 
strip_readeroperator= (const strip_reader &r)
 copy assignment operator More...
 
strip_readeroperator= (strip_reader &&r)
 move assignment operator More...
 
template<typename CTYPE >
void read (size_t c, std::ifstream &stream, CTYPE &data)
 template to read image data of various type More...
 

Static Public Member Functions

static strip_reader create (std::ifstream &stream, const ifd &image_dir, const image_info &info)
 create StripReader instance More...
 

Private Member Functions

template<typename IT , typename CTYPE >
void _read_interlace (size_t c, std::ifstream &stream, CTYPE &data) const
 template to read interlace data More...
 

Private Attributes

std::vector< size_t > _offsets
 array with the file offsets of the strips More...
 
std::vector< size_t > _byte_cnts
 array with byte counts for each strip More...
 
std::vector< size_t > _bits_per_channel
 number of bits per channel More...
 
std::vector< pni::core::type_id_t > _channel_types
 type ids of channel data More...
 

Friends

std::ostream & operator<< (std::ostream &o, const strip_reader &r)
 output operator More...
 

Constructor & Destructor Documentation

pni::io::tiff::strip_reader::strip_reader ( )
pni::io::tiff::strip_reader::strip_reader ( const strip_reader r)
pni::io::tiff::strip_reader::strip_reader ( strip_reader &&  r)
pni::io::tiff::strip_reader::strip_reader ( const std::vector< size_t > &  offsets,
const std::vector< size_t > &  byte_counts,
const std::vector< size_t > &  bits_per_channel,
const std::vector< pni::core::type_id_t > &  channel_types 
)

Standard constructor for this class.

Parameters
offsetsvector with strip offsets
byte_countsvector with byte counts for every strip
bits_per_channelvector with number of pits per channel
channel_typesvector with TypeIDs for each channel
pni::io::tiff::strip_reader::~strip_reader ( )

Member Function Documentation

template<typename IT , typename CTYPE >
void pni::io::tiff::strip_reader::_read_interlace ( size_t  c,
std::ifstream &  stream,
CTYPE &  data 
) const
private

This template method reads image data distributed over several strips. The first template parameter determines the type of the image data to read while T is the type of the target array. The remaining template parameters belong to the array itself and are not of importance here.

Template Parameters
ITdata type used in the image file
CTYPEcontainer type where the data shoule be stored
Parameters
cnumber of the channel to read
streaminput stream from which to read data
datatarget container where to store the data
strip_reader pni::io::tiff::strip_reader::create ( std::ifstream &  stream,
const ifd image_dir,
const image_info info 
)
static

This static factory method creates a StripReader object from the IFD of an image and its ImageInfo structure.

Parameters
streaminput stream from which to read data
image_dirIFD of the image for which the reader should be created
infoImageInfo object for the image
Returns
instance of type StripReader
strip_reader & pni::io::tiff::strip_reader::operator= ( const strip_reader r)
strip_reader & pni::io::tiff::strip_reader::operator= ( strip_reader &&  r)
template<typename CTYPE >
void pni::io::tiff::strip_reader::read ( size_t  c,
std::ifstream &  stream,
CTYPE &  data 
)
inline

Template method to read image data stored as strips from a file. The template parameter determines the type of the output array. The method assumes that the shape of the array is already set properly.

Exceptions
type_errorif the image data type is unkown
Parameters
cnumber of the channel to read
streaminput stream from which to read data
datareference to the container where to store the data

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  o,
const strip_reader r 
)
friend

Field Documentation

std::vector<size_t> pni::io::tiff::strip_reader::_bits_per_channel
private
std::vector<size_t> pni::io::tiff::strip_reader::_byte_cnts
private
std::vector<pni::core::type_id_t> pni::io::tiff::strip_reader::_channel_types
private
std::vector<size_t> pni::io::tiff::strip_reader::_offsets
private

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