Wednesday, May 13, 2020

Using DCM4CHE FindSCU tool to get only certain DICOM fields

DCM4CHE is a powerful framework. It consists of a FindScu tool that we can use to query, find, and present data and metadata.

This post discusses how to find StudyInstanceUIDs, given PatientID and StudyDate, for example.

1. First, make sure the Source PACS (SRCAET) is configured to accept queries from the destination (BMIPACS) AET and port, where you are running these queries from.


2. Go to the dcm4che-5.19.0/etc/findscu folder and create an XSLT template.
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="text"/>

  <xsl:template match="/NativeDicomModel">
    <xsl:text>"</xsl:text>
    <xsl:apply-templates select="DicomAttribute[@tag='0020000D']"/>
    <xsl:text>"</xsl:text>
    <xsl:text>,</xsl:text>
    <xsl:text>"</xsl:text>
    <xsl:apply-templates select="DicomAttribute[@tag='00100020']"/>
    <xsl:text>"</xsl:text>
    <xsl:text>&#xA;</xsl:text>
    
  </xsl:template>

  <xsl:template match="DicomAttribute">
    <xsl:apply-templates select="Value"/>
  </xsl:template>

  <xsl:template match="Value">
    <xsl:if test="@number != 1">\</xsl:if>
    <xsl:value-of select="text()"/>
  </xsl:template>

</xsl:stylesheet> 
  
Please note that above DicomAttribute[@tag='0020000D'] indicates StudyInstanceUID.

3. Save it (we save it as stid.csv.xsl.

4. Now, go to dcm4che-5.19.0/bin and run the below:


./findscu -c SRCAET@XXX.XXX.XXX.XXX:PPP -b BMIPACS:4242 -m PatientID=AAAA -m StudyDate=20180423 -r StudyInstanceUID -x ../etc/findscu/stid.csv.xsl --out-cat --out-file test.csv --out-dir .

In the above query, make sure to replace:
SRCAET with the relevant AE Title of the PACS host,
XXX.XXX.XXX.XXX with its relevant host IP address,
and PPP with its port.
Similarly, BMIPACS:4242 with the respective local AET and port.
 
Replace AAAA with the correct PatientID and StudyDate with an actual study date.

out-dir indicates the output directory. We are storing it to the present directory in this example.

Now, run it.

5. The output will return the StudyInstanceUID and PatientID in test1.csv as below in the specified output directory:
"xxx.xxx.xxx.xxx.xxx.xxx", "AAAA"

No comments:

Post a Comment

You are welcome to provide your opinions in the comments. Spam comments and comments with random links will be deleted.