Container service question

168 views
Skip to first unread message

Simon Doran

unread,
Jul 10, 2019, 11:42:06 AM7/10/19
to xnat_discussion
Hi All,

  I have a piece of data processing that I can easily put into a container. The concept of what I want to do is very simple:

1. Take as an input the DICOM data corresponding to a single DICOM series = XNAT scan (typically this will be a set of files corresponding to a 3-D image).

2. Do some stuff to the data to create a new DICOM series (of type DERIVED/SECONDARY).

3. Write back the new series as an additional scan in the same XNAT session.

  I know how to do 1 and 2. At the end of 2, I have the new DICOM files in a /output directory in my container. I already know how to get the container service to write these back to a RESOURCE of the scan that I'm processing. But that's not what I want to do. I want to create a new scan, which is equivalent to what I would see if someone had done the equivalent data processing on the scanner or PACS and then imported the data into XNAT.

  Any thoughts?

Simon

Kelsey

unread,
Jul 10, 2019, 12:34:06 PM7/10/19
to xnat_discussion
Hi Simon,

The Container Service plugin only has the ability to generate Resources and Assessors on Scans that exist at the time of execution - it cannot automatically create a new scan.  

A method we've used to get around this, is to use the XNAT REST API from within the container to create new scans and upload resources.  The downside to this approach is that all of the output files have to be pushed through Tomcat to get to XNAT.   

The environment within each container launched via Container Service will automatically have access to  $XNAT_USER $XNAT_PASS $XNAT_HOST environment variables, which you can use in your script/curl command to reach and authenticate with the host XNAT.


Best, 
Matt

Simon Doran

unread,
Jul 10, 2019, 7:25:15 PM7/10/19
to xnat_discussion
Hi Matt,

  Thanks. Yes, I guessed that REST might be the solution.

  I'll mull this one over. Logically, I think that there is a good case for saying that what I'm creating *is* really an assessor resource. However, that doesn't play well with visualising the newly created DICOM in the viewer or creating new assessors (e.g., ROIs) on the image, for which I need a scan.

  From a practical point of view, you've given me $XNAT_USER, _PASS and _HOST environment variables, but how do I get at the project, subject, session and scan information for the input data from within the container?

  Best wishes,

Simon

Kate Alpert

unread,
Jul 10, 2019, 7:37:02 PM7/10/19
to xnat_di...@googlegroups.com
Hi, Simon,

I've actually extended the container service to do exactly this (upload a new scan). You just need to create a scan xml (sample attached) within your container. You'd use a command json like the attached to run it (this may also show you how you can get project, subject, etc via container service if you decide to just use REST). 

Of course, this depends on your having our (Radiologics's) branch of the container service and a bugfix changeset on xnat-web... So, feel free to reach out if you're interested in getting that.

Kate


--
You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xnat_discussi...@googlegroups.com.
To post to this group, send email to xnat_di...@googlegroups.com.
Visit this group at https://groups.google.com/group/xnat_discussion.
To view this discussion on the web visit https://groups.google.com/d/msgid/xnat_discussion/20ee1878-d4d6-4f5a-a91a-2ac759b4e1d6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
sample_scan.xml
fake-complex-add-scan.json

Kelsey

unread,
Jul 11, 2019, 10:50:40 AM7/11/19
to xnat_discussion
Hi Simon,
  Information, such as Project ID, Session ID, etc, can be discovered using the "derived-inputs" section of your Container Service command. These values can then be passed into your script via command line parameter.  See: https://github.com/NrgXnat/docker-images/blob/master/plastimatch/command.json for an example.

This section assigns a scan-id value to "SCAN_ID"

"derived-inputs": [
{
"name": "scan-id",
"description": "Scan id",
"type": "string",
"derived-from-wrapper-input": "scan",
"derived-from-xnat-object-property": "id",
"provides-value-for-command-input": "SCAN_ID"
},

This section uses that value to populate a command line string:

"command-line": "plastimatch convert --input /input --output-img /output/#SCAN_ID#.nrrd",
Check out the page at https://wiki.xnat.org/display/CS/Command for all of the "XNAT object properties" that can be extracted in this way.

Best,
Matt

Simon Doran

unread,
Jul 11, 2019, 6:10:52 PM7/11/19
to xnat_discussion
Dear Kate and Matt,

  Thanks very much for the help with this one. I'll have a go at this and get back to you.

  Kate, if you have a link to the version of the container service you are using and the bug-fix, that would be very helpful.

  Best wishes,

Simon
Reply all
Reply to author
Forward
0 new messages