How to generate the Study UID? (HL7 ORM-O01)

1,608 views
Skip to first unread message

Ramon Ribeiro

unread,
Jul 21, 2017, 10:30:28 AM7/21/17
to dcm4che
Hi, guys.

I came to a situation that I can not see the images, when they are made by Worklist information.

When registered direct in CR, the images are normally viewed.

When they are registered by the Worklist information, the images are loading and it does not end.

I have already seen that it was my mistake, in the Mirth I configured the ORM ^ O01 message with the ZDS field, but it looks up the exam's access number instead of generating a StudyUID.

I wanted to know how I'm going to generate this StudyUID prefix ?!
dcm4chee-web3.JPG
Oviyam2.JPG

fleetwoodfc

unread,
Jul 24, 2017, 9:37:02 AM7/24/17
to dcm4che

Gunter Zeilinger

unread,
Jul 24, 2017, 9:44:58 AM7/24/17
to dcm...@googlegroups.com
UIDUtils.createUID() generates the UID from random UUID.

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

Ramon Ribeiro

unread,
Jul 25, 2017, 9:34:42 AM7/25/17
to dcm...@googlegroups.com
Hello, Gunter!

Where do I find this class?

Could I generate this ending in Mirth?
Because I received a FreeUID prefix.

I do not know much about the DICOM standard, could this end be ".xxxx.yyyymmddhh" (year, month, day, time)?

Ramon Ribeiro

unread,
Jul 25, 2017, 9:36:43 AM7/25/17
to dcm4che
thank you, Fleetwoodfc!

I was able to create the prefix with FreeUID.

Gunter Zeilinger

unread,
Jul 25, 2017, 9:55:10 AM7/25/17
to dcm...@googlegroups.com
UIDUtils is provided by dcm4che3 core module. But if you look in the source it's just a few lines to derive a valid UID from a UUID provided by Java's UUID implemention.

On Tue, Jul 25, 2017 at 3:34 PM, Ramon Ribeiro <ramonn...@gmail.com> wrote:
Hello, Gunter!

Where do I find this class?

Could I generate this ending in Mirth?
Because I received a FreeUID prefix.

I do not know much about the DICOM standard, could this end be ".xxxx.yyyymmdd"?

Ramon Ribeiro

unread,
Jul 26, 2017, 9:39:38 AM7/26/17
to dcm4che
Hi, Gunter!

Do you know if you have how to generate Study UID in Mirth?
Using the ZDS in the HL7 message. But my RIS / HIS does not send me information from DICOM, only from the Patient.

Another thing, I could not disable the patient issuer, keep the message
"Patient [id = 2003HO, issuer = null, name = BRUNO GUSTAVO LUCINDO \ S \ null \ S \ null \ S \ HOL] ambiguous", my RIS / HIS hands over the name that way, we do not have the "pid, issuer? "[Familyname, givenname, middlename ?, birthdate] in Brazil, full name only. I've tried "pid, issuer", but some still have errors.


Gunter Zeilinger

unread,
Jul 26, 2017, 10:12:45 AM7/26/17
to dcm...@googlegroups.com
I don't know Mirth. Only know they use internally my dcm4che2 toolkit, so may be you could somehow call the static method org.dcm4che2.util.UIDUtils#createUID().

I am no longer familiar with dcm4chee-arc-2.x. Highly recommend to upgrade to dcm4chee-arc 5.x.

Gunter Zeilinger

unread,
Jul 26, 2017, 10:26:50 AM7/26/17
to dcm...@googlegroups.com
By the way, HL7 OIDs are the same as DICOM UIDs, so if Mirth supports generating HL7 OIDs ...

fleetwoodfc

unread,
Jul 27, 2017, 8:19:13 AM7/27/17
to dcm4che
With Mirth you can add external java libraries (such as dcm4che-core-2.0.29.jar) then call the static method with a javascript step in a transformer. 

Ramon Ribeiro

unread,
Jul 27, 2017, 10:35:06 AM7/27/17
to dcm4che
Thanks, Gunterze and fleetwoodfc!

