1.1 pfdcm initial setup and specifying internal vars - FNNDSC/pfdcm GitHub Wiki

pfdcm initial setup and specifying internal vars

Abstract

This page describes how to use configure some aspects of the pfdcm service. Specifically, it describes how to setup the parameters for a remote PACS host, how to specify location of certain executables, and how to write/configure the xinetd service file.

Preconditions

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

  • 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}')
export HOST_PORT=4055
  • Make sure that pfdcm has been started (see here for more info)
pfdcm --forever --httpResponse

Or, if running the fnndsc/pfdcm dock instead:

docker run --name pfdcm     \
            -v /home:/Users \
            --rm -ti        \
            fnndsc/pfdcm    \
            --forever --httpResponse

If running the docker container, it may be necessary to add the --network="host" flag to allow orthanc to be reachable by pypx within its container. Note that this should only be used for development purposes.

  • Have the following information pertaining to the remote PACS server:
    • IP
    • port
    • AETITLE
    • CALLED AETITLE

Set the internal values specifying the remote PACS host

First, it might be necessary to set the internal parameters for the remote PACS host and associate this information with a specific service name. So, let's configure a service called orthanc as follows:

pfurl --verb POST \
      --raw \
      --http ${HOST_IP}:${HOST_PORT}/api/v1/cmd \
      --jsonwrapper 'payload' \
      --msg \
'{  "action": "internalctl",
    "meta": {
                "var":     "/PACS",
                "set":     {
                             "orthanc" : {
                                  "server_ip": "%HOST_IP",
                                  "aet": "CHIPS",
                                  "aet_listener": "CHIPS",
                                  "aec": "ORTHANC",
                                  "server_port": "4242"
                               }
                           }
            }
}'

Here, the %HOST_UP string will be parsed to set to the corresponding value in the environment. This of course assumes that the PACS server is running on the same host as the pfdcm service itself.

pfurl --verb POST \
        --raw \
        --http ${HOST_IP}:${HOST_PORT}/api/v1/cmd \
        --jsonwrapper 'payload' \
        --msg \
'{  "action": "internalctl",
    "meta": {
                "var":     "%HOST_IP",
                "valueReplace": "ENV"
            }
}'

In the above, the valueReplace directive indicates we want to replace the value of some key in the internal settings. In this case, we examine all the key values for hits of %HOST_IP. All keys that contain this string are flagged for replacement. This replacement is specified with the ENV string, which means search the space of environment variables for a variable called HOST_IP and use this value in each of the flagged keys.

Set a remote PACS directly from the command line

The above calls can be instantiated directly at run time by starting the server with

pfdcm --forever \
        --httpResponse \
        --startlistener \
        --setPACS \
'{
    "orthanc" : {
        "server_ip": "%HOST_IP",
        "aet": "CHIPS",
        "aet_listener": "CHIPS",
        "aec": "ORTHANC",
        "server_port": "4242"
    }
}'

Multiple PACS targets can be set concurrently from the command line, for example:

pfdcm --forever \
        --httpResponse \
        --startlistener \
        --setPACS \
'{
    "orthanc" : {
        "server_ip": "%HOST_IP",
        "aet": "CHIPS",
        "aet_listener": "CHIPS",
        "aec": "ORTHANC",
        "server_port": "4242"
    },
    "bch" : {
        "server_ip": "134.174.12.21",
        "aet": "FNNDSC-CHRISDEV",
        "aet_listener": "CHRIS",
        "aec": "CHRIS",
        "server_port": "104"
    }
}'

Get internal variable tree state

The internal variable tree state can be verified with a quick get call:

pfurl --verb POST \
        --raw \
        --http ${HOST_IP}:${HOST_PORT}/api/v1/cmd \
        --jsonwrapper 'payload' \
        --msg '{  "action": "internalctl",
    "meta": {
                "var":     "/",
                "get":      "value"
            }
}'

Setting a simple internal variable.

It might be necessary to set some more simple internal variables, too. For example, the findscu variable. The default is /usr/local/bin/findscu however on non-containerized systems it might /usr/bin/findscu.

pfurl --verb POST \
        --raw \
        --http ${HOST_IP}:${HOST_PORT}/api/v1/cmd \
        --jsonwrapper 'payload' \
        --msg \
'{  "action": "internalctl",
    "meta": {
                "var":     "/bin/findscu",
                "set":     "/usr/bin/findscu"
            }
}'

--30--

⚠️ **GitHub.com Fallback** ⚠️