-
Notifications
You must be signed in to change notification settings - Fork 100
2.2 ChRIS DS plugin workflow: convert DICOM to jpg and invert image intensities.
This page describes interacting with the ChRIS Ultron Back End (CUBE) using pfurl
and running a 'ds' type plugin called pl-med2img
. The pl-med2img
plugin converts input DICOM data to JPG, and optionally can perform some simple image processing on the resultant JPG files.
In this instance, the input DICOM data will be converted to JPG and image intensities inverted.
The set of operations involves transferring the input directory on the host filesystem into the pfioh
container, running the med2img plugin in the pfioh
container space, and then pulling the results of that operation from the pfioh
container space and back to a target location on the host filesystem.
In the source repo of CUBE, simply do a
*make*
- Make sure that the ChRIS FS plugin workflow example has been completed! This will create the source feed for the DS plugin.
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}')
At least one user with name/password combination as
-
chris
/chris1234
pfcon
pfioh
pman
Volume mapping is defined by the docker-compose.yml
file.
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
{
"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/"
}
}
Follow the links provided to get information on the parameters for the plugin
pfurl --auth chris:chris1234 --http ${HOST_IP}:8000/api/v1/plugins/5/parameters/ \
--quiet --jsonpprintindent 4
{
"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"
}
]
}
]
}
}
Make sure that directory to pass to the image is spec'd relative to the volume mapping for pfcon
!
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"}
]
}'
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
{
"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."
}