Version of Orthanc that allows modifying PatientID at the Study level

Greetings,

I’m trying to modify PatientID at the Study level using Orthanc version 1.11.2 but Im getting the following response

“When modifying a study, the parent PatientID cannot be manually modified”

In the documentation it states:

" Up to version 1.11.2, Orthanc implemented safety checks to preserve the DICOM model of the real world. These checks prevented the modification of some tags that are known to belong to a level in the patient/study/series/instance hierarchy that is higher than the level that corresponds to the REST API call. For instance, the tag PatientID could not be modified if using the /studies/{id}/modify route (in the latter case, the /patients/{id}/modify route had to be used, cf. next section). These sanity checks have been loosened in more recent versions and users must be very careful to preserve the DICOM model when updating these tags (e.g. if you modify the PatientID at study level, also make sure to modify all other Patient related tags (PatientName, PatientBirthDate, …)). "

So the documentation is saying it is possible to modify the PatientID tag at the study level using the latest versions of Orthanc after 1.11.2 but the latest version available in the releases section is 1.11.2. Where can I get a version that allows PatientID modification at the study level?

Hello.

Did you try setting Force to true?

https://api.orthanc-server.com/index.html#tag/Studies/paths/~1studies~1{id}~1modify/post

BR

Maybe those are still pending: https://hg.orthanc-server.com/orthanc/file/tip/NEWS

or you need to compile ?

The alternative is to make the modifications at the instance level for every instance in the study until the next release.

I had a script that did something like that from the CLI. Not sure if that is the one, but you could look at that and modify it for your purposes.

#!/usr/bin/python3

-- coding: utf-8 --

sudo python3 -m pip install requests

import requests
import json

url = ‘apiurl’
headers = {‘Authorization’:‘’}
studyuuid = ‘’
res = requests.get(url+‘studies/’ + studyuuid, headers=headers)
Study = json.loads(res.content)

command = dict()
command[‘Replace’] = dict()
command[‘Force’] = True

tags to alter

command[‘Replace’][‘PatientID’] = ‘PatientID’
command[‘Replace’][‘PatientBirthDate’] = ‘19000101’
command[‘Replace’][‘PatientName’] = ‘Test^Test^Test’
command[‘Replace’][‘PatientSex’] = ‘M’
command[‘Keep’] = [‘StudyInstanceUID’,‘SeriesInstanceUID’,‘SOPInstanceUID’]
imagecount = 0
print(command)
for uuid in Study[‘Series’]:
res = requests.get(url+‘series/%s’ % uuid, headers=headers)
Series = json.loads(res.content)
instances = Series[‘Instances’]
for instance in instances:
print(instance+‘\n’)
imagecount = imagecount + 1
modified = requests.post(url+‘instances/%s/modify’ % instance , data=json.dumps(command), headers=headers)
saved = requests.post(url+‘instances/’, data=modified, headers=headers)

res = requests.post(url+‘studies/’ + Study[‘ID’] + ‘/reconstruct’, data=‘{“Asynchronous”:true}’, headers=headers)

print(res.content)

Hi Rana,

I’m planning to release 1.11.3 early next week. This will include this feature.

Best regards,

Alain.

Awesome :+1:

Alain,
Did this version eventually get released - I can’t seem to find it on Docker’s hub?

I appreciate that versions sometimes get delayed but I would be interested in seeing how this feature works too.

Dave

Hi Dave,

Yes, Orthanc 1.11.3 has been released and is part of osimis/orthanc:23.2.0. See the release notes.

HTH,

Alain