Upload images using C#

12 views
Skip to first unread message

Sathish babu

unread,
Nov 17, 2021, 10:29:00 AM11/17/21
to xnat_discussion
Good afternoon,

I am Sathish , working with Melanoma Institute Australia. 

I can manually login into https://xnat.sydney.edu.au/ and upload compressed files manually into a selected project.

I have been trying to upload compressed image files to a project automatically using C#
Please check my following C# code
 
                var uri = new Uri("https://xnat.sydney.edu.au/");
                var uriWithCred = new UriBuilder(uri) { UserName = "*****", Password = "******" }.Uri;

                var request = (HttpWebRequest)WebRequest.Create(uriWithCred);
                WebResponse response = request.GetResponse();

                if (((System.Net.HttpWebResponse)response).StatusCode == HttpStatusCode.OK)
                {
                    blnResult = true;
                }

I am following https://xnat.readthedocs.io/ for API documentation but it has been explained in the Python.

My question is

How can I connect a existing project and upload compressed files using C#.

Thanks and regards,
Sathish
 

Moore, Charlie

unread,
Nov 17, 2021, 11:17:39 AM11/17/21
to xnat_di...@googlegroups.com
Hi Sathish,

What you've linked is the documentation for XNATpy, not XNAT's API documentation. There are two widely used python libraries that provide their own APIs for wrapping XNAT's REST APIs: XNATpy and pyxnat. If you're using C#, there's no high level XNAT library that I'm aware of, so you'll need to use XNAT's REST APIs directly. The API documentation for the import service is here: https://wiki.xnat.org/display/XAPI/Image+Session+Import+Service+API .

Thanks,
Charlie

From: xnat_di...@googlegroups.com <xnat_di...@googlegroups.com> on behalf of Sathish babu <sathish...@gmail.com>
Sent: Tuesday, November 16, 2021 11:56 PM
To: xnat_discussion <xnat_di...@googlegroups.com>
Subject: [XNAT Discussion] Upload images using C#
 

* External Email - Caution *

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/xnat_discussion/0c8810d1-e9dd-47d5-b9f3-33211801b181n%40googlegroups.com.

 


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.

Reply all
Reply to author
Forward
0 new messages