Well the word "download" is bit odd here. The proper word is Query-Retrieve.
This is two step operation, first part is Query (CFind) that you are already doing.
You can compare this with database query. Suppose you have a table with path of file and name. Your program do not know the path. So you run a query on database something like SELECT Name, Path FROM FilesTable
. Database returns you the data. This is what happen with CFind and this is what you are getting in onResponse(DicomCFindRequest req, DicomCFindResponse res)
. The data in the res
is one record returned by database. This is NOT actual file..
Now the next part is to download this file from the path you just received. So, you do some file operation like File.Copy(srcPath, destPath)
or may be HTTP/FTP download. In DICOM, this could be achieved in two ways - CGet and CMove. CMove is more popular for many reasons.
As in my example, if you already know the path and name of file, you can bypass database query. Similarly, you can bypass CFind and directly do CMove if you know the identifiers in advance. Refer this post.
This paragraph will be bit complicated and may have some variations in workflow with different implementations. To do CMove, there must exist a CStoreSCP. You (CMoveSCU) will send CMove command to PACS (CMoveSCP) with AE Title of CStoreSCP where you want to receive instances. That means either you should also develop your own CStoreSCP or you should involve some other. CMoveSCP will read the AE Title you sent and will match it with its configurations. That means your CStoreSCP must be configured on PACS in advance. From configurations, it will take IP address and Port where it will establish NEW association. This is called Role Switching. CMoveSCP now also works as CStoreSCU. Acting as a CStoreSCU, PACS will then push instances to your CStoreSCP. This way, you actually get the images/instances.
I am not fo-dicom developer (@AndersGustafsson is expert in that tool. I guess he is also contributing to the project); but I am sure this must be simple looking at the efforts you have already put. When I was new to DICOM, I rarely had a problem with syntax. Most of the time, I had a problem with concept and terminology. I tried to explain it here with the best way I can. Hope this helps you.
Refer artilcles from Rony:
http://dicomiseasy.blogspot.in/2012/01/dicom-queryretrieve-part-i.html
http://dicomiseasy.blogspot.in/2012/02/c-move.html
Edit 1:
I found some sample code at the link posted by @AndersGustafsson in his answer.
var cmove = new DicomCMoveRequest("DEST-AE", studyInstanceUid);
var client = new DicomClient();
client.AddRequest(cmove);
client.Send("127.0.0.1", 11112, false, "SCU-AE", "SCP-AE"); // Alt 1
await client.SendAsync("127.0.0.1", 11112, false, "SCU-AE", "SCP-AE"); // Alt 2