libpniio
|
base class for image readers More...
#include <image_reader.hpp>
Public Member Functions | |
virtual | ~image_reader () |
destructor More... | |
virtual size_t | nimages () const =0 |
get number of images More... | |
virtual image_info | info (size_t i) const =0 |
get image info More... | |
template<typename ATYPE > | |
ATYPE | image (size_t, size_t) |
method to read a single channel More... | |
template<typename ATYPE > | |
void | image (ATYPE &, size_t, size_t) |
method to read a single image channel More... | |
![]() | |
virtual | ~data_reader () |
destructor More... | |
pni::core::string | filename () const |
get filename More... | |
void | filename (const pni::core::string &fname) |
set filename More... | |
virtual void | close () |
close the file More... | |
virtual void | open () |
open file More... | |
Protected Member Functions | |
image_reader () | |
default constructor More... | |
image_reader (const image_reader &)=delete | |
copy constructor is deleted More... | |
image_reader (image_reader &&r) | |
move constructor More... | |
image_reader (const pni::core::string &fname, bool binary=false) | |
standard constructor taking the filename as string object More... | |
image_reader & | operator= (const image_reader &r)=delete |
copy assignment is deleted More... | |
image_reader & | operator= (image_reader &&r) |
move assignment operator More... | |
![]() | |
std::ifstream & | _get_stream () const |
get stream More... | |
void | _set_binary () |
set binary mode More... | |
data_reader () | |
default constructor More... | |
data_reader (const pni::core::string &fname, bool binary=false) | |
standard constructor More... | |
data_reader (data_reader &&r) | |
move constructor More... | |
data_reader (const data_reader &r)=delete | |
copy constructor is deleted More... | |
data_reader & | operator= (const data_reader &r)=delete |
copy assigment is deleted More... | |
data_reader & | operator= (data_reader &&r) |
move assignment More... | |
The image_reader class provides the basic functionality for all other image readers. It opens the file and provides a stream from which to read data. ImageReader objects cannot be copied or copy-assigned. However, they can be moved using std::move.
Like data_reader (from which it is derived) an ImageReader object cannot be instantiated using this class. All constructors and assignment operators are thus protected making them only available to derived classes.
|
protected |
|
protecteddelete |
|
protected |
|
explicitprotected |
|
virtual |
|
inline |
This method returns an object determined by ArrayType holding the data from channel c (default is 0) of image i in the file. This method must be implemented by all child classes of ImageReader. It is assumed that the method will allocate enough memory and configure the returning object appropriately.
i | index of the image in the file |
c | (default = 0) image channel to read |
|
inline |
This method reads the data from channle c (default = 0) of image i in the file and stores it in an Array template supplied by the user. The array must provide enough space to hold the data otherwise exceptions will be thrown. The addvantage of this method is that it does not waste time with memory allocation. It is thus useful in cases where data from many files of same size must be read.
array | array where to store the data |
i | index of the image in the file |
c | (default = 0) index of the channel from which to read data. |
|
pure virtual |
Return an instance of ImageInfo with the information of image i in the image stack. This is a virtual function which must be implemented by the concrete reader classes.
i | index of the image |
Implemented in pni::io::tiff_reader, and pni::io::cbf_reader.
|
pure virtual |
Returns the number of images stored in the file. This methods reflects the fact that many image formats can hold more than one image in a single file (CBF, TIFF). Although this feature is hardly used for experiments it should be taken into account. This is a virtual function which must be implemented by the concrete reader classes.
Implemented in pni::io::tiff_reader, and pni::io::cbf_reader.
|
protecteddelete |
|
protected |