DCM4CHEE-ARC-Light v5.13.2 - coerce pat ID

892 views
Skip to first unread message

Docjay

unread,
Jun 29, 2018, 2:27:12 PM6/29/18
to dcm4che
Hi - I'm currently trying to coerce patient ID's when it is stored to the archive.  I need to insert hyphens every two digits (these exams are coming from a different system, so I don't have much control over that side of things)

I'm using this stylesheet:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
 
<xsl:output method="xml"/>
   
<!-- this Stylesheet is meant to fix 'unhyphenated' PIDS from CARDIOLOGY. -->
   
<!-- These studies to fix this way are coming from other site -->
   
<xsl:decimal-format name="dashes" grouping-separator='-'/>
   
<xsl:template match="/NativeDicomModel">
       
<NativeDicomModel>
           
<!-- for when the PID is seven digits long -->
           
<xsl:variable name="modPatientID" select="DicomAttribute[@tag='00100020']/Value"/>
           
<xsl:variable name="Station" select="DicomAttribute[@tag='00081010']/Value"/>
           
<xsl:variable name="Acc" select="DicomAttribute[@tag='00080050']/Value"/>
           
<xsl:variable name="instName" select="DicomAttribute[@tag='00080080']/Value"/>
           
<xsl:variable name="studyDesc" select="DicomAttribute[@tag='00081030']/Value"/>
           
<!-- (0008,1010) Station_Name -->
           
<xsl:if test="string-length($modPatientID)=7">
               
<xsl:if test="not(contains($instName, 'JANE') or contains($instName, 'Bluestem'))">
                   
<xsl:if test="contains($Station,'SJMC') or contains($Station, 'HOSP2') or contains($Station, 'OW_')">
                       
<DicomAttribute tag="00100020" vr="LO">
                           
<xsl:value-of select="concat(
                                substring($modPatientID, 1, 2), '-',
                                substring($modPatientID, 3, 2), '-',
                                substring($modPatientID, 5, 2), '-',
                                substring($modPatientID, 7)
                            )"
/>
                       
</DicomAttribute>
                   
</xsl:if>
               
</xsl:if>
           
</xsl:if>
       
</NativeDicomModel>
     
</xsl:template>
</xsl:stylesheet>

The problem is when I send an exam to the archive with the coercion rule in place as below..   The archive complains of 'Patient ID missing in object'


DIMSE:  C_STORE_RQ
Nokeyword = True
DICOM Transfer role:  SCU
XSL Stylesheet URI:  ${jboss.server.temp.url}/dcm4chee-arc/test.xsl
AET:  RA600 (my AET that I am testing from to send exams to the archive)
Name:  RA600 Test

all the rest is default...

I followed the wiki here to make sure the stylesheet would compile correctly, I'm guessing something is wrong with it.

I've attached a snippet of the error from the server log.


Thanks all for your help









error.txt

vrinda...@j4care.com

unread,
Jun 30, 2018, 5:01:31 AM6/30/18
to dcm4che
Hello,
The error in the log is unrelated with your stylesheet requirement. The object that is received by the archive has no PatientID attribute in it and your configuration probably has Accept Missing Patient ID as NO (either on Archive Device level or on Archive AE level)
By default if there is no Patient ID attribute in object, archive will create it, as default value of Accept Missing Patient ID is CREATE.

Docjay

unread,
Jun 30, 2018, 10:30:25 AM6/30/18
to dcm4che
Vrinda, the study does have a patient ID. If I remove the coercion rule, it will store the exam as it was received. The example I'm trying to use is comprised of a SR object and the study is a US exam. I'll try again with a different example that is a simple CR and post results.

Docjay

unread,
Jun 30, 2018, 10:54:39 AM6/30/18
to dcm...@googlegroups.com
I've tried with a different test exam, this time it is a DX.  It produced the same error:  "Patient ID missing in object."

The exam does have a patient ID on the study of '1122334', expecting the results to be coerced to '11-22-33-4'.

Thank you for helping with this.
error2.txt

Gunter Zeilinger

unread,
Jul 2, 2018, 11:16:32 AM7/2/18
to dcm...@googlegroups.com
Verify the result of the XSLT on DICOM objects you would like to coerce by

$ dcm2xml <dicom-file> -x <xsl-file>




