EMAN2
emdata_io.h
Go to the documentation of this file.
1/*
2 * Author: Steven Ludtke, 04/10/2003 (sludtke@bcm.edu)
3 * Probable contributing author: Liwei Peng
4 * Copyright (c) 2000-2006 Baylor College of Medicine
5 *
6 * This software is issued under a joint BSD/GNU license. You may use the
7 * source code in this file under either license. However, note that the
8 * complete EMAN2 and SPARX software packages have some GPL dependencies,
9 * so you are responsible for compliance with the licenses of these packages
10 * if you opt to use BSD licensing. The warranty disclaimer below holds
11 * in either instance.
12 *
13 * This complete copyright notice must be included in any revised version of the
14 * source code. Additional authorship citations may be added, but existing
15 * author citations must be preserved.
16 *
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation; either version 2 of the License, or
20 * (at your option) any later version.
21 *
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * You should have received a copy of the GNU General Public License
28 * along with this program; if not, write to the Free Software
29 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 *
31 * */
32
37#ifndef emdata__io_h__
38#define emdata__io_h__
39
40
41private:
42void _read_image(ImageIO *imageio, int img_index = 0,
43 bool header_only = false,
44 const Region * region = 0, bool is_3d = false);
45
46void _write_image(ImageIO *imageio,
47 int img_index = 0,
48 EMUtil::ImageType imgtype = EMUtil::IMAGE_UNKNOWN,
49 bool header_only = false,
50 const Region * region = 0,
51 EMUtil::EMDataType filestoragetype = EMUtil::EM_FLOAT,
52 bool use_host_endian = true);
53
54public:
73void read_image(const string & filename, int img_index = 0,
74 bool header_only = false,
75 const Region * region = 0, bool is_3d = false,
76 EMUtil::ImageType imgtype = EMUtil::IMAGE_UNKNOWN);
77
89void read_binedimage(const string & filename, int img_index = 0, int binfactor=0, bool fast = false, bool is_3d = false);
90
91
115void write_image(const string & filename,
116 int img_index = 0,
117 EMUtil::ImageType imgtype = EMUtil::IMAGE_UNKNOWN,
118 bool header_only = false,
119 const Region * region = 0,
120 EMUtil::EMDataType filestoragetype = EMUtil::EM_FLOAT,
121 bool use_host_endian = true);
122
123
131void append_image(const string & filename,
132 EMUtil::ImageType imgtype = EMUtil::IMAGE_UNKNOWN,
133 bool header_only = false);
134
142void write_lst(const string & filename,
143 const string & reffile="", int refn=-1,
144 const string & comment="");
145
146
157static vector<std::shared_ptr<EMData>> read_images(const string & filename,
158 vector<int> img_indices = vector<int>(),
159 EMUtil::ImageType imgtype = EMUtil::IMAGE_UNKNOWN,
160 bool header_only = false);
161
174static bool write_images(const string & filename,
175 vector<std::shared_ptr<EMData>> imgs,
176 EMUtil::ImageType imgtype = EMUtil::IMAGE_UNKNOWN,
177 bool header_only = false,
178 const Region * region = nullptr,
179 EMUtil::EMDataType filestoragetype = EMUtil::EM_FLOAT,
180 bool use_host_endian = true);
181
182friend ostream& operator<<(ostream& out, const EMData& obj);
183
184#endif //emdata__io_h__
void write_lst(const string &filename, const string &reffile="", int refn=-1, const string &comment="")
Append data to a LST image file.
Definition: emdata_io.cpp:361
void append_image(const string &filename, EMUtil::ImageType imgtype=EMUtil::IMAGE_UNKNOWN, bool header_only=false)
append to an image file; If the file doesn't exist, create one.
void read_binedimage(const string &filename, int img_index=0, int binfactor=0, bool fast=false, bool is_3d=false)
read in a binned image, bin while reading.
Definition: emdata_io.cpp:124
void _read_image(ImageIO *imageio, int img_index=0, bool header_only=false, const Region *region=0, bool is_3d=false)
This file is a part of "emdata.h", to use functions in this file, you should "#include "emdata....
friend ostream & operator<<(ostream &out, const EMData &obj)
void write_image(const string &filename, int img_index=0, EMUtil::ImageType imgtype=EMUtil::IMAGE_UNKNOWN, bool header_only=false, const Region *region=0, EMUtil::EMDataType filestoragetype=EMUtil::EM_FLOAT, bool use_host_endian=true)
write the header and data out to an image.
static vector< std::shared_ptr< EMData > > read_images(const string &filename, vector< int > img_indices=vector< int >(), EMUtil::ImageType imgtype=EMUtil::IMAGE_UNKNOWN, bool header_only=false)
Read a set of images from file specified by 'filename'.
void _write_image(ImageIO *imageio, int img_index=0, EMUtil::ImageType imgtype=EMUtil::IMAGE_UNKNOWN, bool header_only=false, const Region *region=0, EMUtil::EMDataType filestoragetype=EMUtil::EM_FLOAT, bool use_host_endian=true)
void read_image(const string &filename, int img_index=0, bool header_only=false, const Region *region=0, bool is_3d=false, EMUtil::ImageType imgtype=EMUtil::IMAGE_UNKNOWN)
read an image file and stores its information to this EMData object.
static bool write_images(const string &filename, vector< std::shared_ptr< EMData > > imgs, EMUtil::ImageType imgtype=EMUtil::IMAGE_UNKNOWN, bool header_only=false, const Region *region=nullptr, EMUtil::EMDataType filestoragetype=EMUtil::EM_FLOAT, bool use_host_endian=true)
Write a set of images to file specified by 'filename'.