Coerce received DICOM objects attributes by XSLT - dcm4che/dcm4chee-arc-light GitHub Wiki
Attributes of received DICOM object can be overwritten using XSLT stylesheets before they are stored to the archive. One may configure one or more XSL stylesheets depending on the requirements. To do this, one needs to create Attribute Coercions. These may be configured either on archive device level or on Archive AE extension level. One must note that the stylesheets shall always conform to Native DICOM Model
An Attribute Coercion
may be created on :
-
Archive Device level - to apply attribute coercion for instances received by any Application Entity of the Archive :
Go to
Menu->Configuration
, then onDevices
page click onEdit
of thedcm4chee-arc
device. Go toExtensions
andEdit extension
ofDevice Extension
. Again go to itsExtensions
andEdit extension
ofArchive Device
. Go to itsChild objects
and select+ Add a new Attribute Coercion
against the fieldAttribute Coercion
. Enter the values forName
, select value forDIMSE
andDICOM Transfer Role
and add one or more optional values and clickSave
.
OR
-
Application Entity level - to apply attribute coercion for instances received by this Application Entity of the Archive
Go to
Menu->Configuration
, then onDevices
page click onEdit
of thedcm4chee-arc
device. Go to itsChild Objects
and select anApplication Entity
from theNetwork AEs
dropdown. Go toExtensions
andEdit extension
ofNetwork AE Extension
. Again go to itsExtensions
andEdit extension
ofArchive Network AE
. Go to itsChild objects
and select+ Add a new Attribute Coercion
against the fieldAttribute Coercion
. Enter the values forName
, select value forDIMSE
andDICOM Transfer Role
and add one or more optional values and clickSave
.
As an example, to coerce attributes when objects are stored to archive, either create a LDIF file to add attributes either on :
-
Archive Device level (e.g.):
version: 1 # Sample configuration for Attribute Coercion dn: cn=Default Attribute Coercion,dicomDeviceName=dcm4chee-arc,cn=Devices,cn=DICOM Configuration,dc=dcm4che,dc=org objectClass: dcmArchiveAttributeCoercion cn: Default Attribute Coercion dcmDIMSE: C_STORE_RQ dicomTransferRole: SCU dcmURI: /path-to-custom-stylesheet.xsl
OR
-
Archive AE level (e.g.):
version: 1 # Sample configuration for Attribute Coercion dn: cn=Default Attribute Coercion,dicomAETitle=DCM4CHEE,dicomDeviceName=dcm4chee-arc,cn=Devices,cn=DICOM Configuration,dc=dcm4che,dc=org objectClass: dcmArchiveAttributeCoercion cn: Default Attribute Coercion dcmDIMSE: C_STORE_RQ dicomTransferRole: SCU dcmURI: /path-to-custom-stylesheet.xsl
and import it to the LDAP Server by using the ldapadd command line utility or the LDIF Import... function of Apache Directory Studio
- or directly use its New Entry... function to create corresponding Attribute Coercion entries.
OR directly use the New Entry... function of Apache Directory Studio
to create corresponding Attribute Coercion entries on Device Level (e.g.:
dicomDeviceName=dcm4chee-arc
) or on Application Entity Level (e.g:dicomAETitle=DCM4CHEE
) of the Archive Configuration.
wherein path-to-custom-stylesheet.xsl
stylesheet contains the various coercions one may want to apply on one or more DICOM attributes of incoming received objects.
One may refer to Archive Attribute Coercion to understand the description of attributes.
Go to the Control tab on Configuration page in archive UI and reload the configuration.
Depending on one's requirements, there are various examples of Attribute Coercions provided in sample configuration
of archive. One may use them as it is or also modify as per one's requirement. The stylesheet may be placed on filesystem
or also on http server. In below examples we are using ${jboss.server.temp.url}/dcm4chee-arc/<stylesheet>.xsl
because
these are packaged by default in the vendor data.
If any custom stylesheet is added, also update the Vendor Data.
-
Overwrite received DICOM object's attributes from previously received HL7 Order Messages
Merge from MWL stylesheet example
The LDAP configuration for the same would be :
dn: cn=Merge MWL,dicomDeviceName=dcm4chee-arc,cn=Devices,cn=DICOM Configuration,dc=dcm4che,dc=org dcmDIMSE: C_STORE_RQ dcmProperty: SendingApplicationEntityTitle=MERGE_MWL dicomTransferRole: SCU dcmMergeMWLMatchingKey: StudyInstanceUID dcmMergeMWLTemplateURI: ${jboss.server.temp.url}/dcm4chee-arc/mwl2series.xsl objectClass: dcmArchiveAttributeCoercion dcmNoKeywords: TRUE cn: Merge MWL
-
Ensure DICOM VR Compliance of attribute values
The attribute values in incoming DICOM objects can be corrected so that the attribute values comply with the DICOM Value Representation. The below example stylesheet corrects the attributes in the dataset which are on root level only and not inside nested datasets
Below table shows the corrections that shall be applied for the corresponding VRs and formats, if the example stylesheet is used..
VR Format Correction AS nnnD, nnnW, nnnM, nnnY nullify CS [0-9A-Z_ ]{0,16} nullify DA YYYYMMDD nullify DS Decimal String nullify DT YYYYMMDDHHMMSS.FFFFFF&ZZXX nullify IS Integer String nullify LO <= 64 chars truncate SH <= 16 chars truncate TM HHMMSS.FFFFFF nullify The LDAP configuration for the same would be :
dn: cn=Correct VR,dicomDeviceName=dcm4chee-arc,cn=Devices,cn=DICOM Configuration,dc=dcm4che,dc=org objectClass: dcmArchiveAttributeCoercion cn: Correct VR dcmDIMSE: C_STORE_RQ dicomTransferRole: SCP dcmProperty: ReceivingApplicationEntityTitle=CORRECT_VR dcmNoKeywords: TRUE dcmURI: ${jboss.server.temp.url}/dcm4chee-arc/correct-vr.xsl
-
Always ensure Patient ID before storing object(s) to archive if it is missing in the received object(s)
Ensure Patient ID stylesheet example
The LDAP configuration for the same would be :
dn: cn=Ensure PID,dicomDeviceName=dcm4chee-arc,cn=Devices,cn=DICOM Configuration,dc=dcm4che,dc=org dcmDIMSE: C_STORE_RQ dcmProperty: SendingApplicationEntityTitle=ENSURE_PID dicomTransferRole: SCU objectClass: dcmArchiveAttributeCoercion dcmNoKeywords: TRUE dcmURI: ${jboss.server.temp.url}/dcm4chee-arc/ensure-pid.xsl cn: Ensure PID
-
Patient name not to be shown for research or test or demo purpose(s)
Nullify Patient Name stylesheet example
The LDAP configuration for the same would be :
dn: cn=Nullify PN,dicomDeviceName=dcm4chee-arc,cn=Devices,cn=DICOM Configuration,dc=dcm4che,dc=org dcmDIMSE: C_STORE_RQ dcmProperty: ReceivingApplicationEntityTitle=NULLIFY_PN dicomTransferRole: SCP objectClass: dcmArchiveAttributeCoercion dcmNoKeywords: TRUE dcmURI: ${jboss.server.temp.url}/dcm4chee-arc/nullify-pn.xsl cn: Nullify PN