本文整理汇总了C++中hoNDArray::get_dimensions方法的典型用法代码示例。如果您正苦于以下问题:C++ hoNDArray::get_dimensions方法的具体用法?C++ hoNDArray::get_dimensions怎么用?C++ hoNDArray::get_dimensions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hoNDArray
的用法示例。
在下文中一共展示了hoNDArray::get_dimensions方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: apply_unmix_coeff_aliased_image
void apply_unmix_coeff_aliased_image(const hoNDArray<T>& aliasedIm, const hoNDArray<T>& unmixCoeff, hoNDArray<T>& complexIm)
{
try
{
GADGET_CHECK_THROW(aliasedIm.get_size(0) == unmixCoeff.get_size(0));
GADGET_CHECK_THROW(aliasedIm.get_size(1) == unmixCoeff.get_size(1));
GADGET_CHECK_THROW(aliasedIm.get_size(2) == unmixCoeff.get_size(2));
std::vector<size_t> dim;
aliasedIm.get_dimensions(dim);
dim[2] = 1;
if (!complexIm.dimensions_equal(&dim))
{
complexIm.create(&dim);
}
hoNDArray<T> buffer2DT(aliasedIm);
Gadgetron::multiply(aliasedIm, unmixCoeff, buffer2DT);
Gadgetron::sum_over_dimension(buffer2DT, complexIm, 2);
}
catch (...)
{
GADGET_THROW("Errors in apply_unmix_coeff_aliased_image(const hoNDArray<T>& aliasedIm, const hoNDArray<T>& unmixCoeff, hoNDArray<T>& complexIm) ... ");
}
}
示例2: apply_unmix_coeff_kspace
void apply_unmix_coeff_kspace(const hoNDArray<T>& kspace, const hoNDArray<T>& unmixCoeff, hoNDArray<T>& complexIm)
{
try
{
GADGET_CHECK_THROW(kspace.get_size(0) == unmixCoeff.get_size(0));
GADGET_CHECK_THROW(kspace.get_size(1) == unmixCoeff.get_size(1));
GADGET_CHECK_THROW(kspace.get_size(2) == unmixCoeff.get_size(2));
hoNDArray<T> buffer2DT(kspace);
GADGET_CATCH_THROW(Gadgetron::hoNDFFT<typename realType<T>::Type>::instance()->ifft2c(kspace, buffer2DT));
std::vector<size_t> dim;
kspace.get_dimensions(dim);
dim[2] = 1;
if (!complexIm.dimensions_equal(&dim))
{
complexIm.create(&dim);
}
Gadgetron::multiply(buffer2DT, unmixCoeff, buffer2DT);
Gadgetron::sum_over_dimension(buffer2DT, complexIm, 2);
}
catch (...)
{
GADGET_THROW("Errors in apply_unmix_coeff_kspace(const hoNDArray<T>& kspace, const hoNDArray<T>& unmixCoeff, hoNDArray<T>& complexIm) ... ");
}
}
示例3: if
int CS_FOCUSS_2D::fRecon(hoNDArray<std::complex<float> > &hacfInput, hoNDArray<std::complex<float> > &hacfRecon){
// input dimensions
vtDim_ = *hacfInput.get_dimensions();
// number of channels
iNChannels_ = (int)vtDim_[2];
// if Matlab is used, initialize singleton variables
/*if (bMatlab_){
for (int iI = 0; iI < 20; iI++){
GlobalVar_FOCUSS::instance()->vbStatPrinc_.push_back(false);
GlobalVar_FOCUSS::instance()->vfPrincipleComponents_.push_back(new hoNDArray<std::complex<float> > ());
}
}*/
// const complex values
const std::complex<float> cfZero(0.0);
const std::complex<float> cfOne(1.0);
// store incoming data in array
hoNDArray<std::complex<float> > hacfKSpace = hacfInput;
// permute kSpace: x-y-c -> y-x-c
std::vector<size_t> vtDimOrder; vtDimOrder.push_back(1); vtDimOrder.push_back(0); vtDimOrder.push_back(2);
hacfKSpace = *permute(&hacfKSpace, &vtDimOrder,false);
// update dim_ vector
vtDim_.clear(); vtDim_ = *hacfKSpace.get_dimensions();
//------------------------------------------------------------------------
//-------------------------- sampling mask -------------------------------
//------------------------------------------------------------------------
hoNDArray<std::complex<float> > hacfFullMask(hacfKSpace.get_dimensions()); hacfFullMask.fill(cfZero);
hoNDArray<bool> habFullMask(hacfKSpace.get_dimensions()); habFullMask.fill(false);
pcfPtr_ = hacfKSpace.get_data_ptr();
pcfPtr2_ = hacfFullMask.get_data_ptr();
pbPtr_ = habFullMask.get_data_ptr();
for (int i = 0; i < hacfKSpace.get_number_of_elements(); i++)
if (pcfPtr_[i] != cfZero){
pcfPtr2_[i] = cfOne;
pbPtr_[i] = true;
}
//-------------------------------------------------------------------------
//---------------- iFFT x direction - x ky kz ^= v (n�) -------------------
//-------------------------------------------------------------------------
if (Transform_fftBA_->get_active()){
if (!bMatlab_ && bDebug_)
#if __GADGETRON_VERSION_HIGHER_3_6__ == 1
GDEBUG("FFT in read direction..\n");
#else
GADGET_DEBUG1("FFT in read direction..\n");
#endif
else if(bMatlab_ && bDebug_){
// mexPrintf("FFT in read direction..\n");mexEvalString("drawnow;");
}
Transform_fftBA_->FTransform(hacfKSpace);
}
示例4:
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;
}