annotate Sphinx/source/users/anonymization.rst @ 1112:ad26102adccc default tip

fix broken link
author Alain Mazy <am@orthanc.team>
date Wed, 23 Oct 2024 16:52:30 +0200
parents d2be251975d1
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 .. highlight:: bash
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 .. _anonymization:
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 Anonymization and modification
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 ==============================
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 .. contents::
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 :depth: 2
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 Orthanc 0.5.0 introduces the anonymization of DICOM resources
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 (i.e. patients, studies, series or instances). This page summarizes
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 how to use this feature.
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 Anonymization of a Single Instance
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 ----------------------------------
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 Orthanc allows to anonymize a single DICOM instance and to download
716
33500fc0c0bb clarification about modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 712
diff changeset
19 the resulting anonymized DICOM file (without storing the anonymized
33500fc0c0bb clarification about modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 712
diff changeset
20 DICOM instance into Orthanc). Anonymization consists in erasing all
33500fc0c0bb clarification about modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 712
diff changeset
21 the tags that are specified in `Table E.1-1 from PS 3.15
691
b8a744941e58 DicomVersion 2021b for anonymization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 648
diff changeset
22 <http://dicom.nema.org/medical/dicom/current/output/chtml/part15/chapter_E.html#table_E.1-1>`__
995
5c8d2250b361 anon profile 2023b
Alain Mazy <am@osimis.io>
parents: 991
diff changeset
23 of the DICOM standard 2008, 2017c, 2021b, 2023b (default). Example::
0
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 $ curl http://localhost:8042/instances/6e67da51-d119d6ae-c5667437-87b9a8a5-0f07c49f/anonymize -X POST -d '{}' > Anonymized.dcm
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 It is possible to control how anonymization is achieved by specifying
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 a JSON body::
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29
444
06521ac2c14a transcode info
Alain Mazy <alain@mazy.be>
parents: 331
diff changeset
30 $ curl http://localhost:8042/instances/6e67da51-d119d6ae-c5667437-87b9a8a5-0f07c49f/anonymize -X POST \
06521ac2c14a transcode info
Alain Mazy <alain@mazy.be>
parents: 331
diff changeset
31 --data '{
06521ac2c14a transcode info
Alain Mazy <alain@mazy.be>
parents: 331
diff changeset
32 "Replace": {
06521ac2c14a transcode info
Alain Mazy <alain@mazy.be>
parents: 331
diff changeset
33 "PatientName": "Hello",
06521ac2c14a transcode info
Alain Mazy <alain@mazy.be>
parents: 331
diff changeset
34 "0010-1001": "World"
06521ac2c14a transcode info
Alain Mazy <alain@mazy.be>
parents: 331
diff changeset
35 },
06521ac2c14a transcode info
Alain Mazy <alain@mazy.be>
parents: 331
diff changeset
36 "Keep": [
06521ac2c14a transcode info
Alain Mazy <alain@mazy.be>
parents: 331
diff changeset
37 "StudyDescription",
06521ac2c14a transcode info
Alain Mazy <alain@mazy.be>
parents: 331
diff changeset
38 "SeriesDescription"
06521ac2c14a transcode info
Alain Mazy <alain@mazy.be>
parents: 331
diff changeset
39 ],
06521ac2c14a transcode info
Alain Mazy <alain@mazy.be>
parents: 331
diff changeset
40 "KeepPrivateTags": true,
06521ac2c14a transcode info
Alain Mazy <alain@mazy.be>
parents: 331
diff changeset
41 "DicomVersion" : "2017c"
06521ac2c14a transcode info
Alain Mazy <alain@mazy.be>
parents: 331
diff changeset
42 }' > Anonymized.dcm
0
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43
694
bcd1a6a89280 replace, keep and remove accept sequences in Orthanc 1.9.4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 692
diff changeset
44 **Explanations:**
0
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 * New UUIDs are automatically generated for the study, the series and
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 the instance.
112
6d357adfd892 updates for the new 1.3.0 API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 111
diff changeset
48 * 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
49 (``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
50 above, ``0010-1001`` corresponds to ``Other Patient Names``).
0
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 * ``Replace`` is an associative array that associates a DICOM tag with its
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 new string value. The value is dynamically cast to the proper DICOM
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 data type (an HTTP error will occur if the cast fails). Replacements
291
829ce317d215 added sample for /modify for sequences and binary fields
Alain Mazy <alain@mazy.be>
parents: 224
diff changeset
54 are applied after all the tags to anonymize have been removed.
829ce317d215 added sample for /modify for sequences and binary fields
Alain Mazy <alain@mazy.be>
parents: 224
diff changeset
55 You may also use the ``Replace`` field to add new tags to the file.
0
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 * ``Keep`` specifies a list of tags that should be preserved from full
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 anonymization.
112
6d357adfd892 updates for the new 1.3.0 API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 111
diff changeset
58 * 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
59 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
60 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
61 the private tags, as such tags can contain patient-specific
0
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 information.
691
b8a744941e58 DicomVersion 2021b for anonymization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 648
diff changeset
63 * ``DicomVersion`` specifies which version of the DICOM standard shall
995
5c8d2250b361 anon profile 2023b
Alain Mazy <am@osimis.io>
parents: 991
diff changeset
64 be used for anonymization. Allowed values are ``2008``, ``2017c``,
5c8d2250b361 anon profile 2023b
Alain Mazy <am@osimis.io>
parents: 991
diff changeset
65 ``2021b`` (new in Orthanc 1.9.4) or ``2023b`` (new in Orthanc 1.12.1).
5c8d2250b361 anon profile 2023b
Alain Mazy <am@osimis.io>
parents: 991
diff changeset
66 This parameter has been introduced in Orthanc 1.3.0. In earlier version,
5c8d2250b361 anon profile 2023b
Alain Mazy <am@osimis.io>
parents: 991
diff changeset
67 the ``2008`` standard was used. If the parameter is absent, the highest
5c8d2250b361 anon profile 2023b
Alain Mazy <am@osimis.io>
parents: 991
diff changeset
68 version that is supported by Orthanc is used.
694
bcd1a6a89280 replace, keep and remove accept sequences in Orthanc 1.9.4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 692
diff changeset
69 * ``Remove`` can also be used to provide a list of tags to be manually
bcd1a6a89280 replace, keep and remove accept sequences in Orthanc 1.9.4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 692
diff changeset
70 deleted.
691
b8a744941e58 DicomVersion 2021b for anonymization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 648
diff changeset
71
694
bcd1a6a89280 replace, keep and remove accept sequences in Orthanc 1.9.4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 692
diff changeset
72 **Important:** Starting with Orthanc 1.9.4, the ``Replace``, ``Keep``
bcd1a6a89280 replace, keep and remove accept sequences in Orthanc 1.9.4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 692
diff changeset
73 and ``Remove`` fields can also specify sequences, using the same
bcd1a6a89280 replace, keep and remove accept sequences in Orthanc 1.9.4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 692
diff changeset
74 syntax as the ``dcmodify`` command-line tool (wildcards are supported
bcd1a6a89280 replace, keep and remove accept sequences in Orthanc 1.9.4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 692
diff changeset
75 as well). Earlier versions were limited to top-level tags in the DICOM
bcd1a6a89280 replace, keep and remove accept sequences in Orthanc 1.9.4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 692
diff changeset
76 dataset. Check out the integration test ``test_modify_subsequences``
bcd1a6a89280 replace, keep and remove accept sequences in Orthanc 1.9.4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 692
diff changeset
77 for `examples
991
1316bc62b5d5 migration to UCLouvain servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
78 <https://orthanc.uclouvain.be/hg/orthanc-tests/file/default/Tests/Tests.py>`__.
691
b8a744941e58 DicomVersion 2021b for anonymization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 648
diff changeset
79
b8a744941e58 DicomVersion 2021b for anonymization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 648
diff changeset
80 **Implementation:** Internally, the setup of the anonymization
b8a744941e58 DicomVersion 2021b for anonymization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 648
diff changeset
81 profiles can be found in the methods ``SetupAnonymizationXXX()`` of
b8a744941e58 DicomVersion 2021b for anonymization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 648
diff changeset
82 the class ``Orthanc::DicomModification`` (cf. `source code
1075
d2be251975d1 Orthanc 1.12.4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1065
diff changeset
83 <https://orthanc.uclouvain.be/hg/orthanc/file/Orthanc-1.12.4/OrthancFramework/Sources/DicomParsing/DicomModification.cpp>`__).
0
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 Modification of a Single Instance
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 ---------------------------------
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 Orthanc allows to modify a set of specified tags in a single DICOM
716
33500fc0c0bb clarification about modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 712
diff changeset
90 instance and to download the resulting modified DICOM file (without
33500fc0c0bb clarification about modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 712
diff changeset
91 storing the modified DICOM instance into Orthanc). Example::
0
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92
444
06521ac2c14a transcode info
Alain Mazy <alain@mazy.be>
parents: 331
diff changeset
93 $ curl -X POST http://localhost:8042/instances/6e67da51-d119d6ae-c5667437-87b9a8a5-0f07c49f/modify \
06521ac2c14a transcode info
Alain Mazy <alain@mazy.be>
parents: 331
diff changeset
94 --data '{
06521ac2c14a transcode info
Alain Mazy <alain@mazy.be>
parents: 331
diff changeset
95 "Replace": {
06521ac2c14a transcode info
Alain Mazy <alain@mazy.be>
parents: 331
diff changeset
96 "PatientName":"hello",
06521ac2c14a transcode info
Alain Mazy <alain@mazy.be>
parents: 331
diff changeset
97 "PatientID":"world"
06521ac2c14a transcode info
Alain Mazy <alain@mazy.be>
parents: 331
diff changeset
98 },
06521ac2c14a transcode info
Alain Mazy <alain@mazy.be>
parents: 331
diff changeset
99 "Remove":[
06521ac2c14a transcode info
Alain Mazy <alain@mazy.be>
parents: 331
diff changeset
100 "InstitutionName"
06521ac2c14a transcode info
Alain Mazy <alain@mazy.be>
parents: 331
diff changeset
101 ],
06521ac2c14a transcode info
Alain Mazy <alain@mazy.be>
parents: 331
diff changeset
102 "RemovePrivateTags": true,
06521ac2c14a transcode info
Alain Mazy <alain@mazy.be>
parents: 331
diff changeset
103 "Force": true,
06521ac2c14a transcode info
Alain Mazy <alain@mazy.be>
parents: 331
diff changeset
104 "Transcode": "1.2.840.10008.1.2.4.70"
06521ac2c14a transcode info
Alain Mazy <alain@mazy.be>
parents: 331
diff changeset
105 }' > Modified.dcm
0
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106
694
bcd1a6a89280 replace, keep and remove accept sequences in Orthanc 1.9.4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 692
diff changeset
107 **Remarks:**
0
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 * The ``Remove`` array specifies the list of the tags to remove.
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 * 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
111 * 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
112 (i.e. manufacturer-specific tags) are removed.
444
06521ac2c14a transcode info
Alain Mazy <alain@mazy.be>
parents: 331
diff changeset
113 * The ``Transcode`` option allows you to define the TransferSyntax
06521ac2c14a transcode info
Alain Mazy <alain@mazy.be>
parents: 331
diff changeset
114 of the modified file.
112
6d357adfd892 updates for the new 1.3.0 API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 111
diff changeset
115 * 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
116 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
117 :ref:`DICOM identifiers <dicom-identifiers>` might lead to breaking
113
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 112
diff changeset
118 the DICOM model of the real-world. In general, any explicit
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 112
diff changeset
119 modification to one of the ``PatientID``, ``StudyInstanceUID``,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 112
diff changeset
120 ``SeriesInstanceUID``, and ``SOPInstanceUID`` requires ``Force`` to
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 112
diff changeset
121 be set to ``true``, in order to prevent any unwanted side effect.
694
bcd1a6a89280 replace, keep and remove accept sequences in Orthanc 1.9.4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 692
diff changeset
122
291
829ce317d215 added sample for /modify for sequences and binary fields
Alain Mazy <alain@mazy.be>
parents: 224
diff changeset
123 .. highlight:: json
0
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124
291
829ce317d215 added sample for /modify for sequences and binary fields
Alain Mazy <alain@mazy.be>
parents: 224
diff changeset
125 * To replace a sequence of tags, you may use this syntax::
829ce317d215 added sample for /modify for sequences and binary fields
Alain Mazy <alain@mazy.be>
parents: 224
diff changeset
126
829ce317d215 added sample for /modify for sequences and binary fields
Alain Mazy <alain@mazy.be>
parents: 224
diff changeset
127
829ce317d215 added sample for /modify for sequences and binary fields
Alain Mazy <alain@mazy.be>
parents: 224
diff changeset
128 {
829ce317d215 added sample for /modify for sequences and binary fields
Alain Mazy <alain@mazy.be>
parents: 224
diff changeset
129 "Replace" : {
829ce317d215 added sample for /modify for sequences and binary fields
Alain Mazy <alain@mazy.be>
parents: 224
diff changeset
130 "ProcedureCodeSequence" : [
829ce317d215 added sample for /modify for sequences and binary fields
Alain Mazy <alain@mazy.be>
parents: 224
diff changeset
131 {
829ce317d215 added sample for /modify for sequences and binary fields
Alain Mazy <alain@mazy.be>
parents: 224
diff changeset
132 "CodeValue" : "2",
829ce317d215 added sample for /modify for sequences and binary fields
Alain Mazy <alain@mazy.be>
parents: 224
diff changeset
133 "CodingSchemeDesignator" : "1",
829ce317d215 added sample for /modify for sequences and binary fields
Alain Mazy <alain@mazy.be>
parents: 224
diff changeset
134 "CodeMeaning": "1"
829ce317d215 added sample for /modify for sequences and binary fields
Alain Mazy <alain@mazy.be>
parents: 224
diff changeset
135 }
829ce317d215 added sample for /modify for sequences and binary fields
Alain Mazy <alain@mazy.be>
parents: 224
diff changeset
136 ]
829ce317d215 added sample for /modify for sequences and binary fields
Alain Mazy <alain@mazy.be>
parents: 224
diff changeset
137 }
829ce317d215 added sample for /modify for sequences and binary fields
Alain Mazy <alain@mazy.be>
parents: 224
diff changeset
138 }
829ce317d215 added sample for /modify for sequences and binary fields
Alain Mazy <alain@mazy.be>
parents: 224
diff changeset
139
829ce317d215 added sample for /modify for sequences and binary fields
Alain Mazy <alain@mazy.be>
parents: 224
diff changeset
140 * To replace a binary tag, you should encode it in base64 and use::
829ce317d215 added sample for /modify for sequences and binary fields
Alain Mazy <alain@mazy.be>
parents: 224
diff changeset
141
829ce317d215 added sample for /modify for sequences and binary fields
Alain Mazy <alain@mazy.be>
parents: 224
diff changeset
142 {
829ce317d215 added sample for /modify for sequences and binary fields
Alain Mazy <alain@mazy.be>
parents: 224
diff changeset
143 "Replace" : {
829ce317d215 added sample for /modify for sequences and binary fields
Alain Mazy <alain@mazy.be>
parents: 224
diff changeset
144 "EncryptedAttributesSequence" : [
829ce317d215 added sample for /modify for sequences and binary fields
Alain Mazy <alain@mazy.be>
parents: 224
diff changeset
145 {
829ce317d215 added sample for /modify for sequences and binary fields
Alain Mazy <alain@mazy.be>
parents: 224
diff changeset
146 "EncryptedContentTransferSyntaxUID" : "1.2.840.10008.1.2",
829ce317d215 added sample for /modify for sequences and binary fields
Alain Mazy <alain@mazy.be>
parents: 224
diff changeset
147 "EncryptedContent" : "data:application/octet-stream;base64,SSB3YXMgaGVyZSBpbiAyMDE5LiAgTWFydHkgTWNGbHku"
829ce317d215 added sample for /modify for sequences and binary fields
Alain Mazy <alain@mazy.be>
parents: 224
diff changeset
148 }
829ce317d215 added sample for /modify for sequences and binary fields
Alain Mazy <alain@mazy.be>
parents: 224
diff changeset
149 ]
829ce317d215 added sample for /modify for sequences and binary fields
Alain Mazy <alain@mazy.be>
parents: 224
diff changeset
150 }
829ce317d215 added sample for /modify for sequences and binary fields
Alain Mazy <alain@mazy.be>
parents: 224
diff changeset
151 }
300
22d567933381 tutorials about plugins by Marco Barnig
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 291
diff changeset
152
1065
24a7480e6ec0 private tags
Alain Mazy <am@orthanc.team>
parents: 1021
diff changeset
153 * To add a Private DICOM tag, you should use this syntax (provided that you have defined 2 entries ``7001,0010": ["LO", "PrivateCreatorForMy", 1, 1, "MyPrivateCreator"], "7001,1001" : [ "CS", "MyPrivateTag", 1, 1, "MyPrivateCreator"]`` in the ``Dictionary`` configuration)::
853
2d9024137da0 add private tag sample
Alain Mazy <am@osimis.io>
parents: 839
diff changeset
154
2d9024137da0 add private tag sample
Alain Mazy <am@osimis.io>
parents: 839
diff changeset
155 {
2d9024137da0 add private tag sample
Alain Mazy <am@osimis.io>
parents: 839
diff changeset
156 "Replace" : {
2d9024137da0 add private tag sample
Alain Mazy <am@osimis.io>
parents: 839
diff changeset
157 "MyPrivateTag" : "Hello"
2d9024137da0 add private tag sample
Alain Mazy <am@osimis.io>
parents: 839
diff changeset
158 },
2d9024137da0 add private tag sample
Alain Mazy <am@osimis.io>
parents: 839
diff changeset
159 "PrivateCreator" : "MyPrivateCreator"
2d9024137da0 add private tag sample
Alain Mazy <am@osimis.io>
parents: 839
diff changeset
160 }
2d9024137da0 add private tag sample
Alain Mazy <am@osimis.io>
parents: 839
diff changeset
161
694
bcd1a6a89280 replace, keep and remove accept sequences in Orthanc 1.9.4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 692
diff changeset
162
bcd1a6a89280 replace, keep and remove accept sequences in Orthanc 1.9.4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 692
diff changeset
163 **Important:** Similarly to anonymization, starting with Orthanc
bcd1a6a89280 replace, keep and remove accept sequences in Orthanc 1.9.4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 692
diff changeset
164 1.9.4, the ``Replace``, ``Keep`` and ``Remove`` fields can also
bcd1a6a89280 replace, keep and remove accept sequences in Orthanc 1.9.4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 692
diff changeset
165 specify sequences, using the same syntax as the ``dcmodify``
bcd1a6a89280 replace, keep and remove accept sequences in Orthanc 1.9.4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 692
diff changeset
166 command-line tool (wildcards are supported as well). Earlier versions
bcd1a6a89280 replace, keep and remove accept sequences in Orthanc 1.9.4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 692
diff changeset
167 were limited to top-level tags in the DICOM dataset. Check out the
bcd1a6a89280 replace, keep and remove accept sequences in Orthanc 1.9.4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 692
diff changeset
168 integration test ``test_modify_subsequences`` for `examples
991
1316bc62b5d5 migration to UCLouvain servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
169 <https://orthanc.uclouvain.be/hg/orthanc-tests/file/default/Tests/Tests.py>`__.
694
bcd1a6a89280 replace, keep and remove accept sequences in Orthanc 1.9.4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 692
diff changeset
170
bcd1a6a89280 replace, keep and remove accept sequences in Orthanc 1.9.4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 692
diff changeset
171
331
48673b8abae3 documentation of storage commitment scu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 300
diff changeset
172 .. _study-modification:
48673b8abae3 documentation of storage commitment scu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 300
diff changeset
173
0
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174 Modification of Studies or Series
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175 ---------------------------------
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177 .. highlight:: bash
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179 It is possible to modify all the instances from a study or from a
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180 series in a single request. In this case, the modified instances are
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
181 stored back into the Orthanc store. Here is how to modify a series::
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183 $ curl http://localhost:8042/series/95a6e2bf-9296e2cc-bf614e2f-22b391ee-16e010e0/modify -X POST -d '{"Replace":{"InstitutionName":"My own clinic"}}'
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
186 .. highlight:: json
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
187
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
188 The parameters are identical to those used to modify a single
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
189 instance. Orthanc will answer a JSON message that tells where the
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
190 modified series has been stored::
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
191
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
192 {
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
193 "ID" : "3bd3d343-82879d86-da77321c-1d23fd6b-faa07bce",
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
194 "Path" : "/series/3bd3d343-82879d86-da77321c-1d23fd6b-faa07bce"
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
195 }
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
196
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
197
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
198 .. highlight:: bash
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
199
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
200 Similarly, here is an interaction to modify a study::
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
201
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
202 $ curl http://localhost:8042/studies/ef2ce55f-9342856a-aee23907-2667e859-9f3b734d/modify -X POST -d '{"Replace":{"InstitutionName":"My own clinic"}}'
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
203
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
204 .. highlight:: json
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
205
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
206 ::
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
207
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
208 {
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
209 "ID" : "1c3f7bf4-85b4aa20-236e6315-5d450dcc-3c1bcf28",
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
210 "Path" : "/studies/1c3f7bf4-85b4aa20-236e6315-5d450dcc-3c1bcf28"
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
211 }
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
212
877
900033cffeb2 loosened sanity checks for modifications
Alain Mazy <am@osimis.io>
parents: 872
diff changeset
213 Up to version 1.11.2, Orthanc implemented safety checks to
716
33500fc0c0bb clarification about modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 712
diff changeset
214 preserve the :ref:`DICOM model of the real world <model-world>`. These
877
900033cffeb2 loosened sanity checks for modifications
Alain Mazy <am@osimis.io>
parents: 872
diff changeset
215 checks prevented the modification of some tags that are known to belong
716
33500fc0c0bb clarification about modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 712
diff changeset
216 to a level in the patient/study/series/instance hierarchy that is
33500fc0c0bb clarification about modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 712
diff changeset
217 higher than the level that corresponds to the REST API call. For
877
900033cffeb2 loosened sanity checks for modifications
Alain Mazy <am@osimis.io>
parents: 872
diff changeset
218 instance, the tag ``PatientID`` could not be modified if using the
716
33500fc0c0bb clarification about modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 712
diff changeset
219 ``/studies/{id}/modify`` route (in the latter case, the
877
900033cffeb2 loosened sanity checks for modifications
Alain Mazy <am@osimis.io>
parents: 872
diff changeset
220 ``/patients/{id}/modify`` route had to be used, cf. next section).
914
6474e299918b Orthanc 1.11.3
Alain Mazy <am@osimis.io>
parents: 877
diff changeset
221 These sanity checks have been loosened in more recent versions (starting from 1.11.3)
6474e299918b Orthanc 1.11.3
Alain Mazy <am@osimis.io>
parents: 877
diff changeset
222 and users must be very careful to preserve the DICOM model when updating these tags (e.g.
877
900033cffeb2 loosened sanity checks for modifications
Alain Mazy <am@osimis.io>
parents: 872
diff changeset
223 if you modify the ``PatientID`` at study level, also make sure to modify all other Patient related
900033cffeb2 loosened sanity checks for modifications
Alain Mazy <am@osimis.io>
parents: 872
diff changeset
224 tags (``PatientName``, ``PatientBirthDate``, ...)).
900033cffeb2 loosened sanity checks for modifications
Alain Mazy <am@osimis.io>
parents: 872
diff changeset
225
900033cffeb2 loosened sanity checks for modifications
Alain Mazy <am@osimis.io>
parents: 872
diff changeset
226 Also note that you have to set the ``Force`` argument to ``true`` if modifying one
716
33500fc0c0bb clarification about modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 712
diff changeset
227 of the :ref:`DICOM identifiers tags <orthanc-ids>`
33500fc0c0bb clarification about modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 712
diff changeset
228 (i.e. ``PatientID``, ``StudyInstanceUID``, ``SeriesInstanceUID`` and
33500fc0c0bb clarification about modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 712
diff changeset
229 ``SOPInstanceUID``).
33500fc0c0bb clarification about modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 712
diff changeset
230
0
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
231
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
232 Modification of Patients
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
233 ------------------------
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
234
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
235 .. highlight:: bash
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
236
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
237 Starting with Orthanc 0.7.5, Orthanc can also modify all the instances
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
238 of a patient with a single REST call. Here is a sample::
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
239
112
6d357adfd892 updates for the new 1.3.0 API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 111
diff changeset
240 $ curl http://localhost:8042/patients/6fb47ef5-072f4557-3215aa29-f99515c1-6fa22bf0/modify -X POST -d '{"Replace":{"PatientID":"Hello","PatientName":"Sample patient name"},"Force":true}'
0
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
241
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
242 .. highlight:: json
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
243
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
244 ::
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
245
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
246 {
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
247 "ID" : "f7ff9e8b-7bb2e09b-70935a5d-785e0cc5-d9d0abf0",
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
248 "Path" : "/patients/f7ff9e8b-7bb2e09b-70935a5d-785e0cc5-d9d0abf0",
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
249 "PatientID" : "f7ff9e8b-7bb2e09b-70935a5d-785e0cc5-d9d0abf0",
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
250 "Type" : "Patient"
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
251 }
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
252
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
253 Please note that, in this case, you have to set the value of the
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
254 ``PatientID (0010,0020)`` tag for Orthanc to accept this modification:
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
255 This is a security to prevent the merging of patient data before and
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
256 after anonymization, if the user does not explicitly tell Orthanc to
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
257 do so.
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
258
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
259
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
260 Anonymization of Patients, Studies or Series
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
261 --------------------------------------------
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
262
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
263 .. highlight:: bash
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
264
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
265 Study and series can be anonymized the same way as they are modified::
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
266
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
267 $ curl http://localhost:8042/patients/6fb47ef5-072f4557-3215aa29-f99515c1-6fa22bf0/anonymize -X POST -d '{}'
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
268 $ curl http://localhost:8042/studies/ef2ce55f-9342856a-aee23907-2667e859-9f3b734d/anonymize -X POST -d '{}'
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
269 $ curl http://localhost:8042/series/95a6e2bf-9296e2cc-bf614e2f-22b391ee-16e010e0/anonymize -X POST -d '{}'
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
270
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
271 As written above, the anonymization process can be fine-tuned by using
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
272 a JSON body.
167
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
273
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
274
711
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
275 .. _bulk-modification:
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
276
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
277 Bulk modification or anonymization
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
278 ----------------------------------
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
279
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
280 Starting with Orthanc 1.9.4, it is possible to use the new routes
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
281 ``/tools/bulk-modify`` and ``/tools/bulk-anonymize`` to respectively
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
282 modify or anonymize a set of multiple DICOM resources that are not
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
283 related (i.e. that don't share any parent DICOM resource). A typical
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
284 use case is to modify/anonymize a list of DICOM instances that don't
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
285 belong to the same parent patient/study/series.
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
286
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
287 .. highlight:: bash
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
288
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
289 These two routes accept the same arguments as described above, but
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
290 must also be provided with an additional argument ``Resources`` that
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
291 lists the :ref:`Orthanc identifiers <orthanc-ids>` of the resources of
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
292 interest (that may indifferently correspond to patients, studies,
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
293 series or instances). Here are two sample calls::
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
294
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
295 $ curl http://localhost:8042/tools/bulk-modify -d '{"Replace":{"SeriesDescription":"HELLO"},"Resources":["b6da0b16-a25ae9e7-1a80fc33-20df01a9-a6f7a1b0","d6634d97-24379e4a-1e68d3af-e6d0451f-e7bcd3d1"]}'
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
296 $ curl http://localhost:8042/tools/bulk-anonymize -d '{"Resources":["b6da0b16-a25ae9e7-1a80fc33-20df01a9-a6f7a1b0","d6634d97-24379e4a-1e68d3af-e6d0451f-e7bcd3d1"]}'
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
297
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
298 .. highlight:: json
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
299
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
300 The output of the modification/anonymization lists all the resources
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
301 that have been altered by the call (including their parents). Here is
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
302 the output of the second sample above::
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
303
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
304 {
712
6c4fcd1ad337 bulk deletion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 711
diff changeset
305 "Description" : "REST API",
6c4fcd1ad337 bulk deletion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 711
diff changeset
306 "FailedInstancesCount" : 0,
6c4fcd1ad337 bulk deletion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 711
diff changeset
307 "InstancesCount" : 2,
6c4fcd1ad337 bulk deletion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 711
diff changeset
308 "IsAnonymization" : true,
6c4fcd1ad337 bulk deletion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 711
diff changeset
309 "Resources" : [
711
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
310 {
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
311 "ID" : "04c04806-27b01a5a-08ea66cb-cb36c8b9-ebe62fe3",
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
312 "Path" : "/instances/04c04806-27b01a5a-08ea66cb-cb36c8b9-ebe62fe3",
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
313 "Type" : "Instance"
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
314 },
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
315 {
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
316 "ID" : "4e37fce9-6b33b8ba-7bb378e1-abc7e2c4-fca4ade3",
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
317 "Path" : "/instances/4e37fce9-6b33b8ba-7bb378e1-abc7e2c4-fca4ade3",
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
318 "Type" : "Instance"
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
319 },
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
320 {
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
321 "ID" : "6438ee62-b58a4788-517931b3-e10321eb-d1ab2613",
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
322 "Path" : "/series/6438ee62-b58a4788-517931b3-e10321eb-d1ab2613",
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
323 "Type" : "Series"
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
324 },
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
325 {
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
326 "ID" : "660494fd-1ddd661b-4358d996-ba600e5a-066d94cc",
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
327 "Path" : "/studies/660494fd-1ddd661b-4358d996-ba600e5a-066d94cc",
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
328 "Type" : "Study"
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
329 },
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
330 {
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
331 "ID" : "5faa0bf8-8a45520b-3a07e536-fc24f241-f59ae3e1",
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
332 "Path" : "/patients/5faa0bf8-8a45520b-3a07e536-fc24f241-f59ae3e1",
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
333 "Type" : "Patient"
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
334 }
712
6c4fcd1ad337 bulk deletion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 711
diff changeset
335 ]
6c4fcd1ad337 bulk deletion
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 711
diff changeset
336 }
711
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
337
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
338
4f658c25addd bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 694
diff changeset
339
224
02399e86f046 starting documentation of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 178
diff changeset
340 .. _split-merge:
02399e86f046 starting documentation of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 178
diff changeset
341
167
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
342 Split/merge of DICOM studies
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
343 ----------------------------
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
344
178
981e5a996b11 Orthanc 1.5.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 167
diff changeset
345 Starting with Orthanc 1.5.0, Orthanc supports splitting and merging
167
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
346 DICOM studies through its REST API.
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
347
224
02399e86f046 starting documentation of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 178
diff changeset
348 .. _split:
02399e86f046 starting documentation of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 178
diff changeset
349
167
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
350 Splitting
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
351 ^^^^^^^^^
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
352
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
353 Here is the syntax to **split** a DICOM study::
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
354
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
355 $ curl http://localhost:8042/studies/6e2c0ec2-5d99c8ca-c1c21cee-79a09605-68391d12/split -d \
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
356 '{"Series":["6ca4c9f3-5e895cb3-4d82c6da-09e060fe-9c59f228"],"Replace":{"PatientName":"HELLO"},"Remove":["AccessionNumber"]}'
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
357
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
358 By issuing this command, the series whose :ref:`Orthanc identifier
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
359 <dicom-identifiers>` is
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
360 ``6ca4c9f3-5e895cb3-4d82c6da-09e060fe-9c59f228``, and that is part of
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
361 the source study with identifier
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
362 ``6e2c0ec2-5d99c8ca-c1c21cee-79a09605-68391d12``, will be removed from
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
363 the source study, and will be moved to a brand new study.
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
364
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
365 This is done by generating a new value for all the following DICOM
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
366 tags in the DICOM instances of the series of interest:
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
367 ``StudyInstanceUID (0x0020, 0x000d)``, ``SeriesInstanceUID (0x0020,
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
368 0x000e)``, and ``SOPInstanceUID (0x0008, 0x0018)``. Here are the
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
369 arguments of this ``/studies/{study}/split`` URI:
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
370
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
371 * ``Series`` gives the list of series to be separated from the parent
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
372 study (mandatory option). These series must all be children of the
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
373 same source study, that is specified in the URI.
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
374 * ``Replace`` allows to overwrite the DICOM tags that are part of the
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
375 "Patient Module Attributes" and the "General Study Module
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
376 Attributes", as specified by the DICOM 2011 standard in Tables C.7-1
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
377 and C.7-3.
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
378 * ``Remove`` allows to remove DICOM tags from the same modules as in
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
379 the ``Replace`` options.
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
380 * ``KeepSource`` (Boolean value), if set to ``true``, instructs
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
381 Orthanc to keep a copy of the original series in the source study.
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
382 By default, the original series are deleted from Orthanc.
691
b8a744941e58 DicomVersion 2021b for anonymization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 648
diff changeset
383
224
02399e86f046 starting documentation of jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 178
diff changeset
384 .. _merge:
167
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
385
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
386 Merging
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
387 ^^^^^^^
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
388
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
389 Here is the syntax to **merge** DICOM series, into another DICOM study::
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
390
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
391 $ curl http://localhost:8042/studies/6e2c0ec2-5d99c8ca-c1c21cee-79a09605-68391d12/merge -d \
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
392 '{"Resources":["ef2ce55f-9342856a-aee23907-2667e859-9f3b734d"]}'
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
393
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
394 By issuing this command, the DICOM series whose :ref:`Orthanc
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
395 identifier <dicom-identifiers>` is
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
396 ``ef2ce55f-9342856a-aee23907-2667e859-9f3b734d``, will be merged into
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
397 target study with identifier
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
398 ``6e2c0ec2-5d99c8ca-c1c21cee-79a09605-68391d12``.
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
399
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
400 As in the case of splitting, this is done by updating the following
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
401 DICOM tags: ``StudyInstanceUID (0x0020, 0x000d)``, ``SeriesInstanceUID
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
402 (0x0020, 0x000e)``, and ``SOPInstanceUID (0x0008,
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
403 0x0018)``. Furthermore, all the DICOM tags that are part of the
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
404 "Patient Module Attributes" and the "General Study Module Attributes"
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
405 (as specified by the DICOM 2011 standard in Tables C.7-1 and C.7-3),
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
406 are modified to match the target study. Here are the
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
407 arguments of this ``/studies/{study}/merge`` URI:
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
408
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
409 * ``Resources`` gives the list of source studies or source series
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
410 that are to be merged into the target study.
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
411 * ``KeepSource`` (Boolean value), if set to ``true``, instructs
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
412 Orthanc to keep the source studies and series. By default, the
7ba16d90ed93 split/merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 113
diff changeset
413 original resources are deleted from Orthanc.
970
bc531449c024 altering the content of a single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 963
diff changeset
414
bc531449c024 altering the content of a single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 963
diff changeset
415
bc531449c024 altering the content of a single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 963
diff changeset
416 .. _altering-dicom:
bc531449c024 altering the content of a single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 963
diff changeset
417
bc531449c024 altering the content of a single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 963
diff changeset
418 Altering the content of a single instance
bc531449c024 altering the content of a single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 963
diff changeset
419 -----------------------------------------
bc531449c024 altering the content of a single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 963
diff changeset
420
bc531449c024 altering the content of a single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 963
diff changeset
421 People often want to add/remove specific DICOM tags in an existing
bc531449c024 altering the content of a single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 963
diff changeset
422 DICOM instance, i.e. to ask ``/instances/{id}/modify`` to keep the
bc531449c024 altering the content of a single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 963
diff changeset
423 existing ``SOPInstanceUID (0008,0018)``. This operation is **strongly
bc531449c024 altering the content of a single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 963
diff changeset
424 discouraged**, as it **breaks medical traceability** by dropping the
bc531449c024 altering the content of a single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 963
diff changeset
425 history of the modifications that were applied to a DICOM
bc531449c024 altering the content of a single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 963
diff changeset
426 instance. Furthermore, the altered DICOM instance may be ignored by
bc531449c024 altering the content of a single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 963
diff changeset
427 further DICOM software. Indeed, the DICOM standard expects two DICOM
bc531449c024 altering the content of a single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 963
diff changeset
428 instances with the same SOP Instance UID to contain exactly the same
bc531449c024 altering the content of a single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 963
diff changeset
429 set of DICOM tags. Consequently, a DICOM software could perfectly
bc531449c024 altering the content of a single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 963
diff changeset
430 decide to only consider the original version of the DICOM instance.
bc531449c024 altering the content of a single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 963
diff changeset
431
bc531449c024 altering the content of a single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 963
diff changeset
432 Consequently, **Orthanc implements safeguards** in its REST API to
bc531449c024 altering the content of a single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 963
diff changeset
433 avoid such dangerous situations to occur. That being said, **if you
bc531449c024 altering the content of a single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 963
diff changeset
434 understand the risks**, it is possible to bypass those safeguards. The
bc531449c024 altering the content of a single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 963
diff changeset
435 trick is to pass both the ``Keep`` and ``Force`` arguments to the
bc531449c024 altering the content of a single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 963
diff changeset
436 ``/instances/{id}/modify`` call. Here is a sample Python script that
bc531449c024 altering the content of a single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 963
diff changeset
437 implements this trick:
bc531449c024 altering the content of a single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 963
diff changeset
438
bc531449c024 altering the content of a single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 963
diff changeset
439 .. literalinclude:: anonymization_bypass.py
bc531449c024 altering the content of a single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 963
diff changeset
440 :language: python
bc531449c024 altering the content of a single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 963
diff changeset
441
bc531449c024 altering the content of a single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 963
diff changeset
442 This sample script downloads an altered version of a DICOM instance
bc531449c024 altering the content of a single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 963
diff changeset
443 from Orthanc (with the same ``SOPInstanceUID``), then uploads it again
bc531449c024 altering the content of a single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 963
diff changeset
444 to Orthanc. By default, Orthanc will ignore the upload of the altered
bc531449c024 altering the content of a single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 963
diff changeset
445 DICOM instance and will answer with the ``AlreadyStored`` message,
bc531449c024 altering the content of a single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 963
diff changeset
446 because ``SOPInstanceUID`` is already present in the Orthanc database.
bc531449c024 altering the content of a single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 963
diff changeset
447 To force the upload of the altered DICOM instance, one can either
bc531449c024 altering the content of a single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 963
diff changeset
448 (1) DELETE the instance before POST-ing it again, or (2) set the
bc531449c024 altering the content of a single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 963
diff changeset
449 ``OverwriteInstances`` :ref:`configuration option <configuration>` of
bc531449c024 altering the content of a single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 963
diff changeset
450 Orthanc to ``true``. Both strategies are implemented in the sample
bc531449c024 altering the content of a single instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 963
diff changeset
451 script.