A basic DICOM worklist provider

Recently we were asked to write a PHP DICOM Worklist server for an overseas customer. DICOM Multi-tool seemed like overkill, and so we put together a very basic project that:

  • Generates DCMTk-compatible dump files from a MySQL schema
  • Converts those dump files to .wl data files
  • Launches wlmscpfs (DCMTk’s worklist daemon) and points it to the records the app creates

This application has no database of its own. But it’s now available under an MIT license. Feel free to comment, contribute and enjoy.

Installing and activating our gateways

All of our gateway applications share large parts of their user interface. Installation, therefore, is pretty similar from product to product. This post describes how to install, configure, and activate the Cardiology Gateway. We will use the example of storage into Philips Xcelera, but the same process is applicable for other destinations, such as AGFA Heartlabs, GE Enterprise Archive, and other compatible destinations.

Installation

Firstly, download the gateway of your choice from our website. The easiest way to do this is to visit our store, here:

https://store.fluxinc.ca/files

Then click on the version you would like to download:

Download Cardiology Gateway

You will then be asked to fill in a few details. Please make sure that your email address is correct, since this is where your download link will be sent.

Once downloaded, double-click to run the installer:

Cardiac Gateway installer

Follow the prompts to complete the installation, and then make sure to Start the Control Center at the end:

Start control center

And that’s it, the application is installed.

By the way, upgrades are the same process, and take just minutes to complete.

The Control Center

This is the gateway Control Center:

Cardiac Control Center

This part of the application looks very similar to the Radiology gateway, Combobulator and Shrinkinator products.

  • The Service panel lets you see if the gateway is running, and to start and stop it.
  • The Connection Check panel allows you to verify that you have connectivity to the ultrasound cart. This part does not need to be filled
  • The PACS panel is where you enter the connection parameters required to reach the PACS.
  • And, finally, the Gateway panel contains settings relating to gateway operation.

A running application log appears beneath the Gateway panel, and should be examined to confirm operation, and check for errors.

Configuration

Firstly, fill in the PACS information. In this case, we are connecting to an Xcelera R3.1 PACS at IP 192.168.1.100, port 104, and the AE title of INTURISPRO_SCP:

Control center short

It’s usually best to use the exact same settings that you see on the ultrasound cart, but some PACS require that you use a dedicated AE title and port (we’re looking at you, Heartlabs!).

Press Echo to test the connection. If you do not receive confirmation of a successful test, then please make sure that all of the parameters are correct, and that the PACS is configured properly to accept your connection.

Next, select the destination profile. This will ensure that the data presented by the gateway will be readable by the PACS:

Select gateway profile

Here, we’ve selected the SC2000 to Xcelera profile.

Choose a port number on which the gateway should listen for connections, and then choose the AE titles it should use. The gateway is capable of mimicking the AE titles of both the cart and the PACS, so that each thinks it’s communicating with the other, but in this case we will be creating a distinct DICOM entity, and so we are leaving the values at DICOM_GATEWAY:

Gateway connection parameters

Make a note of the IP Address, AE titles, and port. You will need these at the cart.

Configuring the Ultrasound Cart

Next, the ultrasound cart needs to be configured to send the DICOM SR segment through the gateway. To do this, please:

  1. Add a new DICOM destination on the cart.
  2. Configure this destination with the IP address, AE title, and Port of the gateway. In our example, these would be 172.30.0.154, port 1104 and AE title DICOM_GATEWAY.
  3. Disable transmission of images, multi-frame images, and RAW data to the gateway. Enable transmission of the SR segment to the gateway.
  4. Disable transmission of the SR segment directly from the ultrasound cart to the PACS.

Once you have completed these changes, you may have to restart the Ultrasound cart.

Activation

Lastly, you need to activate the gateway. To do this, please open the activation window through the Tools menu:

Accessing the activation menu

Once there, you can get your Request Code, please copy this into the clipboard, and visit our store to retrieve an Activation Code:

https://store.fluxinc.ca/activate_product

On the activation page, please enter your request code, and a friendly label for the location — this will help you identify and manage your license online:

Store activation request

Press Activate, and you will be presented with an Activation Code. Copy and paste the activation code back into the Control Center Activation Window and click Activate:

Enter activation code

Press Start at the top of the Control Center, and then you’re ready to start translating measurements.

Send something from the cart and watch the log fly by!

Note that we offer temporary licenses for use during sales. Please contact us with the details of your installation and we will get in touch with you right away.

Adding a logo to DICOM Printer 2 output

Please note that adding these custom elements to DICOM Printer 2 workflows is a task that requires a little knowledge of XML. If you feel that the post is too technical for you, then ask someone with IT experience to help.

Recap

In our previous post, we went through installation and configuration of basic film output. Although this is great for basic use, most facilities we’ve come across like to see their identity expressed on their product.

So, we’ll want to go from this:

Ceph image without logo

To this!

Ceph image with facility and logo

First Things First

In the previous post, we used the Configuration Wizard. The Wizard does the basics, but to add a logo we need to dig into the actual configuration file. To see it, launch the DICOM Printer Control Center. It can be found via the Start Menu, or by searching in Windows 8.

Accessing DICOM Printer 2 control from the start menu

You will then see the main control window.

DICOM Printer 2 Control Center main window

Switch to the Configuration tab. If you followed the previous tutorial, you will see the following text:

<?xml version="1.0" encoding="UTF-8"?>
<DicomPrinterConfig>
    <General>
        <CheckingInterval>1</CheckingInterval>
        <SuspensionTime>1</SuspensionTime>
        <Verbosity>30</Verbosity>
    </General>
    <ActionsList>
        <Print name="PrintOnDevice">
            <Resolution>320 x 320</Resolution>
            <PrintMode>Grayscale12</PrintMode>
            <ConnectionParameters>
                <MyAeTitle>DICOM_PRINTER</MyAeTitle>
                <PeerAeTitle>DS5302</PeerAeTitle>
                <Host>192.168.1.100</Host>
                <Port>5040</Port>
                <AssociationTimeout>10</AssociationTimeout>
                <DimseTimeout>10</DimseTimeout>
            </ConnectionParameters>
        </Print>
        <Trim name="TrimImages">
            <Left>auto</Left>
            <Right>auto</Right>
            <Top>auto</Top>
            <Bottom>auto</Bottom>
        </Trim>
    </ActionsList>
    <Workflow>
        <Perform action="TrimImages" onError="Ignore"/>
        <Perform action="PrintOnDevice" onError="Discard"/>
    </Workflow>
</DicomPrinterConfig>

The configuration is comprised of three parts. General settings, the ActionsList, which is the list of things DP2 will be doing, and the Workflow, which is the order in which they will be performed.

In this example, any printed document pages are “trimmed”, i.e., margins are completely removed:

<Perform action="TrimImages" onError="Ignore"/>

and then they are sent to the DS5302 dry imager at IP address 192.168.1.100 and port 5040:

<Perform action="PrintOnDevice" onError="Discard"/>

If the imager happens to be unavailable, or communication fails, the document is “Discarded”. This is so we don’t create a long queue of documents.

Since we want our logo to appear at the top left, and not overlay the image, we will:

  1. Remove the Trim action, and
  2. Replace it with an action that puts the logo into place.

Remove Trim

Simply get rid of the parts of the configuration that relate to Trim. Leaving only:

<?xml version="1.0" encoding="UTF-8"?>
<DicomPrinterConfig>
    <General>
        <CheckingInterval>1</CheckingInterval>
        <SuspensionTime>1</SuspensionTime>
        <Verbosity>30</Verbosity>
    </General>
    <ActionsList>
        <Print name="PrintOnDevice">
            <Resolution>320 x 320</Resolution>
            <PrintMode>Grayscale12</PrintMode>
            <ConnectionParameters>
                <MyAeTitle>DICOM_PRINTER</MyAeTitle>
                <PeerAeTitle>DS5302</PeerAeTitle>
                <Host>192.168.1.100</Host>
                <Port>5040</Port>
                <AssociationTimeout>10</AssociationTimeout>
                <DimseTimeout>10</DimseTimeout>
            </ConnectionParameters>
        </Print>
    </ActionsList>
    <Workflow>
        <Perform action="PrintOnDevice" onError="Discard"/>
    </Workflow>
</DicomPrinterConfig>

Add the Logo

First, we need to save the logo image to a location where DICOM Printer can find it. The best place for this is the DICOM Printer config folder:

Open up the DICOM Printer Control center and click the shortcut to the config folder.

Save the logo here:

When making your logo image, please note the image type (PNG in this case) and the dimensions. We are using 200 x 100 px. The full path of the logo is:

%ProgramData%\Flux Inc\DICOM Printer 2\config\logo.png

Which, on English machines, is actually the same as:

C:\ProgramData\Flux Inc\DICOM Printer 2\config\logo.png

Create the Action

The logo can be placed onto every page using a PrintImage action, like so:

<PrintImage name="addLogo">
    <ImagePath>C:\ProgramData\Flux Inc\DICOM Printer 2\config\logo.png</ImagePath>
    <X>1</X>
    <Y>1</Y>
    <Width>16</Width>
    <Height>16</Height>
    <Aspect>keep</Aspect>
</PrintImage>

Note that:

  • We’ve called the action addLogo. We’ll use this name later to call the action in the workflow.
  • We’ve also instructed DICOM Printer 2 to place the logo 1% from the top (Y) and 1% from the left (X) of the page, and,
  • The logo is going to be placed into a box that is 16% of the page wide and 16% of the page tall. If you are unsure of your logo dimensions, then we recommend this size.
  • DP2 will fit the image into the box, and keep the original aspect ratio.

When included as part of the original configuration, the addLogo action looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<DicomPrinterConfig>
    <General>
        <CheckingInterval>1</CheckingInterval>
        <SuspensionTime>1</SuspensionTime>
        <Verbosity>30</Verbosity>
    </General>
    <ActionsList>
        <Print name="PrintOnDevice">
            <Resolution>320 x 320</Resolution>
            <PrintMode>Grayscale12</PrintMode>
            <ConnectionParameters>
                <MyAeTitle>DICOM_PRINTER</MyAeTitle>
                <PeerAeTitle>DS5302</PeerAeTitle>
                <Host>192.168.1.100</Host>
                <Port>5040</Port>
                <AssociationTimeout>10</AssociationTimeout>
                <DimseTimeout>10</DimseTimeout>
            </ConnectionParameters>
        </Print>
        <PrintImage name="addLogo">
          <ImagePath>C:\ProgramData\Flux Inc\DICOM Printer 2\config\logo.png</ImagePath>
          <X>1</X>
          <Y>1</Y>
          <Width>16</Width>
          <Height>16</Height>
          <Aspect>keep</Aspect>
        </PrintImage>
    </ActionsList>
    <Workflow>
        <Perform action="addLogo" onError="Ignore"/>
        <Perform action="PrintOnDevice" onError="Discard"/>
    </Workflow>
</DicomPrinterConfig>

Adding the Facility name

Next up, the facility name at the bottom of the page. It requires a separate action, which looks something like this:

<PrintText name="addFooter">
  <Text>Clinica Odontologica – R. Odontologica 131 – São Paulo, Brasil</Text>
  <X>10</X>
  <Y>97</Y>
  <Width>80</Width>
  <Height>3</Height>
  <Color>0xFFFFFF</Color>
  <BackgroundColor>0x80000000</BackgroundColor>
</PrintText>

This is a PrintText action called addFooter, and it will:

  • Place the text “Clinica Odontologica – R. Odontologica 131 – São Paulo, Brasil”.
  • 10% from the left (X), and 97% from the top (Y) of the page.
  • The text box will be 80% wide and 3% tall, with the font automatically adjusted to fit.
  • The foreground colour will be white (0xFFFFFF) and the background will be a semi-transparent (0x80), black (000000) rectangle. This will allow the text to be read even when overlaying part of the image.

The completed configuration, with the addFooter action added to the workflow, looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<DicomPrinterConfig>
    <General>
        <CheckingInterval>1</CheckingInterval>
        <SuspensionTime>1</SuspensionTime>
        <Verbosity>30</Verbosity>
    </General>
    <ActionsList>
        <Print name="PrintOnDevice">
            <Resolution>320 x 320</Resolution>
            <PrintMode>Grayscale12</PrintMode>
            <ConnectionParameters>
                <MyAeTitle>DICOM_PRINTER</MyAeTitle>
                <PeerAeTitle>DS5302</PeerAeTitle>
                <Host>192.168.1.100</Host>
                <Port>5040</Port>
                <AssociationTimeout>10</AssociationTimeout>
                <DimseTimeout>10</DimseTimeout>
            </ConnectionParameters>
        </Print>
        <PrintImage name="addLogo">
          <ImagePath>C:\ProgramData\Flux Inc\DICOM Printer 2\config\logo.png</ImagePath>
          <X>1</X>
          <Y>1</Y>
          <Width>16</Width>
          <Height>16</Height>
          <Aspect>keep</Aspect>
        </PrintImage>
        <PrintText name="addFooter">
          <Text>Clinica Odontologica – R. Odontologica 131 – São Paulo, Brasil</Text>
          <X>10</X>
          <Y>97</Y>
          <Width>80</Width>
          <Height>3</Height>
          <Color>0xFFFFFF</Color>
          <BackgroundColor>0x80000000</BackgroundColor>
        </PrintText>
    </ActionsList>
    <Workflow>
        <Perform action="addLogo" onError="Ignore"/>
        <Perform action="addFooter" onError="Ignore"/>
        <Perform action="PrintOnDevice" onError="Discard"/>
    </Workflow>
</DicomPrinterConfig>

And That’s It!

Now, save and restart the DP2 service, like so:

And then,

Your next print job will have your logo at the top right and facility name at the bottom!

Ceph image with facility and logo

Thanks for reading! Be sure to check out our downloads page, where you can download fully functional 60 day evaluations.

At 495 USD, DICOM Printer is a stupendously inexpensive application. We’re excited that so many people find it useful.