Configuring DCM4CHEE to auto anonymize

1,394 views
Skip to first unread message

BRIT

unread,
Jan 19, 2015, 12:15:41 PM1/19/15
to dcm...@googlegroups.com
So from reading through the DCM4CHE forum there's no "builtin" way of DCM4CHEE automatically anonymizing studies upon receipt, but I did read that there are some things that can be configured in order for anonymization to occur. One such article lead me to get into the StoreScp service a little deeper where I found that supposedly it is possible to anonymize studies from certain AETs using GeneratePatientIDForUnscheduledFromAETitles .

Apparently leaving the GeneratePatientID as is but then setting an AET in GeneratePatientIDForUnscheduledFromAETitles, is supposed to automatically anonymize PatientID as long as there's no reference to a Scheduled Procedure Step ("SPS"). Well, I'm not using the SPS section of DCM4CHEE in my testing environment, so I thought I would give it a go, but when I send from an "ANON" AET (after adding "ANON" into GeneratePatientIDForUnscheduledFromAETitles and restarting the StoreScp service and the DcmServer), everything I sent still had the original PatientID.

Has anyone had any success in getting this to work?

fleetwoodfc

unread,
Jan 19, 2015, 1:25:45 PM1/19/15
to dcm...@googlegroups.com
You can use a coercion xsl file (cstorerq.xsl by default) to remove the pid etc. If you then set the store SCP to AcceptMissingPatientID then it will generate a new PID. There is also a CoerceBeforeWrite option that you need to be aware of. 

BRIT

unread,
Jan 20, 2015, 1:53:14 PM1/20/15
to dcm...@googlegroups.com
fleetwoodfc,
Many thanks - I did some searching and found those coercion files and did some testing and got it working quite nicely. However, I wasn't aware of the CoerceBeforeWrite option on the Store service - it's been set to false and through the web GUI I can see that my changes have been set, but I've not tried querying the files back out of DCM4CHEE to ensure that all tags have been updated, so many thanks for that little nugget of information!

BRIT

unread,
Jan 20, 2015, 2:25:04 PM1/20/15
to dcm...@googlegroups.com
fleetwoodfc,
To follow on from this, I have an AET set upon DCM4CHEE to perform some anonymization, so I have now two AETs set up that my modality can send to (the modality's AET is MR 21):
  1. DCM4CHEE for normal sends from MR21 get stored as per normal
  2. ANON for attribute coercion from MR21
I've created the folder (MR21) and placed the cstorerq.xsl file therein:
<?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" indent="no"/>
 
<xsl:param name="calling" select="'MR21'"/>
 
<xsl:param name="called" select="'ANON'"/>
 
<xsl:template match="/dataset">
   
<dataset>
     
<xsl:variable name="patName" select="attr[@tag='00100010']"/>
     
<xsl:variable name="patDOB" select="attr[@tag='00100030']"/>
     
<xsl:if test="$patName or $patDOB">
       
<attr tag="00100020" vr="LO">
           
<xsl:value-of select="$patName"/>
       
</attr>
     
</xsl:if>
   
</dataset>
 
</xsl:template>
</xsl:stylesheet>

As you can see, if a patientName or patient's DOB is present, I'm just dumping the PatientID for the PatientsName right now (early testing stage!)

However, what's happening is that all studies from MR21 are being coerced, irrespective of whether or not they called DCM4CHEE or ANON. I would've assumed that the logic process behind coercion happens based upon:
  1. Does DCM4CHEE have a folder based upon the calling AET (yes)
  2. Is there a cstorerq.xsl file therein (yes)
  3. Do the param names (if present) match (yes)
  4. Is there either a PatientName or PatientDOB present (yes)
  5. Apply the coercion rules
Are the param names (calling and called) not filtered automatically and the translate continues to be parsed only if they're both true?




On Monday, January 19, 2015 at 10:25:45 AM UTC-8, fleetwoodfc wrote:

fleetwoodfc

unread,
Jan 20, 2015, 2:48:18 PM1/20/15
to dcm...@googlegroups.com
The calling and called AET are passed to cstoreq.xsl so the param(s) in the xsl file get overwritten each time. What you need is something like:

<xsl:if test="normalize-space($called)='ANON">


     
<xsl:variable name="patName" select="attr[@tag='00100010']"/>
     
<xsl:variable name="patDOB" select="attr[@tag='00100030']"/>
     
<xsl:if test="$patName or $patDOB">
       
<attr tag="00100020" vr="LO">
           
<xsl:value-of select="$patName"/>
       
</attr>
     
</xsl:if>

</xsl:if>

BRIT

unread,
Jan 20, 2015, 3:44:58 PM1/20/15
to dcm...@googlegroups.com
I've just been ploughing through some other posts and saw that you mentioned on the dcm4che forum that certain parameters are made available to the stylesheet from the application  -  I was just about to post a "ok, apologies - I've found your other post" and there you have, got the XSLT posted below!  thank you!

Char s

unread,
Jul 29, 2015, 8:27:48 AM7/29/15
to dcm4che, buildingrelia...@gmail.com
I created file cstorerq.xsl and copied into dcm4chee-2.17.3-mysql\server\default\conf\dcm4chee-ae
The files has :

<?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" indent="no"/>
  <xsl:template match="/dataset">
   <dataset>
<attr tag="00100010" vr="PN">Anonim</attr>
<attr tag="00100020" vr="LO">00000000</attr>
<attr tag="00100030" vr="DA">00000000</attr>
<attr tag="00100040" vr="CS">O</attr>
   </dataset>
  </xsl:template>
 </xsl:stylesheet>

But it always anonymized with this same parameters, how to make it for each patient different parameters like Anonim1 , Anonim2 etc.
Reply all
Reply to author
Forward
0 new messages