Sort based on AE Title
Moderator: Moderator Team
Sort based on AE Title
I have 100 customers. I would like to give each one a unique "AE Title" that they should use when sending to my server. When my server receives a dicom file, I want to be able to tell which customer sent it by checking the AE Title that was used. How can I do this kind of thing with DCMTK? Is it possible with binaries, or would we have to modify code?
-
- DCMTK Developer
- Posts: 2072
- Joined: Fri, 2004-11-05, 13:47
- Location: Oldenburg, Germany
- Contact:
Re: Sort based on AE Title
Hi,
storescp (which can receive DICOM objects via C-STORE from clients) has an option which can be configured to do what you want:
as a parameter you give a command line command (e.g. your own little skript or just a "copy" (Windows) command) that than can use #a as a placeholder to refer to the calling ae title.
E.g. on Windows:
will store the file to something like STORESCU_CR.1.3.51.0.7.99.2155959091.26337.877613964.2 where STORESCU is the calling AE title, and CR... is the usual unique name, storescp invents for each incoming file.
BR,
Michael
storescp (which can receive DICOM objects via C-STORE from clients) has an option which can be configured to do what you want:
Code: Select all
Option --exec-on-reception allows one to execute a certain command line after having received and processed
one DICOM object (through a C-STORE-RQ message). The command line to be executed is passed to this option as a
parameter. The specified command line may contain a number of placeholders which will be replaced at run time:
• #p: complete path to the output directory into which the last DICOM object was stored (not available with
option --ignore though)
• #f: filename of the current output file (not available with option --ignore though)
• #a: calling application entity title of the peer Storage SCU
• #c: called application entity title used by the peer Storage SCU to address storescp
• #r: calling presentation address, i.e. hostname or IP address of the peer Storage SCU
E.g. on Windows:
Code: Select all
storescp 1234 --exec-on-reception "rename #f #a_#f"
BR,
Michael
Re: Sort based on AE Title
Perhaps I am doing something wrong, but I cannot get this to work. I first tried with rename and #f and #a, but in trying to track down the problem, I simplified it all the way down to just trying to "create a directory", in case the issue had to do with substituting for #f and #a. So here is my simple test:
storescp.exe -xf C:/Epona/metsrv.txt Default -aet MY_AE -od C:/Epona/Listener 4082 -xcr "mkdir C:\Epona\Listener\foo" (this is printout of actual line in my log file)
The directory "foo" is not being created -- so I think the -xcr is just not working. What would cause it not to execute? The dicom file is being received and appearing in the "Listener" folder as expected.
Sorry, if I am doing something stupid. Can you spot the problem? Thanks!
storescp.exe -xf C:/Epona/metsrv.txt Default -aet MY_AE -od C:/Epona/Listener 4082 -xcr "mkdir C:\Epona\Listener\foo" (this is printout of actual line in my log file)
The directory "foo" is not being created -- so I think the -xcr is just not working. What would cause it not to execute? The dicom file is being received and appearing in the "Listener" folder as expected.
Sorry, if I am doing something stupid. Can you spot the problem? Thanks!
-
- DCMTK Developer
- Posts: 2072
- Joined: Fri, 2004-11-05, 13:47
- Location: Oldenburg, Germany
- Contact:
Re: Sort based on AE Title
Hi Tullhead,
I tried this on Windows now and I also see a problem. The same thing on linux (with mv instead of rename) works. The interpretation of the quotes in the -xcr argument seems to be the problem. I have to look at this in the debugger to see whether there is an easy fix (I will do this but not today). Or there is a way to quote this differently in Windows that I don't know, maybe one of my colleagues.
BR,
Michael
I tried this on Windows now and I also see a problem. The same thing on linux (with mv instead of rename) works. The interpretation of the quotes in the -xcr argument seems to be the problem. I have to look at this in the debugger to see whether there is an easy fix (I will do this but not today). Or there is a way to quote this differently in Windows that I don't know, maybe one of my colleagues.
BR,
Michael
-
- DCMTK Developer
- Posts: 2541
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
Re: Sort based on AE Title
Did you already try to use a double backslash, i.e. "\\" instead of "\"?
-
- DCMTK Developer
- Posts: 2072
- Joined: Fri, 2004-11-05, 13:47
- Location: Oldenburg, Germany
- Contact:
Re: Sort based on AE Title
I tried it at least with commands that don't have special characters at all.
-
- OFFIS DICOM Team
- Posts: 1493
- Joined: Tue, 2004-11-02, 17:22
- Location: Oldenburg, Germany
- Contact:
Re: Sort based on AE Title
The issue on Windows may be caused by the fact that "mkdir" is an executable binary on Linux, but part of cmd.exe on Windows. Perhaps you might try to call .
Code: Select all
storescp.exe -xf C:/Epona/metsrv.txt Default -aet MY_AE -od C:/Epona/Listener 4082 -xcr "cmd.exe /c mkdir C:\Epona\Listener\foo"
Re: Sort based on AE Title
No, the "cmd.exe /c mkdir ..." also does not work. And during my original testing I tried various commands (ren, mv, etc). It simply seems that the -xcr does not execute (at least on windows).
I also took guesses at various quoting and escape sequences trying to find a way that would work -- some kind of work-around. Spent half a day doing that.
Really need this to work - I hope you can find a way...
Thanks again.
I also took guesses at various quoting and escape sequences trying to find a way that would work -- some kind of work-around. Spent half a day doing that.
Really need this to work - I hope you can find a way...
Thanks again.
-
- OFFIS DICOM Team
- Posts: 1493
- Joined: Tue, 2004-11-02, 17:22
- Location: Oldenburg, Germany
- Contact:
Re: Sort based on AE Title
I just tried it with and it works for me. I am using the current DCMTK 3.6.7 on Windows 10, installed via Chocolatey.
Code: Select all
storescp -xcr "cmd.exe /c mkdir d:\test"
Re: Sort based on AE Title
Aha! Indeed, using the form: "cmd.exe /c mkdir d:\test" works!
Thanks for that.
Thanks for that.
Who is online
Users browsing this forum: Ahrefs [Bot], George and 1 guest