8 #ifndef IMPEM2D_PROJECTION_FINDER_H
9 #define IMPEM2D_PROJECTION_FINDER_H
11 #include <IMP/em2d/em2d_config.h>
27 #include <cereal/access.hpp>
28 #include <cereal/types/base_class.hpp>
30 IMPEM2D_BEGIN_NAMESPACE
34 const unsigned int ALIGN2D_PREPROCESSING = 1;
35 const unsigned int ALIGN2D_WITH_CENTERS = 2;
40 friend class cereal::access;
42 template<
class Archive>
void serialize(Archive &ar) {
43 ar(cereal::base_class<ProjectingParameters>(
this));
44 ar(n_projections, coarse_registration_method, save_match_images,
45 optimization_steps, simplex_initial_length, simplex_minimum_size);
48 void init_defaults() {
49 coarse_registration_method = ALIGN2D_PREPROCESSING;
50 save_match_images =
false;
51 optimization_steps = 5;
52 simplex_initial_length = 0.1;
53 simplex_minimum_size = 0.01;
59 unsigned int coarse_registration_method;
60 bool save_match_images;
61 unsigned int optimization_steps;
62 double simplex_initial_length;
63 double simplex_minimum_size;
74 void show(std::ostream &out = std::cout)
const {
75 out <<
"Em2DRestraintParameters: " << std::endl <<
"pixel_size "
76 << pixel_size <<
" resolution " << resolution
77 <<
" coarse_registration_method " << coarse_registration_method
78 <<
" optimization_steps " << optimization_steps
79 <<
" simplex_initial_length " << simplex_initial_length
80 <<
" simplex_minimum_size " << simplex_minimum_size << std::endl;
89 :
Object(
"ProjectionFinder%1%"),
90 parameters_setup_(
false),
91 registration_done_(
false) {};
97 score_function_ = score_function;
101 masks_manager_->setup_kernel(params.resolution, params.pixel_size);
102 fast_optimization_mode_ =
false;
103 parameters_setup_ =
true;
104 preprocessing_time_ = 0.0;
105 coarse_registration_time_ = 0.0;
106 fine_registration_time_ = 0.0;
116 void set_variance_images(
const em2d::Images &variances);
129 bool get_save_match_images()
const {
return params_.save_match_images; }
135 void set_fast_mode(
unsigned int n);
147 void get_coarse_registration();
151 void get_complete_registration();
157 void show(std::ostream &out)
const;
160 double get_preprocessing_time()
const;
163 double get_coarse_registration_time()
const;
166 double get_fine_registration_time()
const;
168 unsigned int get_number_of_subjects()
const {
return subjects_.size(); }
170 void set_number_of_class_averages_members(
Ints n_members) {
171 n_members_ = n_members;
174 unsigned int get_number_of_projections()
const {
return projections_.size(); }
179 double preprocessing_time_, coarse_registration_time_,
180 fine_registration_time_;
182 void get_coarse_registrations_for_subject(
unsigned int i,
185 void do_preprocess_projection(
unsigned int j);
186 void do_preprocess_subject(
unsigned int i);
190 void do_preprocess_for_fast_coarse_registration(
const cv::Mat &m,
192 cv::Mat &POLAR_AUTOC);
202 bool particles_set_, parameters_setup_, registration_done_,
203 fast_optimization_mode_;
205 unsigned int number_of_optimized_projections_;
207 std::vector<cv::Mat> SUBJECTS_;
209 std::vector<cv::Mat> SUBJECTS_POLAR_AUTOC_;
210 std::vector<cv::Mat> PROJECTIONS_POLAR_AUTOC_;
224 IMPEM2D_END_NAMESPACE
Generation of projections from models or density maps Copyright 2007-2022 IMP Inventors. All rights reserved.
void set_save_match_images(bool x)
Represent a rotation in 2D space.
projection masks Copyright 2007-2023 IMP Inventors. All rights reserved.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Alignment of images in 2D Copyright 2007-2022 IMP Inventors. All rights reserved. ...
Interface with OpenCV Copyright 2007-2022 IMP Inventors. All rights reserved.
A more IMP-like version of the std::vector.
const unsigned int ALIGN2D_NO_PREPROCESSING
Methods for registration used by the finder.
IMP images for Electron Microscopy using openCV matrices Copyright 2007-2022 IMP Inventors. All rights reserved.
A smart pointer to a reference counted object.
Scoring functions for 2D Copyright 2007-2022 IMP Inventors. All rights reserved.
#define IMP_VALUES(Name, PluralName)
Define the type for storing sets of values.
Common base class for heavy weight IMP objects.
Base class for all scoring functions related to em2d.
Functions related with rotations in em2d Copyright 2007-2022 IMP Inventors. All rights reserved...
em2d::Images subjects_
Main parameters.
void setup(ScoreFunction *score_function, const Em2DRestraintParameters ¶ms)
Initializes the parameters to generate and match projections.
IMP::Vector< RegistrationResult > RegistrationResults
Simple 3D rotation class.
Parameters needed for the core projection routine.
Classes to handle individual model particles. (Note that implementation of inline functions is in int...
std::ostream & show(Hierarchy h, std::ostream &out=std::cout)
Print the hierarchy using a given decorator to display each node.
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing lists of object pointers.
A nullptr-initialized pointer to an IMP Object.
Parameters used by Em2DRestraint and ProjectionFinder.
unsigned int n_projections
Number of model projections to generate when scoring.
Object(std::string name)
Construct an object with the given name.
void show(std::ostream &out=std::cout) const
MasksManagerPtr masks_manager_
IMP::Vector< Int > Ints
Standard way to pass a bunch of Int values.
double get_global_score(const RegistrationResults &RRs)
Registration results class Copyright 2007-2022 IMP Inventors. All rights reserved.
Class to perform registration of model projections to images.
Management of projection masks.
void set_was_used(bool tf) const