How to properly backup xnat images along with segmentation

737 views
Skip to first unread message

KK Mehta

unread,
Jan 8, 2021, 9:28:02 AM1/8/21
to xnat_discussion
Hello!

I'd like to know the right way to take a backup of all images uploaded on xnat that have a segmentation exported into the DICOM as well.

I've tried downloading Images of the entire project, however, when the same zip is uploaded into another instance of XNAT, it doesn't show the ROI in the session, but instead shows the segmentation as a separate scan in the same session. 

Is there some proper way to download images of the project so that ROIs can be uploaded back as ROIs of the session? 

Thanks!

Simon Doran

unread,
Jan 11, 2021, 3:23:53 AM1/11/21
to xnat_discussion
Hi,

  Your issues sounds as if it is related to how you are getting the segmentations back into the new XNAT, rather than whether they were actually backed up. You don't specify in your post above whether the segmentations are ones that you created within the viewer or whether you had previously imported them into the original XNAT instance from another source, but I'm guessing the former.

  At the moment the correct way of uploading segmentations to XNAT is either via the external app roiuploadassistant (https://bitbucket.org/icrimaginginformatics/roiuploadassistant/src/master/) or via the XNAT REST API (details of the roi-api are on the Swagger page, accessed via Site Administration -> Miscellaneous), which you would most likely use in conjunction with something like XNATpy.

  Hence, what you will need to do is to find and separate out the DICOM-SEG from the image DICOM files in your zip download, then upload the images back to the new instance via your normal route, then treat the DICOM-SEG files as above. 

  Both the viewer development team at ICR and the XNAT core team at WashU are aware that it would be good to have the upload functionality incorporated directly in XNAT. The situation won't change for the forthcoming XNAT 1.8 release, but beyond this discussions are ongoing as to how best to implement this.

  Best wishes,

Simon

KK Mehta

unread,
Jan 24, 2021, 8:52:55 AM1/24/21
to xnat_discussion
Hi Simon,

Thanks a lot for your response! 

The segmentations I've mentioned aren't actually imported from any other source in the original XNAT, but are actually drawn through the viewer and exported back into the DICOM. 
The way that I downloaded/took a backup of the entire database is just by going to the Project -> & Clicked Download Images. 
I was assuming uploading the entire Zip back up on the new XNAT would do it, but it didnt. 
I'll surely try out your suggestion and keep this thread active. 

Thanks!

KK Mehta

unread,
Jan 24, 2021, 10:24:30 AM1/24/21
to xnat_discussion
Hi Simon, 

I tried it out, but unfortunately since I have an Xnat docker image running, downloading the RoiUploadAssistant.jar under xnat -> plugins did not work because after restarting the docker image, the xnat web doesn't show up. I get a 404. 
I checked this twice. If I remove the RoiUploadAssistant.jar plugin, the web page shows up. 

Is there any reason to this?

Simon Doran

unread,
Jan 25, 2021, 4:03:27 AM1/25/21
to xnat_discussion
Hi,

  Sorry, perhaps my previous explanation didn't make one part of the procedure clear enough. When I wrote

     ... via the external app roiuploadassistant ...

what the "external" was supposed to indicate that this app is not part of XNAT (i.e., it is not an XNAT plugin). You should remove this from your plugins directory and restart your XNAT instance. (This is likely to be the explanation for why your XNAT did not start up again.)

  The correct way to run this file is via the command line. On a linux system you can do this by typing

  java -jar <jar file name>     

  Hope that helps.

  Best wishes,

Simon

KK Mehta

unread,
Jan 25, 2021, 5:47:31 AM1/25/21
to xnat_discussion
Oh! I'm sorry. I understood now. I tried it out and was successfully able to upload the ROI collection back.
However it seems a bit slow because you can only upload one at a time. 
But this will do the job for now. 

Thanks a lot!

Simon Doran

unread,
Jan 25, 2021, 9:13:19 AM1/25/21
to xnat_discussion
You can queue up multiple ROIs. They are uploaded sequentially, but you don't have to run the software multiple times to do this. Just point the browser to the top level directory where your ROIs are stored and it will go and hunt for all the RT-STRUCT or AIM files in the file tree below that.

Best wishes,

Simon 

KK Mehta

unread,
Apr 5, 2021, 11:45:35 PM4/5/21
to xnat_discussion
Hey Simon! 

Thanks for your responses. 
Is there a command line tool available to automate this process? 
I have a requirement to upload the AI from a VM where it isn't possible to use the GUI.

Thanks!

James d'Arcy

unread,
Apr 8, 2021, 3:42:47 PM4/8/21
to xnat_discussion
Hi 

There is no command line tool to do this at the moment but you should be able to use curl. The upload URL and the required parameters can be found in the ohif-roi-api section of the Swagger page, it's the only PUT command. For a SEG you would issue a PUT to

{XNAT_URL}/xapi/roi/projects/{projectId}/sessions/{sessionId}/collections/{label}?type=SEG

where you replace the contents of {} with values relevant to your system. The {label} you must generate yourself and must be unique within the project. The plugin will check to ensure that the project and session specified contain all the study, series and SOP instance UIDs referenced in the SEG. A 422 return indicates the plugin was unable to store the SEG, one reason is that one or more UIDs are missing. From version 3.0.0 of the plugin, a 409 return indicates the label already exists.

ttfn

James

Vesa Alexandru

unread,
May 24, 2022, 6:52:20 AM5/24/22
to xnat_discussion
Hello !
Can you explain me please how should I use the Rest API or the app roiuploadassistant ?
Thanks,
Alex

Steve Moore

unread,
Jun 28, 2022, 4:34:59 PM6/28/22
to xnat_discussion
I have a note from Simon Doran of ICR with a writeup on this topic: https://bitbucket.org/icrimaginginformatics/roiuploadassistant/src/master/

Thank you to Simon Doran and James D'Arcy.

Ahmed Hosny

unread,
Jul 12, 2023, 11:34:25 AM7/12/23
to xnat_discussion
Hello James - 
Could you please link to the ohif-roi-api section of the Swagger page? I was able to find the page but no signs of that API call.
Thanks.

Reply all
Reply to author
Forward
0 new messages