Skip to content

3. ChRIS plugin PACS query workflow

Rudolph Pienaar edited this page Oct 25, 2017 · 25 revisions

ChRIS plugin PACS query

Abstract

This page describes interacting with the ChRIS Ultron Back End (CUBE) using pfurl and running a 'fs' type plugin called pl-pacsquery. Essentially, this copies data from a specified directory on the host filesystem into the ChRIS filesystem structure and creates a feed etc.

The set of operations involves copying some data into the chris_dev_files volume container, then using CUBE to transfer this directory out to the pfioh container volume on the remote filesystem (localhost in dev), running a dircopy in the pfioh container space, and then pulling the results of that copy from the pfioh container space and back to a target location on the local filesystem.

Preconditions

HOST_IP env variable

You should set an environment variable, HOST_IP to the IP of the actual host you are using. In Linux, this is

export HOST_IP=$(ip route | grep -v docker | awk '{if(NF==11) print $9}')

Backend user

At least one user with name/password combination as

  • chris/chris1234

Containerized data/processing services:

  • pfcon
  • pfioh
  • pman

Instantiated CUBE

Start CUBE from the repository source directory, running

*make*

Othanc DICOM Server

GET list of plugins and check for pl-pacsquery plugin

Call

pfurl --auth chris:chris1234 --http ${HOST_IP}:8000/api/v1/plugins/ \
    --quiet --jsonpprintindent 4

Look through the list for pl-pacsquery. For example, let's say that this is located at

http://10.17.24.163:8000/api/v1/plugins/3/

we can call

pfurl --auth chris:chris1234 --http ${HOST_IP}:8000/api/v1/plugins/3/ \
    --quiet --jsonpprintindent 4

Receive

           {
                "data": [
                    {
                        "name": "name",
                        "value": "pacsquery"
                    },
                    {
                        "name": "dock_image",
                        "value": "fnndsc/pl-pacsquery"
                    },
                    {
                        "name": "type",
                        "value": "fs"
                    }
                ],
                "href": "http://192.168.1.40:8000/api/v1/plugins/3/",
                "links": [
                    {
                        "href": "http://192.168.1.40:8000/api/v1/plugins/3/parameters/",
                        "rel": "parameters"
                    },
                    {
                        "href": "http://192.168.1.40:8000/api/v1/plugins/3/instances/",
                        "rel": "instances"
                    }
                ]
            }

GET parameter info for plugin

Follow the links provided to get information on the parameters for the plugin

Call

pfurl --auth chris:chris1234 --http ${HOST_IP}:8000/api/v1/plugins/3/parameters/ \
    --quiet --jsonpprintindent 4

Receive

