#include <pgmio.h>
Inheritance diagram for EMAN::PgmIO:
Public Member Functions | |
PgmIO (const string &filename, IOMode rw_mode=READ_ONLY) | |
~PgmIO () | |
Static Public Member Functions | |
static bool | is_valid (const void *first_block) |
Public Attributes | |
DEFINE_IMAGEIO_FUNC | |
Private Types | |
PGM_ASCII | |
PGM_BINARY | |
PGM_UNKNOWN_FILE | |
enum | FileType { PGM_ASCII, PGM_BINARY, PGM_UNKNOWN_FILE } |
Private Attributes | |
string | filename |
IOMode | rw_mode |
FILE * | pgm_file |
bool | is_big_endian |
bool | initialized |
int | nx |
int | ny |
int | maxval |
int | minval |
off_t | file_offset |
float | rendermin |
float | rendermax |
Static Private Attributes | |
static const char * | MAGIC_ASCII = "P2" |
static const char * | MAGIC_BINARY = "P5" |
Header is always in ASCII format. Data can be in either ASCII or BINARY format. Only Binary format is supported in EMAN so far.
A PGM file contains one 2D image.
Definition at line 50 of file pgmio.h.
enum EMAN::PgmIO::FileType [private] |
Definition at line 63 of file pgmio.h.
00064 { 00065 PGM_ASCII, 00066 PGM_BINARY, 00067 PGM_UNKNOWN_FILE 00068 };
PgmIO::PgmIO | ( | const string & | filename, | |
IOMode | rw_mode = READ_ONLY | |||
) | [explicit] |
Definition at line 52 of file pgmio.cpp.
00053 : filename(file), rw_mode(rw), pgm_file(0), is_big_endian(true), 00054 initialized(false), nx(0), ny(0), maxval(0), minval(0), 00055 file_offset(0), rendermin(0), rendermax(0) 00056 {}
PgmIO::~PgmIO | ( | ) |
bool PgmIO::is_valid | ( | const void * | first_block | ) | [static] |
Definition at line 130 of file pgmio.cpp.
References EMAN::Util::check_file_by_magic(), ENTERFUNC, EXITFUNC, and MAGIC_BINARY.
Referenced by EMAN::EMUtil::fast_get_image_type(), and EMAN::EMUtil::get_image_type().
00131 { 00132 ENTERFUNC; 00133 bool result = false; 00134 if (first_block) { 00135 result = Util::check_file_by_magic(first_block, MAGIC_BINARY); 00136 } 00137 EXITFUNC; 00138 return result; 00139 }
off_t EMAN::PgmIO::file_offset [private] |
string EMAN::PgmIO::filename [private] |
bool EMAN::PgmIO::initialized [private] |
bool EMAN::PgmIO::is_big_endian [private] |
const char * PgmIO::MAGIC_ASCII = "P2" [static, private] |
const char * PgmIO::MAGIC_BINARY = "P5" [static, private] |
int EMAN::PgmIO::maxval [private] |
int EMAN::PgmIO::minval [private] |
int EMAN::PgmIO::nx [private] |
int EMAN::PgmIO::ny [private] |
FILE* EMAN::PgmIO::pgm_file [private] |
float EMAN::PgmIO::rendermax [private] |
float EMAN::PgmIO::rendermin [private] |
IOMode EMAN::PgmIO::rw_mode [private] |