EMAN2
omapio.h
Go to the documentation of this file.
00001 
00005 /*
00006  * Author: Grant Tang, 06/07/2011 (gtang@bcm.edu)
00007  * Copyright (c) 2000-2006 Baylor College of Medicine
00008  *
00009  * This software is issued under a joint BSD/GNU license. You may use the
00010  * source code in this file under either license. However, note that the
00011  * complete EMAN2 and SPARX software packages have some GPL dependencies,
00012  * so you are responsible for compliance with the licenses of these packages
00013  * if you opt to use BSD licensing. The warranty disclaimer below holds
00014  * in either instance.
00015  *
00016  * This complete copyright notice must be included in any revised version of the
00017  * source code. Additional authorship citations may be added, but existing
00018  * author citations must be preserved.
00019  *
00020  * This program is free software; you can redistribute it and/or modify
00021  * it under the terms of the GNU General Public License as published by
00022  * the Free Software Foundation; either version 2 of the License, or
00023  * (at your option) any later version.
00024  *
00025  * This program is distributed in the hope that it will be useful,
00026  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00027  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00028  * GNU General Public License for more details.
00029  *
00030  * You should have received a copy of the GNU General Public License
00031  * along with this program; if not, write to the Free Software
00032  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00033  *
00034  * */
00035 
00036 #ifndef eman__omapio_h__
00037 #define eman__omapio_h__ 1
00038 
00039 #include "imageio.h"
00040 
00041 namespace EMAN
00042 {
00054         class OmapIO:public ImageIO
00055         {
00056         public:
00057                 explicit OmapIO(const string & omapname, IOMode rw_mode = READ_ONLY);
00058                 ~OmapIO();
00059 
00060                 DEFINE_IMAGEIO_FUNC;
00061 
00062                 static bool is_valid(const void *first_block, off_t file_size = 0);
00063 
00064         private:
00066                 struct OmapHeader
00067                 {
00068                         short xstart;           //x start
00069                         short ystart;           //y start
00070                         short zstart;           //z start
00071                         short nx;                       //x extent
00072                         short ny;                       //y extent
00073                         short nz;                       //z extent
00074                         short apix_x;           //x sampling rate
00075                         short apix_y;           //y sampling rate
00076                         short apix_z;           //z sampling rate
00077                         short header10;         //header18*A Cell Edge
00078                         short header11;         //header18*B Cell Edge
00079                         short header12;         //header18*C Cell Edge
00080                         short alpha;            //alpha
00081                         short beta;                     //beta
00082                         short gamma;            //gamma
00083                         short iprod;            //scale2*(253-3)/(Rhomax-Rhomin)
00084                         short iplus;            //(3*Rhomax-253*Rhomin)/(Rhomax-Rhomin)
00085                         short scale;            //Cell Constant Scaling Factor
00086                         short scale2;           //constant 100
00087 
00088                         short imin;                     //minimum
00089                         short imax;                     //maximum
00090                         short isigma;           //sigma
00091                         short imean;            //mean, probably not really there
00092 
00093                         short unused[233];      //unused space
00094                 };
00095 
00096                 string filename;
00097                 IOMode rw_mode;
00098                 FILE *omapfile;
00099                 OmapHeader omaph;
00100 
00101                 bool is_big_endian;
00102                 bool initialized;
00103                 bool is_new_file;
00104         };
00105 
00106 }
00107 
00108 #endif  //eman__omapio_h__