IMP  2.1.0
The Integrative Modeling Platform
EMReaderWriter.h
Go to the documentation of this file.
1 /**
2  * \file IMP/em/EMReaderWriter.h
3  * \brief Classes to read or write density files in EM format.
4  *
5  * Copyright 2007-2013 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPEM_EM_READER_WRITER_H
10 #define IMPEM_EM_READER_WRITER_H
11 
12 #include <IMP/em/em_config.h>
13 #include "MapReaderWriter.h"
14 #include "DensityHeader.h"
15 #include "internal/EMHeader.h"
16 #include "def.h"
17 
18 IMPEM_BEGIN_NAMESPACE
19 /** Reader/writer for EM. */
20 class IMPEMEXPORT EMReaderWriter : public MapReaderWriter
21 {
22 public:
23 #if !defined(DOXYGEN) && !defined(SWIG)
24  //! Reads a density file in EM format and stores the information
25  /**
26  \param[in] filename name of the file to read
27  \param[in] data pointer to the data
28  \param[in] header DensityHeader() to store the header information
29  \exception IOException in case that the filename was not found
30  */
31  void read(const char *filename, float **data, DensityHeader &header);
32  //! Writes a density file in EM format with the header information
33  /**
34  \param[in] filename name of the file to read
35  \param[in] data pointer to the data
36  \param[in] header DensityHeader() with the header information
37  */
38  void write(const char* filename, const float *data,
39  const DensityHeader &header);
40 #endif
41 protected:
42  //! Reads the header
43  //! Reads the data
44  /**
45  \param file ifstream of the file to read
46  \param header internal::EMHeader to store the header information
47  */
48  void read_header(std::ifstream &file, internal::EMHeader &header);
49  //! Reads the data
50  /**
51  \param file ifstream of the file to read
52  \param data pointer to store the data
53  \param header internal::EMHeader to store the header information
54  \exception IOException if the data allocation had failed
55  \exception IOException is the requested data type is not implemented
56  */
57  void read_data(std::ifstream &file, float **data,
58  const internal::EMHeader &header);
59  //! Writes the header
60  /**
61  \param[in] s
62  \param[in] header internal::EMHeader with the header information
63  \exception IOException if the writing operation had failed.
64  */
65  void write_header(std::ostream& s, const internal::EMHeader &header);
66 
68 };
69 
70 IMPEM_END_NAMESPACE
71 
72 #endif /* IMPEM_EM_READER_WRITER_H */
The base class to handle reading and writing of density maps.
Definitions for EMBED.
Metadata for a density file.
An abstract class for reading a map.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.