# include“ltdic.h”
pDICOMELEMENTLDicomDS:: InsertKey (pParent、pszKey bOptional)
插入一个新的关键要素Dicom Dir数据集。
指针指向一个DICOMELEMENT结构,包含一个数据集的关键元素。新的关键因素将插入作为关键元素的一个孩子。
字符串包含类型的关键元素。可能的值是:
| 价值 | 意义 |
|---|---|
| “病人” | 病人的关键元素 |
| “研究” | 研究关键要素 |
| “系列” | 系列关键要素 |
| “图像” | 图片关键要素 |
| “叠加” | 覆盖关键要素 |
| “形态附近地区” | Modality-LUT关键要素 |
| “VOI附近地区” | VOI-LUT关键要素 |
| “曲线” | 曲线的关键元素 |
| “存储打印” | 存储打印关键要素 |
| “RT剂量” | RT剂量关键要素 |
| “RT结构设置” | RT结构设置关键元素 |
| “RT计划” | RT计划的关键要素 |
| “RT治疗记录” | RT治疗记录关键元素 |
| “主题” | 主题的关键元素 |
| “访问” | 访问关键要素 |
| “结果” | 结果的关键因素 |
| “解释” | 解释关键要素 |
| “学习组件” | 研究组件关键要素 |
| “演示” | 表示关键要素 |
| “波形” | 波形关键要素 |
| “老文件” | 结构化报告文档关键元素 |
| “私人” | 私钥元素 |
| “关键对象医生” | 关键文档关键元素对象 |
| “光谱” | 光谱学关键要素 |
| “原始数据” | 原始数据的关键元素 |
| “注册” | 注册关键要素 |
| “基准” | 基准的关键元素 |
| “协议” | 悬挂的关键因素 |
| “ENCAP医生” | 封装文档关键要素 |
| “HL7 STRUC医生” | HL7结构化文档的关键元素 |
| “价值地图” | 现实世界的价值关键元素的映射 |
| “实体” | 实体关系的关键因素 |
国旗表明哪些部分插入的关键元素。可能的值是:
| 价值 | 意义 |
|---|---|
| 真正的 | 插入的所有部分指定的关键元素。 |
| 假 | 插入的强制性的部分指定的关键元素。 |
| 价值 | 意义 |
|---|---|
| 零! | 一个指向DICOMELEMENT结构包含新插入的项。 |
| 零 | 没有足够的内存来插入项。 |
新插入的关键元素插入pParent的孩子。
必需的dll和库
Win32, x64
无效DisplayKeyInfo1 (LDicomDS * pDicomDS){装运箱strMsg;装运箱strTmp;LDicomDS DicomDS;/ /移动到根键(病人)pDICOMELEMENT pRootKey = pDicomDS - > GetFirstKey (NULL,假);装运箱strRootKey = pDicomDS - > GetValueKey (pRootKey);strMsg.Format(文本(“根键(% s) \ n”),strRootKey);/ /移动到孩子键(研究)pDICOMELEMENT pStudyKey = pDicomDS - > GetChildKey (pRootKey);装运箱strStudyKey = pDicomDS - > GetValueKey (pStudyKey);strTmp.Format(文本(“根键(% s) \ n”),strStudyKey);strMsg = strMsg + strTmp;/ /移动到孩子键(系列)pDICOMELEMENT pSeriesKey = pDicomDS - > GetChildKey (pStudyKey);/ /找到第一个系列的关键pDICOMELEMENT pElement = pDicomDS - > FindFirstKey (pSeriesKey文本(“系列”),真正的);pElement = pDicomDS - > GetChildElement (pElement,真实);pElement = pDicomDS - > FindFirstElement (pElement TAG_REFERENCED_FILE_ID,真的);strTmp.Format(文本(“第一个系列(% s) \ n”),pDicomDS - > GetStringValue (pElement 0 1));strMsg = strMsg + strTmp;/ /查找下一个系列的关键pElement = pDicomDS - > FindNextKey (pElement,真实);pElement = pDicomDS - > GetChildElement (pElement,真实);pElement = pDicomDS - > FindFirstElement (pElement TAG_REFERENCED_FILE_ID,真的);strTmp.Format(文本(“下一个系列(% s) \ n”),pDicomDS - > GetStringValue (pElement 0 1));strMsg = strMsg + strTmp;/ /找到最后的系列关键pElement = pDicomDS - > FindLastKey (pElement文本(“系列”),真正的);pElement = pDicomDS - > GetChildElement (pElement,真实);pElement = pDicomDS - > FindFirstElement (pElement TAG_REFERENCED_FILE_ID,真的);strTmp.Format(文本(“最后系列(% s) \ n”),pDicomDS - > GetStringValue (pElement 0 1));strMsg = strMsg + strTmp;/ /找到以前的系列关键pElement = pDicomDS - > FindPrevKey (pElement,真实);pElement = pDicomDS - > GetChildElement (pElement,真实);pElement = pDicomDS - > FindFirstElement (pElement TAG_REFERENCED_FILE_ID,真的);strTmp.Format(文本(“以前的系列(% s) \ n”),pDicomDS - > GetStringValue (pElement 0 1));strMsg = strMsg + strTmp;/ /找到根关键的另一种方式pRootKey = pDicomDS - > GetRootKey (pElement);strRootKey = pDicomDS - > GetValueKey (pRootKey);strTmp.Format(文本(“根键(% s) \ n”),strRootKey);strMsg = strMsg + strTmp;AfxMessageBox (strMsg);}无效DisplayKeyInfo2 (LDicomDS * pDicomDS){装运箱strMsg;装运箱strTmp;LDicomDS DicomDS;/ /移动到根键(病人)pDICOMELEMENT pRootKey = pDicomDS - > GetFirstKey (NULL,假);装运箱strRootKey = pDicomDS - > GetValueKey (pRootKey);strMsg.Format(文本(“根键(% s) \ n”),strRootKey);/ /移动到孩子键(研究)pDICOMELEMENT pStudyKey = pDicomDS - > GetChildKey (pRootKey);装运箱strStudyKey = pDicomDS - > GetValueKey (pStudyKey);strTmp.Format(文本(“根键(% s) \ n”),strStudyKey);strMsg = strMsg + strTmp;/ /移动到孩子键(系列)pDICOMELEMENT pSeriesKey = pDicomDS - > GetChildKey (pStudyKey);/ /找到第一个系列的关键pDICOMELEMENT pElement = pDicomDS - > GetFirstKey (pSeriesKey,真实);pElement = pDicomDS - > GetChildElement (pElement,真实);pElement = pDicomDS - > FindFirstElement (pElement TAG_REFERENCED_FILE_ID,真的);strTmp.Format(文本(“第一个系列(% s) \ n”),pDicomDS - > GetStringValue (pElement 0 1));strMsg = strMsg + strTmp;/ /查找下一个系列的关键pElement = pDicomDS - > GetNextKey (pElement,真实);pElement = pDicomDS - > GetChildElement (pElement,真实);pElement = pDicomDS - > FindFirstElement (pElement TAG_REFERENCED_FILE_ID,真的);strTmp.Format(文本(“下一个系列(% s) \ n”),pDicomDS - > GetStringValue (pElement 0 1));strMsg = strMsg + strTmp;/ /找到最后的系列关键pElement = pDicomDS - > GetLastKey (pElement,真实);pElement = pDicomDS - > GetChildElement (pElement,真实);pElement = pDicomDS - > FindFirstElement (pElement TAG_REFERENCED_FILE_ID,真的);strTmp.Format(文本(“最后系列(% s) \ n”),pDicomDS - > GetStringValue (pElement 0 1));strMsg = strMsg + strTmp;/ /找到以前的系列关键pElement = pDicomDS - > GetPrevKey (pElement,真实);pElement = pDicomDS - > GetChildElement (pElement,真实);pElement = pDicomDS - > FindFirstElement (pElement TAG_REFERENCED_FILE_ID,真的);strTmp.Format(文本(“以前的系列(% s) \ n”),pDicomDS - > GetStringValue (pElement 0 1));strMsg = strMsg + strTmp;/ /找到根关键的另一种方式pRootKey = pDicomDS - > GetRootKey (pElement);strRootKey = pDicomDS - > GetValueKey (pRootKey);strTmp.Format(文本(“根键(% s) \ n”),strRootKey);strMsg = strMsg + strTmp;AfxMessageBox (strMsg);}L_INT LDicomDS_InsertKeyExample (){L_INT nRet;装运箱strMsg;装运箱strTmp;LDicomDS DicomDS;pDICOMELEMENT pElement pKey;DicomDS。InitDS (CLASS_BASIC_DIRECTORY 0);/ /插入一些钥匙pKey = DicomDS。InsertKey (NULL,文本(“病人”),真正的);/ /插入病人的关键水平pKey = DicomDS。InsertKey (pKey文本(“研究”),真正的);/ /插入关键研究水平/ /插入5系级键和一些数据为(int我= 0;我< 5;我+ +){pKey = DicomDS。InsertKey (pKey文本(“系列”),真正的);pElement = DicomDS。GetChildElement (pKey假);pElement = DicomDS。FindFirstElement (pElement TAG_REFERENCED_FILE_ID,真实);strTmp.Format(文本(“% d”),我);DicomDS。SetStringValue (pElement (L_TCHAR *) (LPCTSTR) strTmp, 1, DICOM_CHARACTER_SET_DEFAULT);pKey = DicomDS.GetParentKey (pKey);}/ / DisplayKeyInfo1显示树中的信息DisplayKeyInfo1 (&DicomDS);nRet = DicomDS.SaveDS (MAKE_IMAGE_PATH(文本(“one.dcm”)),0);如果(nRet ! = DICOM_SUCCESS)返回nRet;/ /找到最后一个系列和删除它pElement = DicomDS.GetChildKey (pKey);pKey = DicomDS。FindLastKey (pElement文本(“系列”),真正的);DicomDS.DeleteKey (pKey);AfxMessageBox(文本(“删除最后一个系列关键……”));/ / DisplayKeyInfo2显示相同的信息作为DisplayKeyInfo1使用不同的功能DisplayKeyInfo2 (&DicomDS);nRet = DicomDS.SaveDS (MAKE_IMAGE_PATH(文本(“two.dcm”)),0);如果(nRet ! = DICOM_SUCCESS)返回nRet;返回DICOM_SUCCESS;}