本文整理汇总了C++中math::Vector::load方法的典型用法代码示例。如果您正苦于以下问题:C++ Vector::load方法的具体用法?C++ Vector::load怎么用?C++ Vector::load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类math::Vector
的用法示例。
在下文中一共展示了Vector::load方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
void run ()
{
Image::Buffer<value_type> dwi_data (argument[0]);
if (dwi_data.ndim() != 4)
throw Exception ("dwi image should contain 4 dimensions");
Math::Matrix<value_type> grad = DWI::get_valid_DW_scheme<value_type> (dwi_data);
DWI::Shells shells (grad);
// Keep the b=0 shell (may be used for normalisation), but force single non-zero shell
shells.select_shells (true, true);
Math::Matrix<value_type> DW_dirs = DWI::gen_direction_matrix (grad, shells.largest().get_volumes());
Options opt = get_options ("lmax");
lmax = opt.size() ? opt[0][0] : Math::SH::LforN (shells.largest().count());
INFO ("calculating even spherical harmonic components up to order " + str (lmax));
Math::Matrix<value_type> HR_dirs;
Math::Matrix<value_type> HR_SHT;
opt = get_options ("normalise");
if (opt.size()) {
normalise = true;
opt = get_options ("directions");
if (opt.size())
HR_dirs.load (opt[0][0]);
else
DWI::Directions::electrostatic_repulsion_300 (HR_dirs);
Math::SH::init_transform (HR_SHT, HR_dirs, lmax);
}
// set Lmax
int i;
for (i = 0; Math::SH::NforL(i) < shells.largest().count(); i += 2);
i -= 2;
if (lmax > i) {
WARN ("not enough data for SH order " + str(lmax) + ", falling back to " + str(i));
lmax = i;
}
INFO("setting maximum even spherical harmonic order to " + str(lmax));
// Setup response function
int num_RH = (lmax + 2)/2;
Math::Vector<value_type> sigs(num_RH);
std::vector<value_type> AL (lmax+1);
Math::Legendre::Plm_sph<value_type>(&AL[0], lmax, 0, 0);
for (int l = 0; l <= lmax; l += 2) sigs[l/2] = AL[l];
Math::Vector<value_type> response(num_RH);
Math::SH::SH2RH(response, sigs);
opt = get_options ("filter");
Math::Vector<value_type> filter;
if (opt.size()) {
filter.load (opt[0][0]);
if (filter.size() <= response.size())
throw Exception ("not enough filter coefficients supplied for lmax" + str(lmax));
for (int i = 0; i <= lmax/2; i++) response[i] *= filter[i];
INFO ("using initial filter coefficients: " + str (filter));
}
Math::SH::Transform<value_type> FRT_SHT(DW_dirs, lmax);
FRT_SHT.set_filter(response);
Image::Header qbi_header (dwi_data);
qbi_header.dim(3) = Math::SH::NforL (lmax);
qbi_header.datatype() = DataType::Float32;
Image::Stride::set (qbi_header, Image::Stride::contiguous_along_axis (3, dwi_data));
Image::Buffer<value_type> qbi_data (argument[1], qbi_header);
opt = get_options ("mask");
if (opt.size()) {
Image::Buffer<bool> mask_data (opt[0][0]);
Image::ThreadedLoop ("estimating dODFs using Q-ball imaging...", dwi_data, 0, 3)
.run (DWI2QBI (FRT_SHT.mat_A2SH(), HR_SHT, shells), mask_data.voxel(), dwi_data.voxel(), qbi_data.voxel());
}
else
Image::ThreadedLoop ("estimating dODFs using Q-ball imaging...", dwi_data, 0, 3)
.run (DWI2QBI (FRT_SHT.mat_A2SH(), HR_SHT, shells), dwi_data.voxel(), qbi_data.voxel());
}