本文整理汇总了C++中DcmDataset::transferInit方法的典型用法代码示例。如果您正苦于以下问题:C++ DcmDataset::transferInit方法的具体用法?C++ DcmDataset::transferInit怎么用?C++ DcmDataset::transferInit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DcmDataset
的用法示例。
在下文中一共展示了DcmDataset::transferInit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Deserialize
void ctkDICOMDataset::Deserialize()
{
Q_D(ctkDICOMDataset);
// read attribute m_ctkDICOMDataset
// construct a DcmDataset from it
// calls InitializeData(DcmDataset*)
// this method can be called both from sub-classes when they get the InitializeData signal from the persistence framework
// and from EnsureDcmDataSetIsInitialized() when a GetElement.. or SetElement.. method is called.
if (d->m_DICOMDataSetInitialized) return; // only need to do this once
QString stringbuffer = this->GetStoredSerialization();
if ( stringbuffer.isEmpty() )
{
d->m_DICOMDataSetInitialized = true;
return; // TODO nicer: hold three states: newly created / loaded but not initialized / restored from DB
}
//std::cerr << "** " << (void*)this << " ctkDICOMDataset: Deserialize Dataset from string of size " << stringbuffer.size() << "\n" << stringbuffer.toStdString() << std::endl;
QByteArray qtArray = QByteArray::fromBase64( stringbuffer.toAscii() );
//std::cerr << "** " << (void*)this << " ctkDICOMDataset: Deserialize Dataset from byte array of size " << qtArray.size() << std::endl;
DcmInputBufferStream dcmbuffer;
dcmbuffer.setBuffer( qtArray.data(), qtArray.size() );
//std::cerr << "** Buffer state: " << dcmbuffer.status().code() << " " << dcmbuffer.good() << " " << dcmbuffer.eos() << " tell " << dcmbuffer.tell() << " avail " << dcmbuffer.avail() << std::endl;
DcmDataset dataset;
dataset.transferInit();
//std::cerr << "** Dataset state: " << dataset.transferState() << std::endl << std::endl;
OFCondition condition = dataset.read( dcmbuffer, EXS_LittleEndianImplicit );
dataset.transferEnd();
// do this in all cases, even when reading reported an error
this->InitializeFromDataset(&dataset);
if ( condition.bad() )
{
std::cerr << "** Condition code of Dataset::read() is "
<< condition.code() << std::endl;
std::cerr << "** Buffer state: " << dcmbuffer.status().code()
<< " " << dcmbuffer.good()
<< " " << dcmbuffer.eos()
<< " tell " << dcmbuffer.tell()
<< " avail " << dcmbuffer.avail() << std::endl;
std::cerr << "** Dataset state: "
<< static_cast<int>(dataset.transferState()) << std::endl;
std::cerr << "Could not DcmDataset::read(..): "
<< condition.text() << std::endl;
//throw std::invalid_argument( std::string("Could not DcmDataset::read(..): ") + condition.text() );
}
}