void CEffectGroup::AddTagForAllEffect(FLOAT fSettingTimeFromStart, std::string tagName) { for(INDEX i=0; i<m_vectorEffectKey.size(); ++i) { INDEX index = m_vectorTagKey.size(); //TAG_KEY를 생성한다. m_vectorTagKey.push_back(TagKey()); TagKey &tagKey = m_vectorTagKey[index]; //TAG_KEY의 정보를 채운다. tagKey.m_iKeyValue = m_iNextTagKeyValue++; tagKey.m_fSettingTime = fSettingTimeFromStart; tagKey.m_iEffectKeyValue = m_vectorEffectKey[i].m_iKeyValue; tagKey.m_strTagName = tagName; } }
INDEX CEffectGroup::AddTagForEffect(FLOAT fSettingTimeFromStart, INDEX iAddedEffect, std::string tagName) { ASSERT(fSettingTimeFromStart >= 0.0f); EffectKey* effectkey = FindEffectKey(iAddedEffect); if(effectkey == NULL) return -1; //TAG_KEY를 생성한다. INDEX index = m_vectorTagKey.size(); m_vectorTagKey.push_back(TagKey()); TagKey &tagKey = m_vectorTagKey[index]; //TAG_KEY의 정보를 채운다. tagKey.m_iKeyValue = m_iNextTagKeyValue++; tagKey.m_fSettingTime = fSettingTimeFromStart; tagKey.m_iEffectKeyValue = iAddedEffect; tagKey.m_strTagName = tagName; return tagKey.m_iKeyValue; }
bool ctkDICOMDataset::CopyElement( DcmDataset* dataset, const DcmTagKey& tag, int type ) { Q_D(ctkDICOMDataset); switch (type) { case 0x1: case 0x1C: case 0x2: case 0x2C: case 0x3: // these are ok break; default: // nothing else is ok std::cerr << "Unknown attribute type. Cannot process call to ExtractElement " << TagKey(tag).toStdString() << std::endl; return false; } bool missing(false); bool copied(true); if (!dataset) return false; if (dataset == d->m_DcmDataset) { throw std::logic_error("Trying to copy tag to yourself. Please check application logic!"); } // type 1 or 1C must exist AND have a value if (!dataset->tagExistsWithValue( tag )) { if (type == 0x1 || type == 0x1C) missing = true; } // type 2 or 2C must exist but may have an empty value if (!dataset->tagExists( tag )) { if (type == 0x1 || type == 0x1C) missing = true; if (type == 0x2 || type == 0x2C) missing = true; } else { // we found this tag DcmElement* element(NULL); dataset->findAndGetElement( tag, element, OFFalse, OFTrue ); // OFTrue is important (copies element), DcmDataset takes ownership and deletes elements on its own destruction if (element) { copied = CheckCondition( d->m_DcmDataset->insert(element) ); } } if (missing) { std::cerr << "Tag " << TagKey(tag).toStdString() << " [" << TagDescription(tag).toStdString() << "] of type " << QString("%1").arg(type,0,16).toStdString() << " missing or empty." << std::endl; } if (!copied) { std::cerr << "Tag " << TagKey(tag).toStdString() << " [" << TagDescription(tag).toStdString() << "] not copied successfully" << std::endl; } return !missing && copied; }