Getting all DICOM files from a scan at once using pyxnat

406 views
Skip to first unread message

Andrey Fedorov

unread,
Jan 14, 2013, 12:27:15 PM1/14/13
to xnat_di...@googlegroups.com
Hi,

I am trying to work around the bug described here: https://groups.google.com/d/topic/xnat_discussion/zV5xDIXNrWU/discussion

I was told it is possible to get all the DICOM files for a given scan at once. Can someone tell me how this can be done using pyxnat?

I tried

 project.subject(s).experiment(e).scan(s).resources('DICOM').get(path)

but this does not seem to work (for some scans, I am getting a zip file with a number of files, each called 'DICOM', and the number of those files does not match the expected number of DICOM files).

Is there a way to do this?

AF

Herrick, Rick

unread,
Jan 16, 2013, 5:39:24 PM1/16/13
to xnat_di...@googlegroups.com

Andrey,

 

I haven’t been ignoring you but simply haven’t had time to look into this. Can you send me more of the code creating the objects for your subject, experiment, etc.?

--
You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
To view this discussion on the web visit https://groups.google.com/d/msg/xnat_discussion/-/W1UBqu3n7W4J.
To post to this group, send email to xnat_di...@googlegroups.com.
To unsubscribe from this group, send email to xnat_discussi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/xnat_discussion?hl=en.




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.

Just, David J. (Dave)

unread,
Jan 17, 2013, 12:17:31 PM1/17/13
to XNAT_DISCUSSION
There are times when it is more convenient to NOT use pyxnat.  This is one of those times:
Using this URL format to a CURL command will get you a zip of just the dicom:

URL="${XNAT_SERVER}/data/projects/${XNAT_PROJECT}/subjects/${SUBJECT}/experiments/${STUDY}/scans/${SERIES}/resources/DICOM/files?format=zip"

If you want to stay inside of python, the “requests” library is also very handy in a few cases.



On 1/16/13 4:39 PM, "Herrick, Rick" <herr...@mir.wustl.edu> wrote:

Chen Yang

unread,
Jan 17, 2013, 12:30:58 PM1/17/13
to xnat_di...@googlegroups.com
Hi, 
Here is the way that we are using to download all the DICOM files for a given scan at once by using pyxnat. 

scans = project.subject(s).experiment(e).scans()
scans.dwonload(tempDir, type=seriesNumber,extract=True) # download all the DICOM file of  the given seriesNumber scan to tempDir and extract them. 

Good luck!
Chen



AF

--
Reply all
Reply to author
Forward
0 new messages