IMP
2.0.1
The Integrative Modeling Platform
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
SpiderReaderWriter.h
Go to the documentation of this file.
1
/**
2
* \file IMP/em/SpiderReaderWriter.h
3
* \brief Management of Spider Headers Electron Microscopy. Compatible with
4
* Spider and Xmipp formats
5
* Copyright 2007-2013 IMP Inventors. All rights reserved.
6
*/
7
8
#ifndef IMPEM_SPIDER_READER_WRITER_H
9
#define IMPEM_SPIDER_READER_WRITER_H
10
11
#include "IMP/em/em_config.h"
12
#include "
IMP/em/ImageHeader.h
"
13
#include "
IMP/em/header_converters.h
"
14
#include "
IMP/em/MapReaderWriter.h
"
15
#include "
IMP/em/DensityHeader.h
"
16
#include <
IMP/algebra/utility.h
>
17
#include <
IMP/algebra/endian.h
>
18
#include <
IMP/exception.h
>
19
#include <
IMP/log.h
>
20
#include <typeinfo>
21
#include <complex>
22
#include <string>
23
#include <cstdio>
24
#include <iostream>
25
#include <fstream>
26
#include <cstring>
27
28
IMPEM_BEGIN_NAMESPACE
29
30
//! Class to read EM maps (3D) in Spider and Xmipp formats
31
/**
32
* \note: Compatible only with Xmipp 2.2 and Spider floating point maps
33
* \note: A DensityHeader class must be provided
34
*/
35
class
IMPEMEXPORT
SpiderMapReaderWriter
:
public
MapReaderWriter
{
36
public
:
37
String
filename_;
38
bool
skip_type_check_;
39
bool
force_reversed_;
40
bool
skip_extra_checkings_;
41
42
//! Empty constructor. It does not force reversed header and does not
43
//! skip any of the tests
44
SpiderMapReaderWriter
() {
45
skip_type_check_=
false
;
46
force_reversed_=
false
;
47
skip_extra_checkings_=
false
;
48
}
49
50
//! Full constructor.
51
/**
52
* \param[in] filename file to read
53
* \param[in] skip_type_check if true, the check for type of image is skipped
54
* \param[in] force_reversed if true, the reverse mode is enforced
55
* for reading and writting
56
* \param[in] skip_extra_checkings if true, the most stringent
57
* tests for consistency of images are skipped when reading
58
*/
59
SpiderMapReaderWriter
(
String
filename,
bool
skip_type_check,
60
bool
force_reversed,
bool
skip_extra_checkings) {
61
filename_=filename;
62
skip_type_check_=skip_type_check;
63
force_reversed_=force_reversed;
64
skip_extra_checkings_=skip_extra_checkings;
65
}
66
#if !defined(DOXYGEN) && !defined(SWIG)
67
//! Reads a map in Spider format and transfers the data and header.
68
/**
69
* \param[in] filename file to read
70
* \param[in] data pointer to the structure where to store the data
71
* \param[in] header DensityHeader class where to store the info
72
* from the header.
73
*/
74
void
read(
const
char
*filename,
float
**data,
DensityHeader
&header);
75
76
//! Writes a map in Spider format from data and header.
77
/**
78
* \param[in] filename file to write
79
* \param[in] data pointer to the structure where data are stored
80
* \param[in] header DensityHeader class where the header info is stored
81
* data from the header.
82
*/
83
void
write(
const
char
*filename,
84
const
float
*data,
const
DensityHeader
&header);
85
#endif
86
IMP_OBJECT_INLINE
(
SpiderMapReaderWriter
,
87
{out <<
"SpiderMapReaderWriter"
;}, {});
88
};
89
90
IMPEM_END_NAMESPACE
91
92
#endif
/* IMPEM_SPIDER_READER_WRITER_H */