--
You received this message because you are subscribed to the Google Groups "dcm4che" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dcm4che+unsubscribe@googlegroups.com.
To post to this group, send email to dcm...@googlegroups.com.
Visit this group at https://groups.google.com/group/dcm4che.
For more options, visit https://groups.google.com/d/optout.

Docjay

unread,
Jul 2, 2018, 3:58:06 PM7/2/18
to dcm...@googlegroups.com
Here are the results using the new 5.13.2 toolkit..

<?xml version="1.0" encoding="UTF-8"?><NativeDicomModel><DicomAttribute tag="00100020" vr="LO">11-22-33-4</DicomAttribute></NativeDicomModel>

Previouisly - I was trying to send this study from a GE RA600 workstation, but I've now sent the study to an existing DCMCHEE v2.18.0 archive that I have.

Now, when I try to send to the study from dcm4chee v2.18.0 --> dcm4chee v5.13.2, it still complains with the same error:  Below are logs from v5.13.2 archive. 

AET:  RADARCH2 is 2.18.0
AET:  RADROUTE2 is 5.13.2

2018-07-02 15:51:12,610 INFO  [org.dcm4che3.net.Association] (EE-ManagedExecutorService-default-Thread-76) RADROUTE2<-RADARCH2(77) >> A-ASSOCIATE-RQ
2018-07-02 15:51:12,610 INFO  [org.dcm4che3.net.Association] (EE-ManagedExecutorService-default-Thread-76) RADROUTE2<-RADARCH2(77) << A-ASSOCIATE-AC
2018-07-02 15:51:12,610 INFO  [org.dcm4che3.net.Dimse] (EE-ManagedExecutorService-default-Thread-76) RADROUTE2<-RADARCH2(77) >> 1:C-STORE-RQ[pcid=5, prior=0
  orig
=RADARCH2 >> 9:C-MOVE-RQ
  cuid
=1.2.840.10008.5.1.4.1.1.1.1 - Digital X-Ray Image Storage - For Presentation
  iuid
=1.2.528.1.1001.100.4.85985.79905.2803629912.20180702203434357 - ?
  tsuid
=1.2.840.10008.1.2.4.90 - JPEG 2000 Image Compression (Lossless Only)
2018-07-02 15:51:12,891 INFO  [org.dcm4chee.arc.store.impl.StoreServiceImpl] (EE-ManagedExecutorService-default-Thread-76) Coerce Attributes from rule: ArchiveAttributeCoercion[cn=RA600 test, priority=0, DIMSE=C_STORE_RQ, role=SCU, aets=[RADARCH2], hostNames=[], cuids=[], deIdentification=[], xslturi=${jboss.server.temp.url}/dcm4chee-arc/test.xsl, noKeywords=true, leadingCFindSCP=null, mergeMWLMatchingKey=null, mergeMWLTemplateURI=null, attributeUpdatePolicy=MERGE, nullifyIssuerOfPatientID=null, issuerOfPatientIDs=[], supplementFromDeviceName=null]
2018-07-02 15:51:12,907 INFO  [org.dcm4che3.net.Association] (EE-ManagedExecutorService-default-Thread-76) RADROUTE2<-RADARCH2(77): processing 1:C-STORE-RQ[pcid=5, prior=0
  orig
=RADARCH2 >> 9:C-MOVE-RQ
  cuid
=1.2.840.10008.5.1.4.1.1.1.1 - Digital X-Ray Image Storage - For Presentation
  iuid
=1.2.528.1.1001.100.4.85985.79905.2803629912.20180702203434357 - ?
  tsuid
=1.2.840.10008.1.2.4.90 - JPEG 2000 Image Compression (Lossless Only) failed. Caused by:    : org.dcm4che3.net.service.DicomServiceException: Patient ID missing in object.

The study was sent from archive v2.18.0 and has the Pat ID:  '1122334', expected results are for archive 5.13.2 to store with the Pat ID:  '11-22-33-'4'

@Gunter - your 'dcm2xml' test worked just fine and did coerce the DICOM object correctly

ChadN

unread,
Jul 2, 2018, 5:16:23 PM7/2/18
to dcm4che
Use Gunter's suggestion, simplifying the script by removing the layered if statements. I've tried roughly your script (modifying it to work with my data set instead of modifying my data set to your script, so it's not exactly the same). It works as desired for my 8 character PID files.


Docjay

unread,
Jul 2, 2018, 7:32:03 PM7/2/18
to dcm4che
Chad,

  I'll simplify the script some and give it another go.  Can you post the script that you tried that worked successfully?

thanks

Gunter Zeilinger

unread,
Jul 3, 2018, 2:05:03 AM7/3/18
to dcm...@googlegroups.com
Just to clarify: The attributes from the resulting data set will be inserted into the original data set. So an output of <?xml version="1.0" encoding="UTF-8"?><NativeDicomModel/> will leave the received data unchanged. So it would not explain, why the Patient ID is missing, if there was a value for the Patient ID in the original data set.


--

ChadN

unread,
Jul 3, 2018, 3:25:00 PM7/3/18
to dcm4che
I tested on an image with a PID of 8 characters 11223344; Modality of SC; and Manufacturer of GE. Here's the script:


<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
 
<xsl:output method="xml"/>
   
<!-- this Stylesheet is meant to fix 'unhyphenated' PIDS from CARDIOLOGY. -->
   
<!-- These studies to fix this way are coming from other site -->
   
<xsl:decimal-format name="dashes" grouping-separator='-'/>
   
<xsl:template match="/NativeDicomModel">
       
<NativeDicomModel>
           
<!-- for when the PID is seven digits long -->
           
<xsl:variable name="modPatientID" select="DicomAttribute[@tag='00100020']/Value"/>

           
<xsl:variable name="Manuf" select="DicomAttribute[@tag='00080070']/Value"/>

           
<xsl:variable name="Acc" select="DicomAttribute[@tag='00080050']/Value"/>

           
<xsl:variable name="modality" select="DicomAttribute[@tag='00080060']/Value"/>

           
<xsl:variable name="studyDesc" select="DicomAttribute[@tag='00081030']/Value"/>

           
<!-- (0008,1010) Manuf_Name -->
           
<xsl:if test="string-length($modPatientID)=8">
               
<xsl:if test="not(contains($modality, 'CT') or contains($modality, 'MR'))">
                   
<xsl:if test="contains($Manuf,'SIEMENS') or contains($Manuf, 'GE') or contains($Manuf, 'XXX')">

                       
<DicomAttribute tag="00100020" vr="LO">

Docjay

unread,
Jul 5, 2018, 11:37:50 AM7/5/18
to dcm...@googlegroups.com
Chad,

   Thanks for helping test.  In your attribute coercion rule, what settings did you have for:

No Attribute Keyword
DICOM transfer role

My current settings are

No Attribute keyword:  True
DICOM Transfer role:  SCU

During my testing today, I changed the DICOM transfer role to SCP and it was able to accept my study I was sending it instead of getting rejected like it was the whole time (yes, there was a patient ID for the study listed on the studies page).  Of course, it didn't process the stylesheet because the coercion rule was skipped. 

I then changed my setting of 'Accept missing patient ID' to 'Create', also changed the coercion rule back to SCU, and I resent my test study again.  This time, it accepted the exam, but the patient ID ended up a generated patient ID of 'P-00000001'.

I then changed my setting of 'Accept missing patient ID'  from 'Create' to 'yes' and it stored the study bu the patient ID was empty.

I then used your script you posted above.  Then changed the stylesheet to test if the 'string-length' = 8 and if the $Manuf contained 'Philips'.  The study I sent had a Patient ID with a length of '7', so DCM4CHEE stored the study and didn't try to coerce it.  I then changed the stylesheet to test if the 'string-length' = 7.  I then sent a different exam that matched my tests within the stylesheet, and the Patient ID was 7 digits long.  This time, the study was rejected and the log showed 'Patient ID missing in object'.

So, its like whenever the stylesheet test passes, and DICOMobjects are coming inbound, is where it fails.

Can you think of any other way to test this other than what I have done? 

I must be missing something as I can't get patient IDs to coerce with my stylesheet at all, unlike your testing.

What version of the archive are you using?

Can anyone else reproduce this?

Thanks so much for all of your time

ChadN

unread,
Jul 5, 2018, 4:33:58 PM7/5/18
to dcm4che
My test was just using the dcm2xml tool:

dcm2xml <dicom-file> -x <xsl-file>

It was successfully spitting out 

<?xml version="1.0" encoding="UTF-8"?><NativeDicomModel><DicomAttribute tag="00100020" vr="LO">11-22-33-44</DicomAttribute></NativeDicomModel>

I think SCU is the correct DICOM Transfer Role (the peer [sending] entity is the SCU) and I've always used true for no attribute keyword. 

Does your script work with the dcm2xml tool? I think that's the place to start. I have been able to coerce data using 5.13.2 both incoming and outgoing, so it feels like the script is the hangup, but that's just my guess.

Docjay

unread,
Jul 5, 2018, 9:50:32 PM7/5/18
to dcm4che
Chad,

   Yep, the stylesheet works fine with the dcm2xml tool, I posted my results on the sixth post down.  I guess I'll try to not place hypens in the Pat ID and try to prefix it as a test for now.

Thanks

Docjay

unread,
Jul 12, 2018, 6:28:47 PM7/12/18
to dcm4che


so I tried this again on a QC study.  I'm coercing the patient ID to something different, and it gave me the same error, 'Patient ID missing in object'.

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
 
<xsl:output method="xml"/>

   
<!-- this Stylesheet is meant to join MG Phantoms into an already existing patient. -->

   
<xsl:template match="/NativeDicomModel">
       
<NativeDicomModel>

           
<xsl:variable name="patId" select="DicomAttribute[@tag='00100020']"/>
           
<xsl:variable name="patName" select="DicomAttribute[@tag='00100010']"/>
           
<xsl:variable name="StudyDesc" select="DicomAttribute[@tag='00081030']"/>
           
<xsl:variable name="AccNum" select="DicomAttribute[@tag='00080050']"/>
           
<xsl:variable name="Mod" select="DicomAttribute[@tag='00080061']"/>

           
<xsl:variable name="instName" select="DicomAttribute[@tag='00080080']"/>

           
<xsl:variable name="station" select="DicomAttribute[@tag='00081010']"/>
            <xsl:variable name="issuer" select="DicomAttribute[@tag='00100021']"/
   
           
<xsl:if test="contains($StudyDesc, 'Phantom')">
               
<DicomAttribute tag="00100021" vr="LO">HOSP1</DicomAttribute>
               
<DicomAttribute tag="00100010" vr="PN">QC^BAMG1^HOSP1</DicomAttribute>
               
<DicomAttribute tag="00100020" vr="LO">HOSP1-QC-MG</DicomAttribute>
               
<DicomAttribute tag="00080050" vr="SH">WEEKLY</DicomAttribute>

           
</xsl:if>
       
</NativeDicomModel>
   
</xsl:template>
</xsl:stylesheet>

When I use the toolkit, it works correctly, but when I use DCM4CHEE-ARC-light v5.13.2, it throws that error.  Can anyone reproduce this to help out please?

Thank you

gunterze

unread,
Jul 13, 2018, 8:29:33 AM7/13/18
to dcm4che
Your XSL does not reflect the Native DICOM Model specified in DICOM PS 3.19 . Particularly, it ignores Value and PersonName elements.

Docjay

unread,
Jul 13, 2018, 7:20:29 PM7/13/18
to dcm...@googlegroups.com
Gunter,

  Thanks for pointing me the right direction on how to write this.

  Now I can get the archive to accept my study without the error and do some coercions, but its not getting the patient name just right.

Here is what I have so far

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
 
<xsl:output method="xml"/>

   
<!-- to correct MG phantom studies -->

   
<xsl:template match="/NativeDicomModel">
       
<NativeDicomModel>

           
<xsl:variable name="patId" select="DicomAttribute[@tag='00100020']/Value"/>
           
<xsl:variable name="patName" select="DicomAttribute[@tag='00100010']/Value"/>
           
<xsl:variable name="StudyDesc" select="DicomAttribute[@tag='00081030']/Value"/>
         
           
<!-- HOSP1 MG QC-->
           
<xsl:if test="contains($StudyDesc, 'Phantom')"><!-- HOSP1 MG QC Weekly-->

               
<DicomAttribute tag="00100021" vr="LO">

                 
<Value number="1">HOSP1</Value>
                </
DicomAttribute>

               
<DicomAttribute tag="00100010" vr="PN">

                 
<PersonName number="1">QC^BAMG1^HOSP1</PersonName>
                </
DicomAttribute>

               
<DicomAttribute tag="00100020" vr="LO">

                 
<Value number="1">HOSP1-QC-MG</Value>
                </
DicomAttribute>

               
<DicomAttribute tag="00080050" vr="SH">

                 
<Value number="1">WEEKLY</Value>
                </
DicomAttribute>

           
</xsl:if>
        </
NativeDicomModel>
   
</xsl:template>
</
xsl:stylesheet>

The patient's name is being changed to 'HOSP1^QC' and I'm looking for 'QC^BAMG1^HOSP1'

I've tried to also write it like this (only showing a shortend form here)

<DicomAttribute tag="00100010" vr="PN">

 
<PersonName number="1">QC</PersonName>

</DicomAttribute>
<DicomAttribute tag="00100010" vr="PN">

 
<PersonName number="2">BAMG1</PersonName>

</DicomAttribute>
<DicomAttribute tag="00100010" vr="PN">

 
<PersonName number="3">HOSP1</PersonName>
</DicomAttribute>

but it didn't turn out right either.

ps3.19 speaks about alphabetic components, but I'm not sure how to write that.

Anymore hints you can give me on how to format the name in my example?

Thank you again!

zaka

unread,
Jul 14, 2018, 3:32:27 AM7/14/18
to dcm4che
Hi! Try this way.

      <DicomAttribute tag="00100010" vr="PN">
       
<PersonName number="1">

         
<Alphabetic>
           
<FamilyName>QC</FamilyName>
            <GivenName>
BAMG1</GivenName>
            <MiddleName>
HOSP1</MiddleName>
          </Alphabetic>
        </PersonName>
      </DicomAttribute>




On Saturday, July 14, 2018 at 4:20:29 AM UTC+5, Docjay wrote:
Gunter,

  Thanks for pointing me the right direction on how to write this.

  Now I can get the archive to accept my study without the error and do some coercions, but its not getting the patient name just right.

Here is what I have so far

Docjay

unread,
Jul 16, 2018, 2:35:54 PM7/16/18
to dcm...@googlegroups.com
Zaka,

 Thanks for the code you posted, I thought it would get me there, but it coerced the Patient Name to

HOSP1^QC

I double checked in the $wildfly\standalone\tmp\dcm4chee-arc\mgqc-hosp1.xsl is the file and it was uploaded correctly.

<xsl:if test="contains($StudyDesc, 'Phantom')"><!-- HOSP1 MG QC Weekly-->
               
<DicomAttribute tag="00100021" vr="LO">
                 
<Value number="1">HOSP1</Value>

               
</DicomAttribute>
               
<DicomAttribute tag="00100010" vr="PN">

                 
<PersonName number="1">
                   
<Alphabetic>
                     
<FamilyName>QC</FamilyName>
                     
<GivenName>BAMG1</GivenName>
                     
<MiddleName>HOSP1</MiddleName>
                   
</Alphabetic>
                 
</PersonName>
               
</DicomAttribute>

               
<DicomAttribute tag="00100020" vr="LO">
                 
<Value number="1">HOSP1-QC-MG</Value>
               
</DicomAttribute>
               
<DicomAttribute tag="00080050" vr="SH">
                 
<Value number="1">WEEKLY</Value>
               
</DicomAttribute>

Everything else that I'm coercing in the stylesheet is getting changed correctly, its just the patient name.

zaka

unread,
Jul 16, 2018, 4:17:03 PM7/16/18
to dcm4che
Hi! Pay attention to the attribute 'Delete Patient On Delete Last Study' in your dcm4chee-arc configuration. The path is 'devicelist/dcm4chee-arc/Device Extension/Archive Device/Delete Patient On Delete Last Study'. By default it is set to 'false'. If so, even if you have deleted all studies for PatID=HOSP1-QC-MG, the first time added patient record with PatID=HOSP1-QC-MG and PatName=HOSP1^QC will stay in database. And all the subsequent attempts to add new studies with PatID=HOSP1-QC-MG will be double coerced, first time with your stylesheet and second time with archive rules. I had not found any method to delete such hidden records other than drop the entire database and to set 'Delete Patient On Delete Last Study' to 'true'.

Docjay

unread,
Jul 17, 2018, 10:07:43 AM7/17/18
to dcm...@googlegroups.com
Zaka,

   Yep - that was it.  There was an existing patient there from another study I sent to it last week.  I had already set the archive to 'Delete Patient On Delete Last Study', but I had just assumed that there was only one exam for the patient.  Don't forget one way to only search for 'patients' is with the drop down on the far right side, and instead of selecting 'Studies New/Old', drop it down and pick 'Patient New/Old' (or whatever your preference) and then you also have the option to search by Date of Birth.  I found my demo patient there and was able to delete it.

Hey- one more thing, in this code below that deals with the Patient ID, can I pick your brain and see if you think it written correctly?

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
 
<xsl:output method="xml"/>

   
<!-- this Stylesheet is meant to fix 'unhyphenated' PIDS from CARDIOLOGY. -->
   
<!-- These studies to fix this way are coming from other site -->
   
<xsl:decimal-format name="dashes" grouping-separator='-'/>

   
<xsl:template match="/NativeDicomModel">
       
<NativeDicomModel>

           
<!-- for when the PID is seven digits long -->

           
<xsl:variable name="modPatientID" select="DicomAttribute[@tag='00100020']/Value"/>
           
<xsl:variable name="Station" select="DicomAttribute[@tag='00081010']/Value"/>
           
<xsl:variable name="Acc" select="DicomAttribute[@tag='00080050']/Value"/>
           
<xsl:variable name="instName" select="DicomAttribute[@tag='00080080']/Value"/>
           
<xsl:variable name="studyDesc" select="DicomAttribute[@tag='00081030']/Value"/>
           
<!-- (0008,1010) Station_Name -->
           
<xsl:if test="string-length($modPatientID)=7">
               
<xsl:if test="not(contains($instName, 'JANE') or contains($instName, 'Bluestem'))">

                   
<xsl:if test="contains($Station,'HOSP1') or contains($Station, 'HOSP2') or contains($Station, 'OW_')">

                       
<DicomAttribute tag="00100020" vr="LO">

                           
<xsl:value-of select="concat(

                                substring($modPatientID, 1, 2), '-',
                                substring($modPatientID, 3, 2), '-',
                                substring($modPatientID, 5, 2), '-',
                                substring($modPatientID, 7)
                            )/Value"/>

                       
</DicomAttribute>
                   
</xsl:if>
               
</xsl:if>

           
</xsl:if>
       
</NativeDicomModel>
     
</xsl:template>
</xsl:stylesheet>



I'm just not sure on how to format <Value number="1"> with this area after all of the "if" tests

<DicomAttribute tag="00100020" vr="LO">

 
<xsl:value-of select="concat(

   substring($modPatientID, 1, 2), '-',
   substring($modPatientID, 3, 2), '-',
   substring($modPatientID, 5, 2), '-',
   substring($modPatientID, 7)
  )/Value"/>
</DicomAttribute>



Thanks

zaka

unread,
Jul 17, 2018, 10:56:47 AM7/17/18
to dcm4che
Try this way:

<DicomAttribute tag="00100020" vr="LO">
 
<xsl:value-of select="concat(
   substring($modPatientID, 1, 2), '-',
   substring($modPatientID, 3, 2), '-',
   substring($modPatientID, 5, 2), '-',
   substring($modPatientID, 7))"
