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.

00048                                                     :
00049                 filename(situsname), rw_mode(rw), situsfile(0),
00050                 initialized(false), is_new_file(false),
00051                 apix(0.0f), origx(0.0f), origy(0.0f), origz(0.0f),
00052                 nx(0), ny(0), nz(0)
00053 {
00054 }

SitusIO::~SitusIO (  ) 

Definition at line 56 of file situsio.cpp.

References situsfile.

00057 {
00058         if (situsfile) {
00059                 fclose(situsfile);
00060                 situsfile = 0;
00061         }
00062 }


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

00187 {
00188         ENTERFUNC;
00189         if (!first_block) {
00190                 return false;
00191         }
00192 
00193         char *buf = (char *)(first_block);
00194         string line1 = Util::get_line_from_string(&buf);
00195 
00196         if(line1.size()==0) return false;
00197 
00198         float apix, origx, origy, origz;
00199         int nx, ny, nz;
00200 
00201         if(sscanf(line1.c_str(), "%f %f %f %f %d %d %d", &apix, &origx, &origy, &origz, &nx, &ny, &nz) != 7) return false;
00202 
00203         if(apix<0.01 || apix>100) return false;
00204         if(nx<=0 || ny<0 || nz<0) return false;
00205 
00206         EXITFUNC;
00207         return true;
00208 }


Member Data Documentation

float EMAN::SitusIO::apix [private]

Definition at line 70 of file situsio.h.

Referenced by is_valid().

EMAN::SitusIO::DEFINE_IMAGEIO_FUNC

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.

bool EMAN::SitusIO::initialized [private]

Definition at line 67 of file situsio.h.

bool EMAN::SitusIO::is_new_file [private]

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.

IOMode EMAN::SitusIO::rw_mode [private]

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:
Generated on Tue Jun 11 12:45:09 2013 for EMAN2 by  doxygen 1.4.7