3

I'm trying to use dcm4che for downloading images from the free http://www.dicomserver.co.uk/. I've cloned and checked out the 5.13.2 version and built it using mvn install. Now when I go into the dcm4che-assembly/target/dcm4che-5.13.2-bin/dcm4che-5.13.2/bin directory and try to download a StudyInstanceUID:

./movescu -c DCMQRSCP@www.dicomserver.co.uk:104 -m StudyInstanceUID=1.2.826.0.1.3680043.11.105 --dest STORESCP

I get the error:

...
(0000,0902) LO [Unknown Move Destination: STORESCP] ErrorComment
...

The error indicates that it can't connect to the the receiver. I've tried to run:

./storescp -b STORESCP:11112

without much success. I've also tried to run the dcmqrscp with similar outcomes.

My humble request: Please provide a working example of the movescu.


Details

I can get the findscu to work without issues, e.g.:

./findscu -c DCMQRSCP@www.dicomserver.co.uk:104 -m StudyInstanceUID=1.2.826.0.1.3680043.11.105 -r PatientID

gives:

(0008,0005) CS [] SpecificCharacterSet
(0008,0052) CS [STUDY] QueryRetrieveLevel
(0008,0054) AE [DCMQRSCP] RetrieveAETitle
(0010,0020) LO [PAT004] PatientID
(0020,000D) UI [1.2.826.0.1.3680043.11.105] StudyInstanceUID

Similarly the getscu command seems to work:

>./getscu -c DCMQRSCP@www.dicomserver.co.uk:104 -m StudyInstanceUID=1.2.826.0.1.3680043.11.105

Creates the following DICOM files:

ls 1* -lh

-rw-rw-r-- 1 max max  12M jul  7 12:16 1.2.276.0.7230010.3.1.4.39332053.7432.1527748041.31
-rw-rw-r-- 1 max max 150K jul  7 12:17 1.2.276.0.7230010.3.1.4.8323329.11391.1527939718.955155
-rw-rw-r-- 1 max max 6,0M jul  7 12:17 1.2.826.0.1.3680043.9.6384.2.2087.20180322152557.400.100
-rw-rw-r-- 1 max max 6,0M jul  7 12:17 1.2.826.0.1.3680043.9.6384.2.2087.20180322152557.400.104
-rw-rw-r-- 1 max max 6,0M jul  7 12:17 1.2.826.0.1.3680043.9.6384.2.2087.20180322152557.400.108
-rw-rw-r-- 1 max max 6,0M jul  7 12:17 1.2.826.0.1.3680043.9.6384.2.2087.20180322152557.400.112
-rw-rw-r-- 1 max max 6,0M jul  7 12:16 1.2.826.0.1.3680043.9.6384.2.2087.20180322152557.400.80
-rw-rw-r-- 1 max max 6,0M jul  7 12:17 1.2.826.0.1.3680043.9.6384.2.2087.20180322152557.400.84
-rw-rw-r-- 1 max max 6,0M jul  7 12:17 1.2.826.0.1.3680043.9.6384.2.2087.20180322152557.400.88
-rw-rw-r-- 1 max max 6,0M jul  7 12:17 1.2.826.0.1.3680043.9.6384.2.2087.20180322152557.400.92
-rw-rw-r-- 1 max max 6,0M jul  7 12:17 1.2.826.0.1.3680043.9.6384.2.2087.20180322152557.400.96

Lastly, I'm sorry if this question falls into the duplicate category. After spending days without finding a working movescu example on either StackOverflow or the dcm4che-forum, I've given up searching. The goal is to have an example to use so that I can modify the underlying Java code for my own purposes. Also let me know if you're interested in the entire movescu dump.


Update

After Tarmo's helpful tip I tried to (1) use the correct AE & port and (2) change to Orthanc. Unfortunately I still can't retrieve an image from the dicomserver.co.uk but the Orthanc solution worked.

Below is the summary of the outcomes:

Alt. 1: Port & port compliance

As it seems part of my issue was RTFM-related:

Use any calling and called AE titles you like (making them specific to you will assist if logs need to be examined), but if you wish to use C-MOVE, ensure that the calling and destination AETs are the same, and that you listen on port 104.

My first attempt was to align the two AE-titles:

./movescu -c STORESCP@www.dicomserver.co.uk:104 -m StudyInstanceUID=1.2.826.0.1.3680043.11.105 --dest STORESCP

This does not work and it turns out that the destination port is random. At both ends (server log + local) one can find that the port was:

14:23:47,539 INFO  - MOVESCU->APA(1): close Socket
  [addr=www.dicomserver.co.uk/88.202.185.144,port=104,localport=57985]

The localport changes between each attempt. Things that I've tried so far:

  • Variants of --dest (1) STORESCP:104, (2) STORESCP$localhost:104, (3) other AE-titles
  • Starting up a SCP through sudo ./dcmqrscp -b STORESCP:104 --dicomdir /home/max/tmp/dcm (the sudo is due to the low port number) and calling with AE-title only as dest
  • Same as above but with the -b option: ./movescu -c STORESCP@www.dicomserver.co.uk:104 -b STORESCP@localhost:104 -m StudyInstanceUID=1.2.826.0.1.3680043.11.105 --dest STORESCP
  • Same as above without the SCP and with my local IP/external IP (no firewall changes made)
  • I've also tried USB-tethering through my phone to circumvent the router but the phone operated at IPv6 and not v4

It would still be nice to know how to set this up as it could be quite useful. My guess is that since C-MOVE provides the raw IP-address to the dicomserver the 104-port needs to be forwarded to the current machine. Being new to the DICOM-protocol I find many of these features somewhat cryptic...

Alt 2: Local Orthanc server (WORKS!)

Here's the full set-up for anyone that wants to get a test system up and running (using Ubuntu 18.04):

  1. sudo apt install orthanc & check that the service is started systemsctl status orthanc.service
  2. In /etc/orthanc/orthanc.json uncomment the line with: "sample" : [ "STORESCP", "localhost", 2000 ] and restart the server systemsctl restart orthanc.service
  3. Go to http://localhost:8042 (unless you've changed the web-port at /etc/orthanc/orthanc.json)
  4. Navigate into upload and find a dcm-file for uploading (you can find dcm-files to download here: https://www.dicomlibrary.com/ or you can use the getscu from above)
  5. Drag and drop the dcm-file into http://localhost:8042/app/explorer.html#upload + press "Start the upload"
  6. Go to patients and get the new StudyInstanceUID for the uploaded image
  7. Start a SCP-service with the STORESCP and 2000 port that you allowed in the /etc/orthanc/orthanc.json, e.g. ./dcmqrscp -b STORESCP:2000 --dicomdir /home/max/tmp/dcm
  8. Call the movescu with the -b to the above SCP with the new StudyInstanceUID (shortened below for readability), e.g.:

    ./movescu -c ORTHANC@localhost:4242 -m StudyInstanceUID=1.2.826.0.1.3680043.8..... -b STORESCP@localhost:2000 --dest STORESCP

And that's it!

Max Gordon
  • 5,367
  • 2
  • 44
  • 70
  • Have you forwarded the port 104 from your router to your local computer's port 104? If you haven't done that, then the router will block any incoming attempt from dicomserver.co.uk anyway. For `C-MOVE` to work, the server has to be able to open a straight connection back to you, which means you have to let it through the firewall and do a port forward on the router unless your workstation has a public IP address on itself. PS. the random ports that you are seeing in the logs are not the problem, everything is as it should be. Basic TCP/IP networking at play. – Tarmo R Jul 09 '18 at 19:33
  • @tarmor Yeah, I forgot about the port shuffling that the router does. Since it works at the moment with Orthanc I've put the port forwarding on hold, I'll update the post if I ever get around to it. Thanks again for the help! – Max Gordon Jul 09 '18 at 20:37

1 Answers1

3

Please read the C-MOVE information on the http://www.dicomserver.co.uk/ homepage again to figure out, how to set up your query. Your syntax for the command is correct, but some details are wrong.

Basically you need two things:

  1. Your calling AE title must be the same as the destination AE title. You have them different at the moment
  2. Your storescp must be accessible from the public internet on the same port, that you used to connect to dicomserver.co.uk, in your example that is 104. Their server needs to make a new TCP connection back to your computer for it to work.

I think it would be easier to install a lightweight PACS on your local machine to test your applications with (e.g. Orthanc). Getting DICOM C-MOVE to work over public internet is asking for trouble in my opinion.

Tarmo R
  • 1,123
  • 7
  • 15
  • Thanks! I still can't get the dicomserver retrieve to work but the Orthanc works. I'm not certain to why the dcm4che example for `movescu` doesn't specify the `-b` option since I couldn't get it to work without that. Similarly the `--dest` purpose is weird, I get lost in low lvl stuff after [Association::cmove](https://github.com/dcm4che/dcm4che/blob/master/dcm4che-net/src/main/java/org/dcm4che3/net/Association.java#L1008) -> [Association::invoke](https://github.com/dcm4che/dcm4che/blob/master/dcm4che-net/src/main/java/org/dcm4che3/net/Association.java#L1257) (it's in the cmd for some reason). – Max Gordon Jul 08 '18 at 13:35
  • If you leave the `-b` option off, then `movescu` will use its defaults. `--dest` is there to define the destination where the server is supposed to send the images. The thing to understand is, that client `A` can issue a `C-MOVE` command to server `B` to send the images to a third system identified as destination `C`. `A` is by no means required to request the images to be sent to itself. The second thing to understand is, that `C-MOVE` requires to separate connections to work. `C-ECHO`, `C-FIND` and `C-GET` work over a single connection and are therefore much simpler to implement. – Tarmo R Jul 08 '18 at 20:29