comparison Resources/Samples/Python/AnonymizeAllPatients.py @ 352:cc9eddbf07d3

sample to anonymize patients
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 28 Jan 2013 16:43:49 +0100
parents
children 61e4c62b8c35
comparison
equal deleted inserted replaced
351:64625960af22 352:cc9eddbf07d3
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3
4
5 URL = 'http://localhost:8042'
6
7 #
8 # This sample code will anonymize all the patients that are stored in
9 # Orthanc.
10 #
11
12 import sys
13 import RestToolbox
14
15 # Loop over the patients
16 for patient in RestToolbox.DoGet('%s/patients' % URL):
17
18 # Ignore patients whose name starts with "Anonymized", as it is
19 # the result of a previous anonymization
20 infos = RestToolbox.DoGet('%s/patients/%s' % (URL, patient))
21 name = infos['MainDicomTags']['PatientName'].lower()
22 if not name.startswith('anonymized'):
23
24 # Trigger the anonymization
25 RestToolbox.DoPost('%s/patients/%s/anonymize' % (URL, patient))