emimio.h

Go to the documentation of this file.
00001 
00005 /*
00006  * Author: Steven Ludtke, 04/10/2003 (sludtke@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__emimio_h__
00037 #define eman__emimio_h__ 1
00038 
00039 #include "imageio.h"
00040 
00041 namespace EMAN
00042 {
00048         class EmimIO:public ImageIO
00049         {
00050           public:
00051                 explicit EmimIO(const string & filename, IOMode rw_mode = READ_ONLY);
00052                 ~EmimIO();
00053 
00054                 DEFINE_IMAGEIO_FUNC;
00055                 static bool is_valid(const void *first_block);
00056 
00057                 
00058                 bool is_single_image_format() const
00059                 {
00060                         return false;
00061                 }
00062                 int get_nimg();
00063           private:
00064                 static const char *MAGIC;
00065 
00066                 enum
00067                 {
00068                         EMIM_COMPLEX = 1,
00069                         PARM_NONE = 0,
00070                         PARM_NORM = 1,
00071                         NUM_INT_IN_FILE_HEADER = 16
00072                 };
00073 
00074                 struct EmimFileHeader
00075                 {
00076                         char magic[4];          // 'EMIM'
00077                         int order;                      // This defines the byte order, value is 2 on correct machine
00078                         int count;                      // # images in the file (24 bits max)
00079                         int nx;
00080                         int ny;
00081                         int nz;                         // image size (all images in 1 file have same size)
00082                         int flag;                       // flags are the same as well
00083                         float pixel;            // pixel/voxel size in A
00084                         int misc[7];            // misc usage
00085                         int headlen;            // length of individual image headers (currently 166 x 4)
00086                         char name[64];          // optional description of entire set of images
00087                 };
00088 
00089                 struct EmimImageHeader
00090                 {
00091                         char name[80];          // data set name
00092                         unsigned int time;      // time at which image was acquired
00093                         int mgnum;                      // micrograph number or CCD frame
00094                         int clipnum;            // id of clip within micrograph/frame
00095                         int id;                         // another id number
00096                         float dx;
00097                         float dy;
00098                         float dz;                       // translation
00099                         float alt, az, phi;     // orientation
00100                         short nparm;            // number of parameter sets
00101                         int ptype[4];           // type of each parameter set
00102                         float param[4][32];     // Parameterized CTF/SNR, etc...
00103                 };
00104 
00105           private:
00106                 string filename;
00107                 IOMode rw_mode;
00108                 EmimFileHeader efh;
00109                 FILE *emim_file;
00110                 bool is_big_endian;
00111                 bool initialized;
00112         };
00113 }
00114 
00115 
00116 #endif  //eman__emimio_h__

Generated on Tue Jun 11 12:40:22 2013 for EMAN2 by  doxygen 1.4.7