Is there a way to move a whole study to another PatientID ?
It is not possible to use /studies/{id}/modify to change PatientID refereing to OrthancBook.
And, using merge is also not possible because need a target StudyInstanceUID and I don’t want to change the Study attributes.
There is also a “Keep” option when performing modifications.
There is a way to do that, but you need to be careful when doing so.
I’ve experimented around with that previously and forgot what I tried. If you iterate through the instances (maybe the Series would work also) and change the tags that you want with the Force option, Orthanc logs notices in the log file that your are changing tags that you generally should not, but it will make the changes. I don’t think I ever tried that at the Patient level.
It is generally better to keep the original and make a copy with the modified tags, at least initially.
This might be an option with some caveats because it preserves the UID’s. Just a python script from the CLI. You’ll need to have Python
on your system and also the requests PIP module installed.
Might give you some ideas:
#!/usr/bin/python3
-- coding: utf-8 --
sudo python3 -m pip install requests
import requests
import json
url = ‘http://localhost:8042/’ # For example
headers = {‘Authorization’:‘Bearer —’} # if needed for some reason
res = requests.get(url+‘studies/the uid for the study’, headers=headers)
Study = json.loads(res.content)
Stephen is right, as of Orthanc 1.11.2, it is not possible to change the PatientID tag when modifying a Study. Therefore, modifying each instance individually is currently the only valid option.
We have always been overly careful wrt DICOM modifications in Orthanc. I have just loosened some of the constraints but it means that users will have to be careful to make sure they preserve the DICOM model → if you modify the PatientID, make sure to update all Patient related tags as well.
The modification will be available in the next Orthanc release.
For reference, as the manual modification of UID most probably breaks the DICOM model of the real world, which can cause important trouble for the standard workflow, I have just reintroduced the safety checks, but allowed their disabling using the “Force” option: https://hg.orthanc-server.com/orthanc/rev/8638522eeda1