//------------------------------------------------------------------------------ void ctkDICOMDatabase::loadFileHeader (QString fileName) { Q_D(ctkDICOMDatabase); DcmFileFormat fileFormat; OFCondition status = fileFormat.loadFile(fileName.toLatin1().data()); if (status.good()) { DcmDataset *dataset = fileFormat.getDataset(); DcmStack stack; while (dataset->nextObject(stack, true) == EC_Normal) { DcmObject *dO = stack.top(); if (dO->isaString()) { QString tag = QString("%1,%2").arg( dO->getGTag(),4,16,QLatin1Char('0')).arg( dO->getETag(),4,16,QLatin1Char('0')); std::ostringstream s; dO->print(s); d->LoadedHeader[tag] = QString(s.str().c_str()); } } } return; }
void cbPStk(DcmStack& stk) { stack<DcmType*> items; while (!stk.empty()) { items.push(stk.top()); stk.pop(); } while (!items.empty()) { dcmout << items.top()->repr() << ' '; stk.push(items.top()); items.pop(); } dcmout << endl; }
const DcmElement * tissuestack::imaging::DicomFileWrapper::findDcmElement( const DcmDataset * dataSet, const DcmTagKey & tagKey) const { DcmStack stack; OFCondition status = const_cast<DcmDataset *>(dataSet)->nextObject(stack, OFTrue); while (status.good()) { const DcmObject * dobject = stack.top(); const DcmElement * delem = (DcmElement *) dobject; if (delem->getTag().getXTag() == tagKey) return delem; status = const_cast<DcmDataset *>(dataSet)->nextObject(stack, OFTrue); } return nullptr; }
void cbClear(DcmStack& stk) { while (!stk.empty()) { del(stk.top()); stk.pop(); } }