IMP
2.0.1
The Integrative Modeling Platform
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
align2D.h
Go to the documentation of this file.
1
/*!
2
* \file align2D.h
3
* \brief Alignment of images in 2D
4
* Copyright 2007-2013 IMP Inventors. All rights reserved.
5
*/
6
7
#ifndef IMPEM2D_ALIGN_2D_H
8
#define IMPEM2D_ALIGN_2D_H
9
10
#include "IMP/em2d/em2d_config.h"
11
#include "
IMP/em2d/PolarResamplingParameters.h
"
12
#include "
IMP/algebra/utility.h
"
13
#include "
IMP/algebra/Transformation2D.h
"
14
#include "
IMP/algebra/Vector2D.h
"
15
#include <algorithm>
16
#include <vector>
17
18
IMPEM2D_BEGIN_NAMESPACE
19
20
//! Definition of the result of an alignment. Contains the transformation
21
//! to apply to the matrix to align and the cross correlation of the solution
22
typedef
std::pair<algebra::Transformation2D,double>
ResultAlign2D
;
23
24
//! Aligns completely two matrices (rotationally and translationally).
25
//! Uses the autocorrelation function to speed up the rotational alignment
26
/*!
27
\param[in] input Reference matrix
28
\param[in] m_to_align Matrix to align to the reference
29
\param[in] apply if true, apply the transformation
30
to m_to_align after alignment
31
\return The result. Check the definition of ResultAlign2D
32
*/
33
IMPEM2DEXPORT
ResultAlign2D
get_complete_alignment
(
const
cv::Mat &input,
34
cv::Mat &m_to_align,
bool
apply=
false
);
35
36
//! Aligns two matrices rotationally. Based on the autocorrelation function
37
//! of the matrices.
38
/*!
39
\param[in] input Reference matrix
40
\param[in] m_to_align Matrix to align to the reference
41
\param[in] apply if true, apply the transformation
42
to m_to_align after alignment
43
\return The result. Check the definition of ResultAlign2D
44
*/
45
IMPEM2DEXPORT
em2d::ResultAlign2D
get_rotational_alignment
(
const
cv::Mat &input,
46
cv::Mat &m_to_align,
bool
apply=
false
);
47
48
49
//! Aligns two matrices translationally
50
/*!
51
\param[in] input Reference matrix
52
\param[in] m_to_align Matrix to align to the reference
53
\param[in] apply if true, apply the transformation
54
to m_to_align after alignment
55
\return The result. Check the definition of ResultAlign2D
56
*/
57
IMPEM2DEXPORT
ResultAlign2D
get_translational_alignment
(
const
cv::Mat &input,
58
cv::Mat &m_to_align,
bool
apply=
false
);
59
60
61
//! Aligns two matrices rotationally and translationally without
62
//! performing preprocessing. Preprocessed data must be provided.
63
/*!
64
\param[in] input first matrix
65
\param[in] INPUT fft of the first matrix
66
\param[in] POLAR1 fft of the autocorrelation (in polars) of the input.
67
\param[in] m_to_align the matrix to align with the input
68
\param[in] POLAR2 fft of the autocorrelation (in polars) of m_to_align
69
\param[in] apply true if m_to_align is transformed at the end
70
\return The result. Check the definition of ResultAlign2D
71
*/
72
IMPEM2DEXPORT
em2d::ResultAlign2D
get_complete_alignment_no_preprocessing
(
73
const
cv::Mat &input,
74
const
cv::Mat &INPUT,
const
cv::Mat &POLAR1,
75
cv::Mat &m_to_align,
const
cv::Mat &POLAR2,
bool
apply=
false
);
76
77
//! Computes the rotational alignment for two autocorrelation matrices
78
//! It is assumed that the arguments are FFTs
79
/*!
80
\param[in] M1 fft of the first autocorrelation (in polars)
81
\param[in] M2 fft of the second autocorrelation (in polars)
82
\return The result. Check the definition of ResultAlign2D
83
*/
84
IMPEM2DEXPORT
ResultAlign2D
get_rotational_alignment_no_preprocessing
(
85
const
cv::Mat &POLAR1,
86
const
cv::Mat &POLAR2);
87
88
//! Aligns two matrices translationally without preprocessing. The preprocessed
89
//! data must be provided.
90
/*!
91
\param[in] M1 the dft the first matrix (input)
92
\param[in] M2 the dft of the matrix to align with the input
93
\return The result. Check the definition of ResultAlign2D
94
*/
95
IMPEM2DEXPORT
ResultAlign2D
get_translational_alignment_no_preprocessing
(
96
const
cv::Mat &M1,
97
const
cv::Mat &M2);
98
99
100
101
102
103
//! Aligns two matrices (rotation and translation) using centers and
104
//! no preprocessing. Preprocessed data must be provided.
105
/*!
106
\param[in] center1 weighted centroid of the reference matrix
107
\param[in] center2 weighted centroid of the matrix to align
108
\param[in] AUTOC_POLAR1 fft of the autocorrelation (in polars) of the input.
109
\param[in] AUTOC_POLAR2 fft of the autocorrelation (in polars) of m_to_align
110
\return The result. Check the definition of ResultAlign2D
111
*/
112
IMPEM2DEXPORT
ResultAlign2D
113
get_complete_alignment_with_centers_no_preprocessing
(
114
const
algebra::Vector2D
¢er1,
115
const
algebra::Vector2D
¢er2,
116
const
cv::Mat &AUTOC_POLAR1,
117
const
cv::Mat &AUTOC_POLAR2);
118
119
120
IMPEM2D_END_NAMESPACE
121
122
#endif
/* IMPEM2D_ALIGN_2D_H */