/>
</DicomAttribute>

And test your stylesheet with 'dcm2xml' utility from DCM4CHE3. If it works with 'dcm2xml' it MUST works with archive. If not so, the reason is some other then your stylesheet.


On Tuesday, July 17, 2018 at 7:07:43 PM UTC+5, Docjay wrote:

Zaka,

Docjay

unread,
Jul 17, 2018, 1:34:50 PM7/17/18
to dcm...@googlegroups.com
Thanks for the reply.  I had to format it with the '/value"/>' at the end otherwise it was complaining about 'missing patient id'.   It now throws this error:

this is for when I"m trying to coerce the Patient ID from '1122334'' --> '11-22-33-4'


2018-07-17 12:20:25,911 ERROR [stderr] (EE-ManagedExecutorService-default-Thread-22377) ERROR:  'Error checking type of the expression 'FilterParentPath(funcall(concat, [funcall(substring, [cast(variable-ref(modPatientID/node-set), string), cast(int-expr(1), real), cast(int-expr(2), real)]), literal-expr(-), funcall(substring, [cast(variable-ref(modPatientID/node-set), string), cast(int-expr(3), real), cast(int-expr(2), real)]), literal-expr(-), funcall(substring, [cast(variable-ref(modPatientID/node-set), string), cast(int-expr(5), real), cast(int-expr(2), real)]), literal-expr(-), funcall(substring, [cast(variable-ref(modPatientID/node-set), string), cast(int-expr(7), real)])]), step("child", 18))'.'

