ESAPI DICOM Export

Developer
Feb 6, 2014 at 12:30 AM
I am starting to experiment with ESAPI.

Is there any method of performing a DICOM export of specific data using ESAPI ?

Thanks
Coordinator
Feb 6, 2014 at 12:51 AM
Edited Feb 6, 2014 at 10:53 PM
You can get the UIDs you need via the API and then use something like DCMTK, or a .NET dicom package that supports DICOM network operations to remotely control the Varian DB Daemon to extract the DICOM objects you need.

The only .NET DICOM package that supports network operations that I know about is Fellow Oak DICOM though I haven't tried that one myself yet. I know DCMTK scripting together with Varian DB Daemon works, I have used that and will send you a follow-on document via email.

[Follow-up note: It came to my attention that Fellow Oak DICOM does not support C-Move.

See this link:
https://github.com/rcd/fo-dicom/search?q=c-move&ref=cmdform
]
Developer
Feb 6, 2014 at 1:18 AM
Thanks a lot for the quick response.

Yes I was looking at DCMTK.

So you mean that if I write a binary Script Class and add a reference to Fellow Oak DICOM or any other DICOM .NET package, then I can export by specifying UIDs?
And would this work from within Eclipse ? I wasn't sure if a Script class can access other libraries as well.


If you can share some example code that performs this export, it would really help. Thanks
Coordinator
Feb 6, 2014 at 1:30 AM
Edited Feb 6, 2014 at 1:56 AM
Yes, you can call other modules within your Eclipse script, as long as it's a binary plugin script and Eclipse can find the included package to load at runtime. I'll post an example of this eventually when I can get to it.
Feb 6, 2014 at 1:42 PM
Hi all,
I am also interested in an easy export of the DICOM files from the aria database. I' m using DCMTK since several years in my C++ programs. How would you use DCMTK in C# scripts/programs? Do you mean one should launch DCMTK executables like storescp.exe or storescp.exe from a C# script using a shell command ?
Personally as a c++ programmer I dont like C# so much. Would it be possible in princilple using esapi con C++ ?


Thanks Karl
Developer
Feb 6, 2014 at 10:02 PM
Hi Karl,

Wayne explained to me that using C# code, and while running a script from within eclipse, you can generate a text file that contains the required DCMTK syntax.

When you have the script ready, it could possibly be executed from within C# . I am yet to figure out how to do that, but it should not be difficult.

I am still stuck with DCMTK setup, installation etc.

You seem to have much more experience with DCMTK, can you share some thoughts on how to set it up so it can interact with DB Deamon ? And how can we use it to export DCM files of a specific object specified using a UID.

Thanks
Feb 7, 2014 at 8:54 AM

Hi (I can‘ see what is your first name),

I installed DCMTK several times on Linux (gcc) and Windows (mingw/gcc and visual studio express 2010) and I never encountered any problems with it.

Currently I’m using version 3.6.1 which includes RT- features but is not an official release yet. You download Cmake and specify the directory where the CMakeLists.txt file is and specify the compiler you want to use. That in short is all you have to do.

Cmake generates the makefile for you. You run nmake or make(if you use g++ with mingw) that’s all. In this way you generate the libraries which you can use in your C++ programs and also many short programs (like dcmdmp.exe to visualize the content of DICOM files) to launch from the command line. I often use “storescp.exe” as a “pocket” DICOM server or storescu.exe to send DICOM files somewhere. From a within a C++ program you would launch those programs with, for example system("dcmdump.exe");

Since I do not know C# and actually would rather prefer not to have to learn it, I do not know what the equivalent command in C# is, but there has to be one.
Then how to interact actually with Aria/Eclipse I do not know yet, but I guess Wayne (is it Wayne ? I only see “Wkeranen”) can explain that to us.
 
Best regards 
Karl 

Feb 7, 2014 at 9:55 AM

Hi again,

I always compiled DCMTK because version 3.6.1 not an official release, but for the present purpose I guess it will suffice to use the precompiled versions which are available also on the DCMTK website.

Karl

Dr. rer.nat. Karl Ferdinand Loewenich
UniversitätsSpital Zürich / NUK A46
Klinik für Radio-Onkologie
Medizinische Physik
Rämistrasse 100
CH-8091 ZÜRICH
+41 442553248

Von: shashankthebest [email removed]
Gesendet: Donnerstag, 6. Februar 2014 23:02
An: Loewenich Karl Ferdinand
Betreff: Re: ESAPI DICOM Export [variandeveloper:529089]

From: shashankthebest

Hi Karl,

