本文整理汇总了C++中ImageType::from_NDArray方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageType::from_NDArray方法的具体用法?C++ ImageType::from_NDArray怎么用?C++ ImageType::from_NDArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageType
的用法示例。
在下文中一共展示了ImageType::from_NDArray方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: storeImage
bool GtPlusAccumulatorImageTriggerGadget::storeImage(const ISMRMRD::ImageHeader& imgHeader, const hoNDArray<ValueType>& img, const ISMRMRD::MetaContainer& attrib, ImageBufferType& buf)
{
try
{
long long cha = attrib.as_long(GADGETRON_CHA, 0);
size_t slc = imgHeader.slice;
long long e2 = attrib.as_long(GADGETRON_E2, 0);
size_t con = imgHeader.contrast;
size_t phs = imgHeader.phase;
size_t rep = imgHeader.repetition;
size_t set = imgHeader.set;
size_t ave = imgHeader.average;
// create image
ImageType* storedImage = new ImageType();
GADGET_CHECK_RETURN_FALSE(storedImage!=NULL);
storedImage->from_NDArray(img);
storedImage->attrib_ = attrib;
GADGET_CHECK_RETURN_FALSE(gtPlus_util_.setMetaAttributesFromImageHeaderISMRMRD(imgHeader, storedImage->attrib_));
storedImage->attrib_.set(GADGETRON_PASS_IMMEDIATE, (long)0);
buf(cha, slc, e2, con, phs, rep, set, ave) = storedImage;
if ( pass_image_immediate_ )
{
Gadgetron::GadgetContainerMessage<ImageBufferType>* cm1 = new Gadgetron::GadgetContainerMessage<ImageBufferType>();
ImageBufferType& imgBuf = *(cm1->getObjectPtr());
std::vector<size_t> dim2D(num_of_dimensions_, 1);
imgBuf.create(dim2D);
imgBuf(0) = new ImageType();
*imgBuf(0) = *storedImage;
// set the pass_image flag, so next gadget knows
imgBuf(0)->attrib_.set(GADGETRON_PASS_IMMEDIATE, (long)1);
if (this->next()->putq(cm1) < 0)
{
cm1->release();
return false;
}
}
}
catch(...)
{
GERROR_STREAM("Error happens in GtPlusAccumulatorImageTriggerGadget::storeImage(const ISMRMRD::ImageHeader& imgHeader, const hoNDArray<ValueType>& img, const ISMRMRD::MetaContainer& attrib, ImageBufferType& buf) ... ");
return false;
}
return true;
}