Eigen::MatrixXd eddy2scheme (const Eigen::MatrixXd& config, const Eigen::Array<int, Eigen::Dynamic, 1>& indices) { if (config.cols() != 4) throw Exception ("Expected 4 columns in EDDY-format phase-encoding config file"); Eigen::MatrixXd result (indices.size(), 4); for (ssize_t row = 0; row != indices.size(); ++row) { if (indices[row] > config.rows()) throw Exception ("Malformed EDDY-style phase-encoding information: Index exceeds number of config entries"); result.row(row) = config.row(indices[row]-1); } return result; }
mglData mgl(const Eigen::Array<Scalar, Eigen::Dynamic, 1>& d) { return mglData(d.size(), d.data()); }