本文整理汇总了C++中math::Matrix::load方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix::load方法的具体用法?C++ Matrix::load怎么用?C++ Matrix::load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类math::Matrix
的用法示例。
在下文中一共展示了Matrix::load方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
void run ()
{
DWI::Tractography::Properties properties;
DWI::Tractography::Writer<> writer (argument.back(), properties);
for (size_t n = 0; n < argument.size()-1; n++) {
Math::Matrix<float> M;
try {
M.load (argument[n]);
if (M.columns() != 3)
throw Exception ("file \"" + argument[n] + "\" does not contain 3 columns - ignored");
DWI::Tractography::Streamline<float> tck (M.rows());
for (size_t i = 0; i < M.rows(); i++) {
tck[i].set (M (i,0), M (i,1), M (i,2));
}
writer (tck);
writer.total_count++;
}
catch (Exception) { }
}
}
示例2: run
void run ()
{
Image::Buffer<value_type> SH_data (argument[0]);
Math::SH::check (SH_data);
Options opt = get_options ("mask");
std::unique_ptr<Image::Buffer<bool> > mask_data;
if (opt.size())
mask_data.reset (new Image::Buffer<bool> (opt[0][0]));
opt = get_options ("seeds");
Math::Matrix<value_type> dirs;
if (opt.size())
dirs.load (opt[0][0]);
else {
dirs.allocate (60,2);
dirs = Math::Matrix<value_type> (default_directions, 60, 2);
}
if (dirs.columns() != 2)
throw Exception ("expecting 2 columns for search directions matrix");
opt = get_options ("num");
int npeaks = opt.size() ? opt[0][0] : 3;
opt = get_options ("direction");
std::vector<Direction> true_peaks;
for (size_t n = 0; n < opt.size(); ++n) {
Direction p (Math::pi*to<float> (opt[n][0]) /180.0, Math::pi*float (opt[n][1]) /180.0);
true_peaks.push_back (p);
}
if (true_peaks.size())
npeaks = true_peaks.size();
opt = get_options ("threshold");
value_type threshold = -INFINITY;
if (opt.size())
threshold = opt[0][0];
Image::Header header (SH_data);
header.datatype() = DataType::Float32;
opt = get_options ("peaks");
std::unique_ptr<Image::Buffer<value_type> > ipeaks_data;
if (opt.size()) {
if (true_peaks.size())
throw Exception ("you can't specify both a peaks file and orientations to be estimated at the same time");
if (opt.size())
ipeaks_data.reset (new Image::Buffer<value_type> (opt[0][0]));
Image::check_dimensions (header, *ipeaks_data, 0, 3);
npeaks = ipeaks_data->dim (3) / 3;
}
header.dim(3) = 3 * npeaks;
Image::Buffer<value_type> peaks_data (argument[1], header);
DataLoader loader (SH_data, mask_data.get());
Processor processor (peaks_data, dirs, Math::SH::LforN (SH_data.dim (3)),
npeaks, true_peaks, threshold, ipeaks_data.get());
Thread::run_queue (loader, Item(), Thread::multi (processor));
}