Wayne explained to me that using C# code, and while running a script from within eclipse, you can generate a text file that contains the required DCMTK syntax.

When you have the script ready, it could possibly be executed from within C# . I am yet to figure out how to do that, but it should not be difficult.

I am still stuck with DCMTK setup, installation etc.

You seem to have much more experience with DCMTK, can you share some thoughts on how to set it up so it can interact with DB Deamon ? And how can we use it to export DCM files of a specific object specified using a UID.

Thanks

Feb 10, 2014 at 10:22 AM

Hi again,

on the weekend at home I played a little with DCMTK. For the purpose of exporting from aria the precompiled DCMTK command line tools are fine.

I did not try with Aria however. Echoscu fo checking the connection, findscu for finding out if the requested data are really there and movescu for requesting the data seem to be the tools of choice.

I’ll try in week in the department with aria as well. However I do not know yet how to configure the Aria Deamon.

Best regards Karl

Coordinator
Feb 14, 2014 at 2:54 PM
Hi Karl,

I've created an article that shows how to configure the Varian DB Daemon, and how one could script it with a DCMTK DOS command file generated by Eclipse Scripting API. See Scripting the Varian DICOM DB Daemon with ESAPI + DCMTK. There's also a C# project to go with it that I've uploaded called GetDicomCollection.

Best Regards,
Wayne
Developer
Feb 18, 2014 at 2:45 AM
Hi Wayne,

Just an update.

I am using DCMTK 3.6. Everything is working with the manner you have described.
But if someone is calling the DCMTK from a different computer other than the one running DB Daemon and File Daemon,
they also need to add --port argument to the movescu script

example:
movescu -v -aet DCMTK -aec VMSDBD -aem DCMTKS -S --port 5678 -k "0008,0052=IMAGE" -k "0008,0016=XXXXXXX" -k "0020,000D=XXXXXX" 192.168.1.1 56434

the argument --port 5678 tells the File Daemon about the incoming port to use for performing the transfer of dcm files.

I am currently investigating an issue. After all the movescu commands are executed, the last movescu operation does not finish. The user has to manually press control-C or close the terminal in order to finish that process.

I also looked at the log files of the DB Daemon. By explicitly closing the movescu, the DB Daemon logs the following:

S171: (F) 2014/02/18 13:16:50.386 [9224] FSocket::Receive() failed: recv() generated error code 10054. (..\netsys\DC_FSocket.cpp:351)
S171: (F) 2014/02/18 13:16:50.386 [9224] An existing connection was forcibly closed by the remote host.

I have also tried running the movescu script directly from command line and I see the same issue. It just does not exit after all data is transferred.

Do you know how to solve this ?

Thanks again for the help and the article.

Shashank
Coordinator
Feb 19, 2014 at 11:33 PM
Thanks for sharing the additional information.

Does it exit if you do a small move, like moving a single RTPlan? Have you tried different sized operations?
Developer
Feb 20, 2014 at 12:06 AM
Yes, the size does not effect the behavior of movescu.

I have got some insights now.

the movescu command does 2 things:
  1. Starts a storescp server to receive files
  2. Sends c-move command to VMSDBD
VMSDBD compresses the files and initiates a transfer using VMSFD. This time VMSFD acts as a storescu (user) and sends the files to the storescp server running on the client where movescu was first started.

The storescp server runs in a blocking mode. Which means, even after receiving the requested files, it does not exit.

For this reason, every movescu command just stops and the script does not proceed to next movescu.
Coordinator
Feb 20, 2014 at 12:32 AM
So what is your "DCMTKS" AE title?

Just an FYI - maybe this helps: If you use movescu without the -aem parameter it will send the DICOM files back to the caller (which is the DCMTK script). It sounds like that is what is sort of happening in your case.
Feb 20, 2014 at 5:29 PM
There are examples of how to use the C-Move SCU functionality of fo-dicom in the README. There is also at least one example in the group. Using a .NET library would probably be more flexible than scripting DCMTK.

Feel free to contact me or post to the group if you have any questions.
Developer
Mar 4, 2014 at 1:53 AM
Is it possible to use this same functionality to export a Dose Plane ?

I know when trying to export a dose plane from eclipse. We need to specify the x and y size as well as the resolution of the image to be exported.

In my understanding, when we specify these values, Eclipse computes the dose on the fly and then performs a dicom export.

I was wondering if this could be achieved using the DCMTK scripts ?

I.e. can we somehow request Eclipse to dynamically compute a dose plane, and then obtain its UID and finally perform the export using DCMTK ?


Thanks

Shashank