Adding Files

Hello,

I hope you are doing great.
I am Blendi and I was trying to research about Orthanc, and I have one simple question that I couldn’t find in the documentation.
Can you please tell me about the statuses when I try to upload images/files. All I can see is ‘Success’ and ‘AlreadyStored’. Do you have other statuses beside these two ? If yes can you please provide me with them?

Best,
Blend

Hi Blendi,

To be honest i have been having the same question for a long time. There were too many cases that some of my files weren’t uploaded and i didn’t even notice till it was too late. I would really want to know if there are other statuses like: “pending” or “this specific file failed to upload”.

Please let me know if someone gives you an answer.

Hi Gjend and Blend,

If your upload succeeds, you will only receive “Success” or “AlreadyStored” status and a 200 HTTP status code.

If it fails, you will receive a 400 HTTP status code with this kind of payload:

image.png

HTH,

Alain.

Hello,

You are visibly referring to uploads using the built-in Orthanc Explorer, that is primarily designed for low-level, development uses:
https://book.orthanc-server.com/faq/improving-interface.html

You are kindly invited to use the sample Python scripts “OrthancImport.py” and “ImportDicomFiles.py” to import many files, as explained in the Orthanc Book:
https://book.orthanc-server.com/users/rest.html#sending-dicom-images

The Orthanc Explorer 2 plugin might also help you:
https://book.orthanc-server.com/plugins/orthanc-explorer-2.html

@Blend: As of Orthanc 1.11.2, four status codes can be returned during the upload of one instance: “Success”, “AlreadyStored”, “Failure”, and “FilteredOut” (Alain has recently added a value “StorageFull” that could be returned in future versions of Orthanc), as can be seen in the source code:
https://hg.orthanc-server.com/orthanc/file/Orthanc-1.11.2/OrthancServer/Sources/ServerEnumerations.cpp#l327

Regards,
Sébastien-

Thank you so much.
“Failure” and “FilteredOut” are they returned with 200 HTTP STATUS CODE ?

The thing is sometimes the same dicom fails to store, but if I try to store again the same dicom file it works.

You can easily test this by yourself using the curl command line:

$ curl http://localhost:8042/instances --data-binary @/tmp/NOT_A_DICOM_FILE -v

  • Trying 127.0.0.1…
  • TCP_NODELAY set
  • Connected to localhost (127.0.0.1) port 8042 (#0)

POST /instances HTTP/1.1
Host: localhost:8042
User-Agent: curl/7.58.0
Accept: /
Content-Length: 33083
Content-Type: application/x-www-form-urlencoded
Expect: 100-continue

  • Done waiting for 100-continue
  • We are completely uploaded and fine
    < HTTP/1.1 400 Bad Request
    < Connection: keep-alive
    < Keep-Alive: timeout=1
    < Content-Length: 276
    <
    {
    “Details” : “Cannot parse an invalid DICOM file (size: 33083 bytes)”,
    “HttpError” : “Bad Request”,
    “HttpStatus” : 400,
    “Message” : “Bad file format”,
    “Method” : “POST”,
    “OrthancError” : “Bad file format”,
    “OrthancStatus” : 15,
    “Uri” : “/instances”
    }
  • Connection #0 to host localhost left intact

=> The status code is 400 (cf. bold text).

Regarding the question “The thing is sometimes the same dicom fails to store, but if I try to store again the same dicom file it works”, please provide a minimal working example for other people to be able to reproduce your issue:
https://book.orthanc-server.com/users/support.html#discussing-a-minimal-working-example

Sébastien-