{
    "collection": {
        "links": [
            {
                "rel": "plugin",
                "href": "http://192.168.1.189:8000/api/v1/plugins/3/"
            },
            {
                "rel": "next",
                "href": "http://192.168.1.189:8000/api/v1/plugins/3/parameters/?limit=10&offset=10"
            }
        ],
        "items": [
            {
                "links": [
                    {
                        "rel": "plugin",
                        "href": "http://192.168.1.189:8000/api/v1/plugins/3/"
                    }
                ],
                "data": [
                    {
                        "name": "name",
                        "value": "str_pfdcm"
                    },
                    {
                        "name": "type",
                        "value": "string"
                    },
                    {
                        "name": "optional",
                        "value": true
                    },
                    {
                        "name": "default",
                        "value": ""
                    },
                    {
                        "name": "help",
                        "value": "The PACS Q/R intermediary service IP:port."
                    }
                ],
                "href": "http://192.168.1.189:8000/api/v1/plugins/parameters/4/"
            },
            {
                "links": [
                    {
                        "rel": "plugin",
                        "href": "http://192.168.1.189:8000/api/v1/plugins/3/"
                    }
                ],
                "data": [
                    {
                        "name": "name",
                        "value": "str_msg"
                    },
                    {
                        "name": "type",
                        "value": "string"
                    },
                    {
                        "name": "optional",
                        "value": true
                    },
                    {
                        "name": "default",
                        "value": ""
                    },
                    {
                        "name": "help",
                        "value": "The actual complete JSON message to send to the Q/R intermediary service."
                    }
                ],
                "href": "http://192.168.1.189:8000/api/v1/plugins/parameters/5/"
            },
            {
                "links": [
                    {
                        "rel": "plugin",
                        "href": "http://192.168.1.189:8000/api/v1/plugins/3/"
                    }
                ],
                "data": [
                    {
                        "name": "name",
                        "value": "str_patientID"
                    },
                    {
                        "name": "type",
                        "value": "string"
                    },
                    {
                        "name": "optional",
                        "value": true
                    },
                    {
                        "name": "default",
                        "value": ""
                    },
                    {
                        "name": "help",
                        "value": "The PatientID to query."
                    }
                ],
                "href": "http://192.168.1.189:8000/api/v1/plugins/parameters/6/"
            },
            {
                "links": [
                    {
                        "rel": "plugin",
                        "href": "http://192.168.1.189:8000/api/v1/plugins/3/"
                    }
                ],
                "data": [
                    {
                        "name": "name",
                        "value": "str_PACSservice"
                    },
                    {
                        "name": "type",
                        "value": "string"
                    },
                    {
                        "name": "optional",
                        "value": true
                    },
                    {
                        "name": "default",
                        "value": "orthanc"
                    },
                    {
                        "name": "help",
                        "value": "The PACS service to use. Note this a key to a lookup in \"pfdcm\"."
                    }
                ],
                "href": "http://192.168.1.189:8000/api/v1/plugins/parameters/7/"
            },
            {
                "links": [
                    {
                        "rel": "plugin",
                        "href": "http://192.168.1.189:8000/api/v1/plugins/3/"
                    }
                ],
                "data": [
                    {
                        "name": "name",
                        "value": "str_summaryKeys"
                    },
                    {
                        "name": "type",
                        "value": "string"
                    },
                    {
                        "name": "optional",
                        "value": true
                    },
                    {
                        "name": "default",
                        "value": ""
                    },
                    {
                        "name": "help",
                        "value": "If specified, generate a summary report based on a comma separated key list."
                    }
                ],
                "href": "http://192.168.1.189:8000/api/v1/plugins/parameters/8/"
            },
            {
                "links": [
                    {
                        "rel": "plugin",
                        "href": "http://192.168.1.189:8000/api/v1/plugins/3/"
                    }
                ],
                "data": [
                    {
                        "name": "name",
                        "value": "str_summaryFile"
                    },
                    {
                        "name": "type",
                        "value": "string"
                    },
                    {
                        "name": "optional",
                        "value": true
                    },
                    {
                        "name": "default",
                        "value": ""
                    },
                    {
                        "name": "help",
                        "value": "If specified, save (overwrite) a summary report to passed file (in outputdir)."
                    }
                ],
                "href": "http://192.168.1.189:8000/api/v1/plugins/parameters/9/"
            },
            {
                "links": [
                    {
                        "rel": "plugin",
                        "href": "http://192.168.1.189:8000/api/v1/plugins/3/"
                    }
                ],
                "data": [
                    {
                        "name": "name",
                        "value": "str_numberOfHitsFile"
                    },
                    {
                        "name": "type",
                        "value": "string"
                    },
                    {
                        "name": "optional",
                        "value": true
                    },
                    {
                        "name": "default",
                        "value": ""
                    },
                    {
                        "name": "help",
                        "value": "If specified, save (overwrite) the number of hits (in outputdir)."
                    }
                ],
                "href": "http://192.168.1.189:8000/api/v1/plugins/parameters/10/"
            },
            {
                "links": [
                    {
                        "rel": "plugin",
                        "href": "http://192.168.1.189:8000/api/v1/plugins/3/"
                    }
                ],
                "data": [
                    {
                        "name": "name",
                        "value": "str_resultFile"
                    },
                    {
                        "name": "type",
                        "value": "string"
                    },
                    {
                        "name": "optional",
                        "value": true
                    },
                    {
                        "name": "default",
                        "value": ""
                    },
                    {
                        "name": "help",
                        "value": "If specified, save (overwrite) all the hits to the passed file (in outputdir)."
                    }
                ],
                "href": "http://192.168.1.189:8000/api/v1/plugins/parameters/11/"
            },
            {
                "links": [
                    {
                        "rel": "plugin",
                        "href": "http://192.168.1.189:8000/api/v1/plugins/3/"
                    }
                ],
                "data": [
                    {
                        "name": "name",
                        "value": "str_man"
                    },
                    {
                        "name": "type",
                        "value": "string"
                    },
                    {
                        "name": "optional",
                        "value": true
                    },
                    {
                        "name": "default",
                        "value": ""
                    },
                    {
                        "name": "help",
                        "value": "If specified, print help on the passed key entry. Use \"entries\" for all key list"
                    }
                ],
                "href": "http://192.168.1.189:8000/api/v1/plugins/parameters/12/"
            },
            {
                "links": [
                    {
                        "rel": "plugin",
                        "href": "http://192.168.1.189:8000/api/v1/plugins/3/"
                    }
                ],
                "data": [
                    {
                        "name": "name",
                        "value": "b_pfurlQuiet"
                    },
                    {
                        "name": "type",
                        "value": "boolean"
                    },
                    {
                        "name": "optional",
                        "value": true
                    },
                    {
                        "name": "default",
                        "value": "False"
                    },
                    {
                        "name": "help",
                        "value": "Silence pfurl noise."
                    }
                ],
                "href": "http://192.168.1.189:8000/api/v1/plugins/parameters/13/"
            }
        ],
        "href": "http://192.168.1.189:8000/api/v1/plugins/3/parameters/",
        "version": "1.0"
    }
}

