double Em2DRestraint::unprotected_evaluate(DerivativeAccumulator *accum) const { IMP_UNUSED(accum); IMP_USAGE_CHECK(!accum, "No derivatives provided"); IMP_NEW(Model, model, ()); model = get_model(); // Project the model RegistrationResults regs = get_evenly_distributed_registration_results(params_.n_projections); unsigned int rows = em_images_[0]->get_header().get_number_of_rows(); unsigned int cols = em_images_[0]->get_header().get_number_of_columns(); ProjectingOptions options(params_.pixel_size, params_.resolution); Images projections = get_projections(particles_container_->get_particles(), regs, rows, cols, options); finder_->set_projections(projections); if (only_coarse_registration_) { IMP_LOG_TERSE("Em2DRestraint::unprotected::evaluate: Coarse registration" << std::endl); finder_->get_coarse_registration(); } else { if (fast_optimization_mode_) { IMP_LOG_TERSE("Em2DRestraint::unprotected::evaluate: Fast Mode " << number_of_optimized_projections_ << " projections optimized" << std::endl); finder_->set_fast_mode(number_of_optimized_projections_); } IMP_LOG_TERSE("Em2DRestraint::unprotected::evaluate: Complete registration" << std::endl); finder_->get_complete_registration(); } return finder_->get_global_score(); }
int FeatureIO::update ( ) { int rv; rv=get_projections(); return rv; } /* ----- end of method imageSensor::update ----- */
Images create_evenly_distributed_projections(const ParticlesTemp &ps, unsigned int n, const ProjectingOptions &options) { IMP_LOG_TERSE("creating evenly distributed projections" << std::endl); // Sphere that encloses_the_particles IMP_NEW(Particle, p, (ps[0]->get_model(), "cover Particle")); core::XYZs xyzs(ps); unsigned int size = get_enclosing_image_size(ps, options.pixel_size, 4); RegistrationResults regs = get_evenly_distributed_registration_results(n); Images projections = get_projections(ps, regs, size, size, options); return projections; }
IMPEM2D_BEGIN_NAMESPACE em2d::Images get_projections(const ParticlesTemp &ps, const algebra::SphericalVector3Ds &vs, int rows, int cols, const ProjectingOptions &options, Strings names) { IMP_LOG_VERBOSE("Generating projections from spherical vectors" << std::endl); unsigned long n_projs = vs.size(); RegistrationResults registration_values(n_projs); for (unsigned long i = 0; i < n_projs; ++i) { algebra::Rotation3D R = em2d::internal::get_rotation_from_projection_direction(vs[i]); algebra::Vector2D shift(0.0, 0.0); RegistrationResult rr(R, shift); registration_values[i] = rr; } return get_projections(ps, registration_values, rows, cols, options, names); }