how upload NIFTI on XNAT

1,308 views
Skip to first unread message

Aurelien Gibiat

unread,
Sep 17, 2014, 10:24:31 AM9/17/14
to xnat_di...@googlegroups.com
Hi everyone,

I have installed xnat on local on my machine and I want to upload a lot of images (NIFTI images).

I would like to use XNATRestClient (i guess it is the best way to upload a large library of images with metadata, if not notice me). Here my bash script

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#!/bin/bash

subject_in=1002
project=MyProj
img=subject_1002.nii
web_path=http://localhost:8080/xnat/

my_login=admin
my_pass=admin

format_img=NIFTI

path_img=/home/[...]/data/subject1/session1/RAW/SCAN1/$img
restPARa="-host $web_path -u $my_login -p $my_pass"

cmd_XNATRestClient="./bin/XNATRestClient $restPARa -m PUT -remote"

$cmd_XNATRestClient "/data/archive/projects/$project/subjects/$subject_in"

$cmd_XNATRestClient "/data/archive/projects/$project/subjects/$subject_in/experiments/session1?xnat:mrSessionData/date=01/02/07"

$cmd_XNATRestClient "/data/archive/projects/$project/subjects/$subject_in/experiments/session1/scans/SCAN1?xsiType=xnat:mrScanData&xnat:mrScanData/type=T1"

$cmd_XNATRestClient "/data/archive/projects/$project/subjects/$subject_in/experiments/session1/scans/SCAN1/resources/$format_img/files/$img" -local $path_img


----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

I have no error message (except "Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled." but I know is not the issue)

