dicomdcm4che

A basic movescu example for retrieving dicom images


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:

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!


Solution

  • 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.