Embedding and Extracting DICOM Objects in HL7

A common integration challenge is transmitting binary files like DICOM images or PDFs through systems that only support text-based HL7. The standard solution is to Base64 encode the file and place it within an OBX segment. This two-part tutorial shows how to both embed and extract DICOM files with Integration Host.

Tutorial video coming soon!

Part 1: How to Embed a DICOM File in an HL7 Message

  1. Scan for DICOM Files
    Start a new workflow with a Directory Scanner activity. Configure it to watch a folder for *.dcm files and set its Message Type to DICOM.
  2. Prepare the HL7 Message
    Add a TCP Sender (MLLP) activity and paste a sample HL7 message (e.g., an ORU_R01) into its "Message Template" (there is a right-click option to insert an empty message too). Ensure it has an OBX segment, and set OBX-2 (Value Type) to ED (Encapsulated Data).
  3. Embed the File
    In the OBX-5 field, right-click and choose Insert Activity Message. Select the message from the Directory Scanner activity. Integration Host will bind to the incoming message and automatically convert it to Base64 encoded content.

Part 2: How to Extract the DICOM File from HL7

  1. Receive the HL7 Message
    In a new workflow, add a TCP Receiver (MLLP) to receive the HL7 message containing the embedded DICOM file.
  2. Configure the File Writer
    Add a File Writer activity. Set its Message Type to DICOM. For the "File to write", create a dynamic name by typing the output path and drag in fields or variables from the binding tree to make it unique, e.g., C:\dicom_out\${WorkflowInstanceId}.dcm.
  3. Bind the Base64 Data
    In the File Writer's "Message Template", simply create a binding to the OBX-5 field from the inbound HL7 message: ${Observation Value}. Because the message type is set to DICOM, Integration Host automatically knows to Base64-decode the content and save the original binary file.