Skip to content

3.0 pfdcm controlling the listener service

janakitti edited this page Jan 26, 2021 · 2 revisions

pfdcm controllling the listener service

Abstract

This page describes how to use pfdcm to control a DICOM listener service. This service is managed by xinetd, which manages a listener that intercepts communication sent from a remote PACS host. In the context of this system, the listener is a separate python app called px-listen.

Preconditions

  • xinetd on the system running pfdcm -- be it a container or "on the metal".

  • If "on the metal" make sure to also:

    • Install pypx as per your host system. Using pip3:
      pip3 install pypx
    • Install the pypx source repo:
      git clone https://github.com/FNNDSC/pypx.git
    • Make sure the listener is linked to its proper location:
      cd pypx/bin
      sudo ln -s $(pwd)/px-listen /usr/local/bin
  • A HOST_IP environment variable that denotes the IP of the host housing the service. In Linux, you can do:

export HOST_IP=$(ip route | grep -v docker | awk '{if(NF==11) print $9}')
  • Make sure that pfdcm has been started (see here for more info)
pfcon --forever --httpResponse
  • Have the following information pertaining to the remote PACS server:

    • IP
    • port
    • AETITLE
    • CALLED AETITLE
  • Set the internal values specifying the remote PACS host according to here.

Service preconditions

On first run, it is necessary to create the service file and associated directories. This assumes the ability to run as root (or passwordless sudo).

First, create the listener service file:

./pfurl --verb POST                       \
        --raw                             \
        --http ${HOST_IP}:4055/api/v1/cmd \
        --jsonwrapper 'payload'           \
        --msg '{  
            "action": "xinetd",
            "meta": {
                "object" : "file",
                "do":      "create"            
            }
        }'

make the listener service directories:

./pfurl --verb POST                       \
        --raw                             \
        --http ${HOST_IP}:4055/api/v1/cmd \
        --jsonwrapper 'payload'           \
        --msg '{  
            "action": "xinetd",
            "meta": {
                "object" : "service",
                "do":      "mkdirs"            
            }
        }'

and install the listener service file in the correct place

./pfurl --verb POST                       \
        --raw                             \
        --http ${HOST_IP}:4055/api/v1/cmd \
        --jsonwrapper 'payload'           \
        --msg '{  
            "action": "xinetd",
            "meta": {
                "object" : "file",
                "do":      "install"            
            }
        }'

Start the listener service

Once the listener service file and directories exist, we can restart (or start) xinetd to service any incoming DICOM data transmissions:

./pfurl --verb POST                       \
        --raw                             \
        --http ${HOST_IP}:4055/api/v1/cmd \
        --jsonwrapper 'payload'           \
        --msg '{  
            "action": "xinetd",
            "meta": {
                "object" : "service",
                "do":      "restart"            
            }
        }'

Startup conveniences

A convenience flag is available to pfdcm that performs these steps at startup, and is useful for containerization:

pfdcm --forever --httpResponse --startlistener

Or, effect the same outcome by calling

./pfurl --verb POST                       \
        --raw                             \
        --http ${HOST_IP}:4055/api/v1/cmd \
        --jsonwrapper 'payload'           \
        --msg '{  
            "action": "xinetd",
            "meta": {
                "object" : "service",
                "do":      "everything"            
            }
        }'

--30--