Coercion Orthanc

Hello,

Have possibility that modify tags with data no modify the SOPInstanceUID ?

Thanks

It sounds like a dicom violation,
if you modify a dicom you generate a different dicom and thus the UID should change as well.

Hello,

You could do this using one of the following two calls:

$ curl http://localhost:8042/instances/66c8e41e-ac3a9029-0b85e42a-8195ee0a-92c2e62e/modify -d ‘{“Replace”:{“PatientName”:“HELLO”,“SOPInstanceUID”:“hello”},“Force”:true}’

$ curl http://localhost:8042/studies/66c8e41e-ac3a9029-0b85e42a-8195ee0a-92c2e62e/modify -d ‘{“Replace”:{“PatientName”:“HELLO”,“SOPInstanceUID”:“hello”},“Force”:true}’

However, as Salim said, this is a very bad idea, as it totally breaks the DICOM model of the real-world:
https://book.orthanc-server.com/dicom-guide.html#dicom-identifiers

Furthermore, the second call would only be applicable to studies containing 1 instance.

Also, have a look at the “OverwriteInstances” configuration option of Orthanc.

HTH,
Sébastien-

Hello,

Salim, you’re right. But the Dicom’s Protocol it’s ok in a perfect World.

I fight daily with manufacturers, users, Doctors, Dicom’s soft and theirs Dicom’s solutions.

I actived the OverwriteInstances option and it does not running with as expected:

If I send the instance previous modified, it works correctly. But I send the instance and lua script modified the instance, the instance is not overwriten. Create a new instance.

I have adapted a lua Script whith your examples, and it’s Works:

function OnStoredInstance(instanceId, tags, metadata, origin)

– Do not modify twice the same file

if origin[‘RequestOrigin’] ~= ‘Lua’ then

local xSOPInstanceUID = tags[‘SOPInstanceUID’]

local replace = {}

replace[‘SOPInstanceUID’] = xSOPInstanceUID

local request = {}

request[‘Replace’] = replace

request[‘Force’] = true

local modified = RestApiPost(‘/instances/’ … instanceId … ‘/modify’,

DumpJson(request, true))

– Delete the original instance

–RestApiDelete(‘/instances/’ … instanceId)

– Upload the modified instance to the Orthanc store

RestApiPost(‘/instances/’, modified)

end

end

Thanks.