Mercurial > hg > orthanc
view Resources/Samples/Python/AnonymizeAllPatients.py @ 628:8d1175318bb3 Orthanc-0.7.0
Orthanc-0.7.0
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 25 Oct 2013 14:15:56 +0200 |
parents | 61e4c62b8c35 |
children | 44382c8bcd15 |
line wrap: on
line source
#!/usr/bin/python # -*- coding: utf-8 -*- URL = 'http://localhost:8042' # # This sample code will anonymize all the patients that are stored in # Orthanc. # import sys import RestToolbox # Loop over the patients for patient in RestToolbox.DoGet('%s/patients' % URL): # Ignore patients whose name starts with "Anonymized", as it is # the result of a previous anonymization infos = RestToolbox.DoGet('%s/patients/%s' % (URL, patient)) name = infos['MainDicomTags']['PatientName'].lower() if not name.startswith('anonymized'): # Trigger the anonymization RestToolbox.DoPost('%s/patients/%s/anonymize' % (URL, patient), { 'Keep' : [ 'SeriesDescription', 'StudyDescription' ] })