Xmipp
v3.23.11-Nereus
xmipp
libraries
reconstruction
phantom_movie.h
Go to the documentation of this file.
1
/***************************************************************************
2
*
3
* Authors: David Strelak (davidstrelak@gmail.com)
4
*
5
* Unidad de Bioinformatica of Centro Nacional de Biotecnologia , CSIC
6
*
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 2 of the License, or
10
* (at your option) any later version.
11
*
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, write to the Free Software
19
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20
* 02111-1307 USA
21
*
22
* All comments concerning this program package may be sent to the
23
* e-mail address 'xmipp@cnb.csic.es'
24
***************************************************************************/
25
26
#pragma once
27
28
#include "
core/xmipp_filename.h
"
29
#include "
data/dimensions.h
"
30
31
template
<
typename
T>
32
class
MultidimArray
;
33
37
template
<
typename
T>
38
class
PhantomMovie
final
39
{
40
public
:
41
struct
DisplacementParams
42
{
43
float
a1
;
44
float
a2
;
45
float
b1
;
46
float
b2
;
47
float
k1_start
;
48
float
k1_end
;
49
float
k2_start
;
50
float
k2_end
;
51
bool
simple
;
52
static
constexpr
auto
doc
=
"x(t) = a1*t + a2*t*t + cos(t)/10\n"
53
"y(t) = b1*t + b2*t*t + sin(t*t)/5\n"
54
"The barrel/pincushion transform params are linearly interpolated between first and last frame.\n"
55
"For normalized coordinates ([-1..1]) its distance is given by:\n"
56
"r_out = r_in(1 + k1*(r_in)^2 + k2*(r_in)^4"
57
"X and Y shift can be overriden, then only a1 and b1 will be used"
;
58
static
constexpr
auto
shift_param
=
"--shift"
;
59
static
constexpr
auto
barrel_param
=
"--barrel"
;
60
static
constexpr
auto
simple_param
=
"--simple"
;
61
};
62
63
struct
Options
64
{
65
bool
skipBarrel
;
66
bool
skipShift
;
67
bool
shiftAfterBarrel
;
68
bool
skipDose
;
69
bool
skipIce
;
70
};
71
72
struct
Ice
73
{
74
int
seed
;
75
float
avg
;
76
float
stddev
;
77
float
min
;
78
float
max
;
79
float
low_w1
;
80
float
low_raised_w
;
81
};
82
83
struct
Params
84
{
85
Dimensions
req_size =
Dimensions
(1);
86
Dimensions
work_size =
Dimensions
(1);
87
FileName
fn_out
;
88
FileName
fn_gain
;
89
FileName
fn_dark
;
90
};
91
92
enum class
PhantomType
93
{
94
grid,
95
particleCross,
96
particleCircle
97
};
98
99
struct
Content
100
{
101
PhantomType
type
;
102
size_t
xstep
;
// of the grid
103
size_t
ystep
;
// of the grid
104
size_t
thickness
;
// of the line
105
size_t
minSize
;
// of the circle / cross
106
size_t
maxSize
;
// of the circle / cross
107
size_t
count
;
// of the circle / cross
108
float
signal_val
;
109
int
seed
;
110
float
dose
;
111
};
112
113
PhantomMovie
(DisplacementParams dp, Options o, Ice
i
, Content
c
, Params p) : params(p), dispParams(dp), options(o), ice(i), content(c) {}
114
115
void
run
()
const
;
116
117
private
:
118
void
addContent(
MultidimArray<T>
&movie)
const
;
119
void
addGrid(
MultidimArray<T>
&frame)
const
;
120
void
addCircles(
MultidimArray<T>
&frame)
const
;
121
void
addCrosses(
MultidimArray<T>
&frame)
const
;
122
T bilinearInterpolation(
const
MultidimArray<T>
&src,
float
x
,
float
y
)
const
;
123
auto
shiftX(
size_t
t)
const
;
124
auto
shiftY(
size_t
t)
const
;
125
void
generateIce(
MultidimArray<T>
&frame)
const
;
126
template
<
bool
SKIP_DOSE>
127
void
generateMovie(
const
MultidimArray<T>
&refFrame)
const
;
128
void
applyLowPass(
MultidimArray<T>
&frame)
const
;
129
void
displace(
float
&x,
float
&y,
size_t
n
)
const
;
130
MultidimArray<T>
findWorkSize()
const
;
131
132
const
Params params;
133
const
DisplacementParams dispParams;
134
const
Options options;
135
const
Ice ice;
136
const
Content content;
137
};
PhantomMovie::Ice
Definition:
phantom_movie.h:72
PhantomMovie::Ice::stddev
float stddev
Definition:
phantom_movie.h:76
PhantomMovie::Ice::max
float max
Definition:
phantom_movie.h:78
PhantomMovie::Ice::seed
int seed
Definition:
phantom_movie.h:74
PhantomMovie::Ice::avg
float avg
Definition:
phantom_movie.h:75
PhantomMovie::Ice::min
float min
Definition:
phantom_movie.h:77
PhantomMovie::DisplacementParams::doc
static constexpr auto doc
Definition:
phantom_movie.h:52
MultidimArray
Definition:
common_lines.h:35
PhantomMovie::Params::fn_out
FileName fn_out
Definition:
phantom_movie.h:87
PhantomMovie::DisplacementParams::a1
float a1
Definition:
phantom_movie.h:43
PhantomMovie::DisplacementParams::k2_end
float k2_end
Definition:
phantom_movie.h:50
xmipp_filename.h
c
doublereal * c
Definition:
numerical_recipes.cpp:2230
PhantomMovie::Content::count
size_t count
Definition:
phantom_movie.h:107
PhantomMovie< double >::PhantomType
PhantomType
Definition:
phantom_movie.h:92
y
static double * y
Definition:
numerical_recipes.cpp:8487
PhantomMovie::DisplacementParams::shift_param
static constexpr auto shift_param
Definition:
phantom_movie.h:58
PhantomMovie::Options::shiftAfterBarrel
bool shiftAfterBarrel
Definition:
phantom_movie.h:67
PhantomMovie::Options::skipIce
bool skipIce
Definition:
phantom_movie.h:69
PhantomMovie::Content::dose
float dose
Definition:
phantom_movie.h:110
FileName
Definition:
xmipp_filename.h:65
x
doublereal * x
Definition:
numerical_recipes.cpp:2230
i
#define i
Definition:
numerical_recipes.cpp:2493
dimensions.h
PhantomMovie::DisplacementParams::k2_start
float k2_start
Definition:
phantom_movie.h:49
PhantomMovie::Content::maxSize
size_t maxSize
Definition:
phantom_movie.h:106
PhantomMovie::DisplacementParams::simple
bool simple
Definition:
phantom_movie.h:51
PhantomMovie::Params::fn_gain
FileName fn_gain
Definition:
phantom_movie.h:88
PhantomMovie::Content::signal_val
float signal_val
Definition:
phantom_movie.h:108
PhantomMovie::Ice::low_raised_w
float low_raised_w
Definition:
phantom_movie.h:80
PhantomMovie::Params::fn_dark
FileName fn_dark
Definition:
phantom_movie.h:89
PhantomMovie::Options
Definition:
phantom_movie.h:63
PhantomMovie::DisplacementParams::b2
float b2
Definition:
phantom_movie.h:46
PhantomMovie::Content
Definition:
phantom_movie.h:99
PhantomMovie::DisplacementParams::barrel_param
static constexpr auto barrel_param
Definition:
phantom_movie.h:59
PhantomMovie::DisplacementParams
Definition:
phantom_movie.h:41
PhantomMovie::Content::minSize
size_t minSize
Definition:
phantom_movie.h:105
PhantomMovie::PhantomMovie
PhantomMovie(DisplacementParams dp, Options o, Ice i, Content c, Params p)
Definition:
phantom_movie.h:113
PhantomMovie::Ice::low_w1
float low_w1
Definition:
phantom_movie.h:79
PhantomMovie::DisplacementParams::b1
float b1
Definition:
phantom_movie.h:45
PhantomMovie::Content::seed
int seed
Definition:
phantom_movie.h:109
PhantomMovie
Definition:
phantom_movie.h:38
PhantomMovie::Options::skipShift
bool skipShift
Definition:
phantom_movie.h:66
PhantomMovie::run
void run() const
Definition:
phantom_movie.cpp:315
PhantomMovie::DisplacementParams::simple_param
static constexpr auto simple_param
Definition:
phantom_movie.h:60
PhantomMovie::Content::ystep
size_t ystep
Definition:
phantom_movie.h:103
Dimensions
Definition:
dimensions.h:35
PhantomMovie::DisplacementParams::k1_end
float k1_end
Definition:
phantom_movie.h:48
PhantomMovie::Content::type
PhantomType type
Definition:
phantom_movie.h:101
PhantomMovie::DisplacementParams::a2
float a2
Definition:
phantom_movie.h:44
PhantomMovie::Content::thickness
size_t thickness
Definition:
phantom_movie.h:104
PhantomMovie::Options::skipBarrel
bool skipBarrel
Definition:
phantom_movie.h:65
PhantomMovie::Options::skipDose
bool skipDose
Definition:
phantom_movie.h:68
PhantomMovie::DisplacementParams::k1_start
float k1_start
Definition:
phantom_movie.h:47
n
int * n
Definition:
numerical_recipes.cpp:2229
PhantomMovie::Params
Definition:
phantom_movie.h:83
PhantomMovie::Content::xstep
size_t xstep
Definition:
phantom_movie.h:102
Generated by
1.8.13