2018-07-17 12:20:25,911 ERROR [stderr] (EE-ManagedExecutorService-default-Thread-22377) FATAL ERROR:  'Could not compile stylesheet'

I've used the 'concat' fucntion call before in dcm4chee v.2.18

Here is my stylesheet (the formatting maybe off as to how the returns are, not presented well here)

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
 
<xsl:output method="xml"/>
   
<!-- this Stylesheet is meant to fix 'unhyphenated' PIDS from CARDIOLOGY. -->

   
<!-- These studies to fix this way are coming from HOSP1-->

   
<xsl:decimal-format name="dashes" grouping-separator='-'/>
   
<xsl:template match="/NativeDicomModel">
       
<NativeDicomModel>
           
<!-- for when the PID is seven digits long -->
           
<xsl:variable name="modPatientID" select="DicomAttribute[@tag='00100020']/Value"/>
           
<xsl:variable name="Station" select="DicomAttribute[@tag='00081010']/Value"/>
           
<xsl:variable name="Acc" select="DicomAttribute[@tag='00080050']/Value"/>
           
<xsl:variable name="instName" select="DicomAttribute[@tag='00080080']/Value"/>
           
<xsl:variable name="studyDesc" select="DicomAttribute[@tag='00081030']/Value"/>
           
<!-- (0008,1010) Station_Name -->
           