Run an instance of the plugin

Call

Using pfurl

pfurl --auth chris:chris1234 --verb POST --http ${HOST_IP}:8000/api/v1/plugins/3/instances/ --content-type application/vnd.collection+json --jsonwrapper 'template' --msg '
{"data":
    [{"name": "str_pfdcm",            "value": "192.168.1.189:5015"},
     {"name": "str_patientID",        "value": "LILLA-9731"},
     {"name": "str_PACSservice",      "value": "orthanc"},
     {"name": "b_pfurlQuiet",         "value": True},
     {"name": "str_summaryKeys",  "value":"PatientID,PatientAge,StudyDescription,StudyInstanceUID,SeriesDescription,SeriesInstanceUID,NumberOfSeriesRelatedInstances"},
     {"name": "str_summaryFile",      "value": "summary.txt"},
     {"name": "str_resultFile",       "value": "results.json"},
     {"name": "str_numberOfHitsFile", "value": "hits.txt"}
    ]
}' --quiet --jsonpprintindent 4

Receive

{
    "stdout": {
        "collection": {
            "href": "http://192.168.1.40:8000/api/v1/plugins/3/instances/",
            "version": "1.0",
            "items": [
                {
                    "href": "http://192.168.1.40:8000/api/v1/plugins/instances/16/",
                    "links": [
                        {
                            "href": "http://192.168.1.40:8000/api/v1/16/",
                            "rel": "feed"
                        },
                        {
                            "href": "http://192.168.1.40:8000/api/v1/plugins/3/",
                            "rel": "plugin"
                        },
                        {
                            "href": "http://192.168.1.40:8000/api/v1/plugins/string-parameter/21/",
                            "rel": "string_param"
                        },
                        {
                            "href": "http://192.168.1.40:8000/api/v1/plugins/string-parameter/22/",
                            "rel": "string_param"
                        },
                        {
                            "href": "http://192.168.1.40:8000/api/v1/plugins/string-parameter/23/",
                            "rel": "string_param"
                        },
                        {
                            "href": "http://192.168.1.40:8000/api/v1/plugins/string-parameter/24/",
                            "rel": "string_param"
                        }
                    ],
                    "data": [
                        {
                            "name": "id",
                            "value": 16
                        },
                        {
                            "name": "previous_id",
                            "value": null
                        },
                        {
                            "name": "plugin_name",
                            "value": "pacsquery"
                        },
                        {
                            "name": "start_date",
                            "value": "2017-10-02T13:04:36.704831Z"
                        },
                        {
                            "name": "end_date",
                            "value": "2017-10-02T13:04:36.705418Z"
                        },
                        {
                            "name": "status",
                            "value": "started"
                        },
                        {
                            "name": "owner",
                            "value": "chris"
                        }
                    ]
                }
            ],
            "links": []
        }
    },
    "msg": "push OK."
}

Query its state to trigger a pull from remote

Examine the return JSON for the instance ID returned.

Call

Using pfurl

pfurl --auth chris:chris1234                               \
      --verb GET                                           \
      --http ${HOST_IP}:8000/api/v1/plugins/instances/6/   \
      --content-type application/vnd.collection+json       \
      --quiet --jsonpprintindent 4

Receive

--30--

Clone this wiki locally