xsl NativeDicomModel患者姓名标签维护心脏dcm4che

时间:2018-12-13 04:46:29

标签: xml xslt dicom dcm4che

晚上好!

我编写了xsl以便从DCM文件中获取Dicom属性,并且能够正确映射除患者姓名之外的所有内容。价值超过了,但尖号不存在。它结合了姓氏和名字。我希望插入符号分隔姓氏^名字^ MiddleInitial ^后缀。我一生都无法正确编码该值。

下面是我的代码。...

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:template match="/">
        <xsl:apply-templates select="NativeDicomModel"/>
    </xsl:template>
    <xsl:template match="NativeDicomModel|Item">
        <xsl:param name="level"></xsl:param>
        <xsl:value-of select="$level"/>

        <NativeDicomModel xml:space="preserve">
        <DicomAttribute keyword="PatientID" tag="00100020" vr="LO"><Value number="1"><xsl:value-of select="DicomAttribute[@tag='00100020']/Value"/></Value></DicomAttribute>
        <DicomAttribute keyword="PatientName" tag="00100010" vr="PN"><PersonName number="1"><Alphabetic><xsl:value-of select="DicomAttribute[@tag='00100010']"/></Alphabetic></PersonName></DicomAttribute>
        <DicomAttribute keyword="PatientBirthDate" tag="00100030" vr="DA"><Value number="1"><xsl:value-of select="DicomAttribute[@tag='00100030']/Value"/></Value></DicomAttribute>
        <DicomAttribute keyword="PatientSex" tag="00100040" vr="CS"><Value number="1"><xsl:value-of select="DicomAttribute[@tag='00100040']/Value"/></Value></DicomAttribute>
        <DicomAttribute keyword="StudyDate" tag="00080020" vr="DA"><Value number="1"><xsl:value-of select="DicomAttribute[@tag='00080020']/Value"/></Value></DicomAttribute>
        <DicomAttribute keyword="StudyTime" tag="00080030" vr="TM"><Value number="1">0000.000</Value></DicomAttribute>
        <DicomAttribute keyword="SeriesDate" tag="00080021" vr="DA"><Value number="1"><xsl:value-of select="DicomAttribute[@tag='00080020']/Value"/></Value></DicomAttribute>
        <DicomAttribute keyword="SeriesTime" tag="00080031" vr="TM"><Value number="1">0000.000</Value></DicomAttribute>
        <DicomAttribute keyword="ReferringPhysicianName" tag="00080090" vr="PN"><Value number="1"><xsl:value-of select="DicomAttribute[@tag='00080090']/Value"/></Value></DicomAttribute>
        <DicomAttribute keyword="StudyID" tag="00200010" vr="SH"><Value number="1"><xsl:value-of select="DicomAttribute[@tag='00200010']/Value"/></Value></DicomAttribute>
        <DicomAttribute keyword="AccessionNumber" tag="00080050" vr="SH"><Value number="1"><xsl:value-of select="DicomAttribute[@tag='00080050']/Value"/></Value></DicomAttribute>
        <DicomAttribute keyword="Modality" tag="00080060" vr="CS"><Value number="1">NM</Value></DicomAttribute>
        <DicomAttribute keyword="StudyDescription" tag="00081030" vr="LO"><Value number="1">DOCUMENTS</Value></DicomAttribute>
        <DicomAttribute keyword="SeriesDescription" tag="0008103E" vr="LO"><Value number="1">DOCUMENTS</Value></DicomAttribute>
        <DicomAttribute keyword="SeriesNumber" tag="00200011" vr="IS"><Value number="1">1</Value></DicomAttribute>
        <DicomAttribute keyword="Manufacturer" tag="00080070" vr="LO"><Value number="1"></Value></DicomAttribute>
        <DicomAttribute keyword="ConversionType" tag="00080064" vr="CS"><Value number="1">SD</Value></DicomAttribute>
        <DicomAttribute keyword="InstanceNumber" tag="00200013" vr="IS"><Value number="1">1</Value></DicomAttribute>
        <DicomAttribute keyword="BurnedInAnnotation" tag="00280301" vr="CS"><Value number="1">YES</Value></DicomAttribute>
        </NativeDicomModel>
    </xsl:template>
</xsl:stylesheet>

这是有问题的行:

<DicomAttribute keyword="PatientName" tag="00100010" vr="PN"><PersonName number="1"><Alphabetic><xsl:value-of select="DicomAttribute[@tag='00100010']"/></Alphabetic></PersonName></DicomAttribute>

DCM中的“患者姓名”的格式设置为“姓氏^姓氏^中间缩写”后缀。当我运行样式表时,它将这些值组合为一个名称:LastNameFirstNameMiddleInitialSuffix

该代码来自dcm4che版本5工具集,我正在使用dcm2xml命令将DCM文件转换为XML,以便随后进一步解析出值。

1 个答案:

答案 0 :(得分:0)

我想我需要把它睡觉。.我能够弄清楚这一点。

对于DicomAttribute [@ tag ='00100010'],它包含四个部分:名字,中间名,姓氏和后缀。如果您只是简单地声明标签,则它将所有四个值组合在一起。如果您像这样将其分开:

