Skip to content

6. ChRIS workflow: run prostate imaging segmenter

Rudolph Pienaar edited this page May 24, 2018 · 5 revisions

6. ChRIS workflow: run pl-neuproseg

Abstract

This page describes running the pl-neurproseg plugin, which simply runs a trained neural network on an image of the prostate.

Overview

The steps to perform are:

  • Start CUBE
  • Push data to segment from the local filesystem into swift storage
  • Run the pl-dircopy plugin to create a new top level feed. This feed contains the data to segment
  • Run the pl-neuproseg plugin as the next step in this workflow.

Using ASCII art:

┌ ─ ┐
│
└ ┘
├ ┤ ┬ ┴

╔═╗
║
╚═╝
╟ ╢ ╤ ╧

◀ ▶ ▼ ▲

┌────────────────────┐       ╔════════════╗       ┌───────────────┐ 
│ Data on filesystem ├──────▶║ swift push ╟──────▶│ Data in swift │
└────────────────────┘       ╚════════════╝       └───────────────┘
                              __________ 
 +--------------------+      /          \        +---------------+
 | Data on filesystem +---->( swift push )-----> | Data in swift |
 +--------------------+      \__________/        +---------------+

                              __________ 
                             /          \        +---------------+
                            ( swift push )-----> | Data in swift |
 +--------------------+      \__________/        +---------------+





                             pl-dircopy  
                    

Preconditions

Start system

In the source repo of CUBE, simply do a

*make*

Run the dircopy example

  • Make sure that the ChRIS FS plugin workflow example has been completed! This will create the source feed for the DS plugin.

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

Volume mapping

Volume mapping is defined by the docker-compose.yml file.

GET list of plugins and check for pl-med2img plugin

Call

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

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

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

we can call

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

Receive

{
    "collection": {
        "links": [],
        "version": "1.0",
        "items": [
            {
                "links": [
                    {
                        "rel": "parameters",
                        "href": "http://10.17.24.163:8000/api/v1/plugins/5/parameters/"
                    },
                    {
                        "rel": "instances",
                        "href": "http://10.17.24.163:8000/api/v1/plugins/5/instances/"
                    }
                ],
                "data": [
                    {
                        "value": "med2img",
                        "name": "name"
                    },
                    {
                        "value": "fnndsc/pl-med2img",
                        "name": "dock_image"
                    },
                    {
                        "value": "ds",
                        "name": "type"
                    }
                ],
                "href": "http://10.17.24.163:8000/api/v1/plugins/5/"
            }
        ],
        "href": "http://10.17.24.163:8000/api/v1/plugins/5/"
    }
}

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/5/parameters/ \
    --quiet --jsonpprintindent 4

Receive

{
    "collection": {
        "links": [
            {
                "href": "http://10.17.24.163:8000/api/v1/plugins/5/",
                "rel": "plugin"
            }
        ],
        "version": "1.0",
        "href": "http://10.17.24.163:8000/api/v1/plugins/5/parameters/",
        "items": [
            {
                "links": [
                    {
                        "href": "http://10.17.24.163:8000/api/v1/plugins/5/",
                        "rel": "plugin"
                    }
                ],
                "href": "http://10.17.24.163:8000/api/v1/plugins/parameters/23/",
                "data": [
                    {
                        "value": "outputFileType",
                        "name": "name"
                    },
                    {
                        "value": "string",
                        "name": "type"
                    },
                    {
                        "value": true,
                        "name": "optional"
                    },
                    {
                        "value": "jpg",
                        "name": "default"
                    },
                    {
                        "value": "output image file format",
                        "name": "help"
                    }
                ]
            },
            {
                "links": [
                    {
                        "href": "http://10.17.24.163:8000/api/v1/plugins/5/",
                        "rel": "plugin"
                    }
                ],
                "href": "http://10.17.24.163:8000/api/v1/plugins/parameters/24/",
                "data": [
                    {
                        "value": "sliceToConvert",
                        "name": "name"
                    },
                    {
                        "value": "integer",
                        "name": "type"
                    },
                    {
                        "value": true,
                        "name": "optional"
                    },
                    {
                        "value": "-1",
                        "name": "default"
                    },
                    {
                        "value": "slice to convert (for 3D data)",
                        "name": "help"
                    }
                ]
            },
            {
                "links": [
                    {
                        "href": "http://10.17.24.163:8000/api/v1/plugins/5/",
                        "rel": "plugin"
                    }
                ],
                "href": "http://10.17.24.163:8000/api/v1/plugins/parameters/25/",
                "data": [
                    {
                        "value": "func",
                        "name": "name"
                    },
                    {
                        "value": "string",
                        "name": "type"
                    },
                    {
                        "value": true,
                        "name": "optional"
                    },
                    {
                        "value": "",
                        "name": "default"
                    },
                    {
                        "value": "apply the specified transformation function before saving",
                        "name": "help"
                    }
                ]
            }
        ]
    }
}

Run an instance of the plugin

NB!

Make sure that directory to pass to the image is spec'd relative to the volume mapping for pfcon!

Call

Using httpie

http -a chris:chris1234 POST http://${HOST_IP}:8000/api/v1/plugins/5/instances/ \
Content-Type:application/vnd.collection+json \
Accept:application/vnd.collection+json \
template:='{"data":
    [
     {"name":"outputFileType",
      "value":"jpg"},
     {"name":"sliceToConvert",
      "value":"-1"},
     {"name":"func",
      "value":"invertIntensities"},
     {"name":"previous_id",
      "value":"1"}
    ]
}'

Using pfurl

pfurl --auth chris:chris1234 --verb POST --http ${HOST_IP}:8000/api/v1/plugins/5/instances/ \
--content-type application/vnd.collection+json \
--jsonwrapper 'template' --msg '
{"data":
    [
     {"name":"outputFileType",
      "value":"jpg"},
     {"name":"sliceToConvert",
      "value":"-1"},
     {"name":"func",
      "value":"invertIntensities"},
     {"name":"previous_id",
      "value":"1"}
    ]
}' \
--quiet --jsonpprintindent 4

Receive

{
  "stdout": {
    "collection": {
      "items": [
        {
          "href": "http://10.17.24.163:8000/api/v1/plugins/instances/2/",
          "links": [
            {
              "href": "http://10.17.24.163:8000/api/v1/plugins/instances/1/",
              "rel": "previous"
            },
            { "href": "http://10.17.24.163:8000/api/v1/plugins/5/", "rel": "plugin" },
            {
              "href": "http://10.17.24.163:8000/api/v1/plugins/string-parameter/2/",
              "rel": "string_param"
            },
            {
              "href": "http://10.17.24.163:8000/api/v1/plugins/string-parameter/3/",
              "rel": "string_param"
            },
            {
              "href": "http://10.17.24.163:8000/api/v1/plugins/int-parameter/1/",
              "rel": "int_param"
            }
          ],
          "data": [
            { "value": 2, "name": "id" },
            { "value": 1, "name": "previous_id" },
            { "value": "med2img", "name": "plugin_name" },
            { "value": "2017-09-21T21:47:21.718499Z", "name": "start_date" },
            { "value": "2017-09-21T21:47:21.718551Z", "name": "end_date" },
            { "value": "started", "name": "status" },
            { "value": "chris", "name": "owner" }
          ]
        }
      ],
      "href": "http://10.17.24.163:8000/api/v1/plugins/5/instances/",
      "links": [ ],
      "version": "1.0"
    }
  },
  "msg": "push OK."
}
Clone this wiki locally