<xsl:if test="string-length($modPatientID)=7">

               
<xsl:if test="not(contains($instName, 'HOSP1') or contains($instName, 'Bluestem'))">
                   
<xsl:if test="contains($Station,'HOSP3')">

                       
<DicomAttribute tag="00100020" vr="LO">
                           
<xsl:value-of select=
"concat(

                                substring($modPatientID, 1, 2), '-',
                                substring($modPatientID, 3, 2), '-',
                                substring($modPatientID, 5, 2), '-',
                                substring($modPatientID, 7))/value"/>

zaka

unread,
Jul 17, 2018, 4:21:35 PM7/17/18
to dcm4che
Maybe this one^

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
 
<xsl:output method="xml"/>
   
<!-- this Stylesheet is meant to fix 'unhyphenated' PIDS from CARDIOLOGY. -->
   
<!-- These studies to fix this way are coming from HOSP1-->
   
<xsl:decimal-format name="dashes" grouping-separator='-'/>
   
<xsl:template match="/NativeDicomModel">
       
<NativeDicomModel>
           
<!-- for when the PID is seven digits long -->
           
<xsl:variable name="modPatientID" select="DicomAttribute[@tag='00100020']/Value"/>
           
<xsl:variable name="Station" select="DicomAttribute[@tag='00081010']/Value"/>
           
