本文整理汇总了C++中hoNDArray::get_number_of_elements方法的典型用法代码示例。如果您正苦于以下问题:C++ hoNDArray::get_number_of_elements方法的具体用法?C++ hoNDArray::get_number_of_elements怎么用?C++ hoNDArray::get_number_of_elements使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hoNDArray
的用法示例。
在下文中一共展示了hoNDArray::get_number_of_elements方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: maxAbsolute
void maxAbsolute(const hoNDArray<T>& x, T& r, size_t& ind)
{
size_t N = x.get_number_of_elements();
const T* pX = x.begin();
ind = 0;
if ( N == 0 ) return;
long long n;
typename realType<T>::Type v = abs(pX[0]);
typename realType<T>::Type v2;
ind = 0;
for ( n=1; n<(long long)N; n++ )
{
v2 = std::abs(pX[n]);
if ( v2 > v )
{
v = v2;
ind = n;
}
}
r = pX[ind];
}
示例2: sort
void sort(const hoNDArray<T>& x, hoNDArray<T>& r, bool isascending)
{
if ( &r != &x )
{
if ( r.get_number_of_elements()!=x.get_number_of_elements())
{
r = x;
}
else
{
memcpy(r.begin(), x.begin(), x.get_number_of_bytes());
}
}
sort(x.get_number_of_elements(), x.begin(), r.begin(), isascending);
}
示例3:
hoNDArray<uint16_t>
update_field_map(const hoNDArray<uint16_t> &field_map_index, const hoNDArray<uint16_t> &proposed_field_map_index,
const hoNDArray<float> &residuals_map, const hoNDArray<float> &lambda_map) {
hoNDArray<float> residual_diff_map(field_map_index.get_dimensions());
const auto X = field_map_index.get_size(0);
const auto Y = field_map_index.get_size(1);
const auto Z = field_map_index.get_size(2);
for (size_t kz = 0; kz < Z; kz++) {
for (size_t ky = 0; ky < Y; ky++) {
for (size_t kx = 0; kx < X; kx++) {
residual_diff_map(kx, ky,kz) = residuals_map(field_map_index(kx, ky,kz), kx, ky,kz) -
residuals_map(proposed_field_map_index(kx, ky,kz), kx, ky,kz);
}
}
}
std::vector<boost::default_color_type> color_map;
if (Z == 1) {
color_map = graph_cut<2>(field_map_index, proposed_field_map_index, lambda_map,
residual_diff_map);
} else {
color_map = graph_cut<3>(field_map_index, proposed_field_map_index, lambda_map, residual_diff_map);
}
auto result = field_map_index;
size_t updated_voxels = 0;
for (size_t i = 0; i < field_map_index.get_number_of_elements(); i++) {
if (color_map[i] != boost::default_color_type::black_color) {
updated_voxels++;
result[i] = proposed_field_map_index[i];
}
}
return result;
}
示例4: maxValue
void maxValue(const hoNDArray<T>& a, T& v)
{
typedef T ValueType;
try
{
const ValueType* pA = a.begin();
size_t n = a.get_number_of_elements();
v = pA[0];
size_t ii;
for (ii=1; ii<n; ii++)
{
if (pA[ii]>v) v = pA[ii];
}
}
catch(...)
{
GADGET_THROW("Errors in maxValue(const hoNDArray<T>& a, T& v) ... ");
}
}
示例5: dotu
void dotu(const hoNDArray<T>& x, const hoNDArray<T>& y, T& r)
{
GADGET_DEBUG_CHECK_THROW(x.get_number_of_elements()==y.get_number_of_elements());
dotu(x.get_number_of_elements(), x.begin(), y.begin(), r);
}
示例6: amax
template<class T> size_t amax(const hoNDArray<T>& x)
{
return amax(x.get_number_of_elements(), x.begin());
}
示例7:
void norm2(const hoNDArray<T>& x, typename realType<T>::Type& r)
{
norm2(x.get_number_of_elements(), x.begin(), r);
}
示例8: asum
template<class T> void asum(const hoNDArray<T>& x, typename realType<T>::Type& r)
{
asum(x.get_number_of_elements(), x.begin(), r);
}
示例9: correct_heart_beat_time_stamp_with_fitting
void correct_heart_beat_time_stamp_with_fitting(hoNDArray<float>& cpt_time_stamp, hoNDArray<int>& ind_hb, size_t startE1, size_t endE1,
const std::vector<size_t>& start_e1_hb, const std::vector<size_t>& end_e1_hb,
const std::vector<size_t>& start_n_hb, const std::vector<size_t>& end_n_hb )
{
try
{
size_t E1 = cpt_time_stamp.get_size(0);
size_t N = cpt_time_stamp.get_size(1);
size_t rE1 = endE1-startE1+1;
size_t e1, n, ind, ii;
size_t num_acq_read_outs = 0;
for ( n=0; n<N; n++ )
{
for ( e1=0; e1<E1; e1++ )
{
if ( cpt_time_stamp(e1, n) >= 0 )
{
num_acq_read_outs++;
}
}
}
size_t numOfHB = start_e1_hb.size();
std::vector<size_t> ind_HB_start(numOfHB);
std::vector<size_t> ind_HB_end(numOfHB);
for ( ind=0; ind<numOfHB; ind++ )
{
ind_HB_start[ind] = start_e1_hb[ind] + start_n_hb[ind] * E1;
ind_HB_end[ind] = end_e1_hb[ind] + end_n_hb[ind] * E1;
}
// --------------------------------------------------------
// fit a line to every heart beat
// --------------------------------------------------------
float a, b;
std::vector<float> A(numOfHB, 0.0f), B(numOfHB, 0.0f);
for ( ind=0; ind<numOfHB; ind++ )
{
std::vector<float> x, y;
size_t cpt;
for ( cpt=ind_HB_start[ind]; cpt<=ind_HB_end[ind]; cpt++ )
{
size_t n = cpt / E1;
size_t e1 = cpt - n*E1;
if(e1>=startE1 && e1<=endE1)
{
if ( cpt_time_stamp[cpt] > -1 )
{
size_t x_ind = (e1-startE1) + n*rE1;
x.push_back( (float)x_ind );
y.push_back(cpt_time_stamp[cpt]);
}
}
}
if ( !x.empty() )
{
Gadgetron::simple_line_fit(x, y, a, b);
A[ind] = a;
B[ind] = b;
}
}
// --------------------------------------------------------
// compute cpt time stamp for every line
// --------------------------------------------------------
size_t num = cpt_time_stamp.get_number_of_elements();
for ( ind=0; ind<num; ind++ )
{
n = ind / E1;
e1 = ind - n*E1;
if(e1>=startE1 && e1<=endE1)
{
// find to which heart beat this line belongs
bool foundHB = false;
for ( ii=0; ii<numOfHB; ii++ )
{
size_t startHB = ind_HB_start[ii];
size_t endHB = ind_HB_end[ii];
if ( ii==0 && ind<=startHB )
{
foundHB = true;
break;
}
if ( ii==numOfHB-1 && ind>=endHB )
{
foundHB = true;
break;
}
if ( ind>=startHB && ind<=endHB )
//.........这里部分代码省略.........