vtkio.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__vtkio_h__
00037 #define eman__vtkio_h__ 1
00038 
00039 #include "imageio.h"
00040 
00041 namespace EMAN
00042 {
00043 
00076         class VtkIO:public ImageIO
00077         {
00078           public:
00079                 explicit VtkIO(const string & filename, IOMode rw_mode = READ_ONLY);
00080                 ~VtkIO();
00081 
00082                 DEFINE_IMAGEIO_FUNC;
00083                 static bool is_valid(const void *first_block);
00084 
00085           private:
00086                 static const char *MAGIC;
00087 
00088                 enum VtkType
00089                 {
00090                         VTK_UNKNOWN,
00091                         VTK_ASCII,
00092                         VTK_BINARY                      
00093                 };
00094 
00095                 enum DataType
00096                 {
00097                         DATATYPE_UNKNOWN,
00098                         BIT,
00099                         UNSIGNED_CHAR,
00100                         CHAR,                   
00101                         UNSIGNED_SHORT,
00102                         SHORT,
00103                         UNSIGNED_INT,
00104                         INT,
00105                         UNSIGNED_LONG,
00106                         LONG,
00107                         FLOAT,
00108                         DOUBLE
00109                 };
00110 
00111                 enum DatasetType
00112                 {
00113                         DATASET_UNKNOWN,
00114                         STRUCTURED_POINTS,
00115                         STRUCTURED_GRID,
00116                         RECTILINEAR_GRID,
00117                         UNSTRUCTURED_GRID,
00118                         POLYDATA
00119                 };
00120                 
00121                 int to_em_datatype(int vtk_datatype);
00122                 int get_mode_size(DataType d);
00123                 
00124                 void read_dataset(DatasetType dstype);
00125                 DataType get_datatype_from_name(const string& datatype_name);
00126                 DatasetType get_datasettype_from_name(const string& dataset_name);
00127         
00128                 string filename;
00129                 IOMode rw_mode;
00130                 FILE *vtk_file;
00131                 bool is_big_endian;
00132                 bool is_new_file;
00133                 bool initialized;
00134 
00135                 DataType datatype;
00136                 VtkType filetype;
00137                 int nx;
00138                 int ny;
00139                 int nz;
00140                 float originx;
00141                 float originy;
00142                 float originz;
00143                 float spacingx;
00144                 float spacingy;
00145                 float spacingz;
00146                 off_t file_offset;
00147 
00148         };
00149 
00150 }
00151 
00152 #endif  //eman__vtkio_h__

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