I will do the test, I'll post the return here.

Thanks for the answers!

Marius S

unread,
Aug 3, 2022, 3:57:25 AM8/3/22
to dcm4che
Hello,

I am using dcm4chee 2.18.1-mysql, and I am testing ORM messages for creating a worklist. By default we can send Study Instance UID in ZDS 1 segment in HL7 message and it will be stored when creating a worklist.
However I also would like to add some code to orm2dcm.xsl file to generate Study Instance UID.
I see that you mention  UIDUtils.createUID(), also in other post I found that this code was used in orm2dcm.xsl file to generate Study IUID:
<xsl:with-param name="val" select="java:org.dcm4che2.util.UIDUtils.createUID($suid-prefix)"/>

I have added this code:
....
<xsl:template match="ZDS">
        <!-- Study Instance UID -->
        <xsl:call-template name="attr">
            <xsl:with-param name="tag" select="'0020000D'"/>
            <xsl:with-param name="vr" select="'UI'"/>
            <xsl:with-param name="val" select="java:org.dcm4che2.util.UIDUtils.createUID($suid-prefix)"/>
           <!-- <xsl:with-param name="val" select="string(field[1]/text())"/> -->
        </xsl:call-template>
    </xsl:template>
....


But when I try to send ORM message I am getting ERROR: Missing style sheet to process HL7 message! xslPath:orm2dcm.xsl

Could you please let me know how I can call UIDUtils.createUID() in my dcm4chee 2.18.1-mysql orm2dcm.xsl file?


 
On Monday, July 24, 2017 at 4:44:58 PM UTC+3 gunt...@protonmail.com wrote:
UIDUtils.createUID() generates the UID from random UUID.

On Mon, Jul 24, 2017 at 3:37 PM, fleetwoodfc <dda...@eesimed.com> wrote:

https://www.medicalconnections.co.uk/Free_UID

or 



On Friday, July 21, 2017 at 10:30:28 AM UTC-4, Ramon Ribeiro wrote:
Hi, guys.

I came to a situation that I can not see the images, when they are made by Worklist information.

When registered direct in CR, the images are normally viewed.

When they are registered by the Worklist information, the images are loading and it does not end.

I have already seen that it was my mistake, in the Mirth I configured the ORM ^ O01 message with the ZDS field, but it looks up the exam's access number instead of generating a StudyUID.

I wanted to know how I'm going to generate this StudyUID prefix ?!

--
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+u...@googlegroups.com.

Prakash Jayaraman

unread,
Aug 3, 2022, 9:16:56 AM8/3/22
to dcm...@googlegroups.com
Make sure that orm2dcm.xsl file is located in /2.18.1/server/default/conf/dcm4chee-hl7 folder. 

Marius S

unread,
Aug 3, 2022, 10:28:04 AM8/3/22
to dcm4che
Hello,

Yes, file is located in this directory, I haven't moved it.
I have been working on my ORM HL7 message and orm2dcm.xsl file. I have changed some fields in this file according to my ORM message, also I have added some additional fields like Scheduled Station AETitle and Station name from HL7 ORM message to be added to worklist. I am now working with Thai names so I also have changed to TIS-620 encoding, everything is working fine and creates a worklist.

However when I am adding this line <xsl:with-param name="val" select="java:org.dcm4che2.util.UIDUtils.createUID($suid-prefix)"/> I am getting the ERROR.
If I leave as it was <xsl:with-param name="val" select="string(field[1]/text())"/> it creates a worklist with Study Instance UID from ZDS.1 value 1.2.1

Here is my HL7 ORM message I am working:
MSH|^~\&|HIS|PACS||Pacs|20211005172132||ORM^O01|2016072814051461543|1|2.3||||||UTF-8
PID|1||PatientID||ชื่อทดสอบ^นามสกุลเอี่ยมอ่ง||19550119|M|
PV1|1|O||||||5101^RefDocLastName^RefDocFirstName^P^^DR|||||||||||
ORC|NW|ACCNUM||AETITLE|||R|
OBR|1|||ProcedureID^Req Procedure Description^^SchedProcStepID^Scheduled Procedure Description||||||||||||7101^ReqDocLastName^ReqDocFirstName^P^^DR||||||||||||||||||||202204011030||||||||1^DX|||
ZDS|1.2.1^100^Application^DICOM||||



