annotate OrthancServer/Resources/Samples/Python/DicomizeImage.py @ 5522:dd430a1b21fe pg-transactions

simplifying StatelessDatabaseOperations
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 30 Jan 2024 09:41:06 +0100
parents 48b8dae6dc77
children f7adfb22e20e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5240
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 #!/usr/bin/python3
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 # -*- coding: utf-8 -*-
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 # Orthanc - A Lightweight, RESTful DICOM Store
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 # Department, University Hospital of Liege, Belgium
5485
48b8dae6dc77 upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5432
diff changeset
7 # Copyright (C) 2017-2024 Osimis S.A., Belgium
48b8dae6dc77 upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5432
diff changeset
8 # Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
5240
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 #
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 # This program is free software: you can redistribute it and/or
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 # modify it under the terms of the GNU General Public License as
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 # published by the Free Software Foundation, either version 3 of the
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 # License, or (at your option) any later version.
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 #
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 # This program is distributed in the hope that it will be useful, but
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 # WITHOUT ANY WARRANTY; without even the implied warranty of
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 # General Public License for more details.
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 #
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 # You should have received a copy of the GNU General Public License
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 # along with this program. If not, see <http://www.gnu.org/licenses/>.
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 # This sample Python script illustrates how to DICOM-ize a JPEG image,
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 # a PNG image, or a PDF file using the route "/tools/create-dicom" of
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 # the REST API of Orthanc. Make sure to adapt the parameters of the
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 # DICOM-ization below.
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 #
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 # The following command-line will install the required library:
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 #
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 # $ sudo pip3 install requests
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 #
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 import base64
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 import imghdr
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 import json
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 import os
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 import requests
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 ########################################
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 ## Parameters for the DICOM-ization ##
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 ########################################
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 PATH = os.path.join(os.getenv('HOME'), 'Downloads', 'Spy 11B.jpg')
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 URL = 'http://localhost:8042/'
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 USERNAME = 'orthanc'
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 PASSWORD = 'orthanc'
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 TAGS = {
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 'ConversionType' : 'SI', # Scanned Image
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 'InstanceNumber' : '1',
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 'Laterality' : '',
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 'Modality' : 'OT',
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 'PatientOrientation' : '',
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 'SOPClassUID' : '1.2.840.10008.5.1.4.1.1.7', # Secondary Capture Image Storage
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 'SeriesNumber' : '1',
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 }
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 if True:
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 # Case 1: Attach the new DICOM image as a new series in an
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 # existing study. In this case, "PARENT_STUDY" indicates the
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 # Orthanc identifier of the parent study:
5432
59e3b6f8c5be migration to UCLouvain servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5240
diff changeset
66 # https://orthanc.uclouvain.be/book/faq/orthanc-ids.html
5240
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 PARENT_STUDY = '66c8e41e-ac3a9029-0b85e42a-8195ee0a-92c2e62e'
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 else:
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 # Case 2: Create a new study
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 PARENT_STUDY = None
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 STUDY_TAGS = {
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 'PatientID' : 'Test',
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 'PatientName' : 'Hello^World',
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 'PatientSex' : 'O',
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 'PatientBirthDate' : None,
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 'StudyID' : 'Test',
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 'ReferringPhysicianName' : None,
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 'AccessionNumber' : None,
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 }
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 TAGS.update(STUDY_TAGS)
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 ########################################
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 ## Application of the DICOM-ization ##
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 ########################################
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 if imghdr.what(PATH) == 'jpeg':
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 mime = 'image/jpeg'
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 elif imghdr.what(PATH) == 'png':
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 mime = 'image/png'
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 elif os.path.splitext(PATH) [1] == '.pdf':
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 mime = 'application/pdf'
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 else:
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 raise Exception('The input image is neither JPEG, nor PNG, nor PDF')
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 with open(PATH, 'rb') as f:
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 content = f.read()
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 data = 'data:%s;base64,%s' % (mime, base64.b64encode(content).decode('ascii'))
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 arguments = {
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 'Content': data,
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 'Tags': TAGS,
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 }
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 if PARENT_STUDY != None:
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 arguments['Parent'] = PARENT_STUDY
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 r = requests.post('%s/tools/create-dicom' % URL,
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 json.dumps(arguments),
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 auth = requests.auth.HTTPBasicAuth(USERNAME, PASSWORD))
c9e2c6d1cd62 added two Python samples: DicomizeImage.py and MicroCTDicomization.py
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 r.raise_for_status()