Modify Instance and Send to Modality via REST API

I am trying to modify an instance via Mirth Connect/Orthanc REST API, on a Windows PC, and send to a modality without much luck. Something like this in curl…

$ curl http://localhost:8042/instances/6e67da51-d119d6ae-c5667437-87b9a8a5-0f07c49f/modify -X POST -d '{"Replace":{"PatientName":"hello","PatientID":"world"},"Remove":["InstitutionName"],"RemovePrivateTags": true, "Force": true}'

The result of this post is an error (ERROR: Error connecting to HTTP server [SocketException: Software caused connection abort: recv failed]). I am wondering if it is because I have not specified a file name for download, but I do not want to download the new instance.

I was hoping to get a new instance ID in the response and then send that new instance to a modality via another HTTP request.

  • Is there something wrong with my syntax?
  • Is this workflow even possible?
  • Could this be accomplished by sending a Lua command through the REST API?
  • Something like this…
  •   $ curl -X POST http://localhost:8042/tools/execute-script --data-binary "Delete(SendToModality(ModifyInstance(6e67da51-d119d6ae-c5667437-87b9a8a5-0f07c49f
      , '"Replace":{"PatientName":"hello","PatientID":"world"}', '"Remove":["InstitutionName"]', true), 'modality'))"
    
    

Any ideas? :slight_smile:

Calvin.

Hello,

Just had a try, and the following command-line works properly:

$ curl -v http://localhost:8042/instances/19816330-cb02e1cf-df3a8fe8-bf510623-ccefe9f5/modify -X POST -d ‘{“Replace”:{“PatientName”:“hello”,“PatientID”:“world”},“Remove”:[“InstitutionName”],“RemovePrivateTags”: true, “Force”: true}’ > test.dcm

No error is returned, and “test.dcm” has the modified tags set as expected:

$ dcm2xml test.dcm | grep -E ‘PatientName|PatientID’
hello
world

Regards,

Sébastien-