Mercurial > hg > orthanc
comparison OrthancServer/Resources/Samples/Python/AnonymizeAllPatients.py @ 4044:d25f4c0fa160 framework
splitting code into OrthancFramework and OrthancServer
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 10 Jun 2020 20:30:34 +0200 |
parents | Resources/Samples/Python/AnonymizeAllPatients.py@94f4a18a79cc |
children | d9473bd5ed43 |
comparison
equal
deleted
inserted
replaced
4043:6c6239aec462 | 4044:d25f4c0fa160 |
---|---|
1 #!/usr/bin/python | |
2 # -*- coding: utf-8 -*- | |
3 | |
4 # Orthanc - A Lightweight, RESTful DICOM Store | |
5 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
6 # Department, University Hospital of Liege, Belgium | |
7 # Copyright (C) 2017-2020 Osimis S.A., Belgium | |
8 # | |
9 # This program is free software: you can redistribute it and/or | |
10 # modify it under the terms of the GNU General Public License as | |
11 # published by the Free Software Foundation, either version 3 of the | |
12 # License, or (at your option) any later version. | |
13 # | |
14 # This program is distributed in the hope that it will be useful, but | |
15 # WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 # General Public License for more details. | |
18 # | |
19 # You should have received a copy of the GNU General Public License | |
20 # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 | |
22 | |
23 | |
24 URL = 'http://127.0.0.1:8042' | |
25 | |
26 # | |
27 # This sample code will anonymize all the patients that are stored in | |
28 # Orthanc. | |
29 # | |
30 | |
31 import sys | |
32 import RestToolbox | |
33 | |
34 # Loop over the patients | |
35 for patient in RestToolbox.DoGet('%s/patients' % URL): | |
36 | |
37 # Ignore patients whose name starts with "Anonymized", as it is | |
38 # the result of a previous anonymization | |
39 infos = RestToolbox.DoGet('%s/patients/%s' % (URL, patient)) | |
40 name = infos['MainDicomTags']['PatientName'].lower() | |
41 if not name.startswith('anonymized'): | |
42 | |
43 # Trigger the anonymization | |
44 RestToolbox.DoPost('%s/patients/%s/anonymize' % (URL, patient), | |
45 { 'Keep' : [ 'SeriesDescription', | |
46 'StudyDescription' ] }) |