"DicomAttribute[@tag='00100010']/PersonName/Alphabetic/FamilyName"
"DicomAttribute[@tag='00100010']/PersonName/Alphabetic/GivenName"
"DicomAttribute[@tag='00100010']/PersonName/Alphabetic/MiddleName"
"DicomAttribute[@tag='00100010']/PersonName/Alphabetic/NamePrefix"

不只是说

"DicomAttribute[@tag='00100010']/PersonName"

-或-

"DicomAttribute[@tag='00100010']"

-或-

"DicomAttribute[@tag='00100010']/Value"

它将在XML中正确解析出它。

我通过查看第25行找到了答案:

https://github.com/dcm4che/dcm4chee-arc-light/blob/master/dcm4chee-arc-conf-data/src/main/resources/dsr2text.xsl

一旦我看到了这一行,那么就字母名称而言,使用Dicom Convention创建其他行就很有意义。

我想为他人提供我的研究和解决方案,这样他们就不必再经历我的工作了!

  • 史蒂夫:)

                                             

        <NativeDicomModel xml:space="preserve">
    
        <DicomAttribute keyword="PatientID" tag="00100020" vr="LO"><Value number="1"><xsl:value-of select="DicomAttribute[@tag='00100020']/Value"/></Value></DicomAttribute>
        <DicomAttribute keyword="PatientName" tag="00100010" vr="PN"><PersonName number="1"><Alphabetic>
        <FamilyName><xsl:value-of select="DicomAttribute[@tag='00100010']/PersonName/Alphabetic/FamilyName"/></FamilyName>
        <GivenName><xsl:value-of select="DicomAttribute[@tag='00100010']/PersonName/Alphabetic/GivenName"/></GivenName>
        <MiddleName><xsl:value-of select="DicomAttribute[@tag='00100010']/PersonName/Alphabetic/MiddleName"/></MiddleName>
        <NamePrefix><xsl:value-of select="DicomAttribute[@tag='00100010']/PersonName/Alphabetic/NamePrefix"/></NamePrefix>
        </Alphabetic>
        </PersonName>
        </DicomAttribute>
        <DicomAttribute keyword="PatientBirthDate" tag="00100030" vr="DA"><Value number="1"><xsl:value-of select="DicomAttribute[@tag='00100030']/Value"/></Value></DicomAttribute>
        <DicomAttribute keyword="PatientSex" tag="00100040" vr="CS"><Value number="1"><xsl:value-of select="DicomAttribute[@tag='00100040']/Value"/></Value></DicomAttribute>
        <DicomAttribute keyword="StudyDate" tag="00080020" vr="DA"><Value number="1"><xsl:value-of select="DicomAttribute[@tag='00080020']/Value"/></Value></DicomAttribute>
        <DicomAttribute keyword="StudyTime" tag="00080030" vr="TM"><Value number="1">0000.000</Value></DicomAttribute>
        <DicomAttribute keyword="SeriesDate" tag="00080021" vr="DA"><Value number="1"><xsl:value-of select="DicomAttribute[@tag='00080020']/Value"/></Value></DicomAttribute>
        <DicomAttribute keyword="SeriesTime" tag="00080031" vr="TM"><Value number="1">0000.000</Value></DicomAttribute>
        <DicomAttribute keyword="ReferringPhysicianName" tag="00080090" vr="PN"><Value number="1"><xsl:value-of select="DicomAttribute[@tag='00080090']/Value"/></Value></DicomAttribute>
        <DicomAttribute keyword="StudyID" tag="00200010" vr="SH"><Value number="1"><xsl:value-of select="DicomAttribute[@tag='00200010']/Value"/></Value></DicomAttribute>
        <DicomAttribute keyword="AccessionNumber" tag="00080050" vr="SH"><Value number="1"><xsl:value-of select="DicomAttribute[@tag='00080050']/Value"/></Value></DicomAttribute>
        <DicomAttribute keyword="Modality" tag="00080060" vr="CS"><Value number="1">NM</Value></DicomAttribute>
        <DicomAttribute keyword="StudyDescription" tag="00081030" vr="LO"><Value number="1">DOCUMENTS</Value></DicomAttribute>
        <DicomAttribute keyword="SeriesDescription" tag="0008103E" vr="LO"><Value number="1">DOCUMENTS</Value></DicomAttribute>
        <DicomAttribute keyword="SeriesNumber" tag="00200011" vr="IS"><Value number="1">1</Value></DicomAttribute>
        <DicomAttribute keyword="Manufacturer" tag="00080070" vr="LO"><Value number="1"></Value></DicomAttribute>
        <DicomAttribute keyword="ConversionType" tag="00080064" vr="CS"><Value number="1">SD</Value></DicomAttribute>
        <DicomAttribute keyword="InstanceNumber" tag="00200013" vr="IS"><Value number="1">1</Value></DicomAttribute>
        <DicomAttribute keyword="BurnedInAnnotation" tag="00280301" vr="CS"><Value number="1">YES</Value></DicomAttribute>
        </NativeDicomModel>
    </xsl:template>
    

相关问题