I don't have this variable $suid-prefix, so I also tried to use such lines <xsl:with-param name="val" select="java:org.dcm4che2.util.UIDUtils.createUID()"/> , <xsl:with-param name="val" select="UIDUtils.createUID()"/> , <xsl:with-param name="val" select="createUID()"/> but none of these works. 

When I tried with this line: <xsl:with-param name="val" select="java:org.dcm4che2.util.UIDUtils.createUID($suid-prefix)"/>
In server.log I see that java is not declared:
C:\dcm4chee-2.18.1-mysql\server\default\conf\dcm4chee-hl7\orm2dcm.xsl failed:
javax.xml.transform.TransformerConfigurationException: Namespace prefix 'java' is undeclared.

Then I tried with <xsl:with-param name="val" select="org.dcm4che2.util.UIDUtils.createUID()"/>
It shows such error in server.log:
STDERR] FATAL ERROR:  'Error checking type of the expression 'funcall(org.dcm4che2.util.UIDUtils.createUID, [])'.'


So I am confused how I can call UIDUtils.createUID() to generate a Study Instance UID?

I am also attaching orm2dcm.xsl file.


Thanks.

orm2dcm.xsl

Prakash Jayaraman

unread,
Aug 4, 2022, 1:20:27 AM8/4/22
to dcm...@googlegroups.com
Declare the suid-prefix variable in the top and try. For example,  <xsl:variable name="suid-prefix" select="'X.XX.XXX.XXX'"/>. Substitute your <org root> prefix or a numeric value for XXX.XXX.

<?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="yes"/>
    <xsl:include href="common.xsl"/>
    <xsl:variable name="suid-prefix" select="'X.XX. XXX.XXX'"/>
    <xsl:variable name="fill-sps-status" select="'SCHEDULED'"/>
    <xsl:template match="/hl7">
.....
.....
.....
And also replace <xsl:call-template name="attr">"" with <xsl:call-template name="attr" xmlns:java="http://xml.apache.org/xslt/java">""


 <!-- Study Instance UID -->
        <xsl:call-template name="attr" xmlns:java="http://xml.apache.org/xslt/java">

            <xsl:with-param name="tag" select="'0020000D'"/>
            <xsl:with-param name="vr" select="'UI'"/>
            <xsl:with-param name="val" select="java:org.dcm4che2.util.UIDUtils.createUID($suid-prefix)"/> <!-- For generating UIDs -->
        </xsl:call-template>

This works for me. 

Marius S

unread,
Aug 4, 2022, 4:44:07 AM8/4/22
to dcm4che
Thank you very much for detail explanation!
Now I can send HL7 ORM message and it will generate Study Instance UID.

I have added <xsl:variable name="suid-prefix" select="'1.2.826.0'"/> at the top.

Also edited the the ZDS segment as you suggested:

    <xsl:template match="ZDS">
        <!-- Study Instance UID -->
        <xsl:call-template name="attr" xmlns:java="http://xml.apache.org/xslt/java">
            <xsl:with-param name="tag" select="'0020000D'"/>
            <xsl:with-param name="vr" select="'UI'"/>
            <xsl:with-param name="val" select="java:org.dcm4che2.util.UIDUtils.createUID($suid-prefix)"/>
           <!-- <xsl:with-param name="val" select="string(field[1]/text())"/> -->
        </xsl:call-template>
    </xsl:template>

However I still need to send ZDS segment in ORM message, and add something in ZDS.1 (Study Instance UID), because if I would send ORM message without ZDS segment I am getting ERROR:  Could not create entity:com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Column 'study_iuid' cannot be null.
Is this somewhere hardcoded, or configurable? Or I just need to send like ZDS|1|||| to avoid this ERROR?

Thanks.
Reply all
Reply to author
Forward
0 new messages