Anonymize and keep PatientsAge etc.

I tried to anonymize all the patients in my storage using the sample python script. It works like expected as is, but when I modify it to also keep eg. "PatientsAge" or "PatientsSex", the script aborts with the following error:

Traceback (most recent call last):
  File "anonall.py", line 45, in <module>
    { 'Keep' : [ 'SeriesDescription', 'StudyDescription', 'StudyDate', 'StudyComments', 'PatientsAge' ] })
  File "/Users/media/Orthanc/Resources/Samples/Python/RestToolbox.py", line 108, in DoPost
    return _DoPutOrPost(uri, 'POST', data, contentType)
  File "/Users/media/Orthanc/Resources/Samples/Python/RestToolbox.py", line 87, in _DoPutOrPost
    raise Exception(resp.status)
Exception: 500

Thanks for any help!

Hello,

Please post a standalone Python script so that we can help you: The error message is insufficient to get an insight of what went wrong.

Sébastien-

Here is my script...

anonall.py (1.61 KB)

The same happens when using your continuous anonymization script...

contanon.py (3.19 KB)

Hello,

These tags are known to Orthanc as “PatientAge” and “PatientSex” (i.e. there is no “s” at the end of “Patient”).

Remove the “s” and it should work fine.

HTH,
Sébastien-

Thanks so much! Osirix DICOM metadata showed the tags wrong.
I now solved nearly all my problems with your help!
Regards