Esempio n. 1
0
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();
}
Esempio n. 2
0
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;
}