Skip to content

dicom_listener

Nicolas Rannou edited this page Mar 2, 2017 · 20 revisions

Dicom listener

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.

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 localhost:10402.

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

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

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/.

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

Clone this wiki locally