void RegistrationResult::read(const String &line) { algebra::VectorD<4> quaternion; String s = line; size_t n; n=s.find("|"); set_image_index(std::atoi(s.substr(0,n).c_str())); s=s.substr(n+1); n=s.find("|"); set_projection_index(std::atoi(s.substr(0,n).c_str())); s=s.substr(n+1); n=s.find("|"); phi_ =std::atof(s.substr(0,n).c_str()); s=s.substr(n+1); n=s.find("|"); theta_ =std::atof(s.substr(0,n).c_str()); s=s.substr(n+1); n=s.find("|"); psi_ =std::atof(s.substr(0,n).c_str()); s=s.substr(n+1); n=s.find("|"); quaternion[0] =std::atof(s.substr(0,n).c_str()); s=s.substr(n+1); n=s.find("|"); quaternion[1] =std::atof(s.substr(0,n).c_str()); s=s.substr(n+1); n=s.find("|"); quaternion[2] =std::atof(s.substr(0,n).c_str()); s=s.substr(n+1); n=s.find("|"); quaternion[3] =std::atof(s.substr(0,n).c_str()); s=s.substr(n+1); n=s.find("|"); shift_[0] =std::atof(s.substr(0,n).c_str()); s=s.substr(n+1); n=s.find("|"); shift_[1] =std::atof(s.substr(0,n).c_str()); s=s.substr(n+1); n=s.find("|"); set_ccc(std::atof(s.substr(0,n).c_str())); R_ = algebra::get_rotation_from_vector4d(quaternion); }
void RegistrationResult::set_random_registration(unsigned int index, double maximum_shift) { // Random point in the sphere, pick to ensure even distribution double u=get_random_between_zero_and_one(); double v=get_random_between_zero_and_one(); double w=get_random_between_zero_and_one(); double phi = 2*PI*u; double theta = acos((2*v-1))/2; double psi=2*PI*w; set_rotation(phi,theta,psi); shift_[0] = maximum_shift*get_random_between_zero_and_one(); shift_[1] = maximum_shift*get_random_between_zero_and_one(); set_ccc(0.0); set_name(""); set_projection_index(index); set_image_index(0); }
void RegistrationResult::set_random_registration(unsigned int index, double maximum_shift) { ::boost::uniform_real<> rand(0., 1.); // Random point in the sphere, pick to ensure even distribution double u = rand(random_number_generator); double v = rand(random_number_generator); double w = rand(random_number_generator); double phi = 2 * PI * u; double theta = acos((2 * v - 1)) / 2; double psi = 2 * PI * w; set_rotation(phi, theta, psi); shift_[0] = maximum_shift * rand(random_number_generator); shift_[1] = maximum_shift * rand(random_number_generator); set_ccc(0.0); set_name(""); set_projection_index(index); set_image_index(0); }