EMAN2
Public Member Functions | Static Public Member Functions | Public Attributes | Private Attributes | Static Private Attributes
EMAN::SitusIO Class Reference

situs is a a Situs-specific format on a cubic lattice. More...

#include <situsio.h>

Inheritance diagram for EMAN::SitusIO:
Inheritance graph
[legend]
Collaboration diagram for EMAN::SitusIO:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 SitusIO (const string &omapname, IOMode rw_mode=READ_ONLY)
 ~SitusIO ()

Static Public Member Functions

static bool is_valid (const void *first_block)

Public Attributes

 DEFINE_IMAGEIO_FUNC

Private Attributes

string filename
IOMode rw_mode
FILE * situsfile
bool initialized
bool is_new_file
float apix
float origx
float origy
float origz
int nx
int ny
int nz

Static Private Attributes

static const int SITUS_HEADER_LINES = 2
static const int FLOAT_SIZE = 12
static const int NFLOAT_PER_LINE = 10
static const char * OUTFORMAT = "%12.6f"
static const int LINE_LENGTH = 1024

Detailed Description

situs is a a Situs-specific format on a cubic lattice.

This allows Situs programs to keep track of coordinate systems and it makes the core Situs programs independent of the ever changing map format standards. In the editable (ASCII or text) Situs format, a short header holds the voxel spacing WIDTH, the map origin as defined by the 3D coordinates of the first voxel ORIGX, ORIGY, ORIGZ, and the map dimensions (number of increments) NX, NY, NZ. This minimalist header is followed by the data fields such that x increments change fastest and z increments change slowest. http://situs.biomachina.org/fguide.html#map2map

Definition at line 52 of file situsio.h.


Constructor & Destructor Documentation

SitusIO::SitusIO ( const string &  omapname,
IOMode  rw_mode = READ_ONLY 
) [explicit]

Definition at line 48 of file situsio.cpp.

                                                    :
                filename(situsname), rw_mode(rw), situsfile(0),
                initialized(false), is_new_file(false),
                apix(0.0f), origx(0.0f), origy(0.0f), origz(0.0f),
                nx(0), ny(0), nz(0)
{
}
SitusIO::~SitusIO ( )

Definition at line 56 of file situsio.cpp.

References situsfile.

{
        if (situsfile) {
                fclose(situsfile);
                situsfile = 0;
        }
}

Member Function Documentation

bool SitusIO::is_valid ( const void *  first_block) [static]

Definition at line 186 of file situsio.cpp.

References apix, ENTERFUNC, EXITFUNC, EMAN::Util::get_line_from_string(), nx, ny, nz, origx, origy, and origz.

Referenced by EMAN::EMUtil::fast_get_image_type(), and EMAN::EMUtil::get_image_type().

{
        ENTERFUNC;
        if (!first_block) {
                return false;
        }

        char *buf = (char *)(first_block);
        string line1 = Util::get_line_from_string(&buf);

        if(line1.size()==0) return false;

        float apix, origx, origy, origz;
        int nx, ny, nz;

        if(sscanf(line1.c_str(), "%f %f %f %f %d %d %d", &apix, &origx, &origy, &origz, &nx, &ny, &nz) != 7) return false;

        if(apix<0.01 || apix>100) return false;
        if(nx<=0 || ny<0 || nz<0) return false;

        EXITFUNC;
        return true;
}

Member Data Documentation

float EMAN::SitusIO::apix [private]

Definition at line 70 of file situsio.h.

Referenced by is_valid().

Definition at line 58 of file situsio.h.

string EMAN::SitusIO::filename [private]

Definition at line 63 of file situsio.h.

const int SitusIO::FLOAT_SIZE = 12 [static, private]

Definition at line 74 of file situsio.h.

Definition at line 67 of file situsio.h.

Definition at line 68 of file situsio.h.

const int SitusIO::LINE_LENGTH = 1024 [static, private]

Definition at line 77 of file situsio.h.

const int SitusIO::NFLOAT_PER_LINE = 10 [static, private]

Definition at line 75 of file situsio.h.

int EMAN::SitusIO::nx [private]

Definition at line 71 of file situsio.h.

Referenced by is_valid().

int EMAN::SitusIO::ny [private]

Definition at line 71 of file situsio.h.

Referenced by is_valid().

int EMAN::SitusIO::nz [private]

Definition at line 71 of file situsio.h.

Referenced by is_valid().

float EMAN::SitusIO::origx [private]

Definition at line 70 of file situsio.h.

Referenced by is_valid().

float EMAN::SitusIO::origy [private]

Definition at line 70 of file situsio.h.

Referenced by is_valid().

float EMAN::SitusIO::origz [private]

Definition at line 70 of file situsio.h.

Referenced by is_valid().

const char * SitusIO::OUTFORMAT = "%12.6f" [static, private]

Definition at line 76 of file situsio.h.

Definition at line 64 of file situsio.h.

const int SitusIO::SITUS_HEADER_LINES = 2 [static, private]

Definition at line 73 of file situsio.h.

FILE* EMAN::SitusIO::situsfile [private]

Definition at line 65 of file situsio.h.

Referenced by ~SitusIO().


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