<xsl:variable name="Acc" select="DicomAttribute[@tag='00080050']/Value"/>
           
<xsl:variable name="instName" select="DicomAttribute[@tag='00080080']/Value"/>
           
<xsl:variable name="studyDesc" select="DicomAttribute[@tag='00081030']/Value"/>
           
<!-- (0008,1010) Station_Name -->

           
<xsl:choose>
               
<xsl:when test="string-length($modPatientID)=7 and
                               not(contains($instName, 'HOSP1') or contains($instName, 'Bluestem')) and
                               contains($Station,'HOSP3')"
>

                   
<DicomAttribute tag="00100020" vr="LO">
                       
<xsl:value-of select="concat(
                            substring($modPatientID, 1, 2), '-',
                            substring($modPatientID, 3, 2), '-',
                            substring($modPatientID, 5, 2), '-',
                            substring($modPatientID, 7))"
/>

                   
</DicomAttribute>
               
</xsl:when>
               
<xsl:otherwise>

                   
<DicomAttribute tag="00100020" vr="LO">

                       
<Value number="1">
                           
<xsl:value-of select="$modPatientID"/>
                       
</Value>
                   
</DicomAttribute>
               
</xsl:otherwise>
           
</xsl:choose>

       
</NativeDicomModel>
     
</xsl:template>
</xsl:stylesheet>

Docjay

unread,
Jul 17, 2018, 4:44:28 PM7/17/18
to dcm4che

It came back with 'Patient ID missing in object'

Hmm, I wish I knew what I was missing --

Thanks so much for your help!
Reply all
Reply to author
Forward
0 new messages