7 #ifndef IMPEM2D_POLAR_RESAMPLING_PARAMETERS_H
8 #define IMPEM2D_POLAR_RESAMPLING_PARAMETERS_H
10 #include <IMP/em2d/em2d_config.h>
17 #include <cereal/access.hpp>
20 IMPEM2D_BEGIN_NAMESPACE
28 parameters_set_ =
false;
43 setup(m.rows(), m.cols());
52 void setup(
unsigned int rows,
unsigned int cols) {
53 starting_radius_ = 5.0;
58 std::min(rows / 2., cols / 2.);
61 (ending_radius_ - starting_radius_) / (static_cast<double>(n_rings_));
62 parameters_set_ =
true;
64 << rows <<
" x " << cols <<
" Starting radius= "
65 << starting_radius_ <<
" Ending radius= " << ending_radius_
66 <<
" Rings= " << n_rings_ << std::endl);
72 return starting_radius_;
78 return ending_radius_;
85 "PolarResamplingParameters: Requested ring is above the "
87 return starting_radius_ + n_ring * radius_step_;
101 angle_step_ = (2 * PI) / static_cast<double>(n_angles_);
114 if (get_is_setup() ==
false) {
115 IMP_THROW(
"trying to get radius_step before initializing",
124 void create_maps_for_resampling();
136 void show(std::ostream &out)
const {
137 out <<
"starting_radius = " << starting_radius_ << std::endl;
138 out <<
"ending_radius = " << ending_radius_ << std::endl;
139 out <<
"n_rings = " << n_rings_ << std::endl;
142 bool get_is_setup()
const {
143 if (parameters_set_)
return true;
149 internal::RowMajorArray<float> polar_map_;
150 double starting_radius_;
151 double ending_radius_;
153 unsigned int n_rings_, n_angles_, matrix_rows_, matrix_cols_;
154 bool parameters_set_;
155 double radius_step_, angle_step_;
158 friend class cereal::access;
160 template<
class Archive>
void serialize(Archive &ar) {
161 ar(polar_map_, starting_radius_,
162 ending_radius_, n_rings_, n_angles_, matrix_rows_, matrix_cols_,
163 parameters_set_, radius_step_, angle_step_);
169 IMPEM2D_END_NAMESPACE
void get_resampling_map(internal::RowMajorArray< float > &m1) const
Get the map of the (row, column) coordinates of each sample.
Various useful constants.
void set_estimated_number_of_angles(unsigned int aprox_value)
#define IMP_LOG_VERBOSE(expr)
PolarResamplingParameters(const DoubleMatrix &m)
Exception definitions and assertions.
A more IMP-like version of the std::vector.
double get_ending_radius() const
Gets the largest radius.
#define IMP_VALUES(Name, PluralName)
Define the type for storing sets of values.
double get_angle_step() const
get the angular step used
Logging and error reporting support.
double get_radius_step() const
Get the step for the radius coordinate.
double get_starting_radius() const
Gets the initial radius of the resampling.
Matrices used to store image data Copyright 2007-2026 IMP Inventors. All rights reserved.
unsigned int get_number_of_rings() const
Get the number of rings (that is, the number of radius values considered)
Various useful constants.
int get_optimal_dft_size(int n)
Get the smallest size >= n that can be transformed efficiently by FFT.
std::ostream & show(Hierarchy h, std::ostream &out=std::cout)
Print the hierarchy using a given decorator to display each node.
unsigned int get_number_of_angles() const
#define IMP_THROW(message, exception_name)
Throw an exception with a message.
void setup(unsigned int rows, unsigned int cols)
double get_radius(unsigned int n_ring) const
Gets the current radius employed for the ring in consideration)
PolarResamplingParameters(unsigned int rows, unsigned int cols)
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
Logging and error reporting support.
Eigen::Array< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > DoubleMatrix
Matrix of doubles, used to store the data of an image.
Operations involving FFT Copyright 2007-2026 IMP Inventors. All rights reserved.
An exception for an invalid value being passed to IMP.