Skip to content

dicom_listener

Rudolph Pienaar edited this page Sep 30, 2019 · 20 revisions

Dicom listener

WARNING

WARNING: These instructions are somewhat deprecated. The current suggested installation is to use the docker container fnndsc/pypx which contains the necessary infrastructure already configured.

These pages are kept for historical purposes

Table of Contents

DICOM Listener setup

ubuntu

1- Install pypx

2- Install xinetd

apt-get install -y xinetd

3- Make sure directories used to store data exist

mkdir -p /tmp
mkdir -p /incoming/log
mkdir -p /incoming/data

4- Configure xinetd You might have to change root user to your actual username, i.e. chips. This user must have permission to write in the directories used to store data (/tmp, /incoming/log, /incoming/data)

echo "service dicomlistener
{
   disable             = no
   socket_type         = stream
   wait                = no
   user                = root
   server              = /usr/local/bin/px-listen
   server_args         = -e /usr/bin/storescp -t /tmp -l /incoming/log -d /incoming/data
   type                = UNLISTED
   port                = 10402
   bind                = 0.0.0.0
}" > /etc/xinetd.d/dicomlistener

5- Restart xinetd service

service xinetd restart

6- Test listener

# install network utils
apt-get install -y netcat

# connect to listening port
# this command must hang.
# if it returns, something is wrong
# if so, run "/usr/local/bin/px-listen -e /usr/bin/storescp -t /tmp -l /incoming/log -d /incoming/data" for more information
nc localhost 10402

Hit "ctl + c" to stop "nc localhost 10402".

A file should have been created in /incoming/log/.

mac

1- Install pypx

2- Add a new service:

In /etc/services add the lines:

dicom-listener    10402/tcp   # dicom listener
dicom-listener    10402/udp   # dicom listener
#                             Nicolas Rannou <[email protected]>

3- Configure daemon:

Create /Library/LaunchDaemons/org.dicom.listener.plist.

Make sure to replace username Nico by your own username.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>UserName</key>
    <string>nico</string>
    <key>Label</key>
    <string>org.dicom.listener</string>
    <key>ProgramArguments</key>
    <array>
        <string>/Library/Frameworks/Python.framework/Versions/3.5/bin/python3</string>
        <string>/Library/Frameworks/Python.framework/Versions/3.5/bin/px-listen</string>
    	<string>-t</string>
    	<string>/tmp</string>
    	<string>-l</string>
    	<string>/incoming/log</string>
    	<string>-d</string>
    	<string>/incoming/data</string>
    </array>
    <key>inetdCompatibility</key>
    <dict>
        <key>Wait</key>
        <false/>
    </dict>
    <key>Sockets</key>
    <dict>
        <key>Listeners</key>
        <dict>
            <key>SockServiceName</key>
            <string>dicom-listener</string>
            <key>SockType</key>
            <string>stream</string>
        </dict>
    </dict>
</dict>
</plist>

4- Load daemon

launchctl load -w org.dicom.listener.plist
#unload: launchctl unload org.dicom.listener.plist

5- Make sure directories used to store data exist

WARNING: The user listed in the /etc/xinetd.d/dicomlistener or /Library/LaunchDaemons/org.dicom.listener.plist file must have write access to the following directories:

mkdir -p /tmp
mkdir -p /incoming/log
mkdir -p /incoming/data

6- Test listener

# connect to listening port
# this command must hang.
# if it returns, something is wrong
# if so, run "/usr/local/bin/px-listen -e /usr/bin/storescp -t /tmp -l /incoming/log -d /incoming/data" for more information
nc localhost 10402

Hit "ctl + c" to stop "nc localhost 10402".

A file should have been created in /incoming/log/.

If it hangs but no file was created, the user listed in the /etc/xinetd.d/dicomlistener or /Library/LaunchDaemons/org.dicom.listener.plist file probably doesn't have write access to the /tmp/, /incoming/data/, /incoming/log/ directories.

Orthanc setup

See details on the offical website: http://www.orthanc-server.com/.

- Make sure to add a new entry in the "DicomModalities"
- in the orthanc configuration file before starting the server. See below.
  • Orthanc: host, Dicom listener: host.

    • IP: "localhost"
    • PORT: 10402
  • Orthanc: host, Dicom listener: dock

    • IP: "localhost"
    • PORT: 10402
  • Orthanc: dock, Dicom listener: dock

    • IP: ("172.18.0.1" or something similar)
    • PORT: 10402
  • Orthanc: dock, Dicom listener: host

    • IP: ("192.168.0.10" or something similar)
    • PORT: 10402

The following entry tells Orthanc to accept connection from "calling aet" (aet) CHIPS, and if "CHIPS" requires data to be moved (px-move), the data will be pushed to IP:PORT.

If Orthanc and Dicom listener are running on a dock:

"chips" : [ "CHIPS", "172.18.0.1", 10402 ]

Test the full setup

1- Upload data to Orthanc. (default: http://localhost:8042)

2- Browse data in Orthanc web server.

3- Hit "send to remote modality'

4- Select chips

5- --- sending data ---

6- Make sure data has arrived and is organized in /incoming/data