【问题标题】:xsl NativeDicomModel Patient Name Tag Maintain Carets dcm4chexsl NativeDicomModel 患者姓名标签维护插入符号 dcm4che
【发布时间】:2018-12-13 04:46:29
【问题描述】:

晚上好!

我编写了一个 xsl 从 DCM 文件中获取 Dicom 属性,并且能够正确映射除患者姓名之外的所有内容。值出现了,但插入符号不存在;它结合了姓氏和名字。我希望插入符号将 LastName^FirstName^MiddleInitial^Suffix 分开。我一辈子都无法正确编码这个值。

下面是我的代码......

<?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 中的患者姓名格式为 LastName^FirstName^MiddleInitial^Suffix。当我运行样式表时,它将这些值组合成一个名称:LastNameFirstNameMiddleInitialSuffix

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

【问题讨论】:

  • 请提供可重现的示例,包括输入、XSLT 和预期输出。您可以 - 并且应该 - 删除不相关的部分 - 请参阅:minimal reproducible example.

标签: xml xslt dicom dcm4che


【解决方案1】:

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

对于 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 约定创建额外的行是有意义的。

我想为其他人提供我的研究和解决方案,这样他们就不必经历我所做的时间!

  • 史蒂夫 :)

        <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>
    

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-10-20
    • 2020-12-25
    • 2015-04-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多