Upload different filetypes

Hi All,

A researcher wants his machine learning / AI output to be stored Orthanc.
Is it possible to store the filetypes listed below to be stored in Orthanc?

3d-models-airway.tar.gz
1_airwayseg_branchids.dcm
1_check_airway_segmentation.jpeg
1_pi10_graph.jpg
1_pruned_airways.jpeg
1_unet_thumbnail.jpeg
airway_results.tar.gz
airway_tree.csv
airway_tree.pickle
bp_summary_redcap.csv
intermediate-files-.tar.gz
lung_metrics.csv
PROCESS_LOG.log
status.json

3d.bmp

With kind regards,

Martin

Hi,

You can define your own attachments with this configuration:

  // Dictionary of symbolic names for the user-defined types of[](https://hg.orthanc-server.com/orthanc/file/tip/OrthancServer/Resources/Configuration.json#l548)
  // attached files. Each entry must map an unique string to an unique[](https://hg.orthanc-server.com/orthanc/file/tip/OrthancServer/Resources/Configuration.json#l549)
  // number between 1024 and 65535. Optionally, a second argument can[](https://hg.orthanc-server.com/orthanc/file/tip/OrthancServer/Resources/Configuration.json#l550)
  // provided to specify a MIME content type for the attachment.[](https://hg.orthanc-server.com/orthanc/file/tip/OrthancServer/Resources/Configuration.json#l551)
  "UserContentType" : {[](https://hg.orthanc-server.com/orthanc/file/tip/OrthancServer/Resources/Configuration.json#l552)
    // "sample" : 1024[](https://hg.orthanc-server.com/orthanc/file/tip/OrthancServer/Resources/Configuration.json#l553)
    // "sample2" : [ 1025, "application/pdf" ][](https://hg.orthanc-server.com/orthanc/file/tip/OrthancServer/Resources/Configuration.json#l554)
  },

However:

  • orthanc will not keep the filename → you would have to store it in a metadata and implement some logic on your side to rebuild the filename
  • they should be displayed in Orthanc Explorer but not yet in Orthanc Explorer 2

HTH,

Alain

Hello,

As a complement to Alain’s answer, here is the documentation about attachments in the Orthanc Book:
https://book.orthanc-server.com/faq/features.html#metadata-attachments

Regards,
Sébastien-

Hi Guys,

Thank you for your replies.
Do you have an example how I can upload a .pickle file to a specific patient?

With kind regards,

Martin

Hello,

Here is a full bash command-line session using cURL:

$ curl -H ‘Expect:’ http://localhost:8042/instances --data-binary @test.dcm
{
“ID” : “19816330-cb02e1cf-df3a8fe8-bf510623-ccefe9f5”,
“ParentPatient” : “ef9d77db-eb3b2bef-9b31fd3e-bf42ae46-dbdb0cc3”,
“ParentSeries” : “3774320f-ccda46d8-69ee8641-9e791cbf-3ecbbcc6”,
“ParentStudy” : “66c8e41e-ac3a9029-0b85e42a-8195ee0a-92c2e62e”,
“Path” : “/instances/19816330-cb02e1cf-df3a8fe8-bf510623-ccefe9f5”,
“Status” : “Success”
}
$ curl http://localhost:8042/patients
[ “ef9d77db-eb3b2bef-9b31fd3e-bf42ae46-dbdb0cc3” ]
$ curl -H ‘Expect:’ http://localhost:8042/patients/ef9d77db-eb3b2bef-9b31fd3e-bf42ae46-dbdb0cc3/attachments/1024 -X PUT --data-binary @test.pickle
{}
$ curl -s http://localhost:8042/patients/ef9d77db-eb3b2bef-9b31fd3e-bf42ae46-dbdb0cc3/attachments/1024/data > /tmp/attachment.pickle
$ diff -s /tmp/attachment.pickle test.pickle
Files /tmp/attachment.pickle and test.pickle are identical

Evidently, the Patient ID must be adapted to your patient, as well as the “test.dcm” and “test.pickle” files. Furthermore, the “1024” is the identifier of the attachment, and it could be anything between 1024 and 65535. As Alain indicated, you can use the “UserContentType” configuration option of Orthanc to give a symbolic name to this integer identifier.

HTH,
Sébastien-

Hi Sébastien,

Thank you for your reply and your explanation. This is very helpful.

With kind regards,

Martin

Hi,

I have a follow-up question. Can I also save zip files as attachment or will try to extract the zipfile?

With kind regards,

Martin

Hi,

Zip files can be attached as well. Orthanc will not try to extract them.

HTH,

Alain