本文整理汇总了C++中hoNDArray::dimensions_equal方法的典型用法代码示例。如果您正苦于以下问题:C++ hoNDArray::dimensions_equal方法的具体用法?C++ hoNDArray::dimensions_equal怎么用?C++ hoNDArray::dimensions_equal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hoNDArray
的用法示例。
在下文中一共展示了hoNDArray::dimensions_equal方法的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: grappa2d_calib_convolution_kernel
void grappa2d_calib_convolution_kernel(const hoNDArray<T>& dataSrc, const hoNDArray<T>& dataDst, hoNDArray<unsigned short>& dataMask, size_t accelFactor, double thres, size_t kRO, size_t kNE1, hoNDArray<T>& convKer)
{
try
{
bool fitItself = false;
if (&dataSrc != &dataDst) fitItself = true;
GADGET_CHECK_THROW(dataSrc.dimensions_equal(&dataMask));
GADGET_CHECK_THROW(dataDst.dimensions_equal(&dataMask));
// find the fully sampled region
size_t RO = dataMask.get_size(0);
size_t E1 = dataMask.get_size(1);
size_t srcCHA = dataSrc.get_size(2);
size_t dstCHA = dataDst.get_size(2);
size_t startRO(0), endRO(0), startE1(0), endE1(0);
size_t ro, e1, scha, dcha;
for (e1 = 0; e1 < E1; e1++)
{
for (ro = 0; ro < RO; ro++)
{
if (dataMask(ro, e1)>0)
{
if (ro < startRO) startRO = ro;
if (ro > endRO) endRO = ro;
if (e1 < startE1) startE1 = e1;
if (e1 > endE1) endE1 = e1;
}
}
}
GADGET_CHECK_THROW(endRO>startRO);
GADGET_CHECK_THROW(endE1>startE1 + accelFactor);
GADGET_CATCH_THROW(grappa2d_calib_convolution_kernel(dataSrc, dataDst, accelFactor, thres, kRO, kNE1, startRO, endRO, startE1, endE1, convKer));
}
catch (...)
{
GADGET_THROW("Errors in grappa2d_calib_convolution_kernel(dataMask) ... ");
}
}
示例4: grappa2d_unmixing_coeff
void grappa2d_unmixing_coeff(const hoNDArray<T>& kerIm, const hoNDArray<T>& coilMap, size_t acceFactorE1, hoNDArray<T>& unmixCoeff, hoNDArray< typename realType<T>::Type >& gFactor)
{
try
{
typedef typename realType<T>::Type value_type;
size_t RO = kerIm.get_size(0);
size_t E1 = kerIm.get_size(1);
size_t srcCHA = kerIm.get_size(2);
size_t dstCHA = kerIm.get_size(3);
GADGET_CHECK_THROW(acceFactorE1 >= 1);
GADGET_CHECK_THROW(coilMap.get_size(0) == RO);
GADGET_CHECK_THROW(coilMap.get_size(1) == E1);
GADGET_CHECK_THROW(coilMap.get_size(2) == dstCHA);
std::vector<size_t> dimUnmixing(3);
dimUnmixing[0] = RO; dimUnmixing[1] = E1; dimUnmixing[2] = srcCHA;
if (!unmixCoeff.dimensions_equal(&dimUnmixing))
{
unmixCoeff.create(RO, E1, srcCHA);
}
Gadgetron::clear(&unmixCoeff);
std::vector<size_t> dimGFactor(2);
dimGFactor[0] = RO; dimGFactor[1] = E1;
if (!gFactor.dimensions_equal(&dimGFactor))
{
gFactor.create(RO, E1);
}
Gadgetron::clear(&gFactor);
int src;
T* pKerIm = const_cast<T*>(kerIm.begin());
T* pCoilMap = const_cast<T*>(coilMap.begin());
T* pCoeff = unmixCoeff.begin();
std::vector<size_t> dim(2);
dim[0] = RO;
dim[1] = E1;
#pragma omp parallel default(none) private(src) shared(RO, E1, srcCHA, dstCHA, pKerIm, pCoilMap, pCoeff, dim)
{
hoNDArray<T> coeff2D, coeffTmp(&dim);
hoNDArray<T> coilMap2D;
hoNDArray<T> kerIm2D;
#pragma omp for
for (src = 0; src<(int)srcCHA; src++)
{
coeff2D.create(&dim, pCoeff + src*RO*E1);
for (size_t dst = 0; dst<dstCHA; dst++)
{
kerIm2D.create(&dim, pKerIm + src*RO*E1 + dst*RO*E1*srcCHA);
coilMap2D.create(&dim, pCoilMap + dst*RO*E1);
Gadgetron::multiplyConj(kerIm2D, coilMap2D, coeffTmp);
Gadgetron::add(coeff2D, coeffTmp, coeff2D);
}
}
}
hoNDArray<T> conjUnmixCoeff(unmixCoeff);
Gadgetron::multiplyConj(unmixCoeff, conjUnmixCoeff, conjUnmixCoeff);
// Gadgetron::sumOverLastDimension(conjUnmixCoeff, gFactor);
hoNDArray<T> gFactorBuf(RO, E1, 1);
Gadgetron::sum_over_dimension(conjUnmixCoeff, gFactorBuf, 2);
Gadgetron::sqrt(gFactorBuf, gFactorBuf);
Gadgetron::scal((value_type)(1.0 / acceFactorE1), gFactorBuf);
Gadgetron::complex_to_real(gFactorBuf, gFactor);
}
catch (...)
{
GADGET_THROW("Errors in grappa2d_unmixing_coeff(const hoNDArray<T>& kerIm, const hoNDArray<T>& coilMap, hoNDArray<T>& unmixCoeff, hoNDArray<T>& gFactor) ... ");
}
}