Converting a DICOM SR to an XML or JSON File
While HL7 Soup's Integration Host makes DICOM SR data easy to use, some downstream systems may require the report in a standard file format like XML or JSON. This tutorial shows how to perform this conversion with a simple function call.
Tutorial video coming soon!
How to Convert a DICOM SR to XML
This workflow uses a Code activity's transformer to call a function on the DICOM message, storing the result in a variable that can then be saved to a file.
-
Configure the DICOM Receiver
Add a DICOM Receiver activity to the workflow to receive the inbound Structured Report. -
Add a Code Activity to Extract the Data
Add a Code activity. Click Transformers and add a Code Transformer from the toolbox. In the script editor, enter the following code to extract the SR as XML and store it in a workflow variable:IDicomMessage sourceMessage = (IDicomMessage)Receiver().Message; string xml = sourceMessage.GetXml(); SetVariable("DicomXML", xml);
-
Save the XML to a File
Add a File Writer activity. Set the Message Type to XML. In the Message Template, insert the variable you just created by right-clicking, selecting Insert Variable, and choosing DicomXML. The template should simply contain: ${DicomXML}.
How to Convert a DICOM SR to JSON
Converting to JSON follows the same workflow pattern as XML conversion.
-
Configure the DICOM Receiver
Add a DICOM Receiver activity to the workflow to receive the inbound Structured Report. -
Add a Code Activity to Extract the Data
Add a Code activity. Click Transformers and add a Code Transformer from the toolbox. In the script editor, enter the following code to extract the SR as JSON and store it in a workflow variable:IDicomMessage sourceMessage = (IDicomMessage)Receiver().Message; string json = sourceMessage.GetJson(); SetVariable("DicomJSON", json);
-
Save the JSON to a File
Add a File Writer activity. Set the Message Type to JSON. In the Message Template, insert the variable you just created by right-clicking, selecting Insert Variable, and choosing DicomJSON. The template should simply contain: ${DicomJSON}.