Mercurial > hg > orthanc-book
annotate Sphinx/source/users/anonymization.rst @ 247:325dd3901547
ohif
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sun, 19 May 2019 10:08:52 +0200 |
parents | 02399e86f046 |
children | 829ce317d215 |
rev | line source |
---|---|
0 | 1 .. highlight:: bash |
2 .. _anonymization: | |
3 | |
4 Anonymization and modification | |
5 ============================== | |
6 | |
7 .. contents:: | |
8 :depth: 2 | |
9 | |
10 Orthanc 0.5.0 introduces the anonymization of DICOM resources | |
11 (i.e. patients, studies, series or instances). This page summarizes | |
12 how to use this feature. | |
13 | |
14 | |
15 Anonymization of a Single Instance | |
16 ---------------------------------- | |
17 | |
18 Orthanc allows to anonymize a single DICOM instance and to download | |
19 the resulting anonymized DICOM file. Anonymization consists in erasing | |
20 all the tags that are specified in Table E.1-1 from PS 3.15 of the | |
111 | 21 DICOM standard 2008 or 2017c (default). Example:: |
0 | 22 |
23 $ curl http://localhost:8042/instances/6e67da51-d119d6ae-c5667437-87b9a8a5-0f07c49f/anonymize -X POST -d '{}' > Anonymized.dcm | |
24 | |
25 It is possible to control how anonymization is achieved by specifying | |
26 a JSON body:: | |
27 | |
112
6d357adfd892
updates for the new 1.3.0 API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
111
diff
changeset
|
28 $ curl http://localhost:8042/instances/6e67da51-d119d6ae-c5667437-87b9a8a5-0f07c49f/anonymize -X POST -d '{"Replace":{"PatientName":"Hello","0010-1001":"World"},"Keep":["StudyDescription", "SeriesDescription"],"KeepPrivateTags": true, "DicomVersion" : "2017c"}' > Anonymized.dcm |
0 | 29 |
30 Explanations: | |
31 | |
32 * New UUIDs are automatically generated for the study, the series and | |
33 the instance. | |
112
6d357adfd892
updates for the new 1.3.0 API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
111
diff
changeset
|
34 * The DICOM tags can be specified either by their name |
6d357adfd892
updates for the new 1.3.0 API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
111
diff
changeset
|
35 (``PatientName``) or by their hexadecimal identifier (in the example |
6d357adfd892
updates for the new 1.3.0 API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
111
diff
changeset
|
36 above, ``0010-1001`` corresponds to ``Other Patient Names``). |
0 | 37 * ``Replace`` is an associative array that associates a DICOM tag with its |
38 new string value. The value is dynamically cast to the proper DICOM | |
39 data type (an HTTP error will occur if the cast fails). Replacements | |
40 are applied after all the tags to anonymize have been removed. | |
41 * ``Keep`` specifies a list of tags that should be preserved from full | |
42 anonymization. | |
112
6d357adfd892
updates for the new 1.3.0 API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
111
diff
changeset
|
43 * If ``KeepPrivateTags`` is set to ``true`` in the JSON request, |
6d357adfd892
updates for the new 1.3.0 API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
111
diff
changeset
|
44 private tags (i.e. manufacturer-specific tags) are not removed by |
6d357adfd892
updates for the new 1.3.0 API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
111
diff
changeset
|
45 the anonymization process. The default behavior consists in removing |
6d357adfd892
updates for the new 1.3.0 API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
111
diff
changeset
|
46 the private tags, as such tags can contain patient-specific |
0 | 47 information. |
111 | 48 * ``DicomVersion`` specifies which version of the DICOM standard shall be used |
49 for anonymization. Allowed values are ``2008`` and ``2017c`` (default value | |
50 if the parameter is absent). This parameter has been introduced in Orthanc | |
51 1.3.0. In earlier version, the ``2008`` standard was used. | |
0 | 52 |
53 | |
54 Modification of a Single Instance | |
55 --------------------------------- | |
56 | |
57 Orthanc allows to modify a set of specified tags in a single DICOM | |
58 instance and to download the resulting anonymized DICOM | |
59 file. Example:: | |
60 | |
112
6d357adfd892
updates for the new 1.3.0 API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
111
diff
changeset
|
61 $ curl http://localhost:8042/instances/6e67da51-d119d6ae-c5667437-87b9a8a5-0f07c49f/modify -X POST -d '{"Replace":{"PatientName":"hello","PatientID":"world"},"Remove":["InstitutionName"],"RemovePrivateTags": true, "Force": true}' > Modified.dcm |
0 | 62 |
63 Remarks: | |
64 | |
65 * The ``Remove`` array specifies the list of the tags to remove. | |
66 * The ``Replace`` associative array specifies the substitions to be applied (cf. anonymization). | |
112
6d357adfd892
updates for the new 1.3.0 API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
111
diff
changeset
|
67 * If ``RemovePrivateTags`` is set to ``true``, the private tags |
6d357adfd892
updates for the new 1.3.0 API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
111
diff
changeset
|
68 (i.e. manufacturer-specific tags) are removed. |
6d357adfd892
updates for the new 1.3.0 API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
111
diff
changeset
|
69 * The ``Force`` option must be set to ``true``, in order to allow the |
6d357adfd892
updates for the new 1.3.0 API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
111
diff
changeset
|
70 modification of the ``PatientID``, as such a modification of the |
6d357adfd892
updates for the new 1.3.0 API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
111
diff
changeset
|
71 :ref:`DICOM identifiers <dicom-identifiers>` might lead to breaking |
113 | 72 the DICOM model of the real-world. In general, any explicit |
73 modification to one of the ``PatientID``, ``StudyInstanceUID``, | |
74 ``SeriesInstanceUID``, and ``SOPInstanceUID`` requires ``Force`` to | |
75 be set to ``true``, in order to prevent any unwanted side effect. | |
0 | 76 |
77 | |
78 Modification of Studies or Series | |
79 --------------------------------- | |
80 | |
81 .. highlight:: bash | |
82 | |
83 It is possible to modify all the instances from a study or from a | |
84 series in a single request. In this case, the modified instances are | |
85 stored back into the Orthanc store. Here is how to modify a series:: | |
86 | |
87 $ curl http://localhost:8042/series/95a6e2bf-9296e2cc-bf614e2f-22b391ee-16e010e0/modify -X POST -d '{"Replace":{"InstitutionName":"My own clinic"}}' | |
88 | |
89 | |
90 .. highlight:: json | |
91 | |
92 The parameters are identical to those used to modify a single | |
93 instance. Orthanc will answer a JSON message that tells where the | |
94 modified series has been stored:: | |
95 | |
96 { | |
97 "ID" : "3bd3d343-82879d86-da77321c-1d23fd6b-faa07bce", | |
98 "Path" : "/series/3bd3d343-82879d86-da77321c-1d23fd6b-faa07bce" | |
99 } | |
100 | |
101 | |
102 .. highlight:: bash | |
103 | |
104 Similarly, here is an interaction to modify a study:: | |
105 | |
106 $ curl http://localhost:8042/studies/ef2ce55f-9342856a-aee23907-2667e859-9f3b734d/modify -X POST -d '{"Replace":{"InstitutionName":"My own clinic"}}' | |
107 | |
108 .. highlight:: json | |
109 | |
110 :: | |
111 | |
112 { | |
113 "ID" : "1c3f7bf4-85b4aa20-236e6315-5d450dcc-3c1bcf28", | |
114 "Path" : "/studies/1c3f7bf4-85b4aa20-236e6315-5d450dcc-3c1bcf28" | |
115 } | |
116 | |
117 | |
118 Modification of Patients | |
119 ------------------------ | |
120 | |
121 .. highlight:: bash | |
122 | |
123 Starting with Orthanc 0.7.5, Orthanc can also modify all the instances | |
124 of a patient with a single REST call. Here is a sample:: | |
125 | |
112
6d357adfd892
updates for the new 1.3.0 API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
111
diff
changeset
|
126 $ curl http://localhost:8042/patients/6fb47ef5-072f4557-3215aa29-f99515c1-6fa22bf0/modify -X POST -d '{"Replace":{"PatientID":"Hello","PatientName":"Sample patient name"},"Force":true}' |
0 | 127 |
128 .. highlight:: json | |
129 | |
130 :: | |
131 | |
132 { | |
133 "ID" : "f7ff9e8b-7bb2e09b-70935a5d-785e0cc5-d9d0abf0", | |
134 "Path" : "/patients/f7ff9e8b-7bb2e09b-70935a5d-785e0cc5-d9d0abf0", | |
135 "PatientID" : "f7ff9e8b-7bb2e09b-70935a5d-785e0cc5-d9d0abf0", | |
136 "Type" : "Patient" | |
137 } | |
138 | |
139 Please note that, in this case, you have to set the value of the | |
140 ``PatientID (0010,0020)`` tag for Orthanc to accept this modification: | |
141 This is a security to prevent the merging of patient data before and | |
142 after anonymization, if the user does not explicitly tell Orthanc to | |
143 do so. | |
144 | |
145 | |
146 Anonymization of Patients, Studies or Series | |
147 -------------------------------------------- | |
148 | |
149 .. highlight:: bash | |
150 | |
151 Study and series can be anonymized the same way as they are modified:: | |
152 | |
153 $ curl http://localhost:8042/patients/6fb47ef5-072f4557-3215aa29-f99515c1-6fa22bf0/anonymize -X POST -d '{}' | |
154 $ curl http://localhost:8042/studies/ef2ce55f-9342856a-aee23907-2667e859-9f3b734d/anonymize -X POST -d '{}' | |
155 $ curl http://localhost:8042/series/95a6e2bf-9296e2cc-bf614e2f-22b391ee-16e010e0/anonymize -X POST -d '{}' | |
156 | |
157 As written above, the anonymization process can be fine-tuned by using | |
158 a JSON body. | |
167 | 159 |
160 | |
224
02399e86f046
starting documentation of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
178
diff
changeset
|
161 .. _split-merge: |
02399e86f046
starting documentation of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
178
diff
changeset
|
162 |
167 | 163 Split/merge of DICOM studies |
164 ---------------------------- | |
165 | |
178 | 166 Starting with Orthanc 1.5.0, Orthanc supports splitting and merging |
167 | 167 DICOM studies through its REST API. |
168 | |
224
02399e86f046
starting documentation of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
178
diff
changeset
|
169 .. _split: |
02399e86f046
starting documentation of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
178
diff
changeset
|
170 |
167 | 171 Splitting |
172 ^^^^^^^^^ | |
173 | |
174 Here is the syntax to **split** a DICOM study:: | |
175 | |
176 $ curl http://localhost:8042/studies/6e2c0ec2-5d99c8ca-c1c21cee-79a09605-68391d12/split -d \ | |
177 '{"Series":["6ca4c9f3-5e895cb3-4d82c6da-09e060fe-9c59f228"],"Replace":{"PatientName":"HELLO"},"Remove":["AccessionNumber"]}' | |
178 | |
179 By issuing this command, the series whose :ref:`Orthanc identifier | |
180 <dicom-identifiers>` is | |
181 ``6ca4c9f3-5e895cb3-4d82c6da-09e060fe-9c59f228``, and that is part of | |
182 the source study with identifier | |
183 ``6e2c0ec2-5d99c8ca-c1c21cee-79a09605-68391d12``, will be removed from | |
184 the source study, and will be moved to a brand new study. | |
185 | |
186 This is done by generating a new value for all the following DICOM | |
187 tags in the DICOM instances of the series of interest: | |
188 ``StudyInstanceUID (0x0020, 0x000d)``, ``SeriesInstanceUID (0x0020, | |
189 0x000e)``, and ``SOPInstanceUID (0x0008, 0x0018)``. Here are the | |
190 arguments of this ``/studies/{study}/split`` URI: | |
191 | |
192 * ``Series`` gives the list of series to be separated from the parent | |
193 study (mandatory option). These series must all be children of the | |
194 same source study, that is specified in the URI. | |
195 * ``Replace`` allows to overwrite the DICOM tags that are part of the | |
196 "Patient Module Attributes" and the "General Study Module | |
197 Attributes", as specified by the DICOM 2011 standard in Tables C.7-1 | |
198 and C.7-3. | |
199 * ``Remove`` allows to remove DICOM tags from the same modules as in | |
200 the ``Replace`` options. | |
201 * ``KeepSource`` (Boolean value), if set to ``true``, instructs | |
202 Orthanc to keep a copy of the original series in the source study. | |
203 By default, the original series are deleted from Orthanc. | |
204 | |
224
02399e86f046
starting documentation of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
178
diff
changeset
|
205 .. _merge: |
167 | 206 |
207 Merging | |
208 ^^^^^^^ | |
209 | |
210 Here is the syntax to **merge** DICOM series, into another DICOM study:: | |
211 | |
212 $ curl http://localhost:8042/studies/6e2c0ec2-5d99c8ca-c1c21cee-79a09605-68391d12/merge -d \ | |
213 '{"Resources":["ef2ce55f-9342856a-aee23907-2667e859-9f3b734d"]}' | |
214 | |
215 By issuing this command, the DICOM series whose :ref:`Orthanc | |
216 identifier <dicom-identifiers>` is | |
217 ``ef2ce55f-9342856a-aee23907-2667e859-9f3b734d``, will be merged into | |
218 target study with identifier | |
219 ``6e2c0ec2-5d99c8ca-c1c21cee-79a09605-68391d12``. | |
220 | |
221 As in the case of splitting, this is done by updating the following | |
222 DICOM tags: ``StudyInstanceUID (0x0020, 0x000d)``, ``SeriesInstanceUID | |
223 (0x0020, 0x000e)``, and ``SOPInstanceUID (0x0008, | |
224 0x0018)``. Furthermore, all the DICOM tags that are part of the | |
225 "Patient Module Attributes" and the "General Study Module Attributes" | |
226 (as specified by the DICOM 2011 standard in Tables C.7-1 and C.7-3), | |
227 are modified to match the target study. Here are the | |
228 arguments of this ``/studies/{study}/merge`` URI: | |
229 | |
230 * ``Resources`` gives the list of source studies or source series | |
231 that are to be merged into the target study. | |
232 * ``KeepSource`` (Boolean value), if set to ``true``, instructs | |
233 Orthanc to keep the source studies and series. By default, the | |
234 original resources are deleted from Orthanc. |