如何在C#中加载/解析DICOM XML数据?

时间:2017-08-11 13:36:38

标签: xml dicom

是否有人可以帮助我从这个DICOM XML文档加载数据并将其填充到如下结构中:

struct WL_data
        {
            string _id; //PatientName
            string _patient_name; //PatientID
            string _acc_no; //2170001649
            string _modality; //Modality
            string _date; //Study Date + Study Time

        }

XML doc:

    <?xml version="1.0" encoding="UTF-8" ?> 
    <DATASETS>
    <DATASET>
      <ATTRIBUTE TAG="0020,0010" TEXT="StudyID">2170001649</ATTRIBUTE> 
      <ATTRIBUTE TAG="0008,0060" TEXT="Modality">CR</ATTRIBUTE> 
      <ATTRIBUTE TAG="0010,0010" TEXT="PatientID">Duuk^L</ATTRIBUTE> 
      <ATTRIBUTE TAG="0010,0020" TEXT="PatientName">6968110841</ATTRIBUTE> 
      <ATTRIBUTE TAG="0008,0020" TEXT="Study Date">20170427</ATTRIBUTE> 
      <ATTRIBUTE TAG="0008,0030" TEXT="Study Time">174000</ATTRIBUTE> 
      <ATTRIBUTE TAG="0008,0090" TEXT="Refering Physicians Name" /> 
    </DATASET>
    <DATASET>
      <ATTRIBUTE TAG="0020,0010" TEXT="StudyID">2170001650</ATTRIBUTE> 
      <ATTRIBUTE TAG="0008,0060" TEXT="Modality">US</ATTRIBUTE> 
      <ATTRIBUTE TAG="0010,0010" TEXT="PatientID">Slovak^J</ATTRIBUTE> 
      <ATTRIBUTE TAG="0010,0020" TEXT="PatientName">6868780226</ATTRIBUTE> 
      <ATTRIBUTE TAG="0008,0020" TEXT="Study Date">20170427</ATTRIBUTE> 
      <ATTRIBUTE TAG="0008,0030" TEXT="Study Time">174100</ATTRIBUTE> 
      <ATTRIBUTE TAG="0008,0090" TEXT="Refering Physicians Name" /> 
    </DATASET>
    </DATASETS>

1 个答案:

答案 0 :(得分:0)

您可以使用XmlDocument来读取和解析XML。

请参阅https://msdn.microsoft.com/en-us/library/system.xml.xmldocument(v=vs.110).aspx

这里有一个例子:How do I read and parse an XML file in C#?