Public Member Functions | Static Public Member Functions | Public Attributes | Private Types | Private Attributes | Static Private Attributes
EMAN::PgmIO Class Reference

A PGM file = header + data. More...

#include <pgmio.h>

Inheritance diagram for EMAN::PgmIO:
Inheritance graph
Collaboration diagram for EMAN::PgmIO:
Collaboration graph

List of all members.

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


Private Types


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"

Detailed Description

A PGM file = header + data.

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.

Member Enumeration Documentation

enum EMAN::PgmIO::FileType [private]

Definition at line 63 of file pgmio.h.

Constructor & Destructor Documentation

PgmIO::PgmIO ( const string &  filename,
IOMode  rw_mode = READ_ONLY 
) [explicit]

Definition at line 52 of file pgmio.cpp.

:       filename(file), rw_mode(rw), pgm_file(0), is_big_endian(true),
        initialized(false), nx(0), ny(0), maxval(0), minval(0),
        file_offset(0), rendermin(0), rendermax(0)
PgmIO::~PgmIO ( )

Definition at line 58 of file pgmio.cpp.

References pgm_file.

        if (pgm_file) {
                pgm_file = 0;

Member Function Documentation

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().

        bool result = false;
        if (first_block) {
                result = Util::check_file_by_magic(first_block, MAGIC_BINARY);
        return result;

Member Data Documentation

Definition at line 56 of file pgmio.h.

off_t EMAN::PgmIO::file_offset [private]

Definition at line 83 of file pgmio.h.

string EMAN::PgmIO::filename [private]

Definition at line 71 of file pgmio.h.

bool EMAN::PgmIO::initialized [private]

Definition at line 76 of file pgmio.h.

Definition at line 75 of file pgmio.h.

const char * PgmIO::MAGIC_ASCII = "P2" [static, private]

Definition at line 60 of file pgmio.h.

const char * PgmIO::MAGIC_BINARY = "P5" [static, private]

Definition at line 61 of file pgmio.h.

Referenced by is_valid().

int EMAN::PgmIO::maxval [private]

Definition at line 80 of file pgmio.h.

int EMAN::PgmIO::minval [private]

Definition at line 81 of file pgmio.h.

int EMAN::PgmIO::nx [private]

Definition at line 78 of file pgmio.h.

int EMAN::PgmIO::ny [private]

Definition at line 79 of file pgmio.h.

FILE* EMAN::PgmIO::pgm_file [private]

Definition at line 73 of file pgmio.h.

Referenced by ~PgmIO().

float EMAN::PgmIO::rendermax [private]

Definition at line 86 of file pgmio.h.

float EMAN::PgmIO::rendermin [private]

Definition at line 85 of file pgmio.h.

Definition at line 72 of file pgmio.h.

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