But in my xnat webapp ( http://localhost:8080/xnat/ ) I do not have the Nifti file correctly uploaded (see attached)


Is Xnat manages NIFTI ?
How upload correctly?

Thanks
upload_1002_nii.png

Herrick, Rick

unread,
Sep 17, 2014, 10:37:56 AM9/17/14
to xnat_di...@googlegroups.com

Hi Aurelien,

 

A couple things. I’d suggest using XnatDataClient rather than XNATRestClient. That’s the tool we’ll be supporting going forward. It is somewhat (and will become more so) XNAT aware and will do some things to help get your data into XNAT appropriately.

 

That said, what you’re doing is a pretty straightforward operation that can be done with even as simple a tool as curl, since you’re just pushing data to the server. There is no metadata going up with that push, regardless of whether you use curl, XnatDataClient, XNATRestClient, or even upload the data directly through the XNAT user interface. This is at least in part because there’s very little metadata in NIFTI itself.

 

Because of this, currently the primary data format with which XNAT works is DICOM. What you’re seeing is a side effect of this. You are associating your NIFTI data with a particular scan, which is probably OK, but as far as XNAT is concerned, that scan is empty because there’s no DICOM. You’ll notice, however, that the Files column indicates that you have 135.6KB in 1 file. If you hover your mouse over that, it should tell you what that one file is and it will tell you that it’s a NIFTI file. So your data is there, it’s just not appearing in the way you expect it to appear.

 

Another thing is that you’re seeing the broken image in there because of how XNAT generates snapshots of incoming DICOM data. There is currently a pipeline that launches at the time that incoming DICOM data is moved into a project (in XNAT terminology, it’s archived, which means that it’s promoted from the prearchive). That pipeline goes through the DICOM and creates GIF thumbnails of the DICOM and posts them back to XNAT as resources. When you go to a DICOM session and look at the scans, you’ll see these snapshot GIFs. Since your session didn’t go through this process AND has no DICOM data associated with it, you won’t see these snapshots.

 

We’ve been kicking around ways to make NIFTI a first-class citizen in XNAT for quite some time, but there are a number of issues surrounding that, most going back to the lack of metadata I mentioned earlier. Future releases of XNAT will have some means of handling NIFTI better, but I can’t tell you exactly what that will look like. As for the screen shot thing, we hope to have a much better approach for that as well.

 

One last thing: if you want to have a look at what you have in your session for NIFTI files, try using the Manage Files feature. That can be launched by clicking Manage Files on the Actions menu over to the right side of the session page.

 

Rick Herrick

Sr. Programmer/Analyst

Neuroinformatics Research Group

Washington University School of Medicine

(314) 827-4250

--
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 http://groups.google.com/group/xnat_discussion.
For more options, visit https://groups.google.com/d/optout.




The material in this message is private and may contain Protected Healthcare Information (PHI). If you are not the intended recipient, be advised that any unauthorized use, disclosure, copying or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error, please immediately notify the sender via telephone or return mail.

Aurelien Gibiat

unread,
Sep 18, 2014, 6:11:19 AM9/18/14
to xnat_di...@googlegroups.com
Thanks a lot Rick for your answers.
I will used XnatDataClient instead XNATRestClient now. (XnatDataClient over curl on linux ?)

I did not found a tutorial to use XnatDataClient. How it works in order to add img, and metadata ? Is there a tutorial somewhere?

Thank you again



Xin Jie Zhang

unread,
Nov 18, 2016, 12:59:36 PM11/18/16
to xnat_discussion
Hello Rick, when we upload the DICOM file in Xnat server using PyXnat , the uploaded file can not be seen either .
in the main window  ( Pic 1 in the word document attached )
, and if using the view image, it will give the NULLPoint exception error ( Pic2 in the attachment ) .
How ever , can see it in the manage files under the action ( Pic 3,4 in the attachment ) .

Question :
  1. Is this the version of Xnat problem ?  can we solve it in Xnat 1.7 ?
  2.  ( seems I also tested it in the https://central.xnat.org server ,also got the NULLPoint error . ) is it browser reason ? what shall we do besides install the JRE .
  3. Is PyXnat a good tool to upload DICOM data , How can we make the Configure for the Pipeline to work when using Pyxnat to upload file ?
  4. Is there some document describe the Pre-Archieve and Archive process ?

Thank you very much .

Xnat118_ErrorMsg.doc

Herrick, Rick

unread,
Nov 18, 2016, 1:49:01 PM11/18/16
to xnat_di...@googlegroups.com

Re: #1, it’s not a problem with XNAT itself. You probably don’t have the pipeline engine configured properly. The snapshot images that display in the list of scans are actually generated by the pipeline engine through the AutoRun pipeline that is launched whenever a new session is moved into the archive. If you have snapshots, you’ll see them in the Manage Files dialog in addition to the DICOM files:

 

 

Have a look at your XNAT logs (specifically application.log) and the pipeline logs (which will be in a folder named logs in your pipeline engine folder). If you can’t determine what’s going wrong from those, you should be able to find the commands that launched the failed pipelines and run those from the command line

 

I can’t really say anything about the NullPointerException on its own. I’d need to see the stacktrace that’s generated. One of the buttons on that dialog (don’t know which one, sorry, I can’t read Chinese J) will show you more information about the error and that will indicate where it’s actually occurring.

 

Pyxnat is a fine tool for uploading data, but I’m not sure what you mean about configuring a pipeline. Those are separate things. You can configure pipelines through the user interface then run the pipelines on data uploaded by XNAT.

 

Re: #4, there’s documentation on using the prearchive in 1.6 here: https://wiki.xnat.org/display/XNAT16/Using+the+Prearchive. We’re working on updating our documentation now and a description of the prearchive and archive are part of that. They’re not completed yet, though.

 

-- 

Rick Herrick

Sr. Programmer/Analyst

Neuroinformatics Research Group

Washington University School of Medicine

 


For more options, visit https://groups.google.com/d/optout.

 


The materials in this message are private and may contain Protected Healthcare Information or other information of a sensitive nature. If you are not the intended recipient, be advised that any unauthorized use, disclosure, copying or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error, please immediately notify the sender via telephone or return mail.

Xin Jie Zhang

unread,
Nov 18, 2016, 11:09:59 PM11/18/16
to xnat_discussion
 Rick,

Thank you very much for your reply , Is there some document to describe the ways on how to run the pipeline and make it a snapshots ?
Also , can Xnat deal with the NIFTI image now ? ie, to make snapshots for those NIFTI file and transfer them to image files as well ?


Thank you very much .

" You can configure pipelines through the user interface then run the pipelines on data uploaded by XNAT."

zhang...@alu.fudan.edu.cn
 
BTW, I don't know why can not send mail to xnat_discussion<xnat_di...@googlegroups.com> .it;s returned with below the error msg :

Hello zhang...@yahoo.com,
 
We're writing to let you know that the group you tried to contact (xnat_discussion) may not exist, or you may not have permission to post messages to the group. A few more details on why you weren't able to post:
 
* You might have spelled or formatted the group name incorrectly.
* The owner of the group may have removed this group.
* You may need to join the group before receiving permission to post.
* This group may not be open to posting.
 
If you have questions related to this or any other Google Group, visit the Help Center at https://groups.google.com/support/.
 
Thanks,
 
Google Groups
 
is there some way to fix it ? Thanks a lot .

Xin Jie Zhang

unread,
Nov 25, 2016, 6:18:58 AM11/25/16
to xnat_discussion
Thank you very much for your kind reply Rick .

Is there some good document to know how to config and use Pipeline Engine ?
Thanks a lot


On Saturday, November 19, 2016 at 2:49:01 AM UTC+8, Rick Herrick wrote:

江亚

unread,
Aug 8, 2017, 10:33:01 AM8/8/17
to xnat_discussion

Hi,I encountered the same problem.Is there any document about how to upload NIFTI files to XNAT via XnatDataClient?  What method did you use to upload NIFTI files?
I tried to use a sample script refferenced by XNATRestClient https://wiki.xnat.org/documentation/the-xnat-api/upload-image-session-files-with-rest-api 

//create subject_test

XnatDataClient -u MyUsername -p MyPassword -r "http://localhost/xnat/data/projects/MyProjectName/subjects/subject_test" -m PUT

 

//creat session1

XnatDataClient -u MyUsername -p MyPassword -r "http://localhost/xnat/data/projects/ MyProjectName /subjects/subject_test /experiments/session1?xnat:mrSessionData/date=01/02/07" -m PUT

 

//creat SCAN1

XnatDataClient -u MyUsername -p MyPassword -r "http://localhost/xnat/data/projects/ MyProjectName /subjects/subject_test /experiments/session1 /scans/SCAN1?xsiType=xnat:mrScanData&xnat:mrScanData/type=T1" -m PUT

 

//upload SCAN1 files

XnatDataClient -u MyUsername -p MyPassword -r "http://localhost/xnat/data/projects/ MyProjectName /subjects/subject_test /experiments/session1 /scans/SCAN1 /resources/DICOM/resources/DICOM?format=DICOM&content=T1_RAW" -m PUT

 

//upload SCAN1 files

XnatDataClient -u MyUsername -p MyPassword -r "http://localhost/xnat/data/projects/ MyProjectName /subjects/subject_test /experiments/session1 /scans/SCAN1 /resources/DICOM/ files/1232132.dcm" -m PUT -l /localpath/1232132.dcm

 

//create reconstruction 1

XnatDataClient -u MyUsername -p MyPassword -m PUT -r "/data/projects/ MyProjectName /subjects/subject_test/experiments/session1/reconstructions/session1_recon_0343?xnat:reconstructedImageData/type=T1_RECON"

 

//create resource collection to put files into

XnatDataClient -u MyUsername -p MyPassword -m PUT -r "/data/projects/ MyProjectName /subjects/subject_test/experiments/session1/reconstructions/session1_recon_0343/resources/NIFTI?format=NIFTI"

 

//upload reconstruction 1 files...

XnatDataClient -u MyUsername -p MyPassword -m PUT -r "/data/projects/ MyProjectName /subjects/ subject_test /experiments/session1/reconstructions/session1_recon_0343/resources/NIFTI/files/0343.nii" -l /localpath/0343.nii



I executed the command line one by one,and all the command lines were executed successfully except the last one.The error information shown below.


Exception in thread "main" java.net.SocketException: Connection reset
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:118)
at java.net.SocketOutputStream.write(SocketOutputStream.java:159)
at org.apache.http.impl.io.SessionOutputBufferImpl.streamWrite(SessionOutputBufferImpl.java:124)
at org.apache.http.impl.io.SessionOutputBufferImpl.flushBuffer(SessionOutputBufferImpl.java:136)
at org.apache.http.impl.io.SessionOutputBufferImpl.write(SessionOutputBufferImpl.java:167)
at org.apache.http.impl.io.ContentLengthOutputStream.write(ContentLengthOutputStream.java:113)
at org.apache.http.entity.FileEntity.writeTo(FileEntity.java:99)
at org.apache.http.impl.DefaultBHttpClientConnection.sendRequestEntity(DefaultBHttpClientConnection.java:156)
at org.apache.http.impl.conn.CPoolProxy.sendRequestEntity(CPoolProxy.java:162)
at org.apache.http.protocol.HttpRequestExecutor.doSendRequest(HttpRequestExecutor.java:238)
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:123)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:271)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.nrg.xnat.client.data.XnatDataClient.launch(XnatDataClient.java:166)
at org.nrg.xnat.client.data.XnatDataClient.main(XnatDataClient.java:90)

I don't know how to fix it.So I wonder that how did you upload NIFTI files to XNAT.

Thank you very much.

在 2016年11月19日星期六 UTC+8下午12:09:59,Xin Jie Zhang写道:
 Rick,

Thank you very much for your reply , Is there some document to describe the ways on how to run the pipeline and make it a snapshots ?
Also , can Xnat deal with the NIFTI image now ? ie, to make snapshots for those NIFTI file and transfer them to image files as well ?

Thank you very much .

" You can configure pipelines through the user interface then run the pipelines on data uploaded by XNAT."

zhang...@alu.fudan.edu.cn
 
BTW, I don't know why can not send mail to xnat_discussion<xnat_discu...@googlegroups.com> .it;s returned with below the error msg :
Reply all
Reply to author
Forward
0 new messages