Mercurial > hg > orthanc
annotate OrthancServer/Sources/ServerJobs/ResourceModificationJob.h @ 4732:3709565bee7f
fix openapi: /modalities/{id}/move not supporting jobs
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 28 Jun 2021 12:03:07 +0200 |
parents | 45bce660ce3a |
children | f0038043fb97 7053502fbf97 |
rev | line source |
---|---|
2642 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
4437
d9473bd5ed43
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4205
diff
changeset
|
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium |
2642 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU General Public License as | |
9 * published by the Free Software Foundation, either version 3 of the | |
10 * License, or (at your option) any later version. | |
11 * | |
12 * In addition, as a special exception, the copyright holders of this | |
13 * program give permission to link the code of its release with the | |
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it | |
15 * that use the same license as the "OpenSSL" library), and distribute | |
16 * the linked executables. You must obey the GNU General Public License | |
17 * in all respects for all of the code used other than "OpenSSL". If you | |
18 * modify file(s) with this exception, you may extend this exception to | |
19 * your version of the file(s), but you are not obligated to do so. If | |
20 * you do not wish to do so, delete this exception statement from your | |
21 * version. If you delete this exception statement from all source files | |
22 * in the program, then also delete it here. | |
23 * | |
24 * This program is distributed in the hope that it will be useful, but | |
25 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
27 * General Public License for more details. | |
28 * | |
29 * You should have received a copy of the GNU General Public License | |
30 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
31 **/ | |
32 | |
33 | |
34 #pragma once | |
35 | |
4045 | 36 #include "../../../OrthancFramework/Sources/DicomParsing/DicomModification.h" |
3095
beeeb6096f27
removing dependencies upon ServerContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
37 #include "../DicomInstanceOrigin.h" |
3942
5b882ad2ffd0
"/{patients|studies|series}/.../modify": New option "KeepSource"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
38 #include "CleaningInstancesJob.h" |
2642 | 39 |
40 namespace Orthanc | |
41 { | |
3095
beeeb6096f27
removing dependencies upon ServerContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
42 class ServerContext; |
beeeb6096f27
removing dependencies upon ServerContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
43 |
3942
5b882ad2ffd0
"/{patients|studies|series}/.../modify": New option "KeepSource"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
44 class ResourceModificationJob : public CleaningInstancesJob |
2642 | 45 { |
2868
abce036683cd
sharing code within OrthancRestAnonymizeModify
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2860
diff
changeset
|
46 private: |
4693
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
47 class IOutput : public boost::noncopyable |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
48 { |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
49 public: |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
50 virtual ~IOutput() |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
51 { |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
52 } |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
53 |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
54 virtual void Update(DicomInstanceHasher& hasher) = 0; |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
55 |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
56 virtual void Format(Json::Value& target) const = 0; |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
57 |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
58 virtual bool IsSingleResource() const = 0; |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
59 }; |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
60 |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
61 class SingleOutput; |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
62 class MultipleOutputs; |
2642 | 63 |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
64 std::unique_ptr<DicomModification> modification_; |
4693
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
65 boost::shared_ptr<IOutput> output_; |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
66 bool isAnonymization_; |
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
67 DicomInstanceOrigin origin_; |
3943
b26d25d3c1c7
"/{patients|studies|series}/.../modify": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3942
diff
changeset
|
68 bool transcode_; |
b26d25d3c1c7
"/{patients|studies|series}/.../modify": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3942
diff
changeset
|
69 DicomTransferSyntax transferSyntax_; |
2642 | 70 |
71 protected: | |
4205 | 72 virtual bool HandleInstance(const std::string& instance) ORTHANC_OVERRIDE; |
2642 | 73 |
74 public: | |
4204 | 75 explicit ResourceModificationJob(ServerContext& context); |
2642 | 76 |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
77 ResourceModificationJob(ServerContext& context, |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
78 const Json::Value& serialized); |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
79 |
4693
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
80 // NB: The "outputLevel" only controls the output format, and |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
81 // might *not* be the same as "modification->GetLevel()" |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
82 void SetSingleResourceModification(DicomModification* modification, // Takes ownership |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
83 ResourceType outputLevel, |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
84 bool isAnonymization); |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
85 |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
86 void SetMultipleResourcesModification(DicomModification* modification, // Takes ownership |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
87 bool isAnonymization); |
2642 | 88 |
89 void SetOrigin(const DicomInstanceOrigin& origin); | |
90 | |
91 void SetOrigin(const RestApiCall& call); | |
92 | |
2664
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
93 const DicomModification& GetModification() const; |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
94 |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
95 bool IsAnonymization() const |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
96 { |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
97 return isAnonymization_; |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
98 } |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
99 |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
100 const DicomInstanceOrigin& GetOrigin() const |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
101 { |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
102 return origin_; |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
103 } |
a21b244efb37
serialization of DicomModalityStoreJob, OrthancPeerStoreJob and ResourceModificationJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2663
diff
changeset
|
104 |
3943
b26d25d3c1c7
"/{patients|studies|series}/.../modify": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3942
diff
changeset
|
105 bool IsTranscode() const |
b26d25d3c1c7
"/{patients|studies|series}/.../modify": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3942
diff
changeset
|
106 { |
b26d25d3c1c7
"/{patients|studies|series}/.../modify": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3942
diff
changeset
|
107 return transcode_; |
b26d25d3c1c7
"/{patients|studies|series}/.../modify": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3942
diff
changeset
|
108 } |
b26d25d3c1c7
"/{patients|studies|series}/.../modify": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3942
diff
changeset
|
109 |
b26d25d3c1c7
"/{patients|studies|series}/.../modify": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3942
diff
changeset
|
110 DicomTransferSyntax GetTransferSyntax() const; |
b26d25d3c1c7
"/{patients|studies|series}/.../modify": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3942
diff
changeset
|
111 |
b26d25d3c1c7
"/{patients|studies|series}/.../modify": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3942
diff
changeset
|
112 void SetTranscode(DicomTransferSyntax syntax); |
b26d25d3c1c7
"/{patients|studies|series}/.../modify": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3942
diff
changeset
|
113 |
b26d25d3c1c7
"/{patients|studies|series}/.../modify": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3942
diff
changeset
|
114 void SetTranscode(const std::string& transferSyntaxUid); |
b26d25d3c1c7
"/{patients|studies|series}/.../modify": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3942
diff
changeset
|
115 |
b26d25d3c1c7
"/{patients|studies|series}/.../modify": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3942
diff
changeset
|
116 void ClearTranscode(); |
b26d25d3c1c7
"/{patients|studies|series}/.../modify": New option "Transcode"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3942
diff
changeset
|
117 |
4693
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
118 bool IsSingleResourceModification() const; |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
119 |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
120 // Only possible if "IsSingleResourceModification()" |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
121 ResourceType GetOutputLevel() const; |
45bce660ce3a
added routes for bulk anonymization/modification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
122 |
4205 | 123 virtual void Stop(JobStopReason reason) ORTHANC_OVERRIDE |
2642 | 124 { |
125 } | |
126 | |
4205 | 127 virtual void GetJobType(std::string& target) ORTHANC_OVERRIDE |
2642 | 128 { |
129 target = "ResourceModification"; | |
130 } | |
131 | |
4205 | 132 virtual void GetPublicContent(Json::Value& value) ORTHANC_OVERRIDE; |
2642 | 133 |
4205 | 134 virtual bool Serialize(Json::Value& value) ORTHANC_OVERRIDE; |
2642 | 135 }; |
136 } |