Implementing a custom storage area results in JSON Syntax Error

Hello all,

I am currently exploring the Python plugin of Orthanc with the intent of implementing a custom storage area. For this, I am using the sample found in the Orthanc book. The only changes made to the sample is the path where I want to store the files. Using the default path given in the sample, I get a “permission denied” error in the log file. After changing path to the desired one, and ensuring that orthanc has writing and reading permissions, I am now faced with the following error:

E1218 13:30:24.931533 Toolbox.cpp:2335] Cannot parse JSON: * Line 1, Column 1
Syntax error: value, object or array expected.

Any help is greatly appreciated!

Hi,

The only advice so far is to follow these 2 rules from these recommandations

  • Describe your issue with as much details as possible.
  • Review your message as if you were the one who should help you - would you understand your problem?

HTH,

Alain.

My apologies!

I’ve established a connection from my Orthanc server to a DICOM modality, and, in practice, I am able to retrieve data from it and store it in the StorageDirectory set in the configuration file. However, my wish is to implement a custom storage area, and for this I am using the sample provided in Python plugin for Orthanc — Orthanc Book documentation

The Python plugin itself seems to work as I successfully ran the sample.py file that the plugin comes with. When implementing the script above as is, I am facing a “permission denied” error when retrieving data. To this I have the following question: does Orthanc try to store the data in the StorageDirectory that specified in the configuration file, but in the new format? Or where does it try to store the data when using the script as is?

Adding to my previous post, I tried to change the path that is set in the Python script by appending /raid/data/ to it, as this is where I want to set-up the custom storage area. However, this results in the following logfile output (in verbose mode):

W1219 11:51:10.567225 OrthancRestSystem.cpp:909] REST API call has switched the log level to: verbose
I1219 11:51:18.284910 HttpServer.cpp:1244] (http) POST /queries/f2f788b8-0ef0-47b1-89a4-b897126b86bf/answers/2/retrieve
E1219 11:51:18.285124 Toolbox.cpp:2335] Cannot parse JSON: * Line 1, Column 1
Syntax error: value, object or array expected.

W1219 11:51:18.285153 OrthancRestModalities.cpp:949] Driving C-Move SCU on remote modality ulna to target modality ORTHANC
I1219 11:51:18.285561 JobsRegistry.cpp:731] New job submitted with priority 0: 94d26415-0d76-4ca6-9e2f-d18b25b7aaca
I1219 11:51:18.285619 JobsEngine.cpp:134] (jobs) Executing job with priority 0 in worker thread 0: 94d26415-0d76-4ca6-9e2f-d18b25b7aaca
I1219 11:51:18.285864 DicomAssociation.cpp:275] (dicom) Opening a DICOM SCU connection without DICOM TLS from AET “ORTHANC” to AET “ulna” on host XX.XX.X.XX:XXXX (manufacturer: Generic, timeout: 10s)
I1219 11:51:18.346888 CommandDispatcher.cpp:333] (dicom) Association Received from AET ulna on IP XX.XX.X.XX
I1219 11:51:18.346993 main.cpp:317] Incoming connection from AET ulna on IP XX.XX.X.XX, calling AET ORTHANC
I1219 11:51:18.347047 CommandDispatcher.cpp:664] (dicom) Association Acknowledged (Max Send PDV: 4084) to AET ulna on IP XX.XX.X.XX
I1219 11:51:18.356548 main.cpp:352] Incoming Store request from AET ulna on IP XX.XX.X.XX, calling AET ORTHANC
E1219 11:51:18.369555 PluginsManager.cpp:153] Error in the Python StorageCreate callback, traceback:
<class ‘PermissionError’>
[Errno 13] Permission denied: ‘/raid/data/attachment-1-78e2a305-157b-40af-bead-32dad388922e’

File “/etc/orthanc/sample.py”, line 11, in OnCreate
with open(GetPath(uuid, contentType), ‘wb’) as f:

E1219 11:51:18.370467 StoreScp.cpp:198] Exception while storing DICOM: Error encountered within the plugin engine
E1219 11:51:18.413735 OrthancException.cpp:58] Error in the network protocol: C-MOVE SCU to AET “ulna” has failed with DIMSE status 0xFE00
I1219 11:51:18.415907 CommandDispatcher.cpp:929] (dicom) Finishing association with AET ulna on IP XX.XX.X.XX: DUL Peer Requested Release
I1219 11:51:18.415930 CommandDispatcher.cpp:937] (dicom) Association Release with AET ulna on IP XX.XX.X.XX
I1219 11:51:18.427074 JobsRegistry.cpp:504] Job has completed with failure: 94d26415-0d76-4ca6-9e2f-d18b25b7aaca
E1219 11:51:18.427170 OrthancException.cpp:58] Error in the network protocol: C-MOVE SCU to AET “ulna” has failed with DIMSE status 0xFE00

Let me know if more information is needed!

Hi,

I’d say with the script as is, since there is no absolute path specified, Orthanc is trying to save it in the current working directory which is depends on how Orthanc was launched → you should always use an absolute path.

Concerning this error

[Errno 13] Permission denied: ‘/raid/data/attachment-1-78e2a305-157b-40af-bead-32dad388922e’

It seems that the Orthanc process does not have the permission to access that disk